com.tensegrity.gui.swing.control
Class ZoomComboBox

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JComboBox
                  extended bycom.tensegrity.gui.swing.control.ZoomComboBox
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, CompositeNavigator.ZoomValueListener, CompositeViewListener, DocumentListener, java.util.EventListener, EventListenerTag, java.awt.image.ImageObserver, java.awt.ItemSelectable, javax.swing.event.ListDataListener, java.awt.MenuContainer, java.io.Serializable

public class ZoomComboBox
extends javax.swing.JComboBox
implements CompositeNavigator.ZoomValueListener, DocumentListener, CompositeViewListener

The ComboBox implementation for Zoom values. Such a ComboBox allows a quick select of a predefined ZoomValue and apply it to the current document. Beside that users are allowed to add their custom Zoom value which must be in a predefined range between 1 and 400.

Version:
$Id: ZoomComboBox.java,v 1.16 2006/03/23 11:17:08 MichaelKegel Exp $
Author:
GillesIachelini
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComboBox
javax.swing.JComboBox.AccessibleJComboBox, javax.swing.JComboBox.KeySelectionManager
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String suffix
          the suffix to display
 
Fields inherited from class javax.swing.JComboBox
actionCommand, dataModel, editor, isEditable, keySelectionManager, lightWeightPopupEnabled, maximumRowCount, renderer, selectedItemReminder
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ZoomComboBox()
          Deprecated. This constructor doesn't make much sense, since this combo must reflect document states and such.
ZoomComboBox(ApplicationFrame application)
          Creates the ZoomActionComboBox.
 
Method Summary
 void documentAdded(DocumentEvent documentevent)
          Invoked after a document was added to the mdicomponent.
 void documentModelChanged(DocumentEvent documentevent)
          Invoked after a document's model has changed.
 void documentPreAdd(DocumentEvent documentevent)
          Invoked when a document is about to be added to a mdicomponent.
 void documentPreRemove(DocumentEvent documentevent)
          Invoked when a document is about to be removed from a mdicomponent.
 void documentRemoved(DocumentEvent documentevent)
          Invoked after a document was removed from the mdicomponent.
 void documentSelected(DocumentEvent documentevent)
          Invoked after a document was selected in the mdicomponent.
 void documentUnselected(DocumentEvent documentevent)
          Invoked after a document was unselected in the mdicomponent.
 java.awt.Dimension getMaximumSize()
          Returns getPreferredSize.
 java.awt.Dimension getPreferredSize()
          Returns a constant size.
 boolean isAdjusting()
          Returns true, if the combo box value is adjusted to the current view values, which means the combo box is not the source of the view change
 boolean isEnabled()
           
 boolean isFocusTraversable()
           
 void requestFocus()
           
 void setBorder(javax.swing.border.Border border)
          We override this method, because swing handles borders for ComboBox in a very annoying way.
 void viewAddedComposite(ViewAddCompositeEvent event)
          Called whenever a Composite was added.
 void viewAddedComposites(ViewAddCompositesEvent event)
          Called whenever multiple Composites are added.
 void viewCompositeOrderChanged(ViewCompositeOrderChangeEvent event)
          Called whenever the internal order of BaseComposite objects changes.
 void viewModeChanged(ViewModeChangeEvent event)
          Called whenever the mode of the CompositeView changed.
 void viewParameterChanged(ViewParameterChangeEvent event)
          Called whenever a parameter of the view changed.
 void viewRemovedComposite(ViewRemoveCompositeEvent event)
          Called whenever a Composite was removed.
 void viewRemovedComposites(ViewRemoveCompositesEvent event)
          Called whenever multiple Composites were remmoved.
 void viewScrolled(ViewScrolledEvent event)
          Called if the view position is changed during an action.
 void viewSelectionChanged(ViewSelectionChangeEvent event)
          Called whenever the selection of the view changed.
 void zoomValueChanged(double factor)
          The method zoomValueChanged should be invoked, if the zoom value of the represented view of this navigator has changed.
 
