public class IlvSymbologyTreeView extends JPanel
IlvSymbologyTreeView
is a panel that provides a GUI to display
the symbol model of your application. It must be attached to a symbol engine and
displays the symbol model of this symbol engine. The symbol model is graphically
represented by a tree structure in a JTree
object. Predefined actions allow
the user to manage tree items (creation, deletion, editing, visibility).
Example:
// Create the SDM engine: IlvSDMEngine engine = new IlvSDMEngine(); IlvSymbologyTreeView view = new IlvSymbologyTreeView(engine); // and finally add the view to a frame or GUI panel of your application parentPanel.add(view);Note: This class was in the
ilog.views.maps.defense.symbology.swing
package in previous versions of JViews Maps for Defense.Modifier and Type | Class and Description |
---|---|
static interface |
IlvSymbologyTreeView.SymbologyTreeSelectionListener
Interface implemented by elements that should respond to tree selection
Here it is implemented by all actions to have a uniform way to react on
selection changes in the tree view.
|
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
IlvSymbologyTreeView(IlvSDMEngine engine)
Creates a new
IlvSymbologyTreeView object. |
Modifier and Type | Method and Description |
---|---|
AbstractButton |
addAction(Action a)
Adds an action and a button in the action bar to trigger the action.
|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener on property modification.
|
TreePath[] |
getExpandedPaths()
Returns the expanded paths of the tree.
|
Object[] |
getSelectedInTree()
Returns the selected objects or
null if nothing is selected in the tree
view. |
IlvSDMEngine |
getSymbologyEngine()
Returns the engine currently attached to the view.
|
IlvSymbologyTreeViewActions |
getSymbologyTreeViewActions()
Returns the actions.
|
JToolBar |
getToolbar()
Returns the toolbar displayed on top of this panel.
|
JTree |
getTree()
Returns the tree that displays the symbol model.
|
protected boolean |
isAddGroupAllowed(Object[] components)
Returns whether add group is allowed.
|
protected boolean |
isAddSymbolAllowed(Object[] components)
Returns whether add symbol is allowed.
|
protected boolean |
isDuplicateAllowed(Object[] components)
Returns whether duplicating selected symbols is allowed.
|
protected boolean |
isEditAllowed(Object[] components)
Returns whether editing selected symbols and groups is allowed.
|
protected boolean |
isHideAllowed(Object[] components)
Returns whether making nodes and groups invisible is allowed.
|
protected boolean |
isRemoveAllowed(Object[] components)
Returns whether removing selected symbols and groups is allowed.
|
protected boolean |
isRemoveConfirmed(Object[] components)
Displays a dialog that asks for confirmation when deleting a node or group.
|
protected boolean |
isShowAllowed(Object[] components)
Returns whether making nodes and groups visible is allowed.
|
void |
performAddGroup()
Creates a new group and adds it to the selected group.
|
void |
performAddSymbol()
Creates a new symbol and adds it to the selected group.
|
void |
performDuplicate()
Duplicates selected symbols.
|
void |
performEdit()
Edits the selected symbol or group.
|
void |
performRemove()
Removes selected symbols and groups.
|
void |
performVisible(boolean visible)
Performs visibility action on selected nodes or groups.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener on property modification.
|
void |
setExpandedPaths(TreePath[] paths)
Restores the expansion state.
|
void |
setNodeVisible(IlvSDMModel model,
Object node,
boolean v)
Makes a node or a group visible or invisible.
|
void |
setRootVisible(boolean rootVisible)
Determines whether or not the root node in the tree is visible.
|
void |
setSymbologyEngine(IlvSDMEngine engine)
Attaches the
IlvSymbologyTreeView object to an engine and notifies
property change listeners about the change to the engine. |
void |
setSymbologyTreeViewActions(IlvSymbologyTreeViewActions actions)
Sets the actions.
|
void |
showSymbolMenu(MouseEvent e)
Shows a pop-up menu on the selected tree item.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public IlvSymbologyTreeView(IlvSDMEngine engine)
IlvSymbologyTreeView
object.engine
- The engine that displays the symbol modelpublic void setRootVisible(boolean rootVisible)
rootVisible
- true
if the root node of the tree is to be displayedpublic void setSymbologyEngine(IlvSDMEngine engine)
IlvSymbologyTreeView
object to an engine and notifies
property change listeners about the change to the engine.engine
- The enginepublic IlvSDMEngine getSymbologyEngine()
public void setSymbologyTreeViewActions(IlvSymbologyTreeViewActions actions)
IlvSymbologyTreeViewActions
provides methods for implementing interactive
operations to occur when the user initiates actions such as "add
symbol", "remove symbol" and so on. If no operations are set, a default
implementation is used for these actions.
This method calls IlvSymbologyTreeViewActions.setView(ilog.views.maps.symbology.swing.IlvSymbologyTreeView)
to notify the
actions that this is the view of the actions. It also notifies
property change listeners about changes to the actions.
actions
- Actions to usepublic IlvSymbologyTreeViewActions getSymbologyTreeViewActions()
public JToolBar getToolbar()
public JTree getTree()
public Object[] getSelectedInTree()
null
if nothing is selected in the tree
view.public void performAddSymbol()
IlvSymbologyTreeViewActions.createSymbol(ilog.views.sdm.IlvSDMModel, java.lang.Object, ilog.views.IlvApplyObject)
and then adds the new
symbol to the selected group.protected boolean isAddSymbolAllowed(Object[] components)
IlvSymbologyTreeViewActions.isCreateSymbolEnabled(ilog.views.sdm.IlvSDMModel)
and whether the
input components
is exactly one group component.components
- The selected groups of the symbol modelpublic void performAddGroup()
IlvSymbologyTreeViewActions.createGroup(ilog.views.sdm.IlvSDMModel, java.lang.Object, ilog.views.IlvApplyObject)
and then adds the new group
to the selected group.protected boolean isAddGroupAllowed(Object[] components)
IlvSymbologyTreeViewActions.isCreateSymbolEnabled(ilog.views.sdm.IlvSDMModel)
and whether the
input components
is exactly one group component.components
- The selected groups of the symbol modelisRemoveConfirmed(Object[])
public void performRemove()
protected boolean isRemoveConfirmed(Object[] components)
components
- The array of elements to remove.true
if the remove is confirmedprotected boolean isRemoveAllowed(Object[] components)
components
- The selected nodes and groups of the symbol modelpublic void performEdit()
protected boolean isEditAllowed(Object[] components)
components
- The selected nodes and groups of the symbol modelpublic void performDuplicate()
protected boolean isDuplicateAllowed(Object[] components)
components
- The selected nodes and groups of the symbol modelpublic void performVisible(boolean visible)
visible
- If true
, the objects are made visible; otherwise
they are made invisible.public void setNodeVisible(IlvSDMModel model, Object node, boolean v)
model
- The model containing the nodenode
- The node to changev
- Indicates whether the node should be made visible or not.protected boolean isShowAllowed(Object[] components)
components
- The selected nodes and groups of the symbol modelprotected boolean isHideAllowed(Object[] components)
components
- The selected nodes and groups of the symbol modelpublic void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in class Container
listener
- The listener to addpublic void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in class Component
listener
- The listener to removepublic AbstractButton addAction(Action a)
a
- The action to link to the buttonpublic void showSymbolMenu(MouseEvent e)
e
- The eventpublic TreePath[] getExpandedPaths()
public void setExpandedPaths(TreePath[] paths)
paths
- The paths to expand© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.