Ticket #2394 (s2b_design_finished tweak) — at Version 7
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)
- Add a new class TriStateCheckBox extending JCheckBox with the following members:
- A public static enum State representing the state of the checkbox
- public void setState(State state) - sets the new state of the checkbox
- public State getState() - gets 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 JTree backlink to the containing tree, needed for the visual update of nodes when changing a state of a node
- 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. Also updates the nodes visually using the backlink to the containing tree.
- 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 Dimension getPreferredSize() - returns the preferred size, which is label_width + checkbox_width as width and max (check_height, label_height) as height
- 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)
- A public static class CheckNode extends DefaultMutableTreeNode to represent the tree node, containing:
- 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 replaced 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 cleaned up the creation of the tree (it uses addKey now)
- Remove the addTemplateKey method and replaced it with a recursive addKey
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:5 Changed 15 years ago by boyanl
- Owner changed from deyan to boyanl
- Status changed from s1c_analysis_ok to s2a_design_started
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
- A public static class CheckNode extends DefaultMutableTreeNode to represent the tree node, containing:
- 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
Note: See
TracTickets for help on using
tickets.