ilog.cpl
Class IlpTree

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by ilog.cpl.IlpTree
All Implemented Interfaces:
IlpStylable, IlpGraphicComponent, IlpInteractiveGraphicComponent, IlpObjectSelectionModel, IlvStylable, ImageObserver, MenuContainer, Serializable

public class IlpTree
extends JComponent
implements IlpInteractiveGraphicComponent

The Tree Component, used to represent hierarchical data.

This class is a graphical bean which encapsulates an IlpTreeModel, an IlpTreeView and an IlpTreeController.

The tree model can be filled automatically from an IlpDataSource. The data source content is translated into tree model objects, following the containment hierarchy.

The IlpTree class provides convenient methods to access some view, model and controller properties directly.

Since:
JTGO 3.0
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface ilog.cpl.css.IlpStylable
UPDATE_ALL_MASK, UPDATE_COMPONENT_MASK, UPDATE_NONE_MASK, UPDATE_OBJECTS_MASK
 
Fields inherited from interface ilog.views.util.styling.IlvStylable
APPLIED_RULE_MASK, BAD_CLASS_MASK, BAD_PROP_MASK, BAD_PROP_WITH_STACK_MASK, CREATED_MASK, DECL_MASK, DECL_VALUE_MASK, FAILED_CONVERSIONS_MASK, TIME_REPORT_MASK, WARNING_PROP_MASK
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
IlpTree()
          Default constructor.
IlpTree(IlpContext context)
          Creates a Tree with this context and the default MVC.
IlpTree(IlpContext context, IlpTreeModel model, IlpTreeView view, IlpTreeController controller)
          Creates a Tree component with given MVC components.
IlpTree(IlpTreeModel model, IlpTreeView view, IlpTreeController controller)
          Creates a Tree component with given MVC components.
 
Method Summary
 void addPseudoClass(IlpObject bo, String pseudo)
          Adds a pseudoclass to the specified business object.
 void addSelectionObject(IlpObject object)
          Adds the given IlpObject to the selection.
 void clearSelection()
          Clears the selection.
protected  IlpAbstractTreeAdapter createDefaultAdapter()
          Create a tree adapter for the given adapter mode.
protected  IlpTreeController createDefaultController()
          Creates the default controller, which is an IlpTreeController object.
protected  IlpTreeModel createDefaultModel()
          Creates the default model, which is an IlpTreeModel object.
