Ontimize 5.2072EN

com.ontimize.gui.field
Class ColorDataField

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.ontimize.gui.field.DataField
                      extended bycom.ontimize.gui.field.TextFieldDataField
                          extended bycom.ontimize.gui.field.ColorDataField
All Implemented Interfaces:
AccessForm, javax.accessibility.Accessible, ApplicationPreferencesListener, DataComponent, java.util.EventListener, FormComponent, HasHelpIdComponent, HasPreferenceComponent, IdentifiedElement, java.awt.image.ImageObserver, Internationalization, java.awt.MenuContainer, SecureElement, java.io.Serializable, ValueChangeDataComponent

public class ColorDataField
extends TextFieldDataField

The main class for creating a color data field.

Author:
Imatia Innovation
See Also:
Serialized Form

Nested Class Summary
protected  class ColorDataField.ColorInnerDocumentListener
          The main class to listen the document inner color.
protected  class ColorDataField.JPanelColor
          The main class for creating a color panel.
 
Nested classes inherited from class com.ontimize.gui.field.TextFieldDataField
TextFieldDataField.EJTextField, TextFieldDataField.InnerDocumentListener
 
Nested classes inherited from class com.ontimize.gui.field.DataField
DataField.AuxPanel, DataField.CopyActionListener, DataField.ELabel, DataField.FieldButton, DataField.FieldFocusListener, DataField.InfoMouseListener, DataField.ToggleButton
 
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 COLOR_TYPE_VALUE
          Color type value property.
protected  javax.swing.JButton colorButton
          The color button.
protected static javax.swing.JColorChooser colorChooser
          The static Color chooser.
protected  ColorDocument colorDocument
          The Color document.
static boolean DEBUG
          Only for DEBUG mode.
protected  javax.swing.JButton deleteButton
          The delete button.
static java.lang.String ENABLED_TEXT_FIELD_PROPERTY
          Enabled text field property.
static java.lang.String INTEGER_TYPE_VALUE
          Integer type value property.
static java.lang.String NO
          No property.
static java.lang.String NUMBER_TYPE_VALUE
          Number type value property.
protected  ColorDataField.JPanelColor panelColor
          The panel Color.
static java.lang.String RETURN_TYPE_PROPERTY
          Return type property.
protected  int returnType
          The return color.
static java.lang.String SHOW_DELETE_BUTTON_PROPERTY
          Show delete button property.
static java.lang.String SHOW_TEXT_FIELD_PROPERTY
          Show text field property.
static java.lang.String STRING_HEX_TYPE_VALUE
          String Hex type value property.
static java.lang.String STRING_RGB_TYPE_VALUE
          String RGB type value property.
protected  boolean textFieldEnabled
          The condition to enable text field.
static java.lang.String YES
          Yes property.
 
Fields inherited from class com.ontimize.gui.field.TextFieldDataField
disabledTextColor, innerListener
 
Fields inherited from class com.ontimize.gui.field.DataField
advancedQueryMode, ALIGN, ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, alignment, ASTERISK_REQUIRED_STYLE, ATTR, attribute, backgroundColor, BGCOLOR, bold, BOLD, BORDER, BORDER_REQUIRED_STYLE, borderText, BOTTOM, CENTER, CLIPBOARD_COPY, CLIPBOARD_COPY_es_ES, CLIPBOARD_CUT, CLIPBOARD_CUT_es_ES, CLIPBOARD_PASTE, CLIPBOARD_PASTE_es_ES, conditions, dataField, DEFAULT_BORDER, DEFAULT_BOTTOM_MARGIN, DEFAULT_FIELD_LEFT_MARGIN, DEFAULT_FIELD_RIGHT_MARGIN, DEFAULT_LABEL_LEFT_MARGIN, DEFAULT_LABEL_RIGHT_MARGIN, DEFAULT_PARENT_MARGIN, DEFAULT_PARENT_MARGIN_FOR_SCROLL, DEFAULT_TOP_MARGIN, defaultAsteriskColor, DEFAULTBORDER, defaultDisableBackgroundColor, defaultFieldButtonHigh, defaultPreferenceTextNotRetrievedFromPreferences, DEFINE_HELP_FIELD_PREFERENCE, dim, DIM, disabledbgcolor, DISABLEDBGCOLOR, empty, enabled, ENABLED, FIELD_HELP_TIP, fieldlistenerFocus, fieldSize, fireValueEvents, FOCUS_BACKGROUNDCOLOR, FONT, fontColor, FONTCOLOR, fontSize, FONTSIZE, height, HEIGHT, incrementalFont, initPreferenceHelpText, isEnabled, LABELALIGN, labelComponent, LABELFONT, LABELFONTCOLOR, labelPosition, LABELPOSITION, LABELSIZE, labelText, LABELVISIBLE, LEFT, locale, LOWERED, menuCopy, menuCut, menuDefineHelpPreference, menuHelpPreferences, menuPaste, modifiable, NO_STR, NONE, noRequiredBorder, OPAQUE, originalSize, OUTBORDER, panel, parentForm, permissionActivate, permissionVisible, popupMenu, RAISED, redimensionPanel, redimensJTextField, required, REQUIRED, requiredBorder, REQUIREDBORDER, requiredFieldBackgroundColor, resources, restricted, RIGHT, show, showLabel, SIZE, TEXT_STR, TEXTALIGN, textAlignment, textHelpPreference, TIP, tipKey, TOP, validData, VALIGN, Valignment, valueListener, valueSave, VISIBLE, VISUALIZE_HELP_FIELD_PREFERENCE, weightDataFieldH, weightPanelH, width, WIDTH, x, X, y, Y, YES_STR
 
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.DataComponent
COMP_FOCUS_YELLOW, GREEN_VERY_LIGHT, LIGHT_GRAY_BLUE, LIGHT_GREYISH_BLUE, VERY_LIGHT_BLUE, VERY_LIGHT_GRAY, VERY_LIGHT_PINK, VERY_LIGHT_RED, VERY_LIGHT_SKYBLUE, VERY_LIGHT_YELLOW, VERY_LIGHT_YELLOW_2
 
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, PROPERTIES, SOMEBITS
 
