com.ptc.wvs.client.pview
Class PViewToolBar

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JToolBar
                  extended bycom.ptc.wvs.client.pview.PViewToolBar
All Implemented Interfaces:
Accessible, ActionListener, EventListener, ImageObserver, MenuContainer, MouseListener, Serializable, SwingConstants

public class PViewToolBar
extends JToolBar
implements MouseListener, ActionListener

This acts as a convienent way implementing the buttons which surround the viewer These buttons replicate those used by the HTML PVLite viewer. Typically there are 2 toolbars to PVLite. The one at the top, the Model toolbar, and the one at the bottom, the Measurement toolbar. This class can be used to create a toolbar of a specific type. If the two are created and reference, then they will have to same behavior as displayed by PVLite. This class will re-use the text for tooltips that is used by HTML PVLite.



Supported API: false

Extendable: false

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JToolBar
JToolBar.AccessibleJToolBar, JToolBar.Separator
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  JButton[] buttons
           
private static int CLEAR_MEASUREMENT
           
private  URL codebase
           
private static int DIMENSION_MEASUREMENT
           
private static int DISPLAY_HLR
           
private static int DISPLAY_SHADED
           
private static int DISPLAY_WIREFRAME
           
private static int DISTANCE_MEASUREMENT
           
private static int FEATURE_SELECT_MODE
           
private static int HIDE_SELECTED
           
static int MEASUREMENT
          Measurement toolbar
private  PViewToolBar measurementBar
           
static int MODEL
          Model toolbar
private static int PROJECTION_ABS
           
private static int PROJECTION_USR
           
private static int PROJECTION_X
           
private static int PROJECTION_Y
           
private static int PROJECTION_Z
           
private static String PVIEW_DIR
           
private  Vector pviewPanels
           
private static String RESOURCE
           
private static int RESTORE_POSITION
           
private static int SELECT_MODE
           
private static int SELECT_SPIN_CENTER
           
private static int SHOW_ALL
           
private static int SHOW_SELECTED
           
private static int SNAP_TO_CENTER
           
private static int SNAP_TO_COMPONENT
           
private static int SNAP_TO_EDGECURVE
           
private static int SNAP_TO_MIDEND
           
private static int SNAP_TO_SURFACE
           
private static int TOGGLE_COMPONENT_ROTATE
           
private  String[] toolTips
           
private  int type
           
private  boolean usedBySwing
           
private static int ZOOM_ALL
           
private static int ZOOM_SELECTED
           
private static int ZOOM_WINDOW
           
 
Fields inherited from class javax.swing.JToolBar
 
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.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PViewToolBar(PViewPanel pviewPanel, URL codebase, Locale locale, int type, boolean usedBySwing)
          Creates the toolbar
PViewToolBar(Vector pviewPanels, URL codebase, Locale locale, int type, boolean usedBySwing)
          Creates the toolbar
 
Method Summary
 void actionPerformed(ActionEvent e)
          processes the button actions
private  JButton but(String name, String icon)
          Creates a button with icon and tooltip
private  ImageIcon getImageIconFromPViewDir(String gif)
          Returns the icon for the button
 PViewToolBar getMeasurementBar()
          Returns the associated MEASUREMENT toolbar
static Vector getVector(PViewPanel pviewPanel)
           
 void mouseClicked(MouseEvent e)
          Not used
 void mouseEntered(MouseEvent e)
          Displays the tooltip in the Status bar
 void mouseExited(MouseEvent e)
          Resets the Status Bar
 void mousePressed(MouseEvent e)
          Not used
 void mouseReleased(MouseEvent e)
          Not used
 void projectionButtons(boolean viewState)
          Sets the view state on the measurement buttons related to projection
 void setMeasurementBar(PViewToolBar measurementBar)
          Applicable to a toolbar of type MODEL.
 void snapButtons(boolean viewState)
          Sets the view state on the measurement buttons related to snap mode
 
Methods inherited from class javax.swing.JToolBar
add, addImpl, addSeparator, addSeparator, createActionChangeListener, createActionComponent, getAccessibleContext, getComponentAtIndex, getComponentIndex, getMargin, getOrientation, getUI, getUIClassID, isBorderPainted, isFloatable, isRollover, paintBorder, paramString, setBorderPainted, setFloatable, setLayout, setMargin, setOrientation, setRollover, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 

Field Detail

RESOURCE

private static String RESOURCE

PVIEW_DIR

private static String PVIEW_DIR

codebase

private URL codebase

SELECT_MODE

private static int SELECT_MODE

FEATURE_SELECT_MODE

private static int FEATURE_SELECT_MODE

SELECT_SPIN_CENTER

private static int SELECT_SPIN_CENTER

ZOOM_WINDOW

private static int ZOOM_WINDOW

ZOOM_ALL

private static int ZOOM_ALL

ZOOM_SELECTED

private static int ZOOM_SELECTED

HIDE_SELECTED

