Changeset 845


Ignore:
Timestamp:
02/05/14 15:57:58 (10 years ago)
Author:
ngw8
Message:

Web parser now gives converted links an action that creates a new frame containing a web browser with the appropriate URL

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/actions/JfxBrowserActions.java

    r813 r845  
    44import org.expeditee.gui.DisplayIO;
    55import org.expeditee.gui.Frame;
     6import org.expeditee.gui.FrameGraphics;
    67import org.expeditee.gui.FrameIO;
    78import org.expeditee.gui.FrameMouseActions;
     9import org.expeditee.gui.FrameUtils;
    810import org.expeditee.gui.FreeItems;
    911import org.expeditee.gui.MessageBay;
     
    1214import org.expeditee.items.Text;
    1315import org.expeditee.items.widgets.InteractiveWidget;
     16import org.expeditee.items.widgets.InteractiveWidgetInitialisationFailedException;
     17import org.expeditee.items.widgets.InteractiveWidgetNotAvailableException;
    1418import org.expeditee.items.widgets.JfxBrowser;
    1519import org.expeditee.settings.network.NetworkSettings;
     
    125129                FrameIO.SaveFrame(frame);
    126130        }
     131
     132        /**
     133         * Creates a frame containing a JFXBrowser pointed to the specified URL, then navigates to that frame
     134         *
     135         * @param link
     136         *            Item that will link to the new frame
     137         * @param url
     138         *            URL to load in the Web Browser of the new frame
     139         * @throws Exception
     140         */
     141        public static void createFrameWithBrowser(Text link, String url) throws Exception {
     142                Frame frame = FrameIO.CreateNewFrame(link);
     143                frame.removeAllItems(frame.getItems());
     144                link.setLink("" + frame.getNumber());
     145                link.setAction(null);
     146
     147                // Create widget via text annotation
     148                Text wt = frame.addText(10, 10, "@iw: org.expeditee.items.widgets.JfxBrowser " + (int) (FrameGraphics.getMaxFrameSize().getWidth() * 0.9) + " "
     149                                + (int) (FrameGraphics.getMaxFrameSize().getHeight() * 0.9) + " : " + url, null);
     150
     151                InteractiveWidget.createWidget(wt);
     152
     153                FrameIO.SaveFrame(frame);
     154
     155                FrameUtils.DisplayFrame(link.getAbsoluteLink());
     156        }
    127157}
  • trunk/src/org/expeditee/io/WebParser.java

    r842 r845  
    13591359
    13601360                                if (!linkUrl.equals("undefined")) {
    1361                                         t.setAction("gotourl " + linkUrl);
     1361                                        t.setAction("createFrameWithBrowser " + linkUrl);
    13621362                                        t.setActionMark(false);
    13631363                                }
Note: See TracChangeset for help on using the changeset viewer.