ilog.views.appframe.swing
Class IlvToolBar

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 ilog.views.appframe.swing.IlvToolBar
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants

public class IlvToolBar
extends JToolBar

Toolbar that initializes its buttons from the settings of an application.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JToolBar
JToolBar.AccessibleJToolBar, JToolBar.Separator
 
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
static String AUTO_HIDE_PROPERTY
          Bound property of the toolbar that specifies whether the visibility of the toolbar should be automatically updated when components are added or removed from the toolbar.
static String AUTO_RESIZE_PROPERTY
          Bound property of the toolbar that specifies whether the bounds of the toolbar should be automatically updated when it is added or removed components.
static String DEFAULT_TOOLBAR_NAME
          Default value of the "name"attribute of the settings element that provides the settings of the toolbar.
static String HIDE_BUTTON_TEXT
          Bound property of the toolbar that specifies that the text of buttons of the toolbar should not be displayed.
static String SELECTED_BORDER_PROPERTY
          Property that provides the border of a button when it is selected.
static String TOOLBAR_BUTTON_SETTINGS_TYPE
          The type of the root settings element that provides the settings of a button of a toolbar.
static String TOOLBAR_SETTINGS_TYPE
          The type of the root settings element that provides the settings of an IlvToolBar instance.
 
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
 
Constructor Summary
IlvToolBar()
          Constructs a new toolbar; the orientation defaults to HORIZONTAL.
IlvToolBar(int orientation)
          Creates a new toolbar with the specified orientation.
IlvToolBar(String name, int orientation)
          Creates a new toolbar with a specified name and orientation.
 
Method Summary
static JButton AddActionButton(Action action, Container container, int index, IlvApplication application)
          Adds a new button to the specified container at the specified index.
protected  void addImpl(Component component, Object constraints, int index)
          If a JButton is being added, it is set a mouse listener that controls double-click events.
static JSeparator AddSeparator(Container container, int index)
          Adds a new separator within the specified container.
 IlvApplication getApplication()
          Returns the application of the toolbar.
 Insets getButtonInsets()
          Gets the insets of a button created within this toolbar.
 Border getDefaultButtonBorder()
          Gets the border used for creating buttons inserted in this toolbar.
 Dimension getDefaultIconButtonSize()
          Gets the default size of buttons created in this toolbar and displays just icons.
 Dimension getDefaultSeparatorSize()
          Gets the default size of separators created in this toolbar.
 int getIconsSize()
          Returns the size of icons of the toolbar.
 IlvSettings getSettings()
          Returns the settings that the toolbar used to read its content.
 IlvSettingsElement getSettingsElement()
          Returns the settings element that provides the settings for this toolbar.
 String getSettingsName()
          Gets the name that identifies the bar within the settings.
 IlvSettingsQuery getSettingsQuery()
          Returns the query that selects the settings element that defines the content of this toolbar.
 Dimension getSize()
          
 String getUIClassID()
          Returns the name of the L&F class that renders this component.
 String getUndockedTitle()
          Returns the undocked title of the toolbar.
 boolean isAutoHide()
          Determines whether the toolbar is automatically hidden after it has been removed all its child components.
 boolean isAutoResize()
          Determines whether the bounds of the toolbar are automatically updated after the toolbar is added or removed child components.
 void setApplication(IlvApplication application)
          Sets the application of the toolbar.
 void setAutoHide(boolean autoHide)
          Specifies whether the toolbar is automatically hidden after it is removed all its child components.
 void setAutoResize(boolean autoResize)
          Specifies whether the bounds of toolbar should be automatically updated after the toolbar is added or removed child components.
 void setBounds(int x, int y, int width, int height)
          
 void setBounds(Rectangle r)
          
 void setButtonInsets(Insets insets)
          Sets default button insets.
static void SetButtonProperties(IlvToolBar toolbar, AbstractButton button, Action action)
          Sets the default button properties, like the border defined for the specified toolbar, to the specified button.
 void setIconsSize(int iconsSize)
          Sets the size of icons of the toolbar.
 void setSettings(IlvSettings settings)
          Sets the settings that the toolbar uses to read its content.
 void setSettingsElement(IlvSettingsElement element)
          Forces the settings of the toolbar to be read and written from the specified settings element.
 void setSettingsName(String name)
          Sets the name that identifies the toolbar within the settings of the toolbar, set by invoking the method setSettings(ilog.views.appframe.settings.IlvSettings)
 void setSettingsQuery(IlvSettingsQuery query)
          Sets the query that selects the settings element that defines the content of this toolbar.
 void setSize(Dimension d)
          
 void setSize(int width, int height)
          
 void setUndockedTitle(String undockedTitle)
          Sets the undocked title of the toolbar.
 void setVisible(boolean aFlag)
          Makes the component visible or invisible.
 
