Ontimize 5.2072EN

com.ontimize.gui.button
Class ToggleButton

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.AbstractButton
                  extended byjavax.swing.JToggleButton
                      extended bycom.ontimize.gui.button.ToggleButton
All Implemented Interfaces:
AccessForm, javax.accessibility.Accessible, java.util.EventListener, FormComponent, Freeable, HasHelpIdComponent, IdentifiedElement, java.awt.image.ImageObserver, Internationalization, java.awt.ItemSelectable, java.awt.MenuContainer, java.awt.event.MouseListener, SecureElement, java.io.Serializable, javax.swing.SwingConstants

public class ToggleButton
extends javax.swing.JToggleButton
implements FormComponent, AccessForm, Freeable, java.awt.event.MouseListener, SecureElement, IdentifiedElement, HasHelpIdComponent

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JToggleButton
javax.swing.JToggleButton.AccessibleJToggleButton, javax.swing.JToggleButton.ToggleButtonModel
 
Nested classes inherited from class javax.swing.AbstractButton
javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener
 
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 ALIGN
           
protected  int alignment
          The alignment.
protected  int alignmentV
          The vertical alignment.
protected  java.lang.String altIcon
          The reference to icon with alt key pressed.
protected  boolean altMode
          The alt mode state condition.
protected  java.lang.String alttext
          The reference to text with alt key pressed.
protected  java.lang.String altTip
          The reference to tip with alt key pressed.
protected  boolean bold
          The bold font condition.
protected  java.lang.String buttonKey
          The key to manages the button.
protected  FormPermission enabledPermission
          A enable permission reference.
protected  boolean focusable
          Condition about focusable.
protected  java.awt.Color fontColor
          The font color.
protected  int fontSize
          The font size.
protected  java.lang.String helpId
          The help identifier.
protected  java.lang.String icon
          The icon reference.
static java.lang.String KEY
           
protected  java.lang.String keyStrokeText
          The text to show when key pressed from keyboard.
protected  int labelSize
          The label size.
protected  Form parentForm
          A reference to parent form.
protected  int preferredHeight
          The preferred height.
protected  java.util.ResourceBundle resourcesFileName
          A reference to resource bundle file.
protected  boolean restricted
          The restricted condition.
protected  boolean rollover
          The roll over condition.
protected  boolean specifiedTooltip
          A condition to check if tooltip is specified.
protected  java.lang.String text
          The text to show in button.
static java.lang.String TEXT
           
static java.lang.String TIP
           
protected  java.lang.String tooltip
          The tooltip key.
static java.lang.String VALIGN
           
protected  FormPermission visiblePermission
          A visible permission reference.
 
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
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 com.ontimize.gui.field.FormComponent
DEBUG
 
Fields inherited from interface com.ontimize.gui.i18n.Internationalization
DEBUG_LANGUAGE
 
Fields inherited from interface com.ontimize.gui.SecureElement
DESACTIVATE_COMPONENT_BY_PERMISSION_TIP
 
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
ToggleButton(java.util.Hashtable parameters)
           
 
Method Summary
protected  boolean checkEnabledPermission()
          Checks the enabled permission condition.
protected  boolean checkVisiblePermission()
          Checks the visible permission condition.
 void free()
          Makes the object to release the resources.
 java.lang.Object getAttribute()
          Gets the button attribute.
 java.lang.Object getConstraints(java.awt.LayoutManager parentLayout)
          Description method to return the constraints component to place correctly in parent container.
 java.lang.String getHelpIdString()
           
 java.lang.String getKey()
          Gets the button key.
 java.awt.Dimension getPreferredSize()
           
 java.util.Vector getTextsToTranslate()
          Returns all the texts in the element suitable for being translated.
protected  java.lang.String getTextWithKeyStroke(java.lang.String text)
          Gets the keystroke text.
 void init(java.util.Hashtable parameters)
          Main method to init an object from parameters hashtable.
 void initPermissions()
           
 void installHelpId()
           
protected  void installHighlight(java.util.Hashtable params)
           
 boolean isAltMode()
          Checks the alt mode state.
 boolean isRestricted()
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void setAltMode(boolean mode)
          Sets the alt mode state.
 void setBold(boolean bold)
          Sets the bold condition.
 void setComponentLocale(java.util.Locale l)
           
 void setFontColor(java.awt.Color fontColor)
          Sets the font color.
 void setFontSize(int fontSize)
          Sets the font size.
 void setParentForm(Form form)
          Method declaration to set the form that contains the component.
 void setResourceBundle(java.util.ResourceBundle resources)
          Sets the language resource bundle.
 void setRollover(boolean rollover)
          Sets rollover.
protected  void updateTip()
          Updates the tip.
 
Methods inherited from class javax.swing.JToggleButton
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addItemListener, checkHorizontalKey, checkVerticalKey, configurePropertiesFromAction, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setEnabled, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
 
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, 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, 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, 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
 
Methods inherited from interface com.ontimize.gui.field.FormComponent
isEnabled, setEnabled, setVisible
 

Field Detail

TIP

public static final java.lang.String TIP
See Also:
Constant Field Values

TEXT

public static final java.lang.String TEXT
See Also:
Constant Field Values

KEY

public static final java.lang.String KEY
See Also:
Constant Field Values

VALIGN

public static final java.lang.String VALIGN
See Also:
Constant Field Values

ALIGN

public static final java.lang.String ALIGN
See Also:
Constant Field Values

text

protected java.lang.String text
The text to show in button. By default, null.


alignment

protected int alignment
The alignment. By default, centered.


alignmentV

protected int alignmentV
The vertical alignment. By default, at top.


buttonKey

protected java.lang.String buttonKey
The key to manages the button. By default, null.