Constructor Summary
ColorDataField(java.util.Hashtable parameters)
          The class constructor.
 
Method Summary
 void deleteData()
          Deletes data.
 javax.swing.JButton getColorButton()
          Gets the JButton color.
 ColorDataField.JPanelColor getColorPanel()
          Gets the JPanel Color.
 java.awt.Color getColorValue()
          The method to get the color value from a document reference.
 javax.swing.JButton getDeleteButton()
          Gets the delete button.
 java.lang.String getHEXValue()
          The method to get the HEX RGB color from a document reference.
 java.lang.Number getNumericalValue()
          The method to get the number color.
 java.lang.String getRGBValue()
          The method to get the RGB color from a document reference.
 int getSQLDataType()
          The method to get the integer SQL types for color, rgb string, hex string, number or integer.
 java.lang.Object getValue()
          The method to get the number color in a object.
 void init(java.util.Hashtable parameters)
          Calls to super() to init parameters.
protected  void installInnerListener()
          The method to add a new inner listener.
 boolean isEmpty()
          The empty or no empty condition according to method getValue().
 void setEnabled(boolean enabled)
          Checks permissions and enables the buttons according to @param.
 void setValue(java.lang.Object value)
          The main method to set the color values.
 
Methods inherited from class com.ontimize.gui.field.TextFieldDataField
createDataField, getAttribute, getInnerListenerEnabled, getInnerValue, getLabelComponentText, getText, isInnerValueEqual, isModifiable, isRequired, setInnerListenerEnabled, setInnerValue
 
Methods inherited from class com.ontimize.gui.field.DataField
addFocusListener, addHelpMenuPopup, addValueChangeListener, changeButton, changeOpacity, checkDefineHelpPermission, checkEnabledPermission, checkVisiblePermission, configurePopupMenuHelp, createFocusListener, createInstanceConditionCombo, createPopupMenu, defineHelpField, finalize, fireValueChanged, getBorder, getConstraints, getDataField, getDisabledbgcolor, getFontColor, getHelpIdString, getHelpPreferenceKey, getLabelComponent, getLabelFontColor, getLabelText, getParentForm, getPreferenceHelpText, getTextsToTranslate, getValueChangeListeners, hasHelpInPreferences, initPermissions, initPreferences, installFocusListener, installHelpId, installPopupMenuListener, installPreferenceHelpListener, isAdvancedQueryMode, isEnabled, isHidden, isLabelVisible, isModified, isRestricted, parseBoolean, preferenceChanged, removeFocusListener, removeValueChangeListener, requestFocus, seeHelpField, setBold, setComponentLocale, setDisabledbgcolor, setFont, setFontColor, setFontSize, setLabelFontColor, setModifiable, setParentForm, setRequired, setRequiredFieldBackground, setResourceBundle, setVisible, showPopupMenu, updateBackgroundColor, updateBackgroundColor, updateFont, updateTip, updateUI, validateComponentPositions
 
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, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, 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, 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, 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, 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
 

Field Detail

DEBUG

public static boolean DEBUG
Only for DEBUG mode. By default, false.


RETURN_TYPE_PROPERTY

public static final java.lang.String RETURN_TYPE_PROPERTY
Return type property.

See Also:
Constant Field Values

COLOR_TYPE_VALUE

public static final java.lang.String COLOR_TYPE_VALUE
Color type value property.

See Also:
Constant Field Values

STRING_RGB_TYPE_VALUE

public static final java.lang.String STRING_RGB_TYPE_VALUE
String RGB type value property.

See Also:
Constant Field Values

STRING_HEX_TYPE_VALUE

public static final java.lang.String STRING_HEX_TYPE_VALUE
String Hex type value property.

See Also:
Constant Field Values

NUMBER_TYPE_VALUE

public static final java.lang.String NUMBER_TYPE_VALUE
Number type value property.

See Also:
Constant Field Values

