| 1 | [[BackLinksMenu]] |
| 2 | |
| 3 | [[TicketQuery(summary=ELEMENT_VIEWS_REDESIGN, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|)]] |
| 4 | |
| 5 | = Analysis = |
| 6 | |
| 7 | == Overview == |
| 8 | The goal of this task is to clear up the design and hierarchy of resource views and to complete their implementation. |
| 9 | |
| 10 | == Task requirements == |
| 11 | * Look through the following classes, clear up their design, complete their implementation and remove obsolete methods and properties: |
| 12 | * ElementView and all its subclasses |
| 13 | * BookView |
| 14 | * PageWorkArea (including connected classes such as PwaSelecter) |
| 15 | * This will include changes everywhere they are used. |
| 16 | * Create a simple demo that shows a page and some elements in it to demonstrate the views hierarchy. |
| 17 | |
| 18 | == Task result == |
| 19 | The result of this task will be a UML diagram and source code. |
| 20 | |
| 21 | == Implementation idea == |
| 22 | Use the suggested by milo hierarchy of element views. |
| 23 | |
| 24 | == Related == |
| 25 | UNPLANNED_MAIN_WINDOW_REFACTORING_R0 |
| 26 | |
| 27 | == How to demo == |
| 28 | Run the demo. |
| 29 | |
| 30 | = Design = |
| 31 | The hierarchy of the element views will generally follow the hierarchy in the model described in [GROUP_BOOK_MODEL_REDESIGN_R0] |
| 32 | |
| 33 | [[Image(source:branches/second_resource_refactoring/sophie2-platform/doc/uml-design-diagrams/ElementViewsClassDiagram.jpg, 95%)]] |
| 34 | |
| 35 | |
| 36 | * 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. |
| 37 | |
| 38 | |
| 39 | * BookView - a view that shows a book. [[BR]] |
| 40 | * There are 3 helper classes connected with BookView: |
| 41 | * 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. |
| 42 | * 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. |
| 43 | * 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. |
| 44 | * A BookView has: |
| 45 | * 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. |
| 46 | * public RwProp<BookExtrasState> extrasState() - trackes the current state of page extras. |
| 47 | * private RwProp<BookTimeState> timeState() - used for timelines. |
| 48 | * some helper methods to get a specific page view. |
| 49 | * 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. |
| 50 | |
| 51 | * ElementView - a view of a page element which renders as a scene object and has a timeline. [[BR]] |
| 52 | * Main properties, methods and responsibilities: |
| 53 | * public Prop<SceneElement> sceneElement() - the scene element representation of its model. |
| 54 | * By default it is composite scene element containing the scene elements of all subviews. |
| 55 | * If you want to add other child scene elements, you can override the protected void setupSceneElements(List<SceneElement> res) method. |
| 56 | * owns ListProp<ElementView> elementViews() - a list of <code>ElementViews</code> for all sub-elements of this view's model. |
| 57 | * This guarantees that the parent of the subviews will be correct and that they will be kept alive. |
| 58 | * private RwProp<TimePos> localTime() with getter and setter - used for timelines. |
| 59 | * ImmColor computeColor() - used to mark elements that are invisible, inactive or out of the edit scope. |
| 60 | * helper methods: |
| 61 | * BookView getBookView() |
| 62 | * BookViewOptions getViewOptions() |
| 63 | * PageWorkArea getPwa() |
| 64 | * RootPageView |
| 65 | * responsible for visualizing page border and background |
| 66 | * owns AutoProperty<PartPageView> mainPartView() - the main PartPageView that contains views for all children of the page. |
| 67 | * owns AutoListProperty<PartPageView> extraPartViews() - a list of views for all visible page extras. |
| 68 | * PartPageView - base class for: |
| 69 | * MainPageView - a view for all page elements, responsible for clipping the page in preview mode. |
| 70 | * ExtraPageView - a view for a page extra. |
| 71 | * GroupView - a view for a group of elements. |
| 72 | * FrameView - a base class for all views of frames. |
| 73 | * takes care of all common things such as border, background, content location and rotation, resize areas and outlines. |
| 74 | * its subclasses must implement the {{{ protected SceneElement makeContentElement() }}} method. |
| 75 | * AudioAnnotationView |
| 76 | * StickyView |
| 77 | |
| 78 | * PageWorkArea - a view that calculates what is to be displayed from a page and uses scenes to display the contents of a page. |
| 79 | * PwaSelector - a helper class responsible for managing the edit scope and selection in a particular PageWorkArea. |
| 80 | * 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. |
| 81 | * One can only select ElementViews that are sub-views of the edit scope or a part of the current bookExtra. |
| 82 | * ScopeRel - enum, inner for PwaSelector, defines the relation between an ElementView and the edit scope. |
| 83 | * Prop<CompositeSceneElement> rootSceneElement() - a composite scene element, consisting of the RootPageView's scene element, selectionRisenElement(), selectionDragElement() and selectionBoundsElement() |
| 84 | * selectionRisenElement() - a semi-transparent copy of the selected element that is drawn above everything else. |
| 85 | * selectionDragElement() - drag to select SceneElement. |
| 86 | * selectionBoundsElement() - the bounding rectangle of the currently selected elements. |
| 87 | * 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. |
| 88 | |
| 89 | * Selection logic: |
| 90 | * Select/deselect single elements (by cliching on them) - fix ElementLogic.ON_TOGGLE_ELEMENT_SELECTION |
| 91 | * Drag to select - fix ScenePageLogic |
| 92 | |
| 93 | * Menus, halos and huds |
| 94 | * check their computeVisible() method in order to show them |
| 95 | * register all already written hud (bound control) logics as extensions in MainAppHalosModule |
| 96 | * check if hud's logics use correct ResourceAccesses |
| 97 | * implement templating logic |
| 98 | |
| 99 | * Source code: [5387], [5422], [5440], [5483], [5493], [5521], [5582], [5619], [5639], [5663], [5672], [5745], [5747], [5793], [5801], [5889], [5918], [5924] |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | = Implementation = |
| 106 | ^(Describe and link the implementation results here (from the wiki or the repository).)^ |
| 107 | |
| 108 | = Testing = |
| 109 | ^(Place the testing results here.)^ |
| 110 | |
| 111 | = Comments = |
| 112 | ^(Write comments for this or later revisions here.) |