com.ontimize.gui.field
Class ToggleImage
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.ontimize.gui.field.ToggleImage
- All Implemented Interfaces:
- AccessForm, javax.accessibility.Accessible, FormComponent, IdentifiedElement, java.awt.image.ImageObserver, Internationalization, java.awt.MenuContainer, SecureElement, java.io.Serializable
- Direct Known Subclasses:
- CheckToggleImage
- public class ToggleImage
- extends javax.swing.JPanel
- implements FormComponent, AccessForm, IdentifiedElement
This class implements a component with two states. For each state an image is
associated. Size for both images must be the same. Moreover, component allows
resizing (setSize(), setBounds(), resize()) and internal status ('0'->OFF or
'1'->ON) could be obtained from getStatus().
- Author:
- Imatia Innovation S.L.
- See Also:
- Serialized Form
| Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
| 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 |
| 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 |
ToggleImage(java.util.Hashtable parameters)
|
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, 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, 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, paintBorder, 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, 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, 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, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ON
public static final int ON
- See Also:
- Constant Field Values
OFF
public static final int OFF
- See Also:
- Constant Field Values
ALARM
public static final int ALARM
- See Also:
- Constant Field Values
TOP
protected static final int TOP
- See Also:
- Constant Field Values
LEFT
protected static final int LEFT
- See Also:
- Constant Field Values
BOTTOM
protected static final int BOTTOM
- See Also:
- Constant Field Values
RIGHT
protected static final int RIGHT
- See Also:
- Constant Field Values
RIGHT_STR
public static final java.lang.String RIGHT_STR
- See Also:
- Constant Field Values
LEFT_STR
public static final java.lang.String LEFT_STR
- See Also:
- Constant Field Values
CENTER_STR
public static final java.lang.String CENTER_STR
- See Also:
- Constant Field Values
LABELVISIBLE
public static final java.lang.String LABELVISIBLE
- See Also:
- Constant Field Values
VISIBLE
public static final java.lang.String VISIBLE
- See Also:
- Constant Field Values
NO
public static final int NO
- See Also:
- Constant Field Values
YES
public static final int YES
- See Also:
- Constant Field Values
TEXT
public static final int TEXT
- See Also:
- Constant Field Values
DIM
public static final java.lang.String DIM
- See Also:
- Constant Field Values
YES_STR
public static final java.lang.String YES_STR
- See Also:
- Constant Field Values
TEXT_STR
public static final java.lang.String TEXT_STR
- See Also:
- Constant Field Values
NO_STR
public static final java.lang.String NO_STR
- See Also:
- Constant Field Values
ALIGN
public static final java.lang.String ALIGN
- See Also:
- Constant Field Values
VALIGN
public static final java.lang.String VALIGN
- See Also:
- Constant Field Values
alignment
protected int alignment
valignment
protected int valignment
labelPosition
protected int labelPosition
status
protected int status
preferredStatus
protected int preferredStatus
loadStatusOn
protected int loadStatusOn
loadStatusOff
protected int loadStatusOff
loadStatusAlarm
protected int loadStatusAlarm
loadStatusDisabled
protected int loadStatusDisabled
onImage
protected ImageField onImage
offImage
protected ImageField offImage
alarmImage
protected ImageField alarmImage
disabledImage
protected ImageField disabledImage
onImageURL
protected java.net.URL onImageURL
offImageURL
protected java.net.URL offImageURL
alarmImageURL
protected java.net.URL alarmImageURL
disabledImageURL
protected java.net.URL disabledImageURL
attribute
protected java.lang.String attribute
labelText
protected java.lang.String labelText
width
protected int width
high
protected int high
dim
protected int dim
attributeLabel
protected javax.swing.JLabel attributeLabel
labelPanel
protected javax.swing.JPanel labelPanel
panelImage
protected JImage panelImage
isAlarmImage
protected boolean isAlarmImage
parentForm
protected Form parentForm
visiblePermission
protected FormPermission visiblePermission
enabledPermission
protected FormPermission enabledPermission
showLabel
protected boolean showLabel
show
protected boolean show
onImageObserver
protected com.ontimize.gui.field.ToggleImage.OnImageObserver onImageObserver
offImageObserver
protected com.ontimize.gui.field.ToggleImage.OffImageObserver offImageObserver
alarmImageObserver
protected com.ontimize.gui.field.ToggleImage.AlarmImageObserver alarmImageObserver
disabledImageObserver
protected com.ontimize.gui.field.ToggleImage.DisabledImageObserver disabledImageObserver
restricted
protected boolean restricted
ToggleImage
public ToggleImage(java.util.Hashtable parameters)
init
public void init(java.util.Hashtable parameters)
- Initializes parameters.
| attribute |
values |
default |
required |
meaning |
| attr |
|
|
yes |
The field attribute. |
| alarm |
on/off |
|
no |
When enabled image blinks between state image and alarm image. |
| align |
center/left/right |
center |
no |
The alignment for field. |
| valign |
center/top/bottom |
top |
no |
The vertical alignment for field. |
| dim |
no/text/yes |
no |
no |
The resize possibilities (no resize, resize the insertion
space, resize the space between label and text ). |
| imgOn |
|
|
no |
The image for on state. |
| imgOff |
|
|
no |
The image for off state |
| imgAlarm |
|
|
no |
The image for alarm state. |
| imgDisabled |
|
|
no |
The image for disabled state. |
| rotate |
yes/no |
no |
no |
Rotation of field. When this feature is enabled, height and width for image are interchanged. |
| status |
on/off |
|
no |
Initial state for component. |
| width |
|
|
no |
Width of field. |
| height |
|
|
no |
Height of field. |
| label |
left/right/top/bottom |
|
bottom |
Position of label respect of text. |
| labelvisible |
yes/no |
|
yes |
The label visibility. |
| text |
yes/no |
|
yes |
Alternative for attr text. |
- Specified by:
init in interface FormComponent
- Parameters:
parameters - the hashtable with pairs (Key,Value). For example:
| Key |
Value |
| align |
center |
| attr |
attribute |
| ... |
... |
setComponentLocale
public void setComponentLocale(java.util.Locale l)
- Specified by:
setComponentLocale in interface Internationalization
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.
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.
getConstraints
public java.lang.Object getConstraints(java.awt.LayoutManager layout)
- 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:
layout - the parent container reference
- Returns:
- the constraints for the component
getAttribute
public java.lang.Object getAttribute()
- Description copied from interface:
IdentifiedElement
- Gets the object attribute. This attribute allows to identify the object
- Specified by:
getAttribute in interface IdentifiedElement
getInsets
public java.awt.Insets getInsets()
setStatus
public void setStatus(int status)
- This method sets the component status and update the image
- Parameters:
status -
getStatus
public int getStatus()
setParentForm
public void setParentForm(Form parentForm)
- 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:
parentForm - the form reference
setCallFormAlarm
public void setCallFormAlarm(boolean callAlarmForma)
finalize
protected void finalize()
throws java.lang.Throwable
- Throws:
java.lang.Throwable
setEnabled
public void setEnabled(boolean enabled)
- Description copied from interface:
FormComponent
- Description method to set enabled or not the component according the
boolean condition in parameter.
- Specified by:
setEnabled in interface FormComponent
getImageOffset
public java.awt.Point getImageOffset()
setVisible
public void setVisible(boolean visible)
- Description copied from interface:
FormComponent
- Description method to set visible or not the component according the
boolean condition in parameter.
- Specified by:
setVisible in interface FormComponent
initPermissions
public void initPermissions()
- Specified by:
initPermissions in interface SecureElement
checkVisiblePermission
protected boolean checkVisiblePermission()
checkEnabledPermission
protected boolean checkEnabledPermission()
isRestricted
public boolean isRestricted()
- Specified by:
isRestricted in interface SecureElement
isLabelVisible
public boolean isLabelVisible()
isHidden
public boolean isHidden()