Methods inherited from class javax.swing.JComboBox
actionPerformed, addActionListener, addItem, addItemListener, addPopupMenuListener, configureEditor, configurePropertiesFromAction, contentsChanged, createActionPropertyChangeListener, createDefaultKeySelectionManager, fireActionEvent, fireItemStateChanged, firePopupMenuCanceled, firePopupMenuWillBecomeInvisible, firePopupMenuWillBecomeVisible, getAccessibleContext, getAction, getActionCommand, getActionListeners, getEditor, getItemAt, getItemCount, getItemListeners, getKeySelectionManager, getMaximumRowCount, getModel, getPopupMenuListeners, getPrototypeDisplayValue, getRenderer, getSelectedIndex, getSelectedItem, getSelectedObjects, getUI, getUIClassID, hidePopup, insertItemAt, installAncestorListener, intervalAdded, intervalRemoved, isEditable, isLightWeightPopupEnabled, isPopupVisible, paramString, processKeyEvent, removeActionListener, removeAllItems, removeItem, removeItemAt, removeItemListener, removePopupMenuListener, selectedItemChanged, selectWithKeyChar, setAction, setActionCommand, setEditable, setEditor, setEnabled, setKeySelectionManager, setLightWeightPopupEnabled, setMaximumRowCount, setModel, setPopupVisible, setPrototypeDisplayValue, setRenderer, setSelectedIndex, setSelectedItem, setUI, showPopup, 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, getMinimumSize, getNextFocusableComponent, 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, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, 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, addImpl, 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, 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, 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, isFocusable, isFocusOwner, 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

suffix

public static final java.lang.String suffix
the suffix to display

See Also:
Constant Field Values
Constructor Detail

ZoomComboBox

public ZoomComboBox()
Deprecated. This constructor doesn't make much sense, since this combo must reflect document states and such.

Creates the ZoomActionComboBox. It removes any existing border and sets a ZoomComboEditor as editor.


ZoomComboBox

public ZoomComboBox(ApplicationFrame application)
Creates the ZoomActionComboBox. It removes any existing border and sets a ZoomComboEditor as editor. The ApplicationFrame is used to add this ComboBox as DocumentListener. Each time a document is selected this ComboBox adds itself as listener to retrieve ViewParameterChangeEvent's. Whenever such an event is fired, the value of the ComboBox is updated (if necessary).

Parameters:
application - the enclosing ApplicationFrame, required to add this Combo ass combo respectively CompositeViewListener.
Method Detail

requestFocus

public void requestFocus()

isFocusTraversable

public boolean isFocusTraversable()

setBorder

public void setBorder(javax.swing.border.Border border)
We override this method, because swing handles borders for ComboBox in a very annoying way. Each time a LookAndFeel is set, the border is overwritten no matter what user decided already. Therefore we ignore all border except our own.

See Also:
JComponent.setBorder(javax.swing.border.Border)

getMaximumSize

public java.awt.Dimension getMaximumSize()
Returns getPreferredSize.

See Also:
Component.getMaximumSize()

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns a constant size.

See Also:
Component.getPreferredSize()

zoomValueChanged

public void zoomValueChanged(double factor)
Description copied from interface: CompositeNavigator.ZoomValueListener
The method zoomValueChanged should be invoked, if the zoom value of the represented view of this navigator has changed.

Specified by:
zoomValueChanged in interface CompositeNavigator.ZoomValueListener
Parameters:
factor - the factor by which the zoomValue has been changed.

documentSelected

public void documentSelected(DocumentEvent documentevent)
Description copied from interface: DocumentListener
Invoked after a document was selected in the mdicomponent.

Specified by:
documentSelected in interface DocumentListener
Parameters:
documentevent - the documentevent structure carrying information.

documentUnselected

public void documentUnselected(DocumentEvent documentevent)
Description copied from interface: DocumentListener
Invoked after a document was unselected in the mdicomponent.

Specified by:
documentUnselected in interface DocumentListener
Parameters:
documentevent - the documentevent structure carrying information.

documentPreAdd

public void documentPreAdd(DocumentEvent documentevent)
Description copied from interface: DocumentListener
Invoked when a document is about to be added to a mdicomponent. If the implementor throws the declared exception then the documentevent will be veto'd and the corresponding action will not be commence.

Specified by:
documentPreAdd in interface DocumentListener
Parameters:
documentevent - the documentevent structure carrying information.

documentPreRemove

