VRJConfig UI API
v2.0


org.vrjuggler.vrjconfig.commoneditors
Class DeviceProxyGraphEditor

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.vrjuggler.vrjconfig.commoneditors.DeviceProxyGraphEditor
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ConfigListener, EditorConstants

public class DeviceProxyGraphEditor
extends JPanel
implements EditorConstants, ConfigListener

This editor handles all the details of setting up a org.vrjuggler.vrjconfig.commoneditors.DeviceGraph that instance based on a given configuration. The graph is populated by invoking the setConfig() method exactly once.

This editor can create a graph that allows the relationships between all proxies, aliases, and devices to be edited, or it can create a graph with a specific subset of all possible proxies and devices. This editor has no user interface of its own. The contained DeviceGraph instance provdies the interface for editing the device/proxy/alias relationships, but no additional buttons and such are provided. It is expected that higher level editors would provide that part of the user interface.

See Also:
setConfig(ConfigContext,ConfigElement), Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
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 org.vrjuggler.vrjconfig.commoneditors.EditorConstants
ACCUM_ALPHA_SIZE_PROPERTY, ACCUM_BLUE_SIZE_PROPERTY, ACCUM_GREEN_SIZE_PROPERTY, ACCUM_RED_SIZE_PROPERTY, ACTIVE_PROPERTY, ALIAS_TYPE, ANALOG_COUNT_PROPERTY, ANALOG_DEVICE_TYPE, ANALOG_FIRST_PROPERTY, ANALOG_PROXY_TYPE, AUX_BUFFER_COUNT_PROPERTY, BACK_VALUE_INDEX, BASE_FRAME_PROXY_PROPERTY, BORDER_PROPERTY, BUTTON_COUNT_PROPERTY, CAMERA_POS_PROPERTY, CLUSTER_NODE_TYPE, COLOR_ALPHA_SIZE_PROPERTY, COLOR_BLUE_SIZE_PROPERTY, COLOR_GREEN_SIZE_PROPERTY, COLOR_RED_SIZE_PROPERTY, COMMAND_DEVICE_TYPE, COMMON_IMG_ROOT, CUSTOM_SCALE_PROPERTY, DATA_GLOVE_TYPE, DECREMENT_KEYPRESS_PROPERTY, DEFAULT_SIMULATOR_TYPE, DEPTH_BUFFER_SIZE_PROPERTY, DEVICE_PROPERTY, DEVICE_UNITS_PROPERTY, DIGITAL_COUNT_PROPERTY, DIGITAL_DEVICE_TYPE, DIGITAL_FIRST_PROPERTY, DIGITAL_PROXY_TYPE, DIRECTX_JOYSTICK_TYPE, DISPLAY_WINDOW_TYPE, DISPLAY_WINDOWS_PROPERTY, DOWN_VALUE_INDEX, DTK_TYPE, FASTRAK_TYPE, FIRST_MOUSE_BUTTON, FLOCK_TYPE, FORWARD_VALUE_INDEX, FRAME_BUFFER_PROPERTY, FSAA_ENABLE_PROPERTY, GLOVE_DEVICE_TYPE, HEAD_POSITION_PROPERTY, HIDE_MOUSE_PROPERTY, IBOX_TYPE, INCREMENT_KEYPRESS_PROPERTY, INPUT_AREA_TYPE, INPUT_DEVICE_TYPE, INPUT_WINDOW_TYPE, INTEROCULAR_DISTANCE_PROPERTY, INTERSENSE_API_TYPE, INTERSENSE_STATION_TYPE, INTERSENSE_TYPE, KEY_0_INT_VALUE, KEY_0_STRING_VALUE, KEY_1_INT_VALUE, KEY_1_STRING_VALUE, KEY_2_INT_VALUE, KEY_2_STRING_VALUE, KEY_3_INT_VALUE, KEY_3_STRING_VALUE, KEY_4_INT_VALUE, KEY_4_STRING_VALUE, KEY_5_INT_VALUE, KEY_5_STRING_VALUE, KEY_6_INT_VALUE, KEY_6_STRING_VALUE, KEY_7_INT_VALUE, KEY_7_STRING_VALUE, KEY_8_INT_VALUE, KEY_8_STRING_VALUE, KEY_9_INT_VALUE, KEY_9_STRING_VALUE, KEY_A_INT_VALUE, KEY_A_STRING_VALUE, KEY_B_INT_VALUE, KEY_B_STRING_VALUE, KEY_C_INT_VALUE, KEY_C_STRING_VALUE, KEY_D_INT_VALUE, KEY_D_STRING_VALUE, KEY_DOWN_INT_VALUE, KEY_DOWN_STRING_VALUE, KEY_E_INT_VALUE, KEY_E_STRING_VALUE, KEY_ESC_INT_VALUE, KEY_ESC_STRING_VALUE, KEY_F_INT_VALUE, KEY_F_STRING_VALUE, KEY_G_INT_VALUE, KEY_G_STRING_VALUE, KEY_H_INT_VALUE, KEY_H_STRING_VALUE, KEY_I_INT_VALUE, KEY_I_STRING_VALUE, KEY_J_INT_VALUE, KEY_J_STRING_VALUE, KEY_K_INT_VALUE, KEY_K_STRING_VALUE, KEY_L_INT_VALUE, KEY_L_STRING_VALUE, KEY_LEFT_INT_VALUE, KEY_LEFT_STRING_VALUE, KEY_M_INT_VALUE, KEY_M_STRING_VALUE, KEY_MODIFIER_PAIR_TYPE, KEY_N_INT_VALUE, KEY_N_STRING_VALUE, KEY_NONE_INT_VALUE, KEY_NONE_STRING_VALUE, KEY_O_INT_VALUE, KEY_O_STRING_VALUE, KEY_P_INT_VALUE, KEY_P_STRING_VALUE, KEY_PAIR_PROPERTY, KEY_PROPERTY, KEY_Q_INT_VALUE, KEY_Q_STRING_VALUE, KEY_R_INT_VALUE, KEY_R_STRING_VALUE, KEY_RIGHT_INT_VALUE, KEY_RIGHT_STRING_VALUE, KEY_S_INT_VALUE, KEY_S_STRING_VALUE, KEY_T_INT_VALUE, KEY_T_STRING_VALUE, KEY_U_INT_VALUE, KEY_U_STRING_VALUE, KEY_UP_INT_VALUE, KEY_UP_STRING_VALUE, KEY_V_INT_VALUE, KEY_V_STRING_VALUE, KEY_W_INT_VALUE, KEY_W_STRING_VALUE, KEY_X_INT_VALUE, KEY_X_STRING_VALUE, KEY_Y_INT_VALUE, KEY_Y_STRING_VALUE, KEY_Z_INT_VALUE, KEY_Z_STRING_VALUE, KEYBOARD_MOUSE_DEVICE_TYPE, KEYBOARD_MOUSE_PROXY_PTR_PROPERTY, KEYBOARD_MOUSE_PROXY_TYPE, KEYBOARD_MOUSE_PTR_PROPERTY, LAST_MOUSE_BUTTON, LEFT_VALUE_INDEX, LINUX_JOYDEV_TYPE, LOCK_KEY_PROPERTY, LOWER_LEFT_CORNER_PROPERTY, LOWER_RIGHT_CORNER_PROPERTY, MODIFIER_KEY_PROPERTY, MODKEY_ALT_INT_VALUE, MODKEY_ALT_STRING_VALUE, MODKEY_ANY_INT_VALUE, MODKEY_ANY_STRING_VALUE, MODKEY_CTRL_INT_VALUE, MODKEY_CTRL_STRING_VALUE, MODKEY_NONE_INT_VALUE, MODKEY_NONE_STRING_VALUE, MODKEY_SHIFT_INT_VALUE, MODKEY_SHIFT_STRING_VALUE, MOTION_STAR_TYPE, MOUSE_BUT1_INT_VALUE, MOUSE_BUT1_STRING_VALUE, MOUSE_BUT2_INT_VALUE, MOUSE_BUT2_STRING_VALUE, MOUSE_BUT3_INT_VALUE, MOUSE_BUT3_STRING_VALUE, MOUSE_NEGX_INT_VALUE, MOUSE_NEGX_STRING_VALUE, MOUSE_NEGY_INT_VALUE, MOUSE_NEGY_STRING_VALUE, MOUSE_POSX_INT_VALUE, MOUSE_POSX_STRING_VALUE, MOUSE_POSY_INT_VALUE, MOUSE_POSY_STRING_VALUE, OPENGL_FRAME_BUFFER_TYPE, ORIGIN_PROPERTY, PINCH_GLOVE_TYPE, POSITION_FILTERS_PROPERTY, POSITION_PROXY_TYPE, POSITION_TRANSFORM_FILTER_TYPE, POSITIONAL_DEVICE_TYPE, POST_ROTATION_PROPERTY, POST_TRANSLATION_PROPERTY, PRE_ROTATION_PROPERTY, PRE_TRANSLATION_PROPERTY, PROXY_PROPERTY, PROXY_TYPE, PUCK_DEVICE_TYPE, RELATIVE_PROXY_PROPERTY, RIGHT_VALUE_INDEX, ROTATE_CLOCKWISE_VALUE_INDEX, ROTATE_COUNTER_CLOCKWISE_VALUE_INDEX, ROTATE_DOWN_VALUE_INDEX, ROTATE_LEFT_VALUE_INDEX, ROTATE_RIGHT_VALUE_INDEX, ROTATE_UP_VALUE_INDEX, SERIAL_ENCODER_TYPE, SIM_ANALOG_DEVICE_TYPE, SIM_DIGITAL_DEVICE_TYPE, SIM_POS_DEVICE_TYPE, SIM_RELATIVE_POS_DEVICE_TYPE, SIMULATOR_PLUGIN_PROPERTY, SIMULATOR_VIEWPORT_TYPE, SIMULATOR_VIEWPORTS_PROPERTY, SIZE_PROPERTY, SLEEP_TIME_PROPERTY, START_LOCKED_PROPERTY, STATIONS_PROPERTY, STENCIL_BUFFER_SIZE_PROPERTY, STEREO_PROPERTY, STRING_DEVICE_TYPE, SURFACE_VIEWPORT_TYPE, SURFACE_VIEWPORTS_PROPERTY, TRACKD_API_CONTROLLER_TYPE, TRACKD_API_SENSOR_TYPE, TRACKD_CONTROLLER_TYPE, TRACKD_SENSOR_TYPE, TRACKED_PROPERTY, TRACKER_COUNT_PROPERTY, TRACKER_PROXY_PROPERTY, UNIT_PROPERTY, UP_VALUE_INDEX, UPPER_LEFT_CORNER_PROPERTY, UPPER_RIGHT_CORNER_PROPERTY, USE_ANALOG_PROPERTY, USE_DIGITAL_PROPERTY, USER_PROPERTY, USER_TYPE, VERTICAL_FOV_PROPERTY, VIEW_PROPERTY, VISUAL_ID_PROPERTY, VRPN_TYPE, WAND_POS_PROPERTY
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DeviceProxyGraphEditor()
          Creates a new instance of the device/proxy graph editor that allows editing of all known types of device and proxy config elements.
