Ignore:
Timestamp:
02/11/14 01:27:13 (10 years ago)
Author:
ngw8
Message:

Updating the design of the Exploratory Search overlays, along with a few related fixes.

Added the FontAwesome font (used for the ES Back/Forward/Home buttons). Copying and pasting the symbol characters from http://fortawesome.github.io/Font-Awesome/cheatsheet/ to an Expeditee text item with "family: fontawesome" set is the easiest way to use it.

Added image-based buttons with icons for the main Exploratory Search actions. The label part of the buttons are still Expeditee text, but I wasn't able to simply use FontAwesome text items for the icon part, as this meant hovering over a button gave two distinct clickable regions (even when the text and the icon were positioned at the same coord, unless the icon item was loaded to the frame's list of items after the label), which seemed like it might be confusing to the user. Instead the icons are just part of the bitmaps, so it's a little harder to change the icon (setting the icon as a layer mask on the base button image in GIMP or Photoshop is the best way).

Changed the JFXBrowser initialization code so that the initial URL (grabbed from the text item source) is passed through the navigate() method, so search queries or URLs without a protocol can be used as the intial value.

Modified ExploratorySearchActions so that the startBrowserSession() action can be called from items that aren't text (needed so that it could be used on the image buttons). Also changed it so that the widget itself isn't created when the action is run, just its source text item, since the widget gets created automatically when the new frame is opened (and creating it in the action causes some issues with loading the initial page).

With the updated overlays, you'll need to re-copy the resources folder across to your local .expeditee folder.
I haven't changed the positioning of the @ao and @old tags in the ES stuff, so that might need to be adjusted.

File:
1 edited

Legend:

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

    r876 r877  
    77import org.expeditee.gui.FrameMouseActions;
    88import org.expeditee.gui.FreeItems;
    9 import org.expeditee.gui.MessageBay;
    109import org.expeditee.items.Item;
    1110import org.expeditee.items.Text;
    12 import org.expeditee.items.widgets.InteractiveWidget;
    13 import org.expeditee.items.widgets.JfxBrowser;
    1411import org.expeditee.settings.exploratorysearch.ExploratorySearchSettings;
    1512import org.expeditee.settings.network.NetworkSettings;
     
    2320        /**
    2421         * Adds a text item to the cursor which is linked to a new frame with the web browser active overlay and a JavaFX browser.
    25          * @param text The text item attached to the cursor.
     22         * @param caller The item that the action is called from
    2623         */
    27         public static void startBrowserSession(Text text) {
     24        public static void startBrowserSession(Item caller) {
    2825                try {
    29                         if (!(text instanceof Text)) {
    30                                 MessageBay.errorMessage("Must be a text item.");
    31                                 return;
     26                        String url;
     27                       
     28                        Text urlItem = FreeItems.getTextAttachedToCursor();
     29                       
     30                        // If there is a text item attached to the cursor, use it as the URL to load
     31                        if (urlItem != null) {
     32                                url = urlItem.getText();
     33                               
     34                                // Remove the item, since the link to the browser session will added to the cursor
     35                                urlItem.delete();
     36                        } else {
     37                                // Otherwise use the home page specified in the settings
     38                                url = NetworkSettings.HomePage.get();
    3239                        }
    3340                       
    34                         if(text.getLink() != null) {                                            // text item can't already have a link
    35                                 MessageBay.errorMessage("Text item already has link.");
    36                                 return;
    37                         }
    38                        
    39                         String url = "";
    40                        
    41                         // If no text with url is passed to action create a new text item
    42                         if(!FreeItems.textOnlyAttachedToCursor()) {
    43                                 url = NetworkSettings.HomePage.get();                   // use home page specified by settings
    44                                 text = DisplayIO.getCurrentFrame().addText(FrameMouseActions.getX(), FrameMouseActions.getY(),
    45                                                 "Web Browser Session", null);
    46                                 text.setParent(DisplayIO.getCurrentFrame());
    47                                 FrameMouseActions.pickup(text);
    48                         } else {
    49                                 url = text.getText();                                                   // get url from text attached to cursor if possible
    50                         }
    51                        
    52                         // Set text to session id. TODO: set session id.
    53                         text.setText("Web Browser Session");
     41                        Item linkToBrowserSession = DisplayIO.getCurrentFrame().addText(FrameMouseActions.getX(), FrameMouseActions.getY(), "Web Browser Session", null);
     42                        linkToBrowserSession.setParent(DisplayIO.getCurrentFrame());
     43                        FrameMouseActions.pickup(linkToBrowserSession);
    5444                       
    5545                        // Create new frame
    56                         Frame frame = FrameIO.CreateNewFrame(text);
    57                         text.setLink("" + frame.getNumber());                           // link this text item to new frame
     46                        Frame frame = FrameIO.CreateNewFrame(linkToBrowserSession);
     47                       
     48                        // link this text item to new frame
     49                        linkToBrowserSession.setLink("" + frame.getNumber());
    5850                       
    5951                        // Remove everything from new frame
     
    7668                        // Start Browser in fullscreen or default, depending on settings
    7769                        if(ExploratorySearchSettings.BrowserFullScreen.get()) {
    78                                 wt = frame.addText(0 + lm, 70 + tm, "@iw: org.expeditee.items.widgets.JfxBrowser "
     70                                wt = frame.addText(144 + lm, 0 + tm, "@iw: org.expeditee.items.widgets.JfxBrowser "
    7971                                                + ("--anchorLeft " + lm + " --anchorRight " + rm + " --anchorTop " + (tm + ExploratorySearchSettings.BROWSER_VERT_OFFSET) + " --anchorBottom " + bm + " ")
    8072                                                + (Browser._theBrowser.getContentPane().getWidth() - lm - rm) + " "
     
    8274                                System.err.println(wt.getText());
    8375                        } else {
    84                                 wt = frame.addText(0 + lm, 70 + tm, "@iw: org.expeditee.items.widgets.JfxBrowser " +
     76                                wt = frame.addText(144 + lm, 0 + tm, "@iw: org.expeditee.items.widgets.JfxBrowser " +
    8577                                                (ExploratorySearchSettings.BrowserDefaultWidth.get() - lm - rm) + " " +
    8678                                                (ExploratorySearchSettings.BrowserDefaultHeight.get() - tm - bm) + " : " + url, null);
    8779                        }
    88                        
    89                         // Create widget via text annotation
    90                         InteractiveWidget.createWidget(wt);
    9180                       
    9281                        FrameIO.SaveFrame(frame);                                                       // save frame to disk
Note: See TracChangeset for help on using the changeset viewer.