source: trunk/src/org/expeditee/actions/ExploratorySearchActions.java@ 1415

Last change on this file since 1415 was 1415, checked in by bln4, 5 years ago

Renamed Frame.getItems() to Frame.getSortedItems() to better represent its functionality.

-> org.apollo.ApolloGestureActions
-> org.apollo.ApolloSystem
-> org.expeditee.actions.Actions
-> org.expeditee.actions.Debug
-> org.expeditee.actions.ExploratorySearchActions
-> org.expeditee.actions.JfxBrowserActions
-> org.expeditee.actions.Misc
-> org.expeditee.actions.Navigation
-> org.expeditee.actions.ScriptBase
-> org.expeditee.actions.Simple
-> org.expeditee.agents.ComputeTree
-> org.expeditee.agents.CopyTree
-> org.expeditee.agents.DisplayComet
-> org.expeditee.agents.DisplayTree
-> org.expeditee.agents.DisplayTreeLeaves
-> org.expeditee.agents.GraphFramesetLinks
-> org.expeditee.agents.TreeProcessor
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gui.DisplayController
-> org.expeditee.gui.FrameCreator
-> org.expeditee.gui.FrameIO
-> org.expeditee.io.DefaultTreeWriter
-> org.expeditee.io.JavaWriter
-> org.expeditee.io.PDF2Writer
-> org.expeditee.io.TXTWriter
-> org.expeditee.io.WebParser
-> org.expeditee.io.flowlayout.XGroupItem
-> org.expeditee.items.Dot
-> org.expeditee.items.Item
-> org.expeditee.items.ItemUtils
-> org.expeditee.network.FrameShare
-> org.expeditee.stats.TreeStats


Created ItemsList class to wrap ArrayList<Item>. Frames now use this new class to store its body list (used for display) as well as its primaryBody and surrogateBody.

-> org.expeditee.agents.Format
-> org.expeditee.agents.HFormat
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gui.Frame
-> org.expeditee.gui.FrameUtils


Refactorted Frame.setResort(bool) to Frame.invalidateSorted() to better function how it is intended to with a more accurate name.

-> org.expeditee.agents.Sort


When writing out .exp files and getting attributes to respond to LEFT + RIGHT click, boolean items are by default true. This has always been the case. An ammendment to this is that defaults can now be established.
Also added 'EnterClick' functionality. If cursored over a item with this property and you press enter, it acts as if you have clicked on it instead.

-> org.expeditee.assets.resources-public.framesets.authentication.1.exp to 6.exp
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gio.input.KBMInputEvent
-> org.expeditee.gio.javafx.JavaFXConversions
-> org.expeditee.gio.swing.SwingConversions
-> org.expeditee.gui.AttributeUtils
-> org.expeditee.io.Conversion
-> org.expeditee.io.DefaultFrameWriter
-> org.expeditee.items.Item


Fixed a bug caused by calling Math.abs on Integer.MIN_VALUE returning unexpected result. Due to zero being a thing, you cannot represent Math.abs(Integer.MIN_VALUE) in a Integer object. The solution is to use Integer.MIN_VALUE + 1 instead of Integer.MIN_VALUE.

-> org.expeditee.core.bounds.CombinationBounds
-> org.expeditee.io.flowlayout.DimensionExtent


Recoded the contains function in EllipticalBounds so that intersection tests containing circles work correctly.

-> org.expeditee.core.bounds.EllipticalBounds


Added toString() to PolygonBounds to allow for useful printing during debugging.

-> org.expeditee.core.bounds.PolygonBounds

Implemented Surrogate Mode!

-> org.expeditee.encryption.io.EncryptedExpReader
-> org.expeditee.encryption.io.EncryptedExpWriter
-> org.expeditee.encryption.items.surrogates.EncryptionDetail
-> org.expeditee.encryption.items.surrogates.Label
-> org.expeditee.gui.FrameUtils
-> org.expeditee.gui.ItemsList
-> org.expeditee.items.Item
-> org.expeditee.items.Text