DeviceProxyGraphEditor(List allowedTypes)
          Creates a new instance of the device/proxy graph editor that allows editing of only the given config element types.
 
Method Summary
 void applyGraphLayoutAlgorithm()
          Applies the current graph layout algorithm to all the roots of the graph.
 void applyGraphLayoutAlgorithm(Object[] cells)
          Applies the current graph layout algorithm to the given array of roots.
 boolean canConnect(Object cell0, Object cell1)
          Determines if the two given cells can be connected.
 void configElementAdded(ConfigEvent e)
          Handles the addition of a new config element by checking to see if it is among the allowed types for this editor instance.
 void configElementRemoved(ConfigEvent e)
          Does nothing.
 boolean connect(Object cell0, Object cell1)
          Connects the two given cells if they can be connected.
 boolean disconnect(Object cell0, Object cell1)
          Disconnects the two given cells.
 void editorClosing()
           
 List getAllowedTypes()
           
 DeviceGraph getGraph()
           
 org.jgraph.layout.JGraphLayoutAlgorithm getGraphLayoutAlgorithm()
          Returns the current graph layout algorithm to be used by this editor instance.
 boolean isConnected(Object cell0, Object cell1)
          Determines if the two given cells are connected.
 void setConfig(ConfigContext ctx, ConfigElement elt)
          Initializes the graph will the given config element (either a device or a proxy).
 void setGraphLayoutAlgorithm(org.jgraph.layout.JGraphLayoutAlgorithm algorithm)
          Changes the graph layout algorithm to be used by this editor instance to the given reference (which may be null).
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, 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, 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
 

