Version 1 (modified by deyan, 16 years ago) (diff) |
---|
Analysis
Overview
The goal of this task is to clear up the design and hierarchy of resource views and to complete their implementation.
Task requirements
- Look through the following classes, clear up their design, complete their implementation and remove obsolete methods and properties:
- ElementView and all its subclasses
- BookView
- PageWorkArea (including connected classes such as PwaSelecter)
- This will include changes everywhere they are used.
- Create a simple demo that shows a page and some elements in it to demonstrate the views hierarchy.
Task result
The result of this task will be a UML diagram and source code.
Implementation idea
Use the suggested by milo hierarchy of element views.
Related
UNPLANNED_MAIN_WINDOW_REFACTORING_R0
How to demo
Run the demo.
Design
The hierarchy of the element views will generally follow the hierarchy in the model described in [GROUP_BOOK_MODEL_REDESIGN_R0]
- ResourceView - base interface for views that show resources. Implementors should have a constructor by ResourceAccess and a method to get a helper for the resource the view shows.
- BookView - a view that shows a book.
- There are 3 helper classes connected with BookView:
- BookViewOptions - An immutable class that contains settings for displaying a book, such as zoom level, mode (preview or author), should frames and the connections between them be outlined.
- BookExtrasState - An immutable class that represents the state of book extras in a particular moment - all known book extras, which of them are shown and which one is current.
- BookTimeState - An immutable class that contains information about the current page, the local time of the book and the local time of the current page.
- A BookView has:
- private RwProp<BookViewOptions> options() with public getter and setter. The setter should assert that we cannot switch between author and preview mode by changing the options value.
- public RwProp<BookExtrasState> extrasState() - trackes the current state of page extras.
- private RwProp<BookTimeState> timeState() - used for timelines.
- some helper methods to get a specific page view.
- owns private RwListProp<RootPageView> openPageViews() - ensures that the parent property of the views for all open pages is correct and they will be kept alive.
- There are 3 helper classes connected with BookView:
- ElementView - a view of a page element which renders as a scene object and has a timeline.
- Main properties, methods and responsibilities:
- public Prop<SceneElement> sceneElement() - the scene element representation of its model.
- By default it is composite scene element containing the scene elements of all subviews.
- If you want to add other child scene elements, you can override the protected void setupSceneElements(List<SceneElement> res) method.
- owns ListProp<ElementView> elementViews() - a list of <code>ElementViews</code> for all sub-elements of this view's model.
- This guarantees that the parent of the subviews will be correct and that they will be kept alive.
- private RwProp<TimePos> localTime() with getter and setter - used for timelines.
- ImmColor computeColor() - used to mark elements that are invisible, inactive or out of the edit scope.
- helper methods:
- BookView getBookView()
- BookViewOptions getViewOptions()
- PageWorkArea getPwa()
- public Prop<SceneElement> sceneElement() - the scene element representation of its model.
- RootPageView
- responsible for visualizing page border and background
- owns AutoProperty<PartPageView> mainPartView() - the main PartPageView that contains views for all children of the page.
- owns AutoListProperty<PartPageView> extraPartViews() - a list of views for all visible page extras.
- PartPageView - base class for:
- MainPageView - a view for all page elements, responsible for clipping the page in preview mode.
- ExtraPageView - a view for a page extra.
- GroupView - a view for a group of elements.
- FrameView - a base class for all views of frames.
- takes care of all common things such as border, background, content location and rotation, resize areas and outlines.
- its subclasses must implement the protected SceneElement makeContentElement() method.
- AudioAnnotationView
- StickyView
- Main properties, methods and responsibilities:
- PageWorkArea - a view that calculates what is to be displayed from a page and uses scenes to display the contents of a page.
- PwaSelector - a helper class responsible for managing the edit scope and selection in a particular PageWorkArea.
- The edit scope is an ElementView in which one can add new sub-elements and whose sub-elements can be changed or removed. By default this should be the MainPageView of the current page. When the user enters a group, the edit scope should become the responsible GroupView.
- One can only select ElementViews that are sub-views of the edit scope or a part of the current bookExtra.
- ScopeRel - enum, inner for PwaSelector, defines the relation between an ElementView and the edit scope.
- Prop<CompositeSceneElement> rootSceneElement() - a composite scene element, consisting of the RootPageView's scene element, selectionRisenElement(), selectionDragElement() and selectionBoundsElement()
- selectionRisenElement() - a semi-transparent copy of the selected element that is drawn above everything else.
- selectionDragElement() - drag to select SceneElement.
- selectionBoundsElement() - the bounding rectangle of the currently selected elements.
- Prop<JDesktopPane> swingComponent() - the swing representation of this PageWorkArea - a pane which contains a layer for the scene visual, and a layer for the halos.
- PwaSelector - a helper class responsible for managing the edit scope and selection in a particular PageWorkArea.
- Selection logic:
- Select/deselect single elements (by cliching on them) - fix ElementLogic.ON_TOGGLE_ELEMENT_SELECTION
- Drag to select - fix ScenePageLogic
- Menus, halos and huds
- check their computeVisible() method in order to show them
- register all already written hud (bound control) logics as extensions in MainAppHalosModule
- check if hud's logics use correct ResourceAccesses
- implement templating logic
- Source code: [5387], [5422], [5440], [5483], [5493], [5521], [5582], [5619], [5639], [5663], [5672], [5745], [5747], [5793], [5801], [5889], [5918], [5924]
Implementation
(Describe and link the implementation results here (from the wiki or the repository).)
Testing
(Place the testing results here.)
Comments
(Write comments for this or later revisions here.)