???? Use Integer.MAX_VALUE cast to a float instead of Float.MAX_VALUE. This fixed some bug which I cannot remember.

-> org.expeditee.gio.TextLayoutManager
-> org.expeditee.gio.swing.SwingTextLayoutManager


Improved solution for dealing with the F10 key taking focus away from Expeditee due to it being a assessibility key.

-> org.expeditee.gio.swing.SwingInputManager


Renamed variable visibleItems in FrameGraphics.paintFrame to itemsToPaintCanditates to better represent functional intent.

-> org.expeditee.gui.FrameGraphics


Improved checking for if personal resources exist before recreating them

-> org.expeditee.gui.FrameIO


Repeated messages to message bay now have a visual feedback instead of just a beep. This visual feedback is in the form of a count of the amount of times it has repeated.

-> org.expeditee.gui.MessageBay


Updated comment on the Vector class to explain what vectors are.

-> org.expeditee.gui.Vector


Added constants to represent all of the property keys in DefaultFrameReader and DefaultFrameWriter.

-> org.expeditee.io.DefaultFrameReader
-> org.expeditee.io.DefaultFrameWriter


Updated the KeyList setting to be more heirarcial with how users will store their Secrets.

-> org.expeditee.settings.identity.secrets.KeyList

  • Property svn:executable set to *