INTEGER_TYPE_VALUE

public static final java.lang.String INTEGER_TYPE_VALUE
Integer type value property.

See Also:
Constant Field Values

SHOW_TEXT_FIELD_PROPERTY

public static final java.lang.String SHOW_TEXT_FIELD_PROPERTY
Show text field property.

See Also:
Constant Field Values

YES

public static final java.lang.String YES
Yes property.

See Also:
Constant Field Values

NO

public static final java.lang.String NO
No property.

See Also:
Constant Field Values

ENABLED_TEXT_FIELD_PROPERTY

public static final java.lang.String ENABLED_TEXT_FIELD_PROPERTY
Enabled text field property.

See Also:
Constant Field Values

SHOW_DELETE_BUTTON_PROPERTY

public static final java.lang.String SHOW_DELETE_BUTTON_PROPERTY
Show delete button property.

See Also:
Constant Field Values

colorButton

protected javax.swing.JButton colorButton
The color button.


deleteButton

protected javax.swing.JButton deleteButton
The delete button.


panelColor

protected ColorDataField.JPanelColor panelColor
The panel Color.


colorChooser

protected static javax.swing.JColorChooser colorChooser
The static Color chooser.


returnType

protected int returnType
The return color.

See Also:
ColorDocument.RETURN_COLOR

textFieldEnabled

protected boolean textFieldEnabled
The condition to enable text field.


colorDocument

protected ColorDocument colorDocument
The Color document.

Constructor Detail

ColorDataField

public ColorDataField(java.util.Hashtable parameters)
The class constructor. It initializes the parameters, sets the color and sets the document.

Parameters:
parameters - the Hashtable with parameters from XML definition.
Method Detail

init

public void init(java.util.Hashtable parameters)
Calls to super() to init parameters.

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

attribute values default required meaning
returnedtype stringrgb;stringhex;number;integer no The returned type:
  • "stringrgb": Returns a string in decimal format rrr;ggg;bbb (no necessary always 10 characters)
  • "stringhex": Returns a string in hexadecimal format #RRGGBB
  • "number": Returns a Number object. Its value will be R*Math.exp(256, 2) + G*256 + B
  • "integer": Returns an integer object. Its value will be RBG
showtextfield yes/no Condition to show the text field.
enabledtextfield yes/no Condition to activate the text field
showdeletebutton yes/no Condition to show the delete button
colorwidth Width in pixels of color bar showed in this field.
colorheight Height in pixels of color bar showed in this field.
borderbuttons yes/no yes no Condition about border of buttons for this field. by default, borders are enabled.
opaquebuttons yes/no yes no Condition about opacity of buttons for this field. by default, buttons are opaques.
highlightbuttons yes/no no no Condition about highlight of buttons for this field. by default, hightlight is disabled.

getColorPanel

public ColorDataField.JPanelColor getColorPanel()
Gets the JPanel Color.

Returns:
the JPanel Color

getColorButton

public javax.swing.JButton getColorButton()
Gets the JButton color.

Returns:
the color button.

getDeleteButton

public javax.swing.JButton getDeleteButton()
Gets the delete button.

Returns:
the delete button.

installInnerListener

protected void installInnerListener()
The method to add a new inner listener.

Overrides:
installInnerListener in class TextFieldDataField

getSQLDataType

public int getSQLDataType()
The method to get the integer SQL types for color, rgb string, hex string, number or integer.

Returns:
the return type according to SQL types

isEmpty

public boolean isEmpty()
The empty or no empty condition according to method getValue().

Specified by:
isEmpty in interface DataComponent
Overrides:
isEmpty in class TextFieldDataField
Returns:
the condition
See Also:
getValue()

getColorValue

public java.awt.Color getColorValue()
The method to get the color value from a document reference.

Returns:
the document color value.
See Also:
JTextComponent.getDocument()

getRGBValue

public java.lang.String getRGBValue()
The method to get the RGB color from a document reference.

Returns:
the string with RGB value
See Also:
JTextComponent.getDocument()

getHEXValue

public java.lang.String getHEXValue()
The method to get the HEX RGB color from a document reference.

Returns:
the string with Hex RGB value
See Also:
JTextComponent.getDocument()

getNumericalValue

public java.lang.Number getNumericalValue()
The method to get the number color.

Returns:
a numerical value
See Also:
JTextComponent.getDocument()

getValue

public java.lang.Object getValue()
The method to get the number color in a object.

Returns:
a numerical value
See Also:
JTextComponent.getDocument()

setValue

public void setValue(java.lang.Object value)
The main method to set the color values.

Parameters:
value - the object where the values(color,number,...) are placed

deleteData

public void deleteData()
Deletes data.

Specified by:
deleteData in interface DataComponent
Overrides:
deleteData in class TextFieldDataField

setEnabled

public void setEnabled(boolean enabled)
Checks permissions and enables the buttons according to @param.

Specified by:
setEnabled in interface FormComponent
Overrides:
setEnabled in class DataField
Parameters:
enabled - the condition to enable components

Ontimize