Package com.jsql.view.swing.tree.model
Class AbstractNodeModel
java.lang.Object
com.jsql.view.swing.tree.model.AbstractNodeModel
- Direct Known Subclasses:
NodeModelDatabase
,NodeModelEmpty
,NodeModelTable
Model adding functional layer to the node ; used by renderer and editor.
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractNodeModel
(AbstractElementDatabase elementDatabase) Create a functional model for tree node.protected
AbstractNodeModel
(String emptyObject) Create an empty model for tree node. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
buildMenu
(JPopupMenuCustomExtract tablePopupMenu, TreePath path) Display a popupmenu on mouse right click if needed.protected void
displayProgress
(PanelNode panelNode, DefaultMutableTreeNode currentNode) Update progressbar ; display the pause icon if node is paused.getComponent
(JTree tree, Object nodeRenderer, boolean isSelected, boolean isLeaf, boolean hasFocus) Draw the panel component based on node model.int
protected abstract Icon
getLeafIcon
(boolean isLeaf) Get icon displayed next to the node text.getPanel()
protected AbstractElementDatabase
Get the database parent of current node.boolean
boolean
isLoaded()
boolean
abstract boolean
Check if menu should be opened.boolean
boolean
boolean
abstract void
Run injection process (see GUIMediator.model().dao).void
setContainingSelection
(boolean isContainingSelection) void
setIndexProgress
(int indexProgress) void
setIsEdited
(boolean isEdited) void
setLoaded
(boolean isLoaded) void
setLoading
(boolean isLoading) void
setProgressing
(boolean isProgressing) void
setRunning
(boolean isRunning) void
setSelected
(boolean isSelected) void
void
showPopup
(DefaultMutableTreeNode currentTableNode, TreePath path, MouseEvent e) Display a popup menu for a database or table node.toString()
-
Constructor Details
-
AbstractNodeModel
Create a functional model for tree node.- Parameters:
elementDatabase
- Database structural component
-
AbstractNodeModel
Create an empty model for tree node.- Parameters:
emptyObject
- Empty tree default node
-
-
Method Details
-
buildMenu
Display a popupmenu on mouse right click if needed.- Parameters:
tablePopupMenu
- Menu to displaypath
- Treepath of current node
-
isPopupDisplayable
public abstract boolean isPopupDisplayable()Check if menu should be opened. i.e: does not show menu on database except during injection.- Returns:
- True if popupup should be opened, false otherwise
-
getLeafIcon
Get icon displayed next to the node text.- Parameters:
isLeaf
- True will display an arrow icon, false won't- Returns:
- Icon to display
-
runAction
public abstract void runAction()Run injection process (see GUIMediator.model().dao). Used by database and table nodes. -
showPopup
Display a popup menu for a database or table node.- Parameters:
currentTableNode
- Current nodepath
- Path of current node
-
getComponent
public Component getComponent(JTree tree, Object nodeRenderer, boolean isSelected, boolean isLeaf, boolean hasFocus) Draw the panel component based on node model.- Parameters:
tree
-nodeRenderer
-isSelected
-isLeaf
-hasFocus
-- Returns:
-
displayProgress
Update progressbar ; display the pause icon if node is paused.- Parameters:
panelNode
- Panel that contains the bar to updatecurrentNode
- Functional node model object
-
toString
-
getParent
Get the database parent of current node.- Returns:
- Parent
-
getElementDatabase
-
getIndexProgress
public int getIndexProgress() -
setIndexProgress
public void setIndexProgress(int indexProgress) -
isSelected
public boolean isSelected() -
setSelected
public void setSelected(boolean isSelected) -
isRunning
public boolean isRunning() -
setRunning
public void setRunning(boolean isRunning) -
isContainingSelection
public boolean isContainingSelection() -
setContainingSelection
public void setContainingSelection(boolean isContainingSelection) -
isLoaded
public boolean isLoaded() -
setLoaded
public void setLoaded(boolean isLoaded) -
isProgressing
public boolean isProgressing() -
setProgressing
public void setProgressing(boolean isProgressing) -
isLoading
public boolean isLoading() -
setLoading
public void setLoading(boolean isLoading) -
getPanel
-
setIsEdited
public void setIsEdited(boolean isEdited) -
setText
-