Constructor Detail

DeviceProxyGraphEditor

public DeviceProxyGraphEditor()
Creates a new instance of the device/proxy graph editor that allows editing of all known types of device and proxy config elements.


DeviceProxyGraphEditor

public DeviceProxyGraphEditor(List allowedTypes)
Creates a new instance of the device/proxy graph editor that allows editing of only the given config element types. If allowedTypes is null, then the editor will allow editing of all known types of device and proxy config elements.

Parameters:
allowedTypes - a list of ConfigDefinition objects that identifies which types of device and proxy config elements will be edited by this editor instance or null to indicate that all device and proxy elements will be edited
Method Detail

configElementAdded

public void configElementAdded(ConfigEvent e)
Handles the addition of a new config element by checking to see if it is among the allowed types for this editor instance. If the new element is of an allowed type, it is added to the graph.

Specified by:
configElementAdded in interface ConfigListener

configElementRemoved

public void configElementRemoved(ConfigEvent e)
Does nothing.

Specified by:
configElementRemoved in interface ConfigListener

setConfig

public void setConfig(ConfigContext ctx,
                      ConfigElement elt)
Initializes the graph will the given config element (either a device or a proxy). If the config element is for a device proxy, all the devices at which it is allowed to point will be included with the graph. If the config element is for an input device, all the proxies pointing at it (of any type) will be included in the graph. If the given config element is null, then all allowed types of device and proxy config elements will be used to populate the graph.