focusable

protected boolean focusable
Condition about focusable. By default, true.


tooltip

protected java.lang.String tooltip
The tooltip key.


specifiedTooltip

protected boolean specifiedTooltip
A condition to check if tooltip is specified. By default, false.


rollover

protected boolean rollover
The roll over condition. By default, false.


resourcesFileName

protected java.util.ResourceBundle resourcesFileName
A reference to resource bundle file. By default, null.


parentForm

protected Form parentForm
A reference to parent form. By default, null.


visiblePermission

protected FormPermission visiblePermission
A visible permission reference. By default, null.


enabledPermission

protected FormPermission enabledPermission
A enable permission reference. By default, null.


labelSize

protected int labelSize
The label size. By default, -1.


preferredHeight

protected int preferredHeight
The preferred height. By default, -1.


fontSize

protected int fontSize
The font size. By default, 12 pt.


fontColor

protected java.awt.Color fontColor
The font color. By default, black.


bold

protected boolean bold
The bold font condition. By default, false.


keyStrokeText

protected java.lang.String keyStrokeText
The text to show when key pressed from keyboard. By default, null.


helpId

protected java.lang.String helpId
The help identifier. By default, null.


icon

protected java.lang.String icon
The icon reference. By default, null.


altIcon

protected java.lang.String altIcon
The reference to icon with alt key pressed. By default, null.


alttext

protected java.lang.String alttext
The reference to text with alt key pressed. By default, null.


altTip

protected java.lang.String altTip
The reference to tip with alt key pressed. By default, null.


restricted

protected boolean restricted
The restricted condition. By default, false.


altMode

protected boolean altMode
The alt mode state condition. By default, false.

Constructor Detail

ToggleButton

public ToggleButton(java.util.Hashtable parameters)
             throws java.lang.Exception
Method Detail

getConstraints

public java.lang.Object getConstraints(java.awt.LayoutManager parentLayout)
Description copied from interface: FormComponent
Description method to return the constraints component to place correctly in parent container.

Specified by:
getConstraints in interface FormComponent
Parameters:
parentLayout - the parent container reference
Returns:
the constraints for the component

init

public void init(java.util.Hashtable parameters)
          throws java.lang.Exception
Description copied from interface: FormComponent
Main method to init an object from parameters hashtable.

Specified by:
init in interface FormComponent
Parameters:
parameters - the hashtable with pairs (Key,Value). For example:

Key Value
align center
attr attribute
... ...
Throws:
java.lang.Exception - when Exception occurs

getAttribute

public java.lang.Object getAttribute()
Gets the button attribute.

Specified by:
getAttribute in interface IdentifiedElement
Returns:
the button key

installHighlight

protected void installHighlight(java.util.Hashtable params)

getKey

public java.lang.String getKey()
Gets the button key.

Returns:
the buttonkey parameter

setBold

public void setBold(boolean bold)
Sets the bold condition.

Parameters:
bold - the bold condition.

setFontSize

public void setFontSize(int fontSize)
Sets the font size.

Parameters:
fontSize - the font size

setFontColor

public void setFontColor(java.awt.Color fontColor)
Sets the font color.

Parameters:
fontColor - the font color

getTextsToTranslate

public java.util.Vector getTextsToTranslate()
Description copied from interface: Internationalization
Returns all the texts in the element suitable for being translated.

Specified by:
getTextsToTranslate in interface Internationalization
Returns:
all the texts in the element suitable for being translated.

setComponentLocale

public void setComponentLocale(java.util.Locale l)
Specified by:
setComponentLocale in interface Internationalization

setResourceBundle

public void setResourceBundle(java.util.ResourceBundle resources)
Description copied from interface: Internationalization
Sets the language resource bundle. When the application changes the configured language, for all the objects that implement this interface this method must be called with the new file.
The method must translate all the elements that have texts in the GUI

Specified by:
setResourceBundle in interface Internationalization
Parameters:
resources - the new language bundle.

updateTip

protected void updateTip()
Updates the tip.

See Also:
JComponent.setToolTipText(String)

getTextWithKeyStroke

protected java.lang.String getTextWithKeyStroke(java.lang.String text)
Gets the keystroke text.

Parameters:
text - the basic button text
Returns:
the text to show

setParentForm

public void setParentForm(Form form)
Description copied from interface: AccessForm
Method declaration to set the form that contains the component. This method must be called automatically during the form building.

Specified by:
setParentForm in interface AccessForm
Parameters:
form - the form reference

free

public void free()
          throws java.lang.Exception
Description copied from interface: Freeable
Makes the object to release the resources.

Specified by:
free in interface Freeable
Throws:
java.lang.Exception

setRollover

public void setRollover(boolean rollover)
Sets rollover.

Parameters:
rollover - the roll-over condition

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

getPreferredSize

public java.awt.Dimension getPreferredSize()

initPermissions

public void initPermissions()
Specified by:
initPermissions in interface SecureElement

checkVisiblePermission

protected boolean checkVisiblePermission()
Checks the visible permission condition.

Returns:
the condition about visibility permissions

checkEnabledPermission

protected boolean checkEnabledPermission()
Checks the enabled permission condition.

Returns:
the enable permission condition.

isRestricted

public boolean isRestricted()
Specified by:
isRestricted in interface SecureElement

getHelpIdString

public java.lang.String getHelpIdString()
Specified by:
getHelpIdString in interface HasHelpIdComponent

installHelpId

public void installHelpId()
Specified by:
installHelpId in interface HasHelpIdComponent

setAltMode

public void setAltMode(boolean mode)
Sets the alt mode state.

Parameters:
mode - the mode condition

isAltMode

public boolean isAltMode()
Checks the alt mode state.

Returns:
the condition

Ontimize