Changes between Version 23 and Version 24 of PAGE_STRUCTURE_PALETTE_R0


Ignore:
Timestamp:
11/02/09 14:45:31 (16 years ago)
Author:
meddle
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PAGE_STRUCTURE_PALETTE_R0

    v23 v24  
    6262  * The TreePalette will have items TreePaletteItems and will be generic by it's items. 
    6363  * It's clear that the TreePaletteItems and the ListPaletteItems will have some common methods -> the interaction ones, so they will have a common predecessor the InteractableItem. 
    64    * The InteractableItem is abstract class with the following methods with default implementations to do nothing: 
     64   * The {{{InteractableItem}}} is abstract class with the following methods with default implementations to do nothing: 
    6565    * {{{public void clicked()}}} -> Can be implemented to execute action when the item is clicked. 
    6666    * {{{public void doubleClicked()}}} -> Can be implemented to execute action when the item is double clicked. 
     
    6868    * {{{public Transferable draggedOut()}}} -> Implemented if the item can be dragged out. 
    6969    * {{{public void keyPressed(KeyEvent e)}}} -> Implemented if action is executed when key is pressed and the item is selected. 
     70   * The ListPaletteItem and TreePaletteItem are similar in this that have the {{{public abstract Object render()}}} method, but for now may be the render method should be devided... Other idea is to have common interface PaletteItem implemented by the {{{InteractableItem}}} and the list palette will have {{{InteractableItem}}}s instead of ListItems, but this will lead to small refactoring, that's why this will be leaved if there is enough time. But is good idea to be done some day :) 
     71   * The TreePaletteItem will have the {{{public abstract Object render()}}} method, that is track-able and method {{{public abstract ImmList<I> getChildItems()}}} which will return the it's child item and the implementors will have to write it. 'I' is generic parameter that means {{{I extends TreePaletteItem<I>}}}, in other words the method returns child items of the same kind of which is the item. 
     72  * The data TreePalette will be contained in property {{{public abstract Prop<ImmList<I>> treeItems()}}} that the extendors will override. All the elements of the tree must be contained in that list. The model of the tree will be built over that list using the {{{public abstract ImmList<I> getChildItems()}}} method of the item. Here again 'I' represents {{{I extends TreePaletteItem<I>}}}. 
     73  * {{{DefaultMutableTreeNode}}}s will be used to create the model of the JTree, they will be cached for the items of the tree and will be removed from the cache when an item is deleted, so if the user caches the items correctly the tree will not be rebuilt every time the structure changes. The caching can be done using the object generated from {{{public abstract Object render()}}} of the items, but there is a big chance to have repeating objects generated by {{{public abstract Object render()}}}. 
     74  * The tree model will be generated with the algorithm: 
     75   * For every item in the list provided by {{{public abstract Prop<ImmList<I>> treeItems()}}}, get a {{{DefaultMutableTreeNode}}} form the cache or create one if there is no such, then for the children of the item repeat that procedure and add their nodes to the children of the current node. mark all the children items as added to the tree. 
     76   * For every not added to the tree item, add it to the root node of the tree (which is invisible and hidden). This way the items will not need parent items and can be defined easily. 
     77   * Update the tree model, saving the selection and expanded paths. 
     78   * Remove all the entries in the cache (and their children) that are not part of the list with items anymore. 
    7079 
    7180= Implementation =