File size: 9.4 KB
Line 
1/**
2 * ExploratorySearchActions.java
3 * Copyright (C) 2010 New Zealand Digital Library, http://expeditee.org
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package org.expeditee.actions;
20
21import org.expeditee.core.Point;
22import org.expeditee.gio.EcosystemManager;
23import org.expeditee.gio.gesture.StandardGestureActions;
24import org.expeditee.gui.Browser;
25import org.expeditee.gui.DisplayController;
26import org.expeditee.gui.Frame;
27import org.expeditee.gui.FrameIO;
28import org.expeditee.gui.FreeItems;
29import org.expeditee.items.Item;
30import org.expeditee.items.Justification;
31import org.expeditee.items.Text;
32import org.expeditee.settings.exploratorysearch.ExploratorySearchSettings;
33import org.expeditee.settings.network.NetworkSettings;
34
35/**
36 * List of actions which Exploratory Search uses.
37 * @author csl14
38 */
39public class ExploratorySearchActions {
40
41 /**
42 * Adds a text item to the cursor which is linked to a new frame with the web browser active overlay and a JavaFX browser.
43 * @param caller The item that the action is called from
44 */
45 public static void startBrowserSession(Item caller) {
46 try {
47 String url;
48
49 Text urlItem = FreeItems.getTextAttachedToCursor();
50
51 // If there is a text item attached to the cursor, use it as the URL to load
52 if (urlItem != null) {
53 url = urlItem.getText();
54
55 // Remove the item, since the link to the browser session will added to the cursor
56 urlItem.delete();
57 } else {
58 // Otherwise use the home page specified in the settings
59 url = NetworkSettings.HomePage.get();
60 }
61
62 Text linkToBrowserSession = DisplayController.getCurrentFrame().addText(DisplayController.getMouseX(), DisplayController.getMouseY(), " - Web Browser Session", null);
63 linkToBrowserSession.setParent(DisplayController.getCurrentFrame());
64 Text.AddDate(linkToBrowserSession);
65 StandardGestureActions.pickup(linkToBrowserSession);
66
67 // Create new frame
68 Frame frame = FrameIO.CreateNewFrame(linkToBrowserSession);
69
70 // link this text item to new frame
71 linkToBrowserSession.setLink("" + frame.getNumber());
72
73 // Remove everything from new frame
74 frame.removeAllItems(frame.getSortedItems());
75
76 // Add web browser active overlay and @old
77 Text t = (Text) frame.addText(-150, 50, "@ao: 2", null, "overlayset2");
78 t.setAnchorRight(-100);
79 t.setAnchorTop(50);
80 t = (Text) frame.addText(-150, 50, "@old", null);
81 t.setFamily("Roboto Condensed");
82 t.setSize(15.0f);
83 t.setColor(null);
84 t.setWidth(116);
85 t.setJustification(Justification.right);
86 t.setLinkMark(false);
87 t.setAnchorLeft(9);
88 t.setAnchorBottom(114);
89
90 Text wt;
91
92 // Extract marigns from settings
93 int lm = ExploratorySearchSettings.BrowserLeftMargin.get();
94 int rm = ExploratorySearchSettings.BrowserRightMargin.get();
95 int tm = ExploratorySearchSettings.BrowserTopMargin.get();
96 int bm = ExploratorySearchSettings.BrowserBottomMargin.get();
97
98 // Start Browser in fullscreen or default, depending on settings
99 if(ExploratorySearchSettings.BrowserFullScreen.get()) {
100 wt = frame.addText(ExploratorySearchSettings.BROWSER_HORZ_OFFSET + lm, ExploratorySearchSettings.BROWSER_VERT_OFFSET + tm,
101 "@iw: org.expeditee.items.widgets.JfxBrowser "
102 + ("--anchorLeft " + (lm + ExploratorySearchSettings.BROWSER_HORZ_OFFSET) + " --anchorRight " + rm + " --anchorTop "
103 + (ExploratorySearchSettings.BROWSER_VERT_OFFSET + tm) + " --anchorBottom " + bm + " ")
104 + (EcosystemManager.getGraphicsManager().getWindowSize().getWidth() - ExploratorySearchSettings.BROWSER_HORZ_OFFSET - lm - rm) + " "
105 + (EcosystemManager.getGraphicsManager().getWindowSize().getHeight() - ExploratorySearchSettings.BROWSER_VERT_OFFSET - tm - bm) + " : " + url, null);
106 } else {
107 wt = frame.addText(ExploratorySearchSettings.BROWSER_HORZ_OFFSET + lm, ExploratorySearchSettings.BROWSER_VERT_OFFSET + tm,
108 "@iw: org.expeditee.items.widgets.JfxBrowser " +
109 (ExploratorySearchSettings.BrowserDefaultWidth.get() - lm - rm) + " " +
110 (ExploratorySearchSettings.BrowserDefaultHeight.get() - tm - bm) + " : " + url, null);
111 }
112
113 FrameIO.SaveFrame(frame); // save frame to disk
114 } catch(Exception e) {
115 e.printStackTrace();
116 }
117 }
118
119 /**
120 * Adds a text item to the cursor which is linked to a new frame with the mindmap active overlay.
121 */
122 public static void startMindmapSession() {
123 // Replace any text item on cursor with link to a new mindmap
124 FreeItems.getInstance().clear();
125 Point cursorPos = DisplayController.getMousePosition();
126 Text text = DisplayController.getCurrentFrame().addText(cursorPos.getX(), cursorPos.getY(), " - Mindmap Session", null);
127 text.setParent(DisplayController.getCurrentFrame());
128 Text.AddDate(text);
129 StandardGestureActions.pickup(text);
130 Frame frame = FrameIO.CreateNewFrame(text);
131 text.setLink("" + frame.getNumber());
132
133 // Clear new frame and add active overlay and @old
134 frame.removeAllItems(frame.getSortedItems());
135 Text t = (Text) frame.addText(-150, 50, "@ao: 2", null, "overlayset3");
136 t.setAnchorLeft(-150);
137 t.setAnchorTop(50);
138 t = (Text) frame.addText(-150, 50, "@old", null);
139 t.setFamily("Roboto Condensed");
140 t.setSize(15.0f);
141 t.setColor(null);
142 t.setWidth(116);
143 t.setJustification(Justification.right);
144 t.setLinkMark(false);
145 t.setAnchorLeft(9);
146 t.setAnchorBottom(114);
147
148 FrameIO.SaveFrame(frame);
149 }
150
151 /**
152 * Adds a text item to the cursor which is linked to a new frame with the web browser active overlay and a JavaFX browser.
153 * @param caller The item that the action is called from
154 */
155 public static void startBrowserWithOverlay(Item caller) {
156 try {
157 String url;
158
159 Text urlItem = FreeItems.getTextAttachedToCursor();
160
161 // If there is a text item attached to the cursor, use it as the URL to load
162 if (urlItem != null) {
163 url = urlItem.getText();
164
165 // Remove the item, since the link to the browser session will added to the cursor
166 urlItem.delete();
167 } else {
168 // Otherwise use the home page specified in the settings
169 url = NetworkSettings.HomePage.get();
170 }
171
172 Point cursorPos = DisplayController.getMousePosition();
173 Text linkToBrowserSession = DisplayController.getCurrentFrame().addText(cursorPos.getX(), cursorPos.getY(), url, null);
174 linkToBrowserSession.setParent(DisplayController.getCurrentFrame());
175 StandardGestureActions.pickup(linkToBrowserSession);
176
177 // Create new frame
178 Frame frame = FrameIO.CreateNewFrame(linkToBrowserSession);
179
180 // link this text item to new frame
181 linkToBrowserSession.setLink("" + frame.getNumber());
182
183 // Remove everything from new frame
184 frame.removeAllItems(frame.getSortedItems());
185
186 // Add web browser active overlay and @old
187 Text t = (Text) frame.addText(-150, 50, "@ao: 2", null, "overlayset2");
188 t.setAnchorLeft(-150);
189 t.setAnchorTop(50);
190 t = (Text) frame.addText(-150, 50, "@old", null);
191 t.setFamily("Roboto Condensed");
192 t.setSize(15.0f);
193 t.setColor(null);
194 t.setWidth(116);
195 t.setJustification(Justification.right);
196 t.setLinkMark(false);
197 t.setAnchorLeft(9);
198 t.setAnchorBottom(114);
199
200 Text wt;
201
202 // Extract marigns from settings
203 int lm = ExploratorySearchSettings.BrowserLeftMargin.get();
204 int rm = ExploratorySearchSettings.BrowserRightMargin.get();
205 int tm = ExploratorySearchSettings.BrowserTopMargin.get();
206 int bm = ExploratorySearchSettings.BrowserBottomMargin.get();
207
208 // Start Browser in fullscreen or default, depending on settings
209 if(ExploratorySearchSettings.BrowserFullScreen.get()) {
210 wt = frame.addText(ExploratorySearchSettings.BROWSER_HORZ_OFFSET + lm, ExploratorySearchSettings.BROWSER_VERT_OFFSET + tm,
211 "@iw: org.expeditee.items.widgets.JfxBrowser "
212 + ("--anchorLeft " + (lm + ExploratorySearchSettings.BROWSER_HORZ_OFFSET) + " --anchorRight " + rm + " --anchorTop "
213 + (ExploratorySearchSettings.BROWSER_VERT_OFFSET + tm) + " --anchorBottom " + bm + " ")
214 + (EcosystemManager.getGraphicsManager().getWindowSize().getWidth() - ExploratorySearchSettings.BROWSER_HORZ_OFFSET - lm - rm) + " "
215 + (EcosystemManager.getGraphicsManager().getWindowSize().getHeight() - ExploratorySearchSettings.BROWSER_VERT_OFFSET - tm - bm) + " : " + url, null);
216 } else {
217 wt = frame.addText(ExploratorySearchSettings.BROWSER_HORZ_OFFSET + lm, ExploratorySearchSettings.BROWSER_VERT_OFFSET + tm,
218 "@iw: org.expeditee.items.widgets.JfxBrowser " +
219 (ExploratorySearchSettings.BrowserDefaultWidth.get() - lm - rm) + " " +
220 (ExploratorySearchSettings.BrowserDefaultHeight.get() - tm - bm) + " : " + url, null);
221 }
222
223 FrameIO.SaveFrame(frame); // save frame to disk
224 } catch(Exception e) {
225 e.printStackTrace();
226 }
227 }
228
229}
Note: See TracBrowser for help on using the repository browser.