echopointng
Class EditableLabelEx

java.lang.Object
  extended by nextapp.echo2.app.Component
      extended by nextapp.echo2.app.Label
          extended by echopointng.LabelEx
              extended by echopointng.EditableLabelEx
All Implemented Interfaces:
AccessKeyable, Attributeable, Borderable, Delegateable, Heightable, Insetable, MouseCursorable, Sizeable, ToolTipable, Widthable, java.io.Serializable, RenderIdSupport

public class EditableLabelEx
extends LabelEx

EditableLabelEx is a Label component that can contain other child components and when the user clicks on the Label, the underlying (and hidden) child components will be shown.

So for example imagine a EditableLabelEx that contained a TextField as a child. When the user clicks on the Label, the TextField will be shown and the user can edit its contents.

This component uses the concept of a target component to allow it to source its Text from. Any number of components can be added to the EditableLabelEx however only the text of the target component will be synchronised.

And this target can be a grand child of the EditableLabelEx. For example if you added a DateField to the EditableLabelEx then you would set the target to be the TextField part of the DateField, since this is the bit you want to "edit" not the drop down part.

The editing function is "ended" when the user moves away from the editing target or clicks some where else on the page. If the target is a TextComponent, then pressing escape can restore the value back to what it was before editing proceeded.

See Also:
Serialized Form

Field Summary
static int ACTIVATE_ON_DBLCLICK
           
static int ACTIVATE_ON_DELAYEDCLICK
           
static Style DEFAULT_STYLE
           
static java.lang.String PROPERTY_ACTIVATION_METHOD
           
static java.lang.String PROPERTY_SYNCHRONIZED_WITH_TARGET
           
 
Fields inherited from class echopointng.LabelEx
PROPERTY_BACKGROUND_IMAGE, PROPERTY_DISABLED_BACKGROUND, PROPERTY_DISABLED_BACKGROUND_IMAGE, PROPERTY_DISABLED_BORDER, PROPERTY_DISABLED_FONT, PROPERTY_DISABLED_FOREGROUND, PROPERTY_DISABLED_ICON, PROPERTY_INTERPRET_NEWLINES, PROPERTY_LINE_WRAP, PROPERTY_ROLLOVER_BACKGROUND, PROPERTY_ROLLOVER_BACKGROUND_IMAGE, PROPERTY_ROLLOVER_BORDER, PROPERTY_ROLLOVER_ENABLED, PROPERTY_ROLLOVER_FONT, PROPERTY_ROLLOVER_FOREGROUND, PROPERTY_ROLLOVER_ICON
 
Fields inherited from class nextapp.echo2.app.Label
PROPERTY_ICON, PROPERTY_ICON_TEXT_MARGIN, PROPERTY_TEXT, PROPERTY_TEXT_ALIGNMENT, PROPERTY_TEXT_POSITION, PROPERTY_TOOL_TIP_TEXT
 
Fields inherited from class nextapp.echo2.app.Component
CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_TRAVERSAL_INDEX_CHANGED_PROPERTY, FOCUS_TRAVERSAL_PARTICIPANT_CHANGED_PROPERTY, LAYOUT_DIRECTION_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, PROPERTY_BACKGROUND, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_LAYOUT_DATA, STYLE_CHANGED_PROPERTY, STYLE_NAME_CHANGED_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface echopointng.able.Borderable
PROPERTY_BORDER
 
Fields inherited from interface echopointng.able.Widthable
PROPERTY_WIDTH
 
Fields inherited from interface echopointng.able.Heightable
PROPERTY_HEIGHT
 
Fields inherited from interface echopointng.able.Insetable
DEFAULT_INSETS, DEFAULT_OUTSETS, PROPERTY_INSETS, PROPERTY_OUTSETS
 
Fields inherited from interface echopointng.able.AccessKeyable
PROPERTY_ACCESS_KEY
 
Fields inherited from interface echopointng.able.MouseCursorable
CURSOR_AUTO, CURSOR_CROSSHAIR, CURSOR_CUSTOM_URI, CURSOR_DEFAULT, CURSOR_E_RESIZE, CURSOR_HELP, CURSOR_MOVE, CURSOR_N_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_POINTER, CURSOR_S_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE, CURSOR_TEXT, CURSOR_W_RESIZE, CURSOR_WAIT, PROPERTY_MOUSE_CURSOR, PROPERTY_MOUSE_CURSOR_URI
 
Fields inherited from interface echopointng.able.ToolTipable
PROPERTY_TOOL_TIP_TEXT
 
Constructor Summary
EditableLabelEx()
          Constructs a EditableLabelEx with no target component.
EditableLabelEx(Component target)
          Constructs a EditableLabelEx and sets the specified component as its target.
 
Method Summary
 int getActivationMethod()
           
 Component getTarget()
           
 java.lang.String getText()
          Returns the text of the label.
 boolean isSynchronisedWithTarget()
           
 boolean isValidChild(Component component)
          This component does not support children.
 void processInput(java.lang.String inputName, java.lang.Object inputValue)
          Processes client input specific to the Component received from the UpdateManager.
 void setActivationMethod(int newValue)
          Sets the activation method for editing.
 void setSynchronisedWithTarget(boolean newValue)
          If this is true, then the Label's value will be syncrhnonised with its target component.
 void setTarget(Component target)
          Sets the current target of the EditableLabelEx. if this is not already a child of the EditableLabelEx, then it will be added as one.
protected  void synchroniseWithTarget()
          This method is called internally to "synchronise" the value of the EditableLabelEx with its target component.
 void validate()
          A life-cycle method invoked before the component is rendered to ensure it is in a valid state.
 
