source: trunk/src/org/expeditee/actions/Navigation.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

File size: 8.0 KB
Line 
1/**
2 * Navigation.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 java.util.List;
22
23import org.expeditee.gui.DisplayController;
24import org.expeditee.gui.Frame;
25import org.expeditee.gui.FrameIO;
26import org.expeditee.gui.FrameUtils;
27import org.expeditee.gui.MessageBay;
28import org.expeditee.items.Item;
29import org.expeditee.settings.UserSettings;
30
31/**
32 * Provides the Navigation related action procedures
33 *
34 * @author jdm18
35 *
36 */
37public class Navigation {
38
39 public static void setLastNavigationItem(Item i) {
40 _LastItemUsed = i;
41 if (i.getParent() != null) {
42 _Parent = i.getParent().getName();
43 }
44 }
45
46 /**
47 * Performs a back operation from the current Frame. If the back-stack is
48 * empty, then nothing happens.
49 */
50 public static void Back() {
51 DisplayController.Back();
52 }
53
54 public static void Forward() {
55 DisplayController.Forward();
56 }
57
58 /**
59 * Displays the user's home frame
60 */
61 public static void GotoHome() {
62 FrameUtils.DisplayFrame(UserSettings.HomeFrame.get());
63 }
64
65 /**
66 * Displays the user's first settings frame - should be `username`2
67 */
68 public static void GotoSettings() {
69 //String framename = UserSettings.HomeFrame.get();
70 //framename = framename.substring(0, framename.length() - 1) + '2';
71
72 String userName = UserSettings.ProfileName.get();
73 String framename = userName + '2';
74
75 FrameUtils.DisplayFrame(framename);
76 }
77
78 public static void GotoZero() {
79 FrameUtils
80 .DisplayFrame(DisplayController.getCurrentFrame().getFramesetName() + 0);
81 }
82
83 /**
84 * Displays the user's profile frame (if there is one)
85 */
86 public static void GotoProfile() {
87 FrameUtils.DisplayFrame(UserSettings.ProfileName.get() + '1');
88 }
89
90 /**
91 * Loads the Frame in the current frameset with the given number and
92 * displays it
93 *
94 * @param value
95 * The number of the Frame to load
96 */
97 public static void Goto(Integer value) {
98 FrameUtils.DisplayFrame(DisplayController.getCurrentFrame().getFramesetName()
99 + value);
100 }
101
102 /**
103 * Loads the Frame with the given FrameName and displays it
104 *
105 * @param frameName
106 * The name of the Frame to load
107 */
108 public static void Goto(String frameName) {
109 FrameUtils.DisplayFrame(frameName);
110 }
111
112 /**
113 * Goto a frame without adding it to history
114 */
115 public static void GotoQuiet(String frameName) {
116 FrameUtils.DisplayFrame(frameName, false, true);
117 }
118
119 /**
120 * Loads the Frame linked to by the Item that has this action, if there is
121 * one
122 *
123 * @param source
124 * The Item that has a link to the Frame to load and display
125 */
126 public static void GotoLink(Item source) {
127 FrameUtils.DisplayFrame(source.getLink());
128 }
129
130 /**
131 * Turns TwinFrames off if it is on, otherwise does nothing
132 */
133 public static void Large() {
134 if (DisplayController.isTwinFramesOn())
135 DisplayController.toggleTwinFrames();
136 }
137
138 /**
139 * Navigates to the Frame with the next highest frame number in the current
140 * frameset. If the current frame is the last frame in the frameset, nothing
141 * happens.
142 */
143 public static void NextFrame() {
144 NextFrame(true);
145 }
146
147 public static void NextFrame(boolean addToBack) {
148 addToBack = adjustAddToBack(addToBack);
149 Frame next = FrameIO.LoadNext();
150 FrameUtils.DisplayFrame(next, addToBack, true);
151 }
152
153 /**
154 * Navigates to the last frame in the frameset.
155 *
156 */
157 public static void LastFrame() {
158 Frame last = FrameIO.LoadLast();
159 FrameUtils.DisplayFrame(last, true, true);
160 }
161
162 public static void ZeroFrame() {
163 Frame zeroFrame = FrameIO.LoadZero();
164 FrameUtils.DisplayFrame(zeroFrame, true, true);
165 }
166
167 public static void Next() {
168 NextFrame();
169 }
170
171 public static void Previous() {
172 PreviousFrame();
173 }
174
175 public static void PreviousFrame(boolean addToBack) {
176 addToBack = adjustAddToBack(addToBack);
177 Frame prev = FrameIO.LoadPrevious();
178 FrameUtils.DisplayFrame(prev, addToBack, true);
179 }
180
181 public static void PreviousFrame() {
182 PreviousFrame(true);
183 }
184
185 private static String _Parent = null;
186
187 private static Item _LastItemUsed = null;
188
189 public static void NextChild(Frame source) {
190 String back = DisplayController.peekFromBackUpStack();
191 // if there is no parent frame (i.e. the user is on the home frame) //
192 if (back == null) { // No frame was on the Backup stack
193 MessageBay.displayMessage("No Parent Frame Found.");
194 _LastItemUsed = null; // ByRob: what is reason for setting
195 // this to null, who is going to use it????
196 _Parent = null; // ByRob: what is reason for setting this to
197 // null, who is going to use it
198 return;
199 }
200
201 // Ensure the parent variable has been initialised
202 if (_Parent == null || !back.equals(_Parent)) { // ByRob: what the heck
203 // is the code doing?
204 // What is it setting
205 // up???????
206 _Parent = back;
207 _LastItemUsed = null;
208 }
209
210 Frame parent = FrameIO.LoadFrame(_Parent);
211
212 // find the next item to visit
213 List<Item> items = parent.getSortedItems(); // getItems method gets us the
214 // FirstItem on the frame
215 int parentItemLinkedToSource = 0; // ByMike: Will be set to the
216 // index of the item on the parent which follows the item linked to the
217 // child frame we are currently viewing.
218
219 // ByMike: if 'Next' has been clicked previously get the index of the
220 // item FOLLOWING the ParentItem linked to the source
221 if (_LastItemUsed != null) {
222 parentItemLinkedToSource = items.indexOf(_LastItemUsed);
223 }
224
225 // ByMike: If the 'Next' child is being sought for the 1st time...
226 String sourceName = source.getName().toLowerCase();
227
228 // ByMike: Find the first occurence of a ParentItem linked to the source
229 while (parentItemLinkedToSource < items.size()
230 && (items.get(parentItemLinkedToSource).getAbsoluteLink() == null || !items
231 .get(parentItemLinkedToSource).getAbsoluteLink()
232 .toLowerCase().equals(sourceName))) {
233 parentItemLinkedToSource++; // ByRob: this increments to the next
234 // item
235 }
236
237 // Find the next ParentItem linked to the next frame to be displayed
238 for (int i = parentItemLinkedToSource + 1; i < items.size(); i++) {
239 if (items.get(i).isLinkValid()
240 && !items.get(i).isAnnotation()
241 && !items.get(i).getAbsoluteLink().equalsIgnoreCase(
242 source.getName())) {
243 _LastItemUsed = items.get(i);
244 FrameUtils.DisplayFrame(_LastItemUsed.getAbsoluteLink(), false,
245 true);
246 return;
247 } // ByRob: end of if
248
249 } // ByRob: End of For
250
251 MessageBay.displayMessage("No more child frames found.");
252 }
253
254 /**
255 * Turns TwinFrames on if it is off, otherwise does nothing
256 *
257 */
258 // ByRob: Rob doesn't like notion of turning TwinFrames on and off,
259 // better to say more explicitly/directly what the mode is!!!!
260 public static void Small() {
261 if (!DisplayController.isTwinFramesOn())
262 DisplayController.toggleTwinFrames();
263 }
264
265 /*
266 * When display frame is called with addToBack set to false multiple
267 * times... Only the first frame is added to the backup stack. This flag
268 * stores the state for the addToBack parameter the last time this method
269 * was called.
270 */
271 private static boolean _lastAddToBack = true;
272
273 public static void ResetLastAddToBack() {
274 _lastAddToBack = true;
275 }
276
277 private static boolean adjustAddToBack(boolean addToBack) {
278 boolean originalAddToBack = addToBack;
279
280 if (!addToBack && _lastAddToBack) {
281 // This adds the first frame to the backup stack when the user
282 // navigates through a bunch of frames with the keyboard!
283 addToBack = true;
284 }
285
286 _lastAddToBack = originalAddToBack;
287
288 return addToBack;
289 }
290}
Note: See TracBrowser for help on using the repository browser.