Ontimize 5.2072EN

com.ontimize.gui.field
Class Label

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.ontimize.gui.field.Label
All Implemented Interfaces:
AccessForm, javax.accessibility.Accessible, FormComponent, IdentifiedElement, java.awt.image.ImageObserver, Internationalization, java.awt.MenuContainer, SecureElement, java.io.Serializable
Direct Known Subclasses:
DataLabel, HyperlinkLabel

public class Label
extends javax.swing.JPanel
implements FormComponent, IdentifiedElement, AccessForm

The main class to set graphic configuration to labels.

Author:
Imatia Innovation
See Also:
Serialized Form

Nested Class Summary
protected  class Label.EJLabel
          The class to create the label.
 
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
 
Field Summary
static java.lang.String ALIGN
          The align property.
protected  int alignment
          The alignment.
protected  int alignmentV
          The alignment.
static java.lang.String ATTR
          The attr property.
protected  java.lang.Object attribute
          The param attribute.
protected  boolean bold
          The bolt writing condition.
static java.lang.String BOLD
          The bold property.
static java.lang.String BOTTOM
          The bottom property.
static java.lang.String CENTER
          The center property.
static int DEFAULT_BOTTOM_MARGIN
          The bottom margin.
static int DEFAULT_LABEL_LEFT_MARGIN
          The label left margin.
static int DEFAULT_LABEL_RIGHT_MARGIN
          The label right margin.
static int DEFAULT_PARENT_MARGIN
          The parent margin.
static int DEFAULT_TOP_MARGIN
          The top margin.
protected  double dim
          Variable to indicate the field resize.
static java.lang.String FONT
           
protected  java.awt.Color fontColor
          The font color.
static java.lang.String FONTCOLOR
          The fontcolor property.
protected  int fontSize
          The font size.
static java.lang.String FONTSIZE
          The fontsize property.
protected  boolean incrementalFont
          The incremental font.
protected  javax.swing.JLabel label
          The label.
protected  int labelSize
          The label size.
static java.lang.String LEFT
          The left property.
static java.lang.String MARGIN
           
protected  int originalSize
          The original size.
protected  Form parentForm
          The parent form.
protected  FormPermission permissionsActived
          The activation permission.
protected  FormPermission permissionVisible
          The visibility permission.
protected  java.util.ResourceBundle resourceFile
          The resource file.
protected  boolean restricted
          Checks whether component is restricted.
static java.lang.String RIGHT
          The right property.
static java.lang.String SIZE
          The size property.
static java.lang.String TEXT
          The text property.
protected  java.lang.String textLabel
          The text label.
static java.lang.String VALIGN
          The valign 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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Label(java.util.Hashtable parameters)
          The class constructor.
 
Method Summary
protected  boolean checkEnabledPermission()
          Checks whether the component has permission to stay enabled.
protected  boolean checkVisiblePermission()
          Checks whether visible permissions are active.
 java.lang.Object getAttribute()
          Gets the attribute paramameter.
 java.lang.Object getConstraints(java.awt.LayoutManager parentLayout)
          Get the alignment layout constraints.
 javax.swing.JLabel getLabel()
          Gets the reference of a label.
 java.lang.String getText()
          Gets the text from a label.
 java.util.Vector getTextsToTranslate()
          Introduces in a Vector the textLabel.
 void init(java.util.Hashtable parameters)
          This method gets the Hashtable and initializes the label with parameters specified, also aligns the label.
 void initPermissions()
          Initializes the permissions.
 boolean isFocusable()
           
 boolean isRestricted()
           
 void setBold(boolean bold)
          Changes the capitalization to bold.
 void setComponentLocale(java.util.Locale locale)
          Changes the component locale.
 void setEnabled(boolean enabled)
          Activates the label component.
 void setFontColor(java.awt.Color fontColor)
          Changes the font color.
 void setFontSize(int fontSize)
          Changes the font size.
 void setParentForm(Form f)
          Sets the parent form.
 void setResourceBundle(java.util.ResourceBundle resources)
          Changes the resource bundle.
 void setText(java.lang.String text)
          Sets the text to a label.
 void setVisible(boolean visible)
          Enables o disables the visualization permissions.
 void updateFont()
          Updates the font size.
 void updateUI()
          Updates the UI property.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
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, 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, 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
 

Field Detail

DEFAULT_TOP_MARGIN

public static int DEFAULT_TOP_MARGIN
The top margin. By default, 2.

See Also:
DataField.DEFAULT_TOP_MARGIN

DEFAULT_BOTTOM_MARGIN

public static int DEFAULT_BOTTOM_MARGIN
The bottom margin. By default, 2.

See Also:
DataField.DEFAULT_BOTTOM_MARGIN

DEFAULT_LABEL_LEFT_MARGIN

public static int DEFAULT_LABEL_LEFT_MARGIN
The label left margin. By default, 10.

See Also:
DataField.DEFAULT_LABEL_LEFT_MARGIN

DEFAULT_LABEL_RIGHT_MARGIN

public static int DEFAULT_LABEL_RIGHT_MARGIN
The label right margin. By default, 10.

See Also:
DataField.DEFAULT_LABEL_RIGHT_MARGIN

DEFAULT_PARENT_MARGIN

public static int DEFAULT_PARENT_MARGIN
The parent margin. By default, 1.

See Also:
DataField.DEFAULT_PARENT_MARGIN

ATTR

public static final java.lang.String ATTR
The attr property.

See Also:
Constant Field Values

TEXT

public static final java.lang.String TEXT
The text property.

See Also:
Constant Field Values

ALIGN

public static final java.lang.String ALIGN
The align property.

See Also:
Constant Field Values

VALIGN

public static final java.lang.String VALIGN
The valign property.

