Changeset 539


Ignore:
Timestamp:
11/27/13 10:58:55 (10 years ago)
Author:
jts21
Message:

Override that event in JfxBrowser to allow navigation to a new URL

Location:
trunk/src/org/expeditee
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/FrameMouseActions.java

    r516 r539  
    3030import org.expeditee.items.Dot;
    3131import org.expeditee.items.Item;
     32import org.expeditee.items.Item.HighlightMode;
    3233import org.expeditee.items.ItemAppearence;
    3334import org.expeditee.items.ItemUtils;
    3435import org.expeditee.items.Line;
    35 import org.expeditee.items.UserAppliedPermission;
    3636import org.expeditee.items.Picture;
    3737import org.expeditee.items.Text;
     38import org.expeditee.items.UserAppliedPermission;
    3839import org.expeditee.items.XRayable;
    39 import org.expeditee.items.Item.HighlightMode;
    4040import org.expeditee.items.widgets.InteractiveWidget;
    4141import org.expeditee.items.widgets.WidgetCorner;
     
    732732                        if (iw != null) {
    733733
     734                                // Handle dropping items on widgets
     735                                if(iw.ItemsLeftClickDropped()) {
     736                                        return;
     737                                }
     738                               
    734739                                // Note: musten't directly use source for handling the link
    735740                                // because all link operations will by-pass the widgets special
  • trunk/src/org/expeditee/items/widgets/InteractiveWidget.java

    r451 r539  
    3030import org.expeditee.items.ItemParentStateChangedEvent;
    3131import org.expeditee.items.ItemUtils;
     32import org.expeditee.items.Text;
    3233import org.expeditee.items.UserAppliedPermission;
    33 import org.expeditee.items.Text;
    3434
    3535/**
     
    17221722        }
    17231723       
     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
     1728         */
     1729        public boolean ItemsLeftClickDropped() {
     1730                return false;
     1731        }
     1732       
    17241733}
  • trunk/src/org/expeditee/items/widgets/JfxBrowser.java

    r537 r539  
    1717import javax.swing.JPanel;
    1818
     19import org.expeditee.gui.FreeItems;
    1920import org.expeditee.items.Text;
    2021
     
    214215
    215216        public void navigate(final String url) {
     217                System.out.println(url);
    216218                try {
    217                         WebEngineLoad.invoke(WebViewGetEngine.invoke(this._browser.webview), url);
    218                 } catch (IllegalAccessException e) {
    219                         e.printStackTrace();
    220                 } catch (IllegalArgumentException e) {
    221                         e.printStackTrace();
    222                 } catch (InvocationTargetException e) {
    223                         e.printStackTrace();
    224                 }
     219                        PlatformRunLater.invoke(null, new Runnable() {
     220                                @Override
     221                                public void run() {
     222                                        try {
     223                                                WebEngineLoad.invoke(WebViewGetEngine.invoke(JfxBrowser.this._browser.webview), url);
     224                                        } catch (Exception e) {
     225                                                e.printStackTrace();
     226                                        }
     227                                }
     228                        });
     229                } catch (Exception e) {
     230                        e.printStackTrace();
     231                }
     232        }
     233       
     234        @Override
     235        public boolean ItemsLeftClickDropped() {
     236                Text carried = null;
     237                if((carried = FreeItems.getTextAttachedToCursor()) != null) {
     238                        this.navigate(carried.getText());
     239                        return true;
     240                }
     241                return false;
    225242        }
    226243
Note: See TracChangeset for help on using the changeset viewer.