Changeset 573 for trunk/src/org/expeditee/items/widgets
- Timestamp:
- 12/05/13 16:36:38 (11 years ago)
- Location:
- trunk/src/org/expeditee/items/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/widgets/InteractiveWidget.java
r567 r573 1723 1723 1724 1724 /** 1725 * Event called when the widget is left clicked while there are items attached to the FreeItems buffer 1726 * 1727 * @return true if event was handled (no pass through), otherwise false 1725 * Event called when the widget is left clicked while there are items attached to the FreeItems buffer. 1726 * Used to enable expeditee like text-widget interaction for left mouse clicks. 1727 * @return true if event was handled (no pass through), otherwise false. 1728 1728 */ 1729 1729 public boolean ItemsLeftClickDropped() { … … 1732 1732 1733 1733 /** 1734 * Event called when the widget is middle clicked while there are items attached to the FreeItems buffer 1735 * 1736 * @return true if event was handled (no pass through), otherwise false 1734 * Event called when the widget is middle clicked while there are items attached to the FreeItems buffer. 1735 * Used to enable expeditee like text-widget interaction for middle mouse clicks. 1736 * @return true if event was handled (no pass through), otherwise false. 1737 1737 */ 1738 1738 public boolean ItemsMiddleClickDropped() { 1739 System.out.println("MiddleClickDropped");1740 1739 return false; 1741 1740 } 1742 1741 1743 1742 /** 1744 * Event called when the widget is left clicked while there are items attached to the FreeItems buffer 1745 * 1746 * @return true if event was handled (no pass through), otherwise false 1743 * Event called when the widget is left clicked while there are items attached to the FreeItems buffer. 1744 * Used to enable expeditee like text-widget interaction for right mouse clicks 1745 * @return true if event was handled (no pass through), otherwise false. 1747 1746 */ 1748 1747 public boolean ItemsRightClickDropped() { 1749 System.out.println("RightClickDropped");1750 1748 return false; 1751 1749 } -
trunk/src/org/expeditee/items/widgets/JfxBrowser.java
r570 r573 4 4 import java.awt.Color; 5 5 import java.awt.Component; 6 import java.awt.Point; 6 7 import java.awt.event.ActionEvent; 7 8 import java.awt.event.ActionListener; … … 25 26 import org.expeditee.gui.DisplayIO; 26 27 import org.expeditee.gui.FrameMouseActions; 27 import org.expeditee.gui.FrameUtils;28 28 import org.expeditee.gui.FreeItems; 29 29 import org.expeditee.gui.MessageBay; … … 46 46 private static final String REFRESH = "refresh"; 47 47 private static final String GETFRAME = "getframe"; 48 49 public static final int VERT_OFFSET = 50; 50 public static final int VERT_CROP = 88; 51 public static final int HORZ_CROP = 15; 48 52 49 53 private WebBrowserPanel _browser; … … 333 337 334 338 if(JavaFX.MouseEventGetButton.invoke(args[0]).equals(buttonEnum[1])) /* Left Mouse Button */ { 335 /*$#remove*/System.err.println("Left Button Clicked"); 339 336 340 } else if(JavaFX.MouseEventGetButton.invoke(args[0]).equals(buttonEnum[2])) /* Middle Mouse Button */ { 337 /*$#remove*/System.err.println("Middle Button Clicked"); 341 338 342 } else if(JavaFX.MouseEventGetButton.invoke(args[0]).equals(buttonEnum[3])) /* Right Mouse Button */ { 339 /*$#remove*/System.err.println("Right Button Clicked");340 343 // Gets text currently selected in webview 341 344 String selection = (String) JavaFX.WebEngineExecuteScript.invoke(JavaFX.WebViewGetEngine.invoke(webview), "window.getSelection().toString()"); … … 574 577 } 575 578 579 /** 580 * Used to enable expeditee like text-widget interaction for middle mouse clicks. Does nothing if a text item is not attached to cursor. 581 * @return false if a text-widget interaction did not occur, true if a text-widget interaction did occur. 582 */ 583 @Override 584 public boolean ItemsMiddleClickDropped() { 585 Text t = null; 586 if((t = FreeItems.getTextAttachedToCursor()) == null) { // fails if no text item is attached to the cursor. 587 return false; 588 } 589 590 Point p = new Point(FrameMouseActions.getX() - this.getX(), FrameMouseActions.getY() - this.getY()); 591 592 if(!_browser.urlField.contains(p)) { // fails if not clicking on urlField 593 return false; 594 } 595 596 // Inserts text in text item into urlField at the position of the mouse. 597 String s = _browser.urlField.getText(); 598 int index = _browser.urlField.viewToModel(new Point(p.x - _browser.urlField.getX(), p.y - _browser.urlField.getY())); 599 s = s.substring(0, index) + t.getText() + s.substring(index); 600 _browser.urlField.setText(s); 601 602 FreeItems.getInstance().clear(); // removed held text item - like normal expeditee middle click behaviour. 603 604 return true; 605 } 606 607 /** 608 * Used to enable expeditee like text-widget interaction for right mouse clicks. Does nothing if a text item is not attached to cursor. 609 * @return false if a text-widget interaction did not occur, true if a text-widget interaction did occur. 610 */ 611 @Override 612 public boolean ItemsRightClickDropped() { 613 Text t = null; 614 if((t = FreeItems.getTextAttachedToCursor()) == null) { // fails if no text item is attached to the cursor. 615 return false; 616 } 617 618 Point p = new Point(FrameMouseActions.getX() - this.getX(), FrameMouseActions.getY() - this.getY()); 619 620 if(!_browser.urlField.contains(p)) { // fails if not clicking on urlField 621 return false; 622 } 623 624 // Inserts text in text item into urlField at the position of the mouse. 625 String s = _browser.urlField.getText(); 626 int index = _browser.urlField.viewToModel(new Point(p.x - _browser.urlField.getX(), p.y - _browser.urlField.getY())); 627 s = s.substring(0, index) + t.getText() + s.substring(index); 628 _browser.urlField.setText(s); 629 630 return true; 631 } 632 576 633 @Override 577 634 protected String[] getArgs() {
Note:
See TracChangeset
for help on using the changeset viewer.