Last modified 16 years ago
Last modified on 04/21/09 19:01:18
Analysis
Overview
- Links allow the user to add interaction between different pages, page elements or frame contents.
- When a specific event happens with a source then the corresponding action is taken.
- The appearance of elements with defined links may be different in different states of the link.
- LINKS_COMMON_R0 has more on this issue.
- Links have effect only when opened in Sophie reader or when in preview mode.
- Changes done by links are not to be persisted.
Task requirements
- Define a model for links - how will triggers and actions be represented.
- Define how links are to be made part of the book and persisted.
- Define how different styles will be represented.
- Define a GUI for manipulation of links.
- Define some basic link triggers and actions.(look at subtasks for details)
- Links cannot be "executed" while in author mode.
- Text links(when triggering events are performed on text content) are not mandatory for now.
- Some additional tasks should be done - the preview mode of the book and the interactivity of scenes.
- Changes done in preview mode are not persisted.
Task result
The result of this task should be source code.
Implementation idea
- Define the Link as a list of LinkRules
- The later are pairs of (Trigger, Action)
- Actions are a class hierarchy
- Define an OperationR3 that will handle all the links in the application instance
Related
LINKS_MANIPULATION_R0
LINKS_ACTIONS_COMMON_R0
LINKS_ACTIONS_NAVIGATING_R0?
LINKS_ACTIONS_SHOWING_R0
LINKS_ACTIONS_PLAYING_R0
LINKS_ACTIONS_MULTI_PARAMETERS_R0?
LINKS_ACTIONS_ANNOBEAMS_R0?
How to demo
- Run Sophie2
- Make a book with two frames
- Add a link to the first frame that on some action toggles the visibility of the second frame
- Switch in preview mode
- Perform the triggering action several times to demonstrate the showing and hiding of the second frame.
Design
- Add links package in the org.sophie2.base.model.book module. It should contain the following
- LinkState enumeration with elements NORMAL, OVER, PRESSED, VISITED
- LinkTriger empty marker interface
- LinkAction empty interface
- LinkRule final class. It has a parent property of type Link and a LinkTrigger and @Own LinkAction property
- Link abstract class implementing the Derivable interface. It should have a LinkState value property and a @Own @Templated ProList of LinkRule elements.
- PageLink extends Link. It should contain BorderStyle, BackgroundStyle and ShadowStyle for the four link states. These should be @Templated.
- It should also contain a publc enumeration Triggers containing these elements PAGE_SHOWN and PAGE_HIDDEN
- FrameLink extends Link. It should contain BorderStyle, BackgroundStyle and ShadowStyle for the four link states. These should be @Templated.
- It should also contain a publc enumeration Triggers containing these elements
- FRAME_SHOWN
- FRAME_HIDDEN
- FRAME_MOUSE_ENTER
- FRAME_MOUSE_LEAVE
- FRAME_MOUSE_DOUBLE_CLICK
- FRAME_MOUSE_PRESSED
- FRAME_MOUSE_RELEASED
- It should also contain a publc enumeration Triggers containing these elements
- Add an extension point for LinkActions
- Add a link property to the Page class. Review teplate support of styles.
- Add a link property to the Frame class. Review teplate support of styles.
- Note: Style manipulation is not so important so it should be done after everything else.
- Add a visible property of type Boolean to the Frame class
- Modify the WorkAreas so that they use this property correctly.
- Add a public enumeration PageStateChangeEvent in the BookDocumentWindow class.
- Add element PAGE_SHOWN with @EventParams({Page.class})
- Add element PAGE_HIDDEN with @EventParams({Page.class})
- Add a public enumeration FrameStateChangeEvent in the SceneFrameView class.
- Add element FRAME_SHOWN with @EventParams({Frame.class})
- Add element FRAME_HIDDEN with @EventParams({Frame.class})
- Add a resource property that will fire the corresponding events
- Modify the pageSync method to fire these events
- Add LinksProcessor enumeration in the areas package of org.sophie2.main.view module
- It should implement OperationDef interface
- Add element FRAME_INPUT_EVENT it should listen for InputEventR3 which happen with frames
- Add element FRAME_STATE_CHANGE it should listen for FrameStateChangeEvent events
- Add element PAGE_STATE_CHANGE it should listen for PageStateChangeEvent events
- All these should check if the corresponding Page/Frame has defined link and if so whether there are rules with the triggers corresponding to the handled event.
- If there are such LinkRules a LINK_ACTION_TRIGGERED event is fired with the corresponding action as an argument.
- Create a org.sophie2.main.func.links module
- Create a LinkConfigurationPanel interface which extends VisualElement. It should have a getActionClass method that gets the the class of the LinkAction that this pabnel knows how to configure.
- It should contain a hud dialog and a halo button that shows it.
- The hud consists of 5 parts
- Drop down combo with the LinkRulse of the configured element(Page/Frame)
- Drop down combo for the available triggers for the element
- Drop down combo with available actions
- Configuration panel.
- "Add rule" and "Remove rule" buttons
- When an action is selected the hud should look for an appropriate LinkConfigurationPanel and display it as a part of the Configuration panel.
- Create some of the important actions for navigation and frames visibility changing. this includes
- Actions themselves
- Corresponding ActionProviders
- Operaton enumeration that will handle the LINK_ACTION_TRIGGERED event for the declared actions
Implementation
- org.sophie2.main.func.links created. It has packages *., *.actions.navigation and *.actions.showing.
- LinkConfigurationPanel, LinksHalo and LinksHud created.
- CurrentRule, AvailableTriggers and AvailableActions combo boxes created, some errors in the bound controls were fixed, preferred size and visibility of the validation icon were added to the BoundComboBox.
- There are currently 2 implemented ConfigurationPanels, which are attached to the hud when appropriate action is selected.
- Actions created: Next page, Go to page, Show frame, Hide frame, Toggle frame. Each has a provider, GoToPage has own configuration panel and the actions about the visibility use a shared one.
- NavigationActionsOperation and ShowingActionOperation created.
- Obsolete unused LinkHaloButton and LinkHud classes were deleted.
- The Operations of the LinkProcessor were separated so that there is one for each trigger.
- The stylig( appearance) of links was not implemented.
- No templating of links.
- LinkAction was made a class.
- The page and frame triggers were pulled out in their own files.
Changesets: 2076, 2104, 2105, 2106, 2110, 2121, 2123, 2125, 2126, 2132, 2135, 2144, 2152, 2165, 2177, 2178.
- TODO'S for the next revisions:
- The implementations of ActionConfigurationPanel are not using the skin-ids for its size, and they should be.
- Actions and triggers descriptions should be made to use skins.
- Preview mode needs to be refactored.
- The links need ability to work for text selections.
- Links persistence must be designed.
- The appearance of the links is not done yet.
- Some certain triggers don't currently work (for example, MOUSE_CLICKED) because of unconsistent event handling.
- More actions have to be implemented.
- Page and Frame showing/hiding events are not fired correctly enough (see the log when running sophie for details)
Testing
(Place the testing results here.)
Comments
(Write comments for this or later revisions here.)