protected  IlpTreeView createDefaultView()
          Creates the default view, which is an IlpTreeView object.
 void dispose()
          Cleans up the tree, disconnects the component from the data source and drops references to objects to help the garbage collection.
 void doLayout()
          Lays out the components.
 boolean ensureVisible(IlpObject object)
          Scrolls the view in such a way that a given object becomes visible.
 boolean ensureVisible(IlpRepresentationObject object)
          Scrolls the view in such a way that a given representation object becomes visible.
 IlpAbstractTreeAdapter getAdapter()
          Returns the adapter connected to the tree or creates a new one.
 TreeCellRenderer getCellRenderer()
          Retrieves the current tree cell renderer from the view.
 IlpContext getContext()
          Returns the context.
 IlpTreeController getController()
          Returns the current controller.
 IlpDataSource getDataSource()
          Retrieves the current data source.
 IlpViewInteractor getDefaultViewInteractor()
          Returns the default view interactor.
 IlpFilter getFilter()
          Returns the filter used to filter business objects.
 JScrollBar getHorizontalScrollBar()
          Returns the horizontal scroll bar that controls the viewport's horizontal view position.
 int getHorizontalScrollBarPolicy()
          Returns the horizontal scroll bar policy value.
 IlpTreeModel getModel()
          Returns the current model.
 IlpProject getProject()
          Returns the component project configuration.
 JScrollPane getScrollView()
          Returns the scrollable view of this component.
 IlpObject getSelectedObject()
          Returns the first selected IlpObject from the collection of selected objects.
 Collection getSelectedObjects()
          Returns the set of selected IlpObjects.
 TreeSelectionModel getSelectionModel()
          Retrieves the current selection model from the component.
 Comparator getSortComparator()
          Retrieves the comparator used to sort the nodes.
 IlpStyle getStyle()
          Deprecated. The Style API has been replaced by the Cascading Style Sheet mechanism.
 IlpGraphicViewStyleManager getStyleManager()
          Deprecated. The Style API has been replaced by the Cascading Style Sheet mechanism. Please use the method setStyleSheets or getStyleSheets instead.
 int getStyleSheetDebugMask()
          Returns the current debug level.
 String[] getStyleSheets()
          Returns the cascaded style sheets.
 String getStyleSheets(int index)
          Returns one of the cascading style sheets.
 JScrollBar getVerticalScrollBar()
          Returns the vertical scroll bar that controls the viewport's horizontal view position.
 int getVerticalScrollBarPolicy()
          Returns the vertical scroll bar policy value.
 IlpTreeView getView()
          Returns the current view.
 IlpViewInteractor getViewInteractor()
          Retrieves the current view interactor from the controller.
 boolean isObjectSelected(IlpObject object)
          Returns true if the given IlpObject is selected, false otherwise.
 void refilter()
          Reapplies the current filter to the adapter objects.
 void removePseudoClass(IlpObject bo, String pseudo)
          Removes a pseudoclass from the specified business object.
 void removeSelectionObject(IlpObject object)
          Removes the given IlpObject from the selection.
 void setAdapter(IlpAbstractTreeAdapter adapter)
          Sets a new data source adapter.
 void setCellRenderer(TreeCellRenderer renderer)
          Sets a new tree cell renderer on the view.
 void setController(IlpTreeController controller)
          Sets the controller.
 void setDataSource(IlpDataSource dataSource)
          Sets a new data source.
 void setDefaultViewInteractor(IlpViewInteractor interactor)
          Sets the default view interactor.
 void setEnabled(boolean enabled)
          Sets whether or not this component is enabled.
 void setFilter(IlpFilter filter)
          Sets the filter.
 void setHorizontalScrollBarPolicy(int policy)
          Determines when the horizontal scrollbar appears.
 void setModel(IlpTreeModel model)
          Sets the model.
 void setProject(IlpProject proj)
          Sets the project configuration, containing data source information and style sheets.
 void setProject(URL projectURL)
          Sets a Tree component project configuration.
 void setSelectedObject(IlpObject object)
          Sets the selected IlpObject.
 void setSelectedObjects(Collection objects)
          Sets the set of selected IlpObjects.
 void setSelectionLookAndFeel(int selectionLookAndFeel)
          Sets the way the selection is rendered to/manipulated by the end-user.
 void setSelectionModel(TreeSelectionModel selectionModel)
          Sets a new selection model on the component.
 void setSortComparator(Comparator comparator)
          Sets the comparator used to sort the nodes.
 void setStyleSheetDebugMask(int mask)
          Sets the debug level while parsing the style sheets.
 void setStyleSheets(int index, String css)
          Changes one of the cascading style sheets.
 void setStyleSheets(int index, String css, int updateMask)
          Changes one of the cascading style sheets.
 void setStyleSheets(String[] css)
          Sets the Cascading Style Sheets.
 void setStyleSheets(String[] css, int updateMask)
          Sets the cascading style sheets.
 void setVerticalScrollBarPolicy(int policy)
          Determines when the vertical scrollbar appears.
 void setView(IlpTreeView view)
          Sets the view, which gets connected to the model and controller.
 void setViewInteractor(IlpViewInteractor interactor)
          Sets the interactor associated with the view.
 void sort()
          Sorts the model according to the current sort comparator.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
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, hide, 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, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ilog.views.util.styling.IlvStylable
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

IlpTree

public IlpTree()
Default constructor. Creates an IlpTree component in the default context.

A default model, view and controller will be created and used.

See Also:
IlpSystem.GetDefaultContext()

IlpTree

public IlpTree(IlpContext context,
               IlpTreeModel model,
               IlpTreeView view,
               IlpTreeController controller)
Creates a Tree component with given MVC components.

Parameters:
context - The context used by the tree.
model - The model to be used; if null, createDefaultModel() is called.
view - The view to be used; if null, createDefaultView() is called.
controller - The controller to be used; if null, createDefaultController() is called.

IlpTree

public IlpTree(IlpTreeModel model,
               IlpTreeView view,
               IlpTreeController controller)
Creates a Tree component with given MVC components.