Methods inherited from class javax.swing.JToolBar
add, addSeparator, addSeparator, createActionChangeListener, createActionComponent, getAccessibleContext, getComponentAtIndex, getComponentIndex, getMargin, getOrientation, getUI, 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, 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, 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, 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, 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, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, 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

DEFAULT_TOOLBAR_NAME

public static final String DEFAULT_TOOLBAR_NAME
Default value of the "name"attribute of the settings element that provides the settings of the toolbar.

See Also:
Constant Field Values

HIDE_BUTTON_TEXT

public static String HIDE_BUTTON_TEXT
Bound property of the toolbar that specifies that the text of buttons of the toolbar should not be displayed.


TOOLBAR_SETTINGS_TYPE

public static final String TOOLBAR_SETTINGS_TYPE
The type of the root settings element that provides the settings of an IlvToolBar instance.

See Also:
Constant Field Values

TOOLBAR_BUTTON_SETTINGS_TYPE

public static final String TOOLBAR_BUTTON_SETTINGS_TYPE
The type of the root settings element that provides the settings of a button of a toolbar.

See Also:
Constant Field Values

SELECTED_BORDER_PROPERTY

public static final String SELECTED_BORDER_PROPERTY
Property that provides the border of a button when it is selected.

See Also:
Constant Field Values

AUTO_RESIZE_PROPERTY

public static final String AUTO_RESIZE_PROPERTY
Bound property of the toolbar that specifies whether the bounds of the toolbar should be automatically updated when it is added or removed components. For example, this can happen when adding or removing settings from the application that participate in the definition of the toolbar.

If the value of the property equals Boolean.TRUE, the size of the toolbar is automatically updated to take into account components that are added or removed from the toolbar. This mechanism is not activated while the toolbar is being initialized from the settings.
If the value of the property does not equal Boolean.TRUE, the bounds of the toolbar remain unchanged whenever components are added or removed.

By default, an IlvToolBar is not automatically resizable.

Since:
JViews 6.0
See Also:
setAutoResize(boolean), isAutoResize(), Constant Field Values

AUTO_HIDE_PROPERTY

public static final String AUTO_HIDE_PROPERTY
Bound property of the toolbar that specifies whether the visibility of the toolbar should be automatically updated when components are added or removed from the toolbar.

If the value of the property equals Boolean.TRUE, the toolbar is automatically hidden if it does not contain any child components. It is also automatically shown when new components are added and that the bar was previously hidden by this mechanism.
If the value of the property does not equal Boolean.TRUE, the visibility of the toolbar stays unchanged whenever it becomes empty.

By default, the toolbar the automatic hiding property of the toolbar is set to Boolean.TRUE.

Since:
JViews 6.0
See Also:
setAutoHide(boolean), isAutoHide(), Constant Field Values
Constructor Detail

IlvToolBar

public IlvToolBar()
Constructs a new toolbar; the orientation defaults to HORIZONTAL.


IlvToolBar

public IlvToolBar(int orientation)
Creates a new toolbar with the specified orientation. The orientation must be either HORIZONTAL or VERTICAL.

Parameters:
orientation - The desired orientation.

IlvToolBar

public IlvToolBar(String name,
                  int orientation)
Creates a new toolbar with a specified name and orientation. If orientation is an invalid value, an exception will be thrown.

Parameters:
name - The name of the toolbar.
orientation - The initial orientation. It must be one of these values:
  • HORIZONTAL
  • VERTICAL
Throws:
IllegalArgumentException - if orientation is neither HORIZONTAL nor VERTICAL
Method Detail

getUIClassID

public String getUIClassID()
Returns the name of the L&F class that renders this component.

Overrides:
getUIClassID in class JToolBar
Returns:
the string "ToolBarUI"
See Also:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

getApplication

public IlvApplication getApplication()
Returns the application of the toolbar.

See Also:
setApplication(ilog.views.appframe.IlvApplication)

setApplication

public void setApplication(IlvApplication application)
Sets the application of the toolbar.

Parameters:
application - The new application of the toolbar.
See Also:
getApplication()

getSettings

public IlvSettings getSettings()
Returns the settings that the toolbar used to read its content.


setSettings

public void setSettings(IlvSettings settings)
Sets the settings that the toolbar uses to read its content.

Parameters:
settings - The new settings of the toolbar.

getSettingsName

