com.sun.electric.tool.user.ui
Class ToolBar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JToolBar
                  extended by com.sun.electric.tool.user.ui.ToolBar
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.SwingConstants

public class ToolBar
extends javax.swing.JToolBar

This class manages the Electric toolbar.

See Also:
Serialized Form

Nested Class Summary
static class ToolBar.ArrowDistance
          ArrowDisatance is a typesafe enum class that describes the distance that arrow keys move (full, half, or quarter).
static class ToolBar.CursorMode
          CursorMode is a typesafe enum class that describes the current editing mode (select, zoom, etc).
static class ToolBar.EToolBarButton
          Generic tool bar button.
static class ToolBar.EToolBarGeneralMenuButton
          Generic tool bar radio button.
static class ToolBar.SelectMode
          SelectMode is a typesafe enum class that describes the current selection modes (objects or area).
static class ToolBar.SelectModeButton
           
 
Nested classes/interfaces inherited from class javax.swing.JToolBar
javax.swing.JToolBar.AccessibleJToolBar, javax.swing.JToolBar.Separator
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static ToolBar.EToolBarButton expandOneLevelCommand
           
static EMenu modesSubMenu
           
static ToolBar.EToolBarButton openLibraryCommand
           
static ToolBar.EToolBarButton preferencesCommand
           
static ToolBar.EToolBarButton redoCommand
           
static ToolBar.EToolBarButton saveLibraryCommand
           
static ToolBar.EToolBarButton undoCommand
           
static ToolBar.EToolBarButton unexpandOneLevelCommand
           
 
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 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
 
Method Summary
static ToolBar createToolBar()
          Method to create the toolbar.
 void finished()
          Call when done with this toolBar to release its resources
static java.util.List<ToolBar.EToolBarButton> getAllButtons()
          Method to return a list of all known toolbar buttons.
static java.util.Map<java.lang.String,java.lang.String> getCommandToIconMap()
          Method to return a mapping from command names to disk files with their icons.
static ToolBar.CursorMode getCursorMode()
          Method to tell which cursor mode is in effect.
static ToolBar.EToolBarButton[] getFactoryButtons()
          Method to return the "factory default" set of toolbar buttons.
static javax.swing.ImageIcon getProperSizeIcon(java.lang.String fileName)
          Method to convert an image file name into a proper-sized icon for the Toolbar.
static ToolBar.SelectMode getSelectMode()
          Method to tell what selection mode is in effect.
static ToolBar.EToolBarButton[] getToolbarButtons()
          Method to return all of the buttons in the toolbar.
static javax.swing.ImageIcon getUnknownIcon()
          Method to return the icon to use when no icon can be found.
static boolean isSelectSpecial()
          Returns state of "select special" button
static java.awt.Cursor readCursor(java.lang.String cursorName, int hotX, int hotY)
           
static void setCommandToIconMap(java.util.Map<java.lang.String,java.lang.String> newMap)
          Method to set a mapping from command names to disk files with their icons.
static void setGridAligment()
          Method to signal ToolBar that gridAlignment changed
static void setSaveLibraryButton()
           
static void setToolbarButtons(ToolBar.EToolBarButton[] buttons)
          Method to change the order of buttons in the toolbar.
 void updateCellHistoryStatus(boolean backEnabled, boolean forwardEnabled)
          Update CellHistory buttons on this ToolBar
static void updateToolBarButtons()
          Update associated ToolBarButtons on all toolbars und updatable menu items on all menubars
static void updateUndoRedoButtons(boolean undo, boolean redo)
           
 
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, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, 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, 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, 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, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

openLibraryCommand

public static final ToolBar.EToolBarButton openLibraryCommand

saveLibraryCommand

public static final ToolBar.EToolBarButton saveLibraryCommand

modesSubMenu

public static final EMenu modesSubMenu

preferencesCommand

public static final ToolBar.EToolBarButton preferencesCommand

expandOneLevelCommand

public static final ToolBar.EToolBarButton expandOneLevelCommand

unexpandOneLevelCommand

public static final ToolBar.EToolBarButton unexpandOneLevelCommand

undoCommand

public static final ToolBar.EToolBarButton undoCommand

redoCommand

public static final ToolBar.EToolBarButton redoCommand
Method Detail

createToolBar

public static ToolBar createToolBar()
Method to create the toolbar.


getFactoryButtons

public static ToolBar.EToolBarButton[] getFactoryButtons()
Method to return the "factory default" set of toolbar buttons.

Returns:
an array of default toolbar buttons.

getAllButtons

public static java.util.List<ToolBar.EToolBarButton> getAllButtons()
Method to return a list of all known toolbar buttons.

Returns:
a list of all known toolbar buttons.

getToolbarButtons

public static ToolBar.EToolBarButton[] getToolbarButtons()
Method to return all of the buttons in the toolbar.

Returns:
an array of buttons in the toolbar.

getUnknownIcon

public static javax.swing.ImageIcon getUnknownIcon()
Method to return the icon to use when no icon can be found.

Returns:
the default icon for the toolbar.

setToolbarButtons

public static void setToolbarButtons(ToolBar.EToolBarButton[] buttons)
Method to change the order of buttons in the toolbar. This affects the current toolbar and is also saved for future runs of Electric.

Parameters:
buttons - the new order of buttons in the toolbar.

getProperSizeIcon

public static javax.swing.ImageIcon getProperSizeIcon(java.lang.String fileName)
Method to convert an image file name into a proper-sized icon for the Toolbar.

Parameters:
fileName - the path to the image file.
Returns:
the toolbar icon (no more than 16 tall).

getCommandToIconMap

public static java.util.Map<java.lang.String,java.lang.String> getCommandToIconMap()
Method to return a mapping from command names to disk files with their icons.

Returns:
a mapping from command names to disk files with their icons.

setCommandToIconMap

public static void setCommandToIconMap(java.util.Map<java.lang.String,java.lang.String> newMap)
Method to set a mapping from command names to disk files with their icons.

Parameters:
newMap - a new mapping from command names to disk files with their icons.

setSaveLibraryButton

public static void setSaveLibraryButton()

readCursor

public static java.awt.Cursor readCursor(java.lang.String cursorName,
                                         int hotX,
                                         int hotY)

getCursorMode

public static ToolBar.CursorMode getCursorMode()
Method to tell which cursor mode is in effect.

Returns:
the current mode (select, pan, zoom, outline, measure).

setGridAligment

public static void setGridAligment()
Method to signal ToolBar that gridAlignment changed


getSelectMode

public static ToolBar.SelectMode getSelectMode()
Method to tell what selection mode is in effect.

Returns:
the current selection mode (objects or area).

isSelectSpecial

public static boolean isSelectSpecial()
Returns state of "select special" button

Returns:
true if select special button selected, false otherwise

updateUndoRedoButtons

public static void updateUndoRedoButtons(boolean undo,
                                         boolean redo)

updateCellHistoryStatus

public void updateCellHistoryStatus(boolean backEnabled,
                                    boolean forwardEnabled)
Update CellHistory buttons on this ToolBar

Parameters:
backEnabled - true to enable goBackButton.
forwardEnabled - true toenable goForwardButton.

updateToolBarButtons

public static void updateToolBarButtons()
Update associated ToolBarButtons on all toolbars und updatable menu items on all menubars


finished

public void finished()
Call when done with this toolBar to release its resources