Changeset 1102 for trunk/src/org/expeditee/items/widgets/JfxBrowser.java
- Timestamp:
- 05/10/18 16:04:51 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/widgets/JfxBrowser.java
r1060 r1102 76 76 import netscape.javascript.JSObject; 77 77 78 import org.expeditee.gui.DisplayIO; 79 import org.expeditee.gui.FrameMouseActions; 78 import org.expeditee.gio.gesture.StandardGestureActions; 79 import org.expeditee.gio.swing.SwingConversions; 80 import org.expeditee.gui.DisplayController; 80 81 import org.expeditee.gui.FreeItems; 81 82 import org.expeditee.gui.MessageBay; … … 468 469 public void handle(KeyEvent e) { 469 470 // Hiding the cursor when typing, to be more Expeditee-like 470 Display IO.setCursor(org.expeditee.items.Item.HIDDEN_CURSOR);471 DisplayController.setCursor(org.expeditee.items.Item.HIDDEN_CURSOR); 471 472 } 472 473 }); … … 481 482 } 482 483 // Checking if the user has been typing - if so, move the cursor to the caret position 483 if (Display IO.getCursor() == Item.HIDDEN_CURSOR) {484 Display IO.setCursor(org.expeditee.items.Item.TEXT_CURSOR);485 Display IO.setCursorPosition(getCoordFromCaret(JfxBrowser.this._urlField));484 if (DisplayController.getCursor() == Item.HIDDEN_CURSOR) { 485 DisplayController.setCursor(org.expeditee.items.Item.TEXT_CURSOR); 486 DisplayController.setCursorPosition(SwingConversions.fromSwingPoint(getCoordFromCaret(JfxBrowser.this._urlField))); 486 487 } else { 487 488 // Otherwise, move the caret to the cursor location … … 523 524 public void changed(ObservableValue<? extends Boolean> property, Boolean oldValue, Boolean newValue) { 524 525 if(newValue.booleanValue()) { 525 Display IO.setCursor(org.expeditee.items.Item.TEXT_CURSOR);526 DisplayController.setCursor(org.expeditee.items.Item.TEXT_CURSOR); 526 527 } else { 527 528 // Restoring the standard cursor, since it is changed to a text cursor when focus is gained 528 Display IO.setCursor(org.expeditee.items.Item.DEFAULT_CURSOR);529 DisplayController.setCursor(org.expeditee.items.Item.DEFAULT_CURSOR); 529 530 } 530 531 } … … 545 546 if (e.getButton() == MouseButton.SECONDARY) { 546 547 // Right mouse button released, so copy the selection (i.e. don't remove the original) 547 item = Display IO.getCurrentFrame().createNewText(JfxBrowser.this._urlField.getSelectedText());548 FrameMouseActions.pickup(item);548 item = DisplayController.getCurrentFrame().createNewText(JfxBrowser.this._urlField.getSelectedText()); 549 StandardGestureActions.pickup(item); 549 550 } else if (e.getButton() == MouseButton.MIDDLE) { 550 551 // Middle mouse button released, so copy the selection then remove it from the URL field 551 item = Display IO.getCurrentFrame().createNewText(JfxBrowser.this._urlField.getSelectedText());552 item = DisplayController.getCurrentFrame().createNewText(JfxBrowser.this._urlField.getSelectedText()); 552 553 JfxBrowser.this._urlField.setText( 553 554 JfxBrowser.this._urlField.getText().substring(0, JfxBrowser.this._urlField.getSelection().getStart()) … … 555 556 JfxBrowser.this._urlField.getText().length())); 556 557 557 FrameMouseActions.pickup(item);558 StandardGestureActions.pickup(item); 558 559 } 559 560 } … … 660 661 661 662 if (((String) style.call("getPropertyValue", new Object[] { "background-image" })).startsWith("url(")) { 662 pic = WebParser.getBackgroundImageFromNode(node, style, Display IO.getCurrentFrame(), null,663 (float) FrameMouseActions.getX(), (float) FrameMouseActions.getY(), width, height);663 pic = WebParser.getBackgroundImageFromNode(node, style, DisplayController.getCurrentFrame(), null, 664 (float) DisplayController.getMouseX(), (float) DisplayController.getMouseY(), width, height); 664 665 665 666 } else { … … 667 668 if(node.getNodeName().toLowerCase().equals("img") && 668 669 (imgSrc = ((JSObject) node).getMember("src").toString()) != null) { 669 pic = WebParser.getImageFromUrl(imgSrc, null, Display IO.getCurrentFrame(),670 (float) FrameMouseActions.getX(), (float) FrameMouseActions.getY(), (int) width, null, null, null, null, null, 0, 0);670 pic = WebParser.getImageFromUrl(imgSrc, null, DisplayController.getCurrentFrame(), 671 (float) DisplayController.getMouseX(), (float) DisplayController.getMouseY(), (int) width, null, null, null, null, null, 0, 0); 671 672 } else { 672 673 return; … … 685 686 } 686 687 687 pic.setXY( FrameMouseActions.getX(), FrameMouseActions.getY());688 FrameMouseActions.pickup(pic);688 pic.setXY(DisplayController.getMouseX(), DisplayController.getMouseY()); 689 StandardGestureActions.pickup(pic); 689 690 } catch (Exception e1) { 690 691 // TODO Auto-generated catch block … … 714 715 + ((JSObject)node).getMember("height") 715 716 + ":" + src); 716 t.setParent(Display IO.getCurrentFrame());717 t.setXY( FrameMouseActions.getX(), FrameMouseActions.getY());717 t.setParent(DisplayController.getCurrentFrame()); 718 t.setXY(DisplayController.getMouseX(), DisplayController.getMouseY()); 718 719 JfxMedia media = new JfxMedia(t, new String[] { src }); 719 FrameMouseActions.pickup(media.getItems());720 StandardGestureActions.pickup(media.getItems()); 720 721 721 722 } else if(node.getNodeName().toLowerCase().equals("a") && ((JSObject)node).getMember("href") != null) { 722 723 // If a link is right clicked, copy the text content and give it an action to create 723 724 // a new frame containing a browser pointing to the linked page 724 Text t = Display IO.getCurrentFrame().createNewText(((String) ((JSObject)node).getMember("textContent")).trim());725 Text t = DisplayController.getCurrentFrame().createNewText(((String) ((JSObject)node).getMember("textContent")).trim()); 725 726 t.addAction("createFrameWithBrowser " + (String) ((JSObject)node).getMember("href")); 726 t.setXY( FrameMouseActions.getX(), FrameMouseActions.getY());727 FrameMouseActions.pickup(t);727 t.setXY(DisplayController.getMouseX(), DisplayController.getMouseY()); 728 StandardGestureActions.pickup(t); 728 729 } 729 730 } 730 731 } else { 731 732 // Copy text and attach to cursor 732 Text t = Display IO.getCurrentFrame().createNewText(selection);733 t.setXY( FrameMouseActions.getX(), FrameMouseActions.getY());734 FrameMouseActions.pickup(t);733 Text t = DisplayController.getCurrentFrame().createNewText(selection); 734 t.setXY(DisplayController.getMouseX(), DisplayController.getMouseY()); 735 StandardGestureActions.pickup(t); 735 736 } 736 737 } … … 871 872 public void getFrame() { 872 873 try { 873 WebParser.parsePageSimple(this, _webEngine, _webView, Display IO.getCurrentFrame());874 WebParser.parsePageSimple(this, _webEngine, _webView, DisplayController.getCurrentFrame()); 874 875 } catch (Exception e) { 875 876 e.printStackTrace(); … … 886 887 new Thread(new Runnable() { 887 888 public void run() { 888 WebParser.parsePageSimple(JfxBrowser.this, JfxBrowser.this._webEngine, JfxBrowser.this._webView, Display IO.getCurrentFrame());889 WebParser.parsePageSimple(JfxBrowser.this, JfxBrowser.this._webEngine, JfxBrowser.this._webView, DisplayController.getCurrentFrame()); 889 890 } 890 891 }).start(); … … 954 955 } 955 956 956 final int x = FrameMouseActions.getX() - this.getX(), y = FrameMouseActions.getY() - this.getY();957 final int x = DisplayController.getMouseX() - this.getX(), y = DisplayController.getMouseY() - this.getY(); 957 958 if(!this._urlField.getBoundsInParent().contains(x, y)) { 958 959 // fails if not clicking on urlField
Note:
See TracChangeset
for help on using the changeset viewer.