public String getSettingsName()
Gets the name that identifies the bar within the settings. If no name was specified using the method setSettingsName(java.lang.String), the name of the default menu bar defined in the Application Framework settings will be returned.

Returns:
The settings name of the menu bar.

setSettingsName

public void setSettingsName(String name)
Sets the name that identifies the toolbar within the settings of the toolbar, set by invoking the method setSettings(ilog.views.appframe.settings.IlvSettings)

Parameters:
name - The new settings name of the toolbar.

setButtonInsets

public void setButtonInsets(Insets insets)
Sets default button insets.

Parameters:
insets - The new button insets.

getButtonInsets

public Insets getButtonInsets()
Gets the insets of a button created within this toolbar.


getIconsSize

public int getIconsSize()
Returns the size of icons of the toolbar.

Returns:
The size of icons of the toolbar. It can have one of these values:
  • IlvAction.SMALL_ICONS for 16x16 icons.
  • IlvAction.BIG_ICONS for 32x32 icons.
.

setIconsSize

public void setIconsSize(int iconsSize)
Sets the size of icons of the toolbar.

Parameters:
iconsSize - the new size of icons of the toolbar.
See Also:
getIconsSize()

getUndockedTitle

public String getUndockedTitle()
Returns the undocked title of the toolbar.

Returns:
a string, or null if none was specified
Since:
JViews 8.1

setUndockedTitle

public void setUndockedTitle(String undockedTitle)
Sets the undocked title of the toolbar. This is the title of the dialog containing the toolbar when it is undocked.

Since:
JViews 8.1

getDefaultButtonBorder

public Border getDefaultButtonBorder()
Gets the border used for creating buttons inserted in this toolbar.


getDefaultIconButtonSize

public Dimension getDefaultIconButtonSize()
Gets the default size of buttons created in this toolbar and displays just icons.


getDefaultSeparatorSize

public Dimension getDefaultSeparatorSize()
Gets the default size of separators created in this toolbar.


setSettingsQuery

public void setSettingsQuery(IlvSettingsQuery query)
Sets the query that selects the settings element that defines the content of this toolbar.

Parameters:
query - The settings query.
See Also:
getSettingsQuery()

getSettingsQuery

public final IlvSettingsQuery getSettingsQuery()
Returns the query that selects the settings element that defines the content of this toolbar.

Returns:
The settings query. If no query has been specified using the method setSettingsQuery(ilog.views.appframe.settings.IlvSettingsQuery) or if no settings name has been defined using the method setSettingsName(java.lang.String), this method will return null.
See Also:
setSettingsQuery(ilog.views.appframe.settings.IlvSettingsQuery)

setSettingsElement

public void setSettingsElement(IlvSettingsElement element)
Forces the settings of the toolbar to be read and written from the specified settings element. This method overrides the settings element that is selected by default within the settings given by the method getSettings() with the query getSettingsQuery().

Parameters:
element - The settings element that provides the settings for the toolbar.
See Also:
getSettingsElement()

getSettingsElement

public IlvSettingsElement getSettingsElement()
Returns the settings element that provides the settings for this toolbar. If a settings element has been specified with the setSettingsElement(ilog.views.appframe.settings.IlvSettingsElement) method, it will be returned. Otherwise, the settings element is selected from the settings given by the getSettings() method with the query returned by getSettingsQuery().

Returns:
The settings element or null if no settings element could be found.
See Also:
setSettingsElement(ilog.views.appframe.settings.IlvSettingsElement), getSettingsQuery()

AddActionButton

public static JButton AddActionButton(Action action,
                                      Container container,
                                      int index,
                                      IlvApplication application)
Adds a new button to the specified container at the specified index. The newly created button is linked to the specified action.

Parameters:
action - The action of the button to create.
container - The container to create the new button in.
index - The insertion index of the new component within its parent container. If it is equal to -1, the new component will be added at the last position in the children of the container.
application - The application used for internationalization services.
Returns:
The newly created button associated with the specified action.

SetButtonProperties

public static void SetButtonProperties(IlvToolBar toolbar,
                                       AbstractButton button,
                                       Action action)
Sets the default button properties, like the border defined for the specified toolbar, to the specified button.

Parameters:
toolbar - The toolbar providing the default button properties. If null, default static properties defined for the IlvToolBar(java.lang.String, int) class will be set to the button.
button - The button to set properties to.
action - The action of the button

AddSeparator

public static JSeparator AddSeparator(Container container,
                                      int index)
Adds a new separator within the specified container.

Parameters:
container - The container to add a new separator to.
index - The insertion index of