private static int HIDE_SELECTED

SHOW_SELECTED

private static int SHOW_SELECTED

SHOW_ALL

private static int SHOW_ALL

RESTORE_POSITION

private static int RESTORE_POSITION

DISPLAY_SHADED

private static int DISPLAY_SHADED

DISPLAY_HLR

private static int DISPLAY_HLR

DISPLAY_WIREFRAME

private static int DISPLAY_WIREFRAME

TOGGLE_COMPONENT_ROTATE

private static int TOGGLE_COMPONENT_ROTATE

DIMENSION_MEASUREMENT

private static int DIMENSION_MEASUREMENT

DISTANCE_MEASUREMENT

private static int DISTANCE_MEASUREMENT

CLEAR_MEASUREMENT

private static int CLEAR_MEASUREMENT

PROJECTION_ABS

private static int PROJECTION_ABS

PROJECTION_X

private static int PROJECTION_X

PROJECTION_Y

private static int PROJECTION_Y

PROJECTION_Z

private static int PROJECTION_Z

PROJECTION_USR

private static int PROJECTION_USR

SNAP_TO_MIDEND

private static int SNAP_TO_MIDEND

SNAP_TO_CENTER

private static int SNAP_TO_CENTER

SNAP_TO_EDGECURVE

private static int SNAP_TO_EDGECURVE

SNAP_TO_SURFACE

private static int SNAP_TO_SURFACE

SNAP_TO_COMPONENT

private static int SNAP_TO_COMPONENT

pviewPanels

private Vector pviewPanels

buttons

private JButton[] buttons

toolTips

private String[] toolTips

type

private int type

usedBySwing

private boolean usedBySwing

measurementBar

private PViewToolBar measurementBar

MODEL

public static int MODEL
Model toolbar


MEASUREMENT

public static int MEASUREMENT
Measurement toolbar

Constructor Detail

PViewToolBar

public PViewToolBar(PViewPanel pviewPanel,
                    URL codebase,
                    Locale locale,
                    int type,
                    boolean usedBySwing)
Creates the toolbar

Parameters:
pviewPanel - the panel that the toolbar is to operate
codebase - URL to the codebase
locale - the current locale
type - the type of toolbar eg MODEL or MEASUREMENT
usedBySwing - if true, toolbar can float, and tooltips will be displayed on the buttons

PViewToolBar

public PViewToolBar(Vector pviewPanels,
                    URL codebase,
                    Locale locale,
                    int type,
                    boolean usedBySwing)
Creates the toolbar

Parameters:
pviewPanels - a Vector of PViewPanels that the toolbar is to controll
codebase - URL to the codebase
locale - the current locale
type - the type of toolbar eg MODEL or MEASUREMENT
usedBySwing - if true, toolbar can float, and tooltips will be displayed on the buttons
Method Detail

getVector

public static Vector getVector(PViewPanel pviewPanel)

setMeasurementBar

public void setMeasurementBar(PViewToolBar measurementBar)
Applicable to a toolbar of type MODEL. Sets the associated MEASUREMENT toolbar

Parameters:
measurementBar - the measurement toolbar

getMeasurementBar

public PViewToolBar getMeasurementBar()
Returns the associated MEASUREMENT toolbar

Returns:
measurement toolbar

projectionButtons

public void projectionButtons(boolean viewState)
Sets the view state on the measurement buttons related to projection

Parameters:
viewState - used to specify the visibility of the projection buttons

snapButtons

public void snapButtons(boolean viewState)
Sets the view state on the measurement buttons related to snap mode

Parameters:
viewState - used to specify the visibility of the snap mode buttons

but

private JButton but(String name,
                    String icon)
Creates a button with icon and tooltip

Parameters:
name - the tooltip on the button
icon - the icon to be displayed on the button referenced as a gif

getImageIconFromPViewDir

private ImageIcon getImageIconFromPViewDir(String gif)
Returns the icon for the button

Parameters:
gif - the icon to be displayed on the button

mouseEntered

public void mouseEntered(MouseEvent e)
Displays the tooltip in the Status bar

Specified by:
mouseEntered in interface MouseListener
Parameters:
e - the event

mouseExited

public void mouseExited(MouseEvent e)
Resets the Status Bar

Specified by:
mouseExited in interface MouseListener
Parameters:
e - the event

mouseReleased

public void mouseReleased(MouseEvent e)
Not used

Specified by:
mouseReleased in interface MouseListener
Parameters:
e - the event

mouseClicked

public void mouseClicked(MouseEvent e)
Not used

Specified by:
mouseClicked in interface MouseListener
Parameters:
e - the event

mousePressed

public void mousePressed(MouseEvent e)
Not used

Specified by:
mousePressed in interface MouseListener
Parameters:
e - the event

actionPerformed

public void actionPerformed(ActionEvent e)
processes the button actions

Specified by:
actionPerformed in interface ActionListener
Parameters:
e - the event