NOTE:

This method may be invoked at most once per object lifetime.

Parameters:
ctx - the context containing the given config element and any devices to which that config element may refer
elt - the config element for an input device (its definition is of type EditorConstants.INPUT_DEVICE_TYPE), for a device proxy (its definition is of type EditorConstants.PROXY_TYPE), or null
See Also:
EditorConstants

editorClosing

public void editorClosing()

getGraph

public DeviceGraph getGraph()

getAllowedTypes

public List getAllowedTypes()

setGraphLayoutAlgorithm

public void setGraphLayoutAlgorithm(org.jgraph.layout.JGraphLayoutAlgorithm algorithm)
Changes the graph layout algorithm to be used by this editor instance to the given reference (which may be null). If the given algorithm reference is null, then subsequent invocations of applyGraphLayoutAlgorithm() will have no effect.

Parameters:
algorithm - the new layout algorithm to use

getGraphLayoutAlgorithm

public org.jgraph.layout.JGraphLayoutAlgorithm getGraphLayoutAlgorithm()
Returns the current graph layout algorithm to be used by this editor instance. The returned reference may be null.


applyGraphLayoutAlgorithm

public void applyGraphLayoutAlgorithm()
Applies the current graph layout algorithm to all the roots of the graph.

See Also:
applyGraphLayoutAlgorithm(Object[])

applyGraphLayoutAlgorithm

public void applyGraphLayoutAlgorithm(Object[] cells)
Applies the current graph layout algorithm to the given array of roots. If the current graph layout algorithm is null, this method does nothing. The given graph cells must be roots of the graph being used by this editor instance. Furthermore, the given graph cells are passed off to the graph layout algorithm as dynamic cells.

Parameters:
cells - the collection of roots in the graph that will be laid out using the current layout algorithm
See Also:
setGraphLayoutAlgorithm(JGraphLayoutAlgorithm)

canConnect

public boolean canConnect(Object cell0,
                          Object cell1)
Determines if the two given cells can be connected.


isConnected

public boolean isConnected(Object cell0,
                           Object cell1)
Determines if the two given cells are connected.

See Also:
DefaultGraphModel.containsEdgeBetween(org.jgraph.graph.GraphModel,Object,Object)

connect

public boolean connect(Object cell0,
                       Object cell1)
Connects the two given cells if they can be connected. For the connection to succeed, both cells must be instances of org.jgraph.graph.DefaultGraphCell, and one must be a graph cell for a proxy and the other a graph cell for a device. The determination about which cell is which is made by this method.

Parameters:
cell0 - the first cell
cell1 - the second cell
Returns:
true is returned if the connection succeeded; false otherwise
See Also:
GraphHelpers.connectPr