Methods inherited from class echopointng.LabelEx
getAccessKey, getAttribute, getAttributeNames, getBackgroundImage, getBorder, getDisabledBackground, getDisabledBackgroundImage, getDisabledBorder, getDisabledFont, getDisabledForeground, getDisabledIcon, getHeight, getInsets, getMouseCursor, getMouseCursorURI, getOutsets, getRolloverBackground, getRolloverBackgroundImage, getRolloverBorder, getRolloverFont, getRolloverForeground, getRolloverIcon, getWidth, isIntepretNewlines, isLineWrap, isRolloverEnabled, setAccessKey, setAttribute, setBackgroundImage, setBorder, setDisabledBackground, setDisabledBackgroundImage, setDisabledBorder, setDisabledFont, setDisabledForeground, setDisabledIcon, setHeight, setInsets, setIntepretNewlines, setLineWrap, setMouseCursor, setMouseCursorURI, setOutsets, setRolloverBackground, setRolloverBackgroundImage, setRolloverBorder, setRolloverEnabled, setRolloverFont, setRolloverForeground, setRolloverIcon, setWidth
 
Methods inherited from class nextapp.echo2.app.Label
getIcon, getIconTextMargin, getTextAlignment, getTextPosition, getToolTipText, setIcon, setIconTextMargin, setText, setTextAlignment, setTextPosition, setToolTipText
 
Methods inherited from class nextapp.echo2.app.Component
add, add, addPropertyChangeListener, dispose, firePropertyChange, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusTraversalIndex, getFont, getForeground, getId, getIndexedProperty, getLayoutData, getLayoutDirection, getLocale, getParent, getProperty, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLayoutDirection, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, init, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isValidParent, isVisible, remove, remove, removeAll, removePropertyChangeListener, setBackground, setEnabled, setFocusTraversalIndex, setFocusTraversalParticipant, setFont, setForeground, setId, setIndexedProperty, setLayoutData, setLayoutDirection, setLocale, setProperty, setStyle, setStyleName, setVisible, verifyInput, visibleIndexOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface echopointng.able.Delegateable
getRenderProperty, getRenderProperty
 
Methods inherited from interface echopointng.able.Delegateable
getRenderProperty, getRenderProperty
 
Methods inherited from interface echopointng.able.Delegateable
getRenderProperty, getRenderProperty
 
Methods inherited from interface echopointng.able.ToolTipable
getToolTipText, setToolTipText
 

Field Detail

ACTIVATE_ON_DBLCLICK

public static final int ACTIVATE_ON_DBLCLICK
See Also:
Constant Field Values

ACTIVATE_ON_DELAYEDCLICK

public static final int ACTIVATE_ON_DELAYEDCLICK
See Also:
Constant Field Values

PROPERTY_SYNCHRONIZED_WITH_TARGET

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

PROPERTY_ACTIVATION_METHOD

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

DEFAULT_STYLE

public static final Style DEFAULT_STYLE
Constructor Detail

EditableLabelEx

public EditableLabelEx()
Constructs a EditableLabelEx with no target component.


EditableLabelEx

public EditableLabelEx(Component target)
Constructs a EditableLabelEx and sets the specified component as its target.

Parameters:
target - - the target of the EditableLabelEx
Method Detail

processInput

public void processInput(java.lang.String inputName,
                         java.lang.Object inputValue)
Description copied from class: Component
Processes client input specific to the Component received from the UpdateManager. Derivative implementations should take care to invoke super.processInput().

Overrides:
processInput in class Component
Parameters:
inputName - the name of the input
inputValue - the value of the input
See Also:
Component.processInput(java.lang.String, java.lang.Object)

getTarget

public Component getTarget()
Returns:
Returns the target of the EditableLabelEx.

setTarget

public void setTarget(Component target)
Sets the current target of the EditableLabelEx. if this is not already a child of the EditableLabelEx, then it will be added as one.

Parameters:
target - The target to set.

isValidChild

public boolean isValidChild(Component component)
Description copied from class: Label
This component does not support children.

Overrides:
isValidChild in class Label
Parameters:
component - the Component to evaluate as a child
Returns:
true if the Component is a valid child
See Also:
Label.isValidChild(nextapp.echo2.app.Component)

synchroniseWithTarget

protected void synchroniseWithTarget()
This method is called internally to "synchronise" the value of the EditableLabelEx with its target component.

The default implementation will look to see if the component has a String getText() method and use that to set the text of the Label to be the same as its target.

You can overrride this method to synchronise the Label with any type of component. This method may be called multiple times and the target may be null so take this into account.


isSynchronisedWithTarget

public boolean isSynchronisedWithTarget()
Returns:
true if the Label's value will be syncrhnonised with its target component.

getText

public java.lang.String getText()
Description copied from class: Label
Returns the text of the label.

Overrides:
getText in class Label
Returns:
the text
See Also:
Label.getText()

setSynchronisedWithTarget

public void setSynchronisedWithTarget(boolean newValue)
If this is true, then the Label's value will be syncrhnonised with its target component.

Parameters:
newValue - - the new state of the boolean flag

getActivationMethod

public int getActivationMethod()

setActivationMethod

public void setActivationMethod(int newValue)
Sets the activation method for editing. This can be one of the following values

validate

public void validate()
Description copied from class: Component
A life-cycle method invoked before the component is rendered to ensure it is in a valid state. Default implementation is empty. Overriding implementations should ensure to invoke super.validate() out of convention.

Overrides:
validate in class Component
See Also:
Component.validate()