See Also:
Constant Field Values

LEFT

public static final java.lang.String LEFT
The left property.

See Also:
Constant Field Values

RIGHT

public static final java.lang.String RIGHT
The right property.

See Also:
Constant Field Values

CENTER

public static final java.lang.String CENTER
The center property.

See Also:
Constant Field Values

BOTTOM

public static final java.lang.String BOTTOM
The bottom property.

See Also:
Constant Field Values

SIZE

public static final java.lang.String SIZE
The size property.

See Also:
Constant Field Values

FONTSIZE

public static final java.lang.String FONTSIZE
The fontsize property.

See Also:
Constant Field Values

FONT

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

FONTCOLOR

public static final java.lang.String FONTCOLOR
The fontcolor property.

See Also:
Constant Field Values

BOLD

public static final java.lang.String BOLD
The bold property.

See Also:
Constant Field Values

MARGIN

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

bold

protected boolean bold
The bolt writing condition.


attribute

protected java.lang.Object attribute
The param attribute. By default, null.

See Also:
getAttribute()

fontColor

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

See Also:
Color.black

fontSize

protected int fontSize
The font size. By default, -1.


originalSize

protected int originalSize
The original size. By default, -1.


incrementalFont

protected boolean incrementalFont
The incremental font. By default, false.


labelSize

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


textLabel

protected java.lang.String textLabel
The text label. By default, -1.


alignment

protected int alignment
The alignment. By default, NORTHWEST.

See Also:
GridBagConstraints.NORTHWEST

alignmentV

protected int alignmentV
The alignment. By default, NORTH.

See Also:
GridBagConstraints.NORTH

parentForm

protected Form parentForm
The parent form. By default, null.


permissionVisible

protected FormPermission permissionVisible
The visibility permission. By default, null.


permissionsActived

protected FormPermission permissionsActived
The activation permission. By default, null.


resourceFile

protected java.util.ResourceBundle resourceFile
The resource file. By default, null.


label

protected javax.swing.JLabel label
The label.


dim

protected double dim
Variable to indicate the field resize.


restricted

protected boolean restricted
Checks whether component is restricted.

Constructor Detail

Label

public Label(java.util.Hashtable parameters)
The class constructor. Sets layout, borders and inits parameters

Parameters:
parameters - a Hashtable with label parameters
Method Detail

init

public void init(java.util.Hashtable parameters)
This method gets the Hashtable and initializes the label with parameters specified, also aligns the label.

Specified by:
init in interface FormComponent
Parameters:
parameters - the Hashtable with parameters

attribute values default required meaning
attr yes The attribute
text yes The label text
align right/left no The alignment
valign center/bottom no The vertical alignment
size no The label size
icon no The icon for label
fontsize no The font size
fontcolor black no The font color
font A string like : 'Arial-BOLD-18' (See #Font.decode()) The default font for system no Font for data field.
bold yes/no no The bold capitalization condition
margin no The empty space around the label in its panel
dim no/text/yes no no The resize possibilities (no resize or resize, values yes and text are the same but both of them exist to maintain the same possibilities that other fields accept).

updateFont

public void updateFont()
Updates the font size.


setFontSize

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

Parameters:
fontSize - the font size

setFontColor

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

Parameters:
fontColor - the font color

getConstraints

public java.lang.Object getConstraints(java.awt.LayoutManager parentLayout)
Get the alignment layout constraints.

Specified by:
getConstraints in interface FormComponent
Parameters:
parentLayout - the layout to check
Returns:
the constraints

setComponentLocale

public void setComponentLocale(java.util.Locale locale)
Changes the component locale.

Specified by:
setComponentLocale in interface Internationalization
Parameters:
locale - the locale

setResourceBundle

public void setResourceBundle(java.util.ResourceBundle resources)
Changes the resource bundle.

Specified by:
setResourceBundle in interface Internationalization
Parameters:
resources - the resource

getTextsToTranslate

public java.util.Vector getTextsToTranslate()
Introduces in a Vector the textLabel.

Specified by:
getTextsToTranslate in interface Internationalization
Returns:
a Vector where textLabel is introduced.

getAttribute

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

Specified by:
getAttribute in interface IdentifiedElement
Returns:
the value specified in 'attr'

setVisible

public void setVisible(boolean visible)
Enables o disables the visualization permissions.

Specified by:
setVisible in interface FormComponent
Parameters:
visible - the condition of visualization

setEnabled

public void setEnabled(boolean enabled)
Activates the label component.

Specified by:
setEnabled in interface FormComponent
Parameters:
enabled - the boolean to activate

initPermissions

public void initPermissions()
Initializes the permissions.

Specified by:
initPermissions in interface SecureElement

checkVisiblePermission

protected boolean checkVisiblePermission()
Checks whether visible permissions are active.

Returns:
the visibility condition

checkEnabledPermission

protected boolean checkEnabledPermission()
Checks whether the component has permission to stay enabled.

Returns:
the boolean result of checking permissions

setParentForm

public void setParentForm(Form f)
Sets the parent form.

Specified by:
setParentForm in interface AccessForm
Parameters:
f - the parent form

updateUI

public void updateUI()
Updates the UI property. If BOLD is true, also it calls to updateFont()


setBold

public void setBold(boolean bold)
Changes the capitalization to bold.

Parameters:
bold - sets bold capitalization.

setText

public void setText(java.lang.String text)
Sets the text to a label.

Parameters:
text - the text to put in the label

getText

public java.lang.String getText()
Gets the text from a label.

Returns:
the reference for a display area

getLabel

public javax.swing.JLabel getLabel()
Gets the reference of a label.

Returns:
the reference for a display area

isRestricted

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

isFocusable

public boolean isFocusable()

Ontimize