Parameters:
model - The model to be used; if null, createDefaultModel() is called.
view - The view to be used; if null, createDefaultView() is called.
controller - The controller to be used; if null, createDefaultController() is called.

The Tree component is initialized using the default context.

See Also:
IlpSystem.GetDefaultContext()

IlpTree

public IlpTree(IlpContext context)
Creates a Tree with this context and the default MVC.

Method Detail

dispose

public void dispose()
Cleans up the tree, disconnects the component from the data source and drops references to objects to help the garbage collection.

Note: After calling this function, this tree is no longer functional.

Since:
JTGO 4.0

getContext

public IlpContext getContext()
Returns the context.

Specified by:
getContext in interface IlpGraphicComponent

getView

public IlpTreeView getView()
Returns the current view.

Returns:
The current view.

setView

public void setView(IlpTreeView view)
Sets the view, which gets connected to the model and controller. The previous view is disconnected from the model and the controller.

Parameters:
view - The new view. When this parameter is null, a default view is created using createDefaultView().

getModel

public IlpTreeModel getModel()
Returns the current model.

Returns:
The current model.

setModel

public void setModel(IlpTreeModel model)
Sets the model.

Parameters:
model - The new model. If this parameter is null, a default model is created using <createDefaultModel().

getController

public IlpTreeController getController()
Returns the current controller.

Returns:
The current controller.

setController

public void setController(IlpTreeController controller)
Sets the controller.

Parameters:
controller - The new controller. If this parameter is null, a default controller is created using createDefaultController().

getStyleManager

public IlpGraphicViewStyleManager getStyleManager()
Deprecated. The Style API has been replaced by the Cascading Style Sheet mechanism. Please use the method setStyleSheets or getStyleSheets instead.

Returns the style manager of the encapsulated view.

Deprecated Since:
JTGO 3.5

getStyle

public IlpStyle getStyle()
Deprecated. The Style API has been replaced by the Cascading Style Sheet mechanism.

Returns the style used to configure the tree view graphically. Returns null if the tree view has no graphic view style manager. (This should not occur.)

Deprecated Since:
JTGO 3.5

getSelectedObject

public IlpObject getSelectedObject()
Returns the first selected IlpObject from the collection of selected objects. Returns null if there is no selected object.

Specified by:
getSelectedObject in interface IlpObjectSelectionModel

getSelectedObjects

public Collection getSelectedObjects()
Returns the set of selected IlpObjects. Returns an empty set if there is no selected object.

Specified by:
getSelectedObjects in interface IlpObjectSelectionModel
Returns:
An unmodifiable Collection of IlpObjects.

isObjectSelected

public boolean isObjectSelected(IlpObject object)
Returns true if the given IlpObject is selected, false otherwise.

Specified by:
isObjectSelected in interface IlpObjectSelectionModel
Parameters:
object - The object which may be selected.

addSelectionObject

public void addSelectionObject(IlpObject object)
Adds the given IlpObject to the selection. This has no effect if the given object is null.

Specified by:
addSelectionObject in interface IlpObjectSelectionModel
Parameters:
object - The object that will be added to the selection.

removeSelectionObject

public void removeSelectionObject(IlpObject object)
Removes the given IlpObject from the selection. This has no effect if the given object is null.

Specified by:
removeSelectionObject in interface IlpObjectSelectionModel
Parameters:
object - The object that will be removed from the selection.

setSelectedObject

public void setSelectedObject(IlpObject object)
Sets the selected IlpObject. This has no effect if the given object is already selected.

Specified by:
setSelectedObject in interface IlpObjectSelectionModel
Parameters:
object - The object that will become the selection.
Since:
JTGO 4.0

setSelectedObjects

public void setSelectedObjects(Collection objects)
Sets the set of selected IlpObjects.

Specified by:
setSelectedObjects in interface IlpObjectSelectionModel
Parameters:
objects - The collection of objects that will become the selection.
Since:
JTGO 4.0

clearSelection

public void clearSelection()
Clears the selection.

Specified by:
clearSelection in interface IlpObjectSelectionModel

setSelectionModel

public void setSelectionModel(TreeSelectionModel selectionModel)
Sets a new selection model on the component.

Parameters:
selectionModel - The new selection model.

getSelectionModel

pub