Ticket #2394 (s2b_design_finished tweak) — at Version 8

Opened 15 years ago

Last modified 13 years ago

template-dialog-tree -- Create a tree inside template dialog

Reported by: deyan Owned by: boyanl
Priority: major Milestone:
Component: uncategorized Version: 2.0
Keywords: Cc:
Category: unknown Effort:
Importance: Ticket_group:
Estimated Number of Hours: 0 Add Hours to Ticket: 0
Billable?: yes Total Hours: 0
Analysis_owners: deyan Design_owners: boyanl
Imp._owners: boyanl Test_owners:
Analysis_reviewers: todor Changelog: Changelog
Design_reviewers: Imp._reviewers:
Test_reviewers: Analysis_score: 3.5
Design_score: 4 Imp._score: 0
Test_score: 3.5

Description (last modified by boyanl) (diff)

Replace the existing template dialog with a collapsable tree.

  • The tree should have three state checkboxes
    • Selected state
    • Not selected state
    • Gray-out state (some of the children are selected)
  • Selecting a child of empty parent should make the parent grayed out (if there are other unselected checkboxes) or selected (if all of the children are selected)
  • Selecting/deselecting a parent selects/deselects all of its children
  • The root and the first level should be seen on opening of the dialog
  • Opened nodes and states of the nodes should be selectable by developers

Change History

comment:1 Changed 15 years ago by deyan

  • Owner set to deyan
  • Status changed from new to s1a_analysis_started
  • Description modified (diff)

comment:2 Changed 15 years ago by deyan

  • Status changed from s1a_analysis_started to s1b_analysis_finished
  • Description modified (diff)

comment:3 Changed 15 years ago by todor

  • Status changed from s1b_analysis_finished to s1c_analysis_ok
  • Analysis_score changed from 0 to 3.5

the requirements are sufficient

comment:4 Changed 15 years ago by todor

  • Analysis_reviewers set to todor

comment:5 Changed 15 years ago by boyanl

  • Owner changed from deyan to boyanl
  • Status changed from s1c_analysis_ok to s2a_design_started

comment:6 Changed 15 years ago by boyanl

  • Design_owners set to boyanl
  • Imp._owners set to boyanl

comment:7 Changed 15 years ago by boyanl

  • Status changed from s2a_design_started to s2b_design_finished
  • Description modified (diff)
  • Add a new class TriStateCheckBox extending JCheckBox with the following members:
    • A public static enum State representing the state of the checkbox
    • public void setSelected(boolean selected) - overriding JCheckBox's method, setting the state according to the state model
    • public void paintComponent(Graphics g) , which defines how to draw the checkbox (with an added code for drawing the new state)
    • an inner public static class TriStateModel extending JToggleButton.ToggleButtonModel , which holds a State variable and defines when the checkbox will be "selected" and the state transition
  • Add a new class CheckBoxTree extending JTree with the following members:
    • A public static class CheckNode extends DefaultMutableTreeNode to represent the tree node, containing:
      • a TriStateModel state , representing the state of the node
      • public State getState() - returns the state of the node
      • public void nextState() - sets the node state to the "next" one, as defined in the state transition of the model
      • public void setState (State newState) - sets a new state of the node and propagates the changes to children/parent if necessary.
    • A class CheckRenderer extends JPanel implements TreeCellRenderer to visualize the tree nodes, it contains:
      • A JLabel label to hold the text of the node
      • A TriStateCheckBox check to hold the checkbox component
      • public void doLayout() - layouts both components. Sets the location and bounds of the checkbox and the label
    • A class NodeSelectionListener extends MouseAdapter with the following methods:
      • public void mouseClicked (MouseEvent e) - handles the mouse input over the tree. If some row of the tree is clicked, it alters the state of the CheckNode for that row (sets it to the "next" state)
    • public CheckNode addNode (String nodeText) - adds a new node attached to the tree root and returns the added node
    • public CheckNode addNode (String nodeText, CheckNode parent) - adds a new node with a specified parent
    • public CheckNode getRootNode() - returns the root of the tree
    • public CheckBoxTree (String rootName) - creates a tree with a specified root name
  • Changes to the TemplateDialog class
    • Change the dialog to use a CheckBoxTree instead of a BoundGroupCheckBox as a tree
    • Remove the JPanel checkBoxPanel member and getter and replace it with a JScrollPane treeScrollPane scroll pane for the tree
    • Modify the setup() method to create a new tree with a root name the title from the input info, and sets the tree to the treeScrollPane , and clean up the creation of the tree (it uses addKey now)
    • Remove the addTemplateKey method and replace it with a recursive addKey

comment:8 Changed 15 years ago by boyanl

  • Description modified (diff)
  • Add a new class TriStateCheckBox extending JCheckBox with the following members:
    • A public static enum State representing the state of the checkbox
    • public void setSelected(boolean selected) - overriding JCheckBox's method, setting the state according to the state model
    • public void paintComponent(Graphics g) , which defines how to draw the checkbox (with an added code for drawing the new state)
    • an inner public static class TriStateModel extending JToggleButton.ToggleButtonModel , which holds a State variable and defines when the checkbox will be "selected" and the state transition
  • Add a new class CheckBoxTree extending JTree with the following members:
    • A public static class CheckNode extends DefaultMutableTreeNode to represent the tree node, containing:
      • a TriStateModel state , representing the state of the node
      • public State getState() - returns the state of the node
      • public void nextState() - sets the node state to the "next" one, as defined in the state transition of the model
      • public void setState (State newState) - sets a new state of the node and propagates the changes to children/parent if necessary.
    • A class CheckRenderer extends JPanel implements TreeCellRenderer to visualize the tree nodes, it contains:
      • A JLabel label to hold the text of the node
      • A TriStateCheckBox check to hold the checkbox component
      • public void doLayout() - layouts both components. Sets the location and bounds of the checkbox and the label
    • A class NodeSelectionListener extends MouseAdapter with the following methods:
      • public void mouseClicked (MouseEvent e) - handles the mouse input over the tree. If some row of the tree is clicked, it alters the state of the CheckNode for that row (sets it to the "next" state)
    • public CheckNode addNode (String nodeText) - adds a new node attached to the tree root and returns the added node
    • public CheckNode addNode (String nodeText, CheckNode parent) - adds a new node with a specified parent
    • public CheckNode getRootNode() - returns the root of the tree
    • public CheckBoxTree (String rootName) - creates a tree with a specified root name
  • Changes to the TemplateDialog class
    • Change the dialog to use a CheckBoxTree instead of a BoundGroupCheckBox as a tree
    • Remove the JPanel checkBoxPanel member and getter and replace it with a JScrollPane treeScrollPane scroll pane for the tree
    • Modify the setup() method to create a new tree with a root name the title from the input info, and sets the tree to the treeScrollPane , and clean up the creation of the tree (it uses addKey now)
    • Remove the addTemplateKey method and replace it with a recursive addKey

Changed 15 years ago by boyanl

Note: See TracTickets for help on using tickets.