public void documentPreRemove(DocumentEvent documentevent)
Description copied from interface: DocumentListener
Invoked when a document is about to be removed from a mdicomponent. If the implementor throws the declared exception then the documentevent will be veto'd and the corresponding action will not be commence.

Specified by:
documentPreRemove in interface DocumentListener
Parameters:
documentevent - the documentevent structure carrying information.

documentAdded

public void documentAdded(DocumentEvent documentevent)
Description copied from interface: DocumentListener
Invoked after a document was added to the mdicomponent.

Specified by:
documentAdded in interface DocumentListener
Parameters:
documentevent - the documentevent structure carrying information.

documentRemoved

public void documentRemoved(DocumentEvent documentevent)
Description copied from interface: DocumentListener
Invoked after a document was removed from the mdicomponent.

Specified by:
documentRemoved in interface DocumentListener
Parameters:
documentevent - the documentevent structure carrying information.

documentModelChanged

public void documentModelChanged(DocumentEvent documentevent)
Description copied from interface: DocumentListener
Invoked after a document's model has changed. This means the data behind the document has changed subtantially and needs to be rehashed.

Specified by:
documentModelChanged in interface DocumentListener
Parameters:
documentevent - the documentevent structure carrying information.

viewAddedComposite

public void viewAddedComposite(ViewAddCompositeEvent event)
Description copied from interface: CompositeViewListener
Called whenever a Composite was added.

Specified by:
viewAddedComposite in interface CompositeViewListener
Parameters:
event - the corresponding event.

viewAddedComposites

public void viewAddedComposites(ViewAddCompositesEvent event)
Description copied from interface: CompositeViewListener
Called whenever multiple Composites are added.

Specified by:
viewAddedComposites in interface CompositeViewListener
Parameters:
event - the corresponding event.

viewRemovedComposite

public void viewRemovedComposite(ViewRemoveCompositeEvent event)
Description copied from interface: CompositeViewListener
Called whenever a Composite was removed.

Specified by:
viewRemovedComposite in interface CompositeViewListener
Parameters:
event - the corresponding event.

viewRemovedComposites

public void viewRemovedComposites(ViewRemoveCompositesEvent event)
Description copied from interface: CompositeViewListener
Called whenever multiple Composites were remmoved.

Specified by:
viewRemovedComposites in interface CompositeViewListener
Parameters:
event - the corresponding event.

viewCompositeOrderChanged

public void viewCompositeOrderChanged(ViewCompositeOrderChangeEvent event)
Description copied from interface: CompositeViewListener
Called whenever the internal order of BaseComposite objects changes.

Specified by:
viewCompositeOrderChanged in interface CompositeViewListener
Parameters:
event - the corresponding ViewCompositeOrderChangeEvent event.

viewSelectionChanged

public void viewSelectionChanged(ViewSelectionChangeEvent event)
Description copied from interface: CompositeViewListener
Called whenever the selection of the view changed.

Specified by:
viewSelectionChanged in interface CompositeViewListener
Parameters:
event - the corresponding ViewSelectionChangeEvent event.

viewModeChanged

public void viewModeChanged(ViewModeChangeEvent event)
Description copied from interface: CompositeViewListener
Called whenever the mode of the CompositeView changed.

Specified by:
viewModeChanged in interface CompositeViewListener
Parameters:
event - the corresponding ViewModeChangeEvent event.

viewParameterChanged

public void viewParameterChanged(ViewParameterChangeEvent event)
Description copied from interface: CompositeViewListener
Called whenever a parameter of the view changed.

Specified by:
viewParameterChanged in interface CompositeViewListener
Parameters:
event - the corresponding ViewParameterChangeEvent event.

isEnabled

public boolean isEnabled()

viewScrolled

public void viewScrolled(ViewScrolledEvent event)
Description copied from interface: CompositeViewListener
Called if the view position is changed during an action.

Specified by:
viewScrolled in interface CompositeViewListener
Parameters:
event - the corresponding ViewScrollingEvent event.

isAdjusting

public boolean isAdjusting()
Returns true, if the combo box value is adjusted to the current view values, which means the combo box is not the source of the view change

Returns:
true, if the combo box value is adjusted to the current view values, which means the combo box is not the source of the view change


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.