org.wings
Class SComponent

java.lang.Object
  extended by org.wings.SComponent
All Implemented Interfaces:
Serializable, Cloneable, Renderable
Direct Known Subclasses:
DragAndDropManager, SAbstractAdjustable, SAbstractIconTextCompound, SComboBox, SContainer, SFileChooser, SLabel, SList, SPopup, SPopupMenu, SProgressBar, SRawTextComponent, SSeparator, SSpacer, SSpinner, STable, STextComponent, STree

public abstract class SComponent
extends Object
implements Cloneable, Serializable, Renderable

Object having a graphical representation that can be displayed on the screen and that can interact with the user.

Author:
Armin Haaf
See Also:
Serialized Form

Field Summary
static int DONE_RENDERING
          Internal constants for fireRenderEvent(int)
protected  Map<Selector,Style> dynamicStyles
          Map of Selector to CSS Styles currently assigned to this component.
protected  boolean enabled
          Enabled / disabled.
protected  PropertyChangeSupport propertyChangeSupport
          PropertyChangeSupport
static Selector SELECTOR_ALL
          Global CSS selector
static int START_RENDERING
          Internal constants for fireRenderEvent(int)
protected  boolean visible
          Visibility of the component.
static int WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT
          Constants for conditions on which actions are triggered.
static int WHEN_IN_FOCUSED_FRAME
          Constants for conditions on which actions are triggered.
 
Constructor Summary
SComponent()
          Default empty constructor.
 
Method Summary
 void addComponentListener(SComponentListener l)
          Adds the specified component listener to receive component events from this component.
 void addDynamicStyle(Style style)
          Register a new CSS style on this component for a specfic CSS selector.
protected
<T extends EventListener>
void
addEventListener(Class<T> type, T listener)
          Adds an event listener for the given event class
 void addNotify()
          Method called to notify this SComponent that it has a new parent component.
 void addParentFrameListener(SParentFrameListener l)
          Registers a "parent frame listener" to receive events from this component when the parent frame chanegs i.e.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Add a PropertyChangeListener for a specific property.
 void addRenderListener(SRenderListener renderListener)
          Adds a listenere to this component which wil get notified when the rendering of this components starts.
 void addScriptListener(ScriptListener listener)
          Adds the specified component listener to receive component events from this component.
 void addStyle(String additionalCssClassName)
          Append a style class name to the style string.
 Object clone()
          Clone this component.
protected  void fireComponentChangeEvent(SComponentEvent aEvent)
          Reports a component change.
 void fireFinalEvents()
          Internal event trigger used by CGs.
protected  void fireKeyEvents()
          Internal method to trigger firing of key events.
 void fireRenderEvent(int type)
          Internal method called by the CGs to indicate different states of the rendering process.
 ActionMap getActionMap()
          Action map for key binding feature
 Color getBackground()
          Returns the current background color of this component.
 SBorder getBorder()
          Returns the border of this component or null if no border has been set.
 ComponentCG getCG()
          Return the look and feel delegate.
 Object getClientProperty(Object key)
          Returns the value of the property with the specified key.
 SPopupMenu getComponentPopupMenu()
           
 Style getDynamicStyle(Selector selector)
          Returns the style defined for the passed CSS selector.
 Collection getDynamicStyles()
          Returns the collection of currently defined CSS styles on this component.
 int getFocusTraversalIndex()
          returns the focus traversal index.
 SFont getFont()
          Return the font used inside this component.
 Color getForeground()
          Return the components foreground color.
 int getHorizontalAlignment()
          Return the value of the horizontal alignment property.
 InputMap getInputMap()
           
 InputMap getInputMap(int condition)
           
protected  int getListenerCount(Class type)
          Returns the number of listeners of the specified type for this component.
protected  Object[] getListenerList()
          Returns all the listeners of this component.
 EventListener[] getListeners(Class<? extends EventListener> type)
          Creates an typed array of all listeners of the specified type
 String getLowLevelEventId()
          Default implementation of the method in LowLevelEventListener.
 String getName()
          Gets the name property of a component.
 SContainer getParent()
          Return the parent container.
 SFrame getParentFrame()
          Return the parent frame.
 SDimension getPreferredSize()
          Get the preferred size of this component.
 RequestURL getRequestURL()
          The URL under which this component is accessible for the browser.
 boolean getResidesInForm()
          Return true, if this component is contained in a form.
 List<ScriptListener> getScriptListenerList()
          Returns the script listeners of this component.
 ScriptListener[] getScriptListeners()
          returns the script listeners of this component
 Session getSession()
          Return the session this component belongs to.
 boolean getShowAsFormComponent()
          Test, what display method is set.
 String getStyle()
           
 String getToolTipText()
          Return the tooltip text.
 int getVerticalAlignment()
          Return the value of the vertical alignment property.
 void invite(ComponentVisitor visitor)
          Invite a ComponentVisitor.
protected static boolean isDifferent(Object oldObject, Object newObject)
          use this method for changing a variable.
 boolean isEnabled()
          Return true if this component is enabled.
 boolean isFocusOwner()
          Returns true if this SComponent is owning the edit focus.
 boolean isRecursivelyVisible()
          Return the visibility.
 boolean isReloadForced()
           
protected  boolean isUpdatePossible()
           
 boolean isVisible()
          Return the local visibility.
protected  String paramString()
          Generates a string describing this SComponent.
protected  void processComponentEvent(SComponentListener listener, SComponentEvent e)
          Processes component events occurring on this component by dispatching them to any registered SComponentListener objects.
protected  boolean processKeyEvents(String[] values)
           
protected  void processLowLevelEvent(String name, String[] values)
           
 void putClientProperty(Object key, Object value)
          Add an arbitrary key/value "client property" to this component.
 void reload()
          Marks this component as subject to reload.
protected  void reloadIfChange(boolean oldVal, boolean newVal)
          Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.
protected  void reloadIfChange(byte oldVal, byte newVal)
          Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.
protected  void reloadIfChange(char oldVal, char newVal)
          Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.
protected  void reloadIfChange(double oldVal, double newVal)
          Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.
protected  void reloadIfChange(float oldVal, float newVal)
          Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.
protected  void reloadIfChange(int oldVal, int newVal)
          Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.
protected  void reloadIfChange(long oldVal, long newVal)
          Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.
protected  void reloadIfChange(Object oldVal, Object newVal)
          Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.
protected  void reloadIfChange(short oldVal, short newVal)
          Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.
 void removeComponentListener(SComponentListener l)
          Removes the specified component listener so that it no longer receives component events from this component.
 void removeDynamicStyle(Selector selector)
          Remove all CSS style definitions defined for the passed CSS selector.
protected
<T extends EventListener>
void
removeEventListener(Class<T> type, T listener)
          Removed named event listener.
 void removeNotify()
          Method called to notify this SComponent that it has no longer a parent component.
 void removeParentFrameListener(SParentFrameListener l)
          Removes the specified parent frame listener so that it no longer receives events from this component.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a PropertyChangeListener from the listener list.
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Remove a PropertyChangeListener for a specific property.
 void removeRenderListener(SRenderListener renderListener)
          Removes the named render listener.
 void removeScriptListener(ScriptListener listener)
          Removes the specified component listener so that it no longer receives component events from this component.
 void removeStyle(String cssStyleClassName)
          Remove a style class definiton from this component.
 void requestFocus()
          Requests the edit focus for this component for the following renderings by calling SFrame.setFocus(SComponent).
 void scrollRectToVisible(Rectangle aRect)
          Forwards the scrollRectToVisible() message to the SComponent's parent.
 void setActionMap(ActionMap actionMap)
          Binds action names to Actions.
 void setAttribute(CSSProperty property, String propertyValue)
          Assign or overwrite a CSS property/value pair on this component.
 void setAttribute(Selector selector, CSSProperty property, Color color)
          Convenience variant of setAttribute(org.wings.style.Selector, org.wings.style.CSSProperty, String).
 void setAttribute(Selector selector, CSSProperty property, SIcon icon)
          Convenience variant of setAttribute(org.wings.style.Selector, org.wings.style.CSSProperty, String).
 void setAttribute(Selector selector, CSSProperty property, String propertyValue)
          Assign or overwrite a CSS property/value pair at this component.
 void setAttribute(String cssPropertyName, String value)
          Defines a free text css property / value pair to this component.
 void setAttributes(Selector selector, CSSAttributeSet attributes)
           
 void setBackground(Color color)
          Set the components background color.
 void setBorder(SBorder border)
          Sets the border for this component.
 void setCG(ComponentCG newCG)
          Set the look and feel delegate for this component.
 void setComponentPopupMenu(SPopupMenu popupMenu)
           
 void setDynamicStyles(Collection dynamicStyles)
          Adds the passed collection of Style definitions.
 void setEnabled(boolean enabled)
          Set wether this component should be enabled.
 void setFocusTraversalIndex(int index)
          The index in which the focus is traversed using Tab.
 void setFont(SFont font)
          Set the font.
 void setForeground(Color color)
          Set the foreground color.
 void setHorizontalAlignment(int alignment)
          Set the horizontal alignment.
 void setInputMap(InputMap inputMap)
          Map for key binding feature.
 void setInputMap(int condition, InputMap inputMap)
          Sets The current input map.
 void setName(String uniqueName)
          Sets the name property of a component which must be unique!
Assigning the same name multiple times will cause strange results!

 void setNameRaw(String uncheckedName)
          Direct setter for name.
 void setParent(SContainer parent)
          Sets the parent container.
protected  void setParentFrame(SFrame parentFrame)
          Sets the parent frame.
 void setPreferredSize(SDimension preferredSize)
          Set the preferred size of the receiving component in pixel.
 void setReloadForced(boolean forced)
           
 void setShowAsFormComponent(boolean showAsFormComponent)
          Set display mode (href or form-component).
 void setStyle(String cssClassName)
          Set an CSS class name provided by the laf-provided Cascading Style Sheet (CSS), which should be applied to this component.
 void setToolTipText(String t)
          Set the tooltip text.
 void setVerticalAlignment(int alignment)
          Set the vertical alignment.
 void setVisible(boolean visible)
          Set the visibility.
 String toString()
          A string representation of this component.
 void update(Update update)
          Hands the given update to the Reload Manager.
 void updateCG()
          Notification from the CGFactory that the L&F has changed.
 void write(Device s)
          Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dynamicStyles

protected Map<Selector,Style> dynamicStyles
Map of Selector to CSS Styles currently assigned to this component.


visible

protected boolean visible
Visibility of the component.


enabled

protected boolean enabled
Enabled / disabled.


START_RENDERING

public static final int START_RENDERING
Internal constants for fireRenderEvent(int)

See Also:
Constant Field Values

DONE_RENDERING

public static final int DONE_RENDERING
Internal constants for fireRenderEvent(int)

See Also:
Constant Field Values

WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT

public static final int WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT
Constants for conditions on which actions are triggered. Mainly two cases: the focus has either to be at the component (or at a child) or somewhere in the parent frame.

See Also:
setInputMap(int, javax.swing.InputMap), Constant Field Values

WHEN_IN_FOCUSED_FRAME

public static final int WHEN_IN_FOCUSED_FRAME
Constants for conditions on which actions are triggered. Mainly two cases: the focus has either to be at the component (or at a child) or somewhere in the parent frame.

See Also:
setInputMap(int, javax.swing.InputMap), Constant Field Values

SELECTOR_ALL

public static final Selector SELECTOR_ALL
Global CSS selector


propertyChangeSupport

protected final PropertyChangeSupport propertyChangeSupport
PropertyChangeSupport

Constructor Detail

SComponent

public SComponent()
Default empty constructor. The method updateCG is called during construction time to get a cg delegate installed (renderer).

Method Detail

getBorder

public SBorder getBorder()
Returns the border of this component or null if no border has been set.

Returns:
the border object
See Also:
setBorder(SBorder)

setBorder

public void setBorder(SBorder border)
Sets the border for this component.

Parameters:
border - the border to be set for the component

getParent

public final SContainer getParent()
Return the parent container.

Returns:
the container this component resides in

setParent

public void setParent(SContainer parent)
Sets the parent container. Also gets the parent frame from the parent.

Parameters:
parent - the container

setParentFrame

protected void setParentFrame(SFrame parentFrame)
Sets the parent frame.

Parameters:
parentFrame - the frame

setComponentPopupMenu

public void setComponentPopupMenu(SPopupMenu popupMenu)

getComponentPopupMenu

public SPopupMenu getComponentPopupMenu()

getRequestURL

public RequestURL getRequestURL()
The URL under which this component is accessible for the browser. This is equivalent to the URL of the component's root frame, as this is the node externalized to the browser via the ReloadResource externalizer.

Returns:
The HTTP URL where this component can be accessed.

setPreferredSize

public void setPreferredSize(SDimension preferredSize)
Set the preferred size of the receiving component in pixel. It is not guaranteed that the component accepts this property because of missing implementations in the component cg or html properties. If width or height is zero, it is ignored and the browser defines the size.

See Also:
getPreferredSize()

getPreferredSize

public SDimension getPreferredSize()
Get the preferred size of this component.

See Also:
setPreferredSize(org.wings.SDimension)

addComponentListener

public final void addComponentListener(SComponentListener l)
Adds the specified component listener to receive component events from this component. If l is null, no exception is thrown and no action is performed.

Parameters:
l - the component listener.
See Also:
SComponentEvent, SComponentListener, removeComponentListener(org.wings.event.SComponentListener)

removeComponentListener

public final void removeComponentListener(SComponentListener l)
Removes the specified component listener so that it no longer receives component events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If l is null, no exception is thrown and no action is performed.

Parameters:
l - the component listener.
See Also:
SComponentEvent, SComponentListener, addComponentListener(org.wings.event.SComponentListener)

addParentFrameListener

public final void addParentFrameListener(SParentFrameListener l)
Registers a "parent frame listener" to receive events from this component when the parent frame chanegs i.e. via setParentFrame(SFrame). If l is null, no exception is thrown and no action is performed.

Parameters:
l - the parent frame listener. May be null.
See Also:
SParentFrameEvent, SParentFrameListener, removeParentFrameListener(org.wings.event.SParentFrameListener), removeNotify(), addNotify()

removeParentFrameListener

public final void removeParentFrameListener(SParentFrameListener l)
Removes the specified parent frame listener so that it no longer receives events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If l is null, no exception is thrown and no action is performed.

Parameters:
l - the parent frame listener.
See Also:
SParentFrameEvent, SParentFrameListener, addParentFrameListener(org.wings.event.SParentFrameListener), removeNotify(), addNotify()

fireComponentChangeEvent

protected void fireComponentChangeEvent(SComponentEvent aEvent)
Reports a component change.

Parameters:
aEvent - report this event to all listeners
See Also:
SComponentListener

processComponentEvent

protected void processComponentEvent(SComponentListener listener,
                                     SComponentEvent e)
Processes component events occurring on this component by dispatching them to any registered SComponentListener objects.

This method is not called unless component events are enabled for this component. Component events are enabled when one of the following occurs:

Parameters:
e - the component event.
See Also:
SComponentEvent, SComponentListener, addComponentListener(org.wings.event.SComponentListener)

addScriptListener

public final void addScriptListener(ScriptListener listener)
Adds the specified component listener to receive component events from this component. If l is null, no exception is thrown and no action is performed. If there is already a ScriptListener which is equal, the new one is not added.

Parameters:
listener - the component listener.
See Also:
SComponentEvent, SComponentListener, removeComponentListener(org.wings.event.SComponentListener)

removeScriptListener

public final void removeScriptListener(ScriptListener listener)
Removes the specified component listener so that it no longer receives component events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If l is null, no exception is thrown and no action is performed.

Parameters:
listener - the component listener.
See Also:
SComponentEvent, SComponentListener, addComponentListener(org.wings.event.SComponentListener)

getScriptListeners

public ScriptListener[] getScriptListeners()
returns the script listeners of this component

Returns:
the ScriptListener Array.

getScriptListenerList

public List<ScriptListener> getScriptListenerList()
Returns the script listeners of this component.

Returns:
The ScriptListeners in a List.

setName

public void setName(String uniqueName)
Sets the name property of a component which must be unique!
Assigning the same name multiple times will cause strange results!

Valid names must begin with a letter ([A-Za-z]), underscores ("_") or dollars ("$") and may be followed by any number of letters, digits ([0-9]), underscores ("_") and dollars ("$")

If no name is set, it is generated when necessary.

Explanation: This property is an identifier which is used inside the generated HTML as an element identifier (id="") and sometimes as a javascript function name.

Parameters:
uniqueName - A unique name to set. Only valid identifier as described are allowed!
See Also:
Character

setNameRaw

public void setNameRaw(String uncheckedName)
Direct setter for name. Do not use unless you explicitly know what you're doing! (Former package) protected raw setter for component name to avoid sanity check.

Parameters:
uncheckedName - String to use as componentn name/identifier.

getName

public final String getName()
Gets the name property of a component. This property is an identifier,so it should be always unique. For details refer to setName(String)

Returns:
The name of the component.

getSession

public final Session getSession()
Return the session this component belongs to.

Returns:
the session

setStyle

public void setStyle(String cssClassName)
Set an CSS class name provided by the laf-provided Cascading Style Sheet (CSS), which should be applied to this component.

Note: Probably the addStyle(String) method is more what you want.

By default this is set to the wingS component class name (i.e. "SLabel").

The PLAFs render the value of this String to an class="cssClassName" attribute inside the generated HTML code of this component.

The default wingS plaf initializes this by default to the wingS component class name (i.e. SButton for button instances).
Please be aware if you replace this default value, the default wingS style will no longer take effect, as they operate on these default styles. To avoid this you should append your CSS styles via spaces i.e.
c.setStyle(c.getStyle + "myStyle");

Parameters:
cssClassName - The new CSS name value for this component
See Also:
addStyle(String), removeStyle(String)

addStyle

public void addStyle(String additionalCssClassName)
Append a style class name to the style string. Use this method if you want to append a specific CSS class to a componentn without loosing the other CSS styles assigned to the component (i.e. the wingS default styles.)

Parameters:
additionalCssClassName - The style class to remove (if existing).
See Also:
removeStyle(String)

removeStyle

public void removeStyle(String cssStyleClassName)
Remove a style class definiton from this component.

Parameters:
cssStyleClassName - The style class to remove (if existing).

getStyle

public String getStyle()
Returns:
The current CSS style class name. Defaults to the unqualified wingS component class name.
See Also:
setStyle(String)

addDynamicStyle

public void addDynamicStyle(Style style)
Register a new CSS style on this component for a specfic CSS selector.

Typically you will want to use the method setAttribute(org.wings.style.CSSProperty, String) to specify a single CSS property/value pair on this component.

Parameters:
style - A Style instance.

removeDynamicStyle

public void removeDynamicStyle(Selector selector)
Remove all CSS style definitions defined for the passed CSS selector.

Parameters:
selector - The selector. The default selector for most CSS attributes is SELECTOR_ALL.

getDynamicStyle

public Style getDynamicStyle(Selector selector)
Returns the style defined for the passed CSS selector.

Parameters:
selector - The CSS selector the style to retrieve. See Style.getSelector(). The default selector for most CSS styles is SELECTOR_ALL.
Returns:
A style (collection of css property/value pairs) or null

setDynamicStyles

public void setDynamicStyles(Collection dynamicStyles)
Adds the passed collection of Style definitions. Existing Styles for the same CSS selectors (see Style.getSelector()) are overwritten.

Parameters:
dynamicStyles - A collection collection of Style definitions.

getDynamicStyles

public Collection getDynamicStyles()
Returns the collection of currently defined CSS styles on this component.

Returns:
A unmodifyable collection of Style instances.

setAttribute

public void setAttribute(String cssPropertyName,
                         String value)
Defines a free text css property / value pair to this component. The CSS property will appear as an inline style in the generated HTML code.


setAttribute

public void setAttribute(CSSProperty property,
                         String propertyValue)
Assign or overwrite a CSS property/value pair on this component. This CSS property definition will use a CSS selector which adresses this component as whole as CSS selector (new CSSProperty(this)). The CSS property will appear as an inline style in the generated HTML code.

Parameters:
property - The CSS property (i.e. CSSProperty.BACKGROUND).
propertyValue - A valid string value for this CSS property (i.e. red or #fff in our example).

setAttribute

public void setAttribute(Selector selector,
                         CSSProperty property,
                         String propertyValue)
Assign or overwrite a CSS property/value pair at this component. This CSS property definition will use the CSS selector you passed, so in the most exotic case it could affect a totally different component or component area. Typically you use this method to assign CSS property values to pseudo CSS selectors Selector. This are selector affecting only a part of a component and not the component at all.. The CSS property will appear as an inline style in the generated HTML code.

Parameters:
selector - A valid CSS selector. Typically values are i.e. the SELECTOR_ALL or other SELECTOR_xxx value instances declared in the component. (look ie. at STabbedPane.SELECTOR_CONTENT) or manually constructed instances of Selector. In most case setAttribute(org.wings.style.CSSProperty, String) will be your choice.
property - The css property you want to define a value for
propertyValue - A valid string value for this property.

setAttribute

public void setAttribute(Selector selector,
                         CSSProperty property,
                         SIcon icon)
Convenience variant of setAttribute(org.wings.style.Selector, org.wings.style.CSSProperty, String). Converts the passed icon into a URL and applies the according CSS style.

Parameters:
selector - A valid CSS selector. Typically values are i.e. the SELECTOR_ALL or other SELECTOR_xxx value instances declared in the component. (look ie. at STabbedPane.SELECTOR_CONTENT) or manually constructed instances of Selector. In most case setAttribute(org.wings.style.CSSProperty, String) will be your choice.
property - The css property you want to define a value for (in this case mostly something like CSSProperty.BACKGROUND_IMAGE.
icon - The icon you want to assign.

setAttribute

public void setAttribute(Selector selector,
                         CSSProperty property,
                         Color color)
Convenience variant of setAttribute(org.wings.style.Selector, org.wings.style.CSSProperty, String). Converts the passed color into according color string.

Parameters:
selector - A valid CSS selector. Typically values are i.e. the SELECTOR_ALL or other SELECTOR_xxx value instances declared in the component. (look ie. at STabbedPane.SELECTOR_CONTENT) or manually constructed instances of Selector. In most case setAttribute(org.wings.style.CSSProperty, String) will be your choice.
property - The css property you want to define a value for (in this case mostly something like CSSProperty.BACKGROUND_IMAGE.
color - The color value you want to assign.

setAttributes

public void setAttributes(Selector selector,
                          CSSAttributeSet attributes)

getBackground

public Color getBackground()
Returns the current background color of this component.

Returns:
The current background color or null

setBackground

public void setBackground(Color color)
Set the components background color.

Parameters:
color - the new background color or null

getForeground

public Color getForeground()
Return the components foreground color.

Returns:
the foreground color or null

setForeground

public void setForeground(Color color)
Set the foreground color.

Parameters:
color - the new foreground color or null

setFont

public void setFont(SFont font)
Set the font.

Parameters:
font - the new font

getFont

public SFont getFont()
Return the font used inside this component.

Returns:
The current font declaration or null

setVisible

public void setVisible(boolean visible)
Set the visibility.

Parameters:
visible - wether this component will show or not

isVisible

public boolean isVisible()
Return the local visibility. If set to true this ccmponent should be visible if all parent components are visible, too.

Returns:
true If the component and it's children should show, false otherwise
See Also:
isRecursivelyVisible()

isRecursivelyVisible

public boolean isRecursivelyVisible()
Return the visibility. If the Component itself or any of it's parent is invisible, this method will return false.

Returns:
true if this component and all it's ancestors are visible, false otherwise.

setEnabled

public void setEnabled(boolean enabled)
Set wether this component should be enabled.

Parameters:
enabled - true if the component is enabled, false otherwise

isEnabled

public boolean isEnabled()
Return true if this component is enabled.

Returns:
true if component is enabled

reload

public void reload()
Marks this component as subject to reload. The component will be registered with the ReloadManager.


update

public void update(Update update)
Hands the given update to the Reload Manager.

Parameters:
update - the update for this component

isUpdatePossible

protected boolean isUpdatePossible()

isReloadForced

public boolean isReloadForced()

setReloadForced

public void setReloadForced(boolean forced)

reloadIfChange

protected final void reloadIfChange(Object oldVal,
                                    Object newVal)
Mark this component as subject to reload if the property, that is given in its old and new fashion, changed. Fires an PropertyChangeEvent with the property name, the old value and the new value

Parameters:
oldVal - the old value of some property
newVal - the new value of some property

reloadIfChange

protected final void reloadIfChange(int oldVal,
                                    int newVal)
Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.

Parameters:
oldVal - the old value of some property
newVal - the new value of some property

reloadIfChange

protected final void reloadIfChange(boolean oldVal,
                                    boolean newVal)
Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.

Parameters:
oldVal - the old value of some property
newVal - the new value of some property

reloadIfChange

protected final void reloadIfChange(byte oldVal,
                                    byte newVal)
Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.

Parameters:
oldVal - the old value of some property
newVal - the new value of some property

reloadIfChange

protected final void reloadIfChange(short oldVal,
                                    short newVal)
Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.

Parameters:
oldVal - the old value of some property
newVal - the new value of some property

reloadIfChange

protected final void reloadIfChange(long oldVal,
                                    long newVal)
Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.

Parameters:
oldVal - the old value of some property
newVal - the new value of some property

reloadIfChange

protected final void reloadIfChange(float oldVal,
                                    float newVal)
Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.

Parameters:
oldVal - the old value of some property
newVal - the new value of some property

reloadIfChange

protected final void reloadIfChange(double oldVal,
                                    double newVal)
Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.

Parameters:
oldVal - the old value of some property
newVal - the new value of some property

reloadIfChange

protected final void reloadIfChange(char oldVal,
                                    char newVal)
Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.

Parameters:
oldVal - the old value of some property
newVal - the new value of some property

write

public void write(Device s)
           throws IOException
Mark this component as subject to reload if the property, that is given in its old and new fashion, changed.

Specified by:
write in interface Renderable
Throws:
IOException

toString

public String toString()
A string representation of this component. Uses the paramString() methods

Overrides:
toString in class Object
Returns:
string representation of this component with all properties.

paramString

protected String paramString()
Generates a string describing this SComponent. This method is mainly for debugging purposes.

Returns:
a string containing all properties

getLowLevelEventId

public String getLowLevelEventId()
Default implementation of the method in LowLevelEventListener.


getParentFrame

public SFrame getParentFrame()
Return the parent frame.

NOTE: You will receive null if you call this i.e. during component creation time, as the parent frame is set when you add it to a visible SContainer. Use addParentFrameListener(org.wings.event.SParentFrameListener) in this case.

Returns:
the parent frame
See Also:
addParentFrameListener(org.wings.event.SParentFrameListener)

getResidesInForm

public boolean getResidesInForm()
Return true, if this component is contained in a form.

Returns:
true, if this component resides in a form, false otherwise

setToolTipText

public void setToolTipText(String t)
Set the tooltip text. To style use HTML tags.

Parameters:
t - the new tooltip text

getToolTipText

public String getToolTipText()
Return the tooltip text.

Returns:
the tooltip text

setFocusTraversalIndex

public void setFocusTraversalIndex(int index)
The index in which the focus is traversed using Tab. This is a very simplified notion of traversing the focus, but that is, what browser like interfaces currently offer. This has a bit rough edge, since you have to make sure, that the index is unique within the whole frame. You probably don't want to change this programmatically, but this is set usually by the template property manager.

Parameters:
index - the focus traversal index. Pressing the focus traversal key (usually TAB) in the browser jumps to the next index. Must not be zero.

getFocusTraversalIndex

public int getFocusTraversalIndex()
returns the focus traversal index.

See Also:
setFocusTraversalIndex(int)

clone

public Object clone()
Clone this component.

Overrides:
clone in class Object
Returns:
a clone of this component

getHorizontalAlignment

public int getHorizontalAlignment()
Return the value of the horizontal alignment property.

Returns:
the horizontal alignment
See Also:
SConstants

setHorizontalAlignment

public void setHorizontalAlignment(int alignment)
Set the horizontal alignment.

Parameters:
alignment - new value for the horizontal alignment
See Also:
SConstants

setVerticalAlignment

public void setVerticalAlignment(int alignment)
Set the vertical alignment.

Parameters:
alignment - new value for the vertical alignment
See Also:
SConstants

getVerticalAlignment

public int getVerticalAlignment()
Return the value of the vertical alignment property.

Returns:
the vertical alignment
See Also:
SConstants

getClientProperty

public final Object getClientProperty(Object key)
Returns the value of the property with the specified key. Only properties added with putClientProperty will return a non-null value.

Returns:
the value of this property or null
See Also:
putClientProperty(java.lang.Object, java.lang.Object)

putClientProperty

public final void putClientProperty(Object key,
                                    Object value)
Add an arbitrary key/value "client property" to this component.

The get/putClientProperty methods provide access to a small per-instance hashtable. Callers can use get/putClientProperty to annotate components that were created by another module, e.g. a layout manager might store per child constraints this way. For example:

 componentA.putClientProperty("to the left of", componentB);
 

If value is null this method will remove the property. Changes to client properties are reported with PropertyChange events. The name of the property (for the sake of PropertyChange events) is key.toString().

The clientProperty dictionary is not intended to support large scale extensions to SComponent nor should be it considered an alternative to subclassing when designing a new component.

See Also:
getClientProperty(java.lang.Object)

setCG

public void setCG(ComponentCG newCG)
Set the look and feel delegate for this component. SComponent subclasses generally override this method to narrow the argument type, e.g. in STextField:
 public void setCG(TextFieldCG newCG) {
     super.setCG(newCG);
 }
 

See Also:
updateCG(), CGManager.getLookAndFeel(), CGManager.getCG(org.wings.SComponent)

getCG

public ComponentCG getCG()
Return the look and feel delegate.

Returns:
the componet's cg

updateCG

public void updateCG()
Notification from the CGFactory that the L&F has changed.

See Also:
updateCG()

invite

public void invite(ComponentVisitor visitor)
            throws Exception
Invite a ComponentVisitor. Invokes visit(SComponent) on the ComponentVisitor.

Parameters:
visitor - the visitor to be invited
Throws:
Exception

isDifferent

protected static boolean isDifferent(Object oldObject,
                                     Object newObject)
use this method for changing a variable. if a new value is different from the old value set the new one and notify e.g. the reloadmanager...


addEventListener

protected final <T extends EventListener> void addEventListener(Class<T> type,
                                                                T listener)
Adds an event listener for the given event class

Parameters:
type - The class/type of events to listen to.
listener - The listener itself.

removeEventListener

protected final <T extends EventListener> void removeEventListener(Class<T> type,
                                                                   T listener)
Removed named event listener.

Parameters:
type - The class/type of events to listen to.
listener - The listener itself.

getListenerCount

protected final int getListenerCount(Class type)
Returns the number of listeners of the specified type for this component.

Parameters:
type - The type of listeners
Returns:
The number of listeners
See Also:
EventListenerList

getListenerList

protected final Object[] getListenerList()
Returns all the listeners of this component. For performance reasons, this is the actual data structure and so no modification of this array should be made.

Returns:
All listeners of this component. The result array has a pair structure, the first element of each pair is the listener type, the second the listener itself. It is guaranteed that this returns a non-null array.
See Also:
EventListenerList

getListeners

public final EventListener[] getListeners(Class<? extends EventListener> type)
Creates an typed array of all listeners of the specified type

Parameters:
type - All listeners of this type are added to the result array
Returns:
an array of the specified type with all listeners of the specified type
See Also:
EventListenerList

addRenderListener

public final void addRenderListener(SRenderListener renderListener)
Adds a listenere to this component which wil get notified when the rendering of this components starts. (This happens after all events / request has been processed and wingS starts to build the response).

Parameters:
renderListener -
See Also:
SRenderListener

removeRenderListener

public final void removeRenderListener(SRenderListener renderListener)
Removes the named render listener.

Parameters:
renderListener - Render listener to remove
See Also:
addRenderListener(org.wings.event.SRenderListener), SRenderListener

fireRenderEvent

public final void fireRenderEvent(int type)
Internal method called by the CGs to indicate different states of the rendering process.

Parameters:
type - Either DONE_RENDERING or START_RENDERING.

scrollRectToVisible

public void scrollRectToVisible(Rectangle aRect)
Forwards the scrollRectToVisible() message to the SComponent's parent. Components that can service the request, such as SScrollPane, override this method and perform the scrolling.

Parameters:
aRect - the visible Rectangle
See Also:
SScrollPane

requestFocus

public void requestFocus()
Requests the edit focus for this component for the following renderings by calling SFrame.setFocus(SComponent).


isFocusOwner

public boolean isFocusOwner()
Returns true if this SComponent is owning the edit focus.

Returns:
true if this SComponent is owning the edit focus otherwise false
See Also:
requestFocus()

setShowAsFormComponent

public void setShowAsFormComponent(boolean showAsFormComponent)
Set display mode (href or form-component). An AbstractButton can appear as HTML-Form-Button or as HTML-HREF. If button is inside a SForm the default is displaying it as html form button. Setting showAsFormComponent to false will force displaying as href even if button is inside a form.

Parameters:
showAsFormComponent - if true, display as link, if false as html form component.

getShowAsFormComponent

public boolean getShowAsFormComponent()
Test, what display method is set.

Returns:
true, if displayed as link, false when displayed as html form component.
See Also:
setShowAsFormComponent(boolean)

setActionMap

public void setActionMap(ActionMap actionMap)
Binds action names to Actions. Use for key binding feature.

Parameters:
actionMap - The new action map.
See Also:
setInputMap(javax.swing.InputMap), ActionMap, InputMap

getActionMap

public ActionMap getActionMap()
Action map for key binding feature

Returns:
The current action map
See Also:
setActionMap(javax.swing.ActionMap)

setInputMap

public void setInputMap(InputMap inputMap)
Map for key binding feature. (?) Binds input keystrokes to action names (?).

Parameters:
inputMap - The current input map.
See Also:
InputMap, ActionMap, setActionMap(javax.swing.ActionMap), JComponent.setInputMap(int, javax.swing.InputMap)

setInputMap

public void setInputMap(int condition,
                        InputMap inputMap)
Sets The current input map.

Parameters:
inputMap - The new input map
condition - Either WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT or WHEN_IN_FOCUSED_FRAME
See Also:
JComponent.setInputMap(int, javax.swing.InputMap)

getInputMap

public InputMap getInputMap()
Returns:
The input map for the condition WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT
See Also:
setInputMap(javax.swing.InputMap)

getInputMap

public InputMap getInputMap(int condition)
Parameters:
condition - Either WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT or WHEN_IN_FOCUSED_FRAME
Returns:
The input map for the given condition.
See Also:
setInputMap(int, javax.swing.InputMap)

processLowLevelEvent

protected void processLowLevelEvent(String name,
                                    String[] values)

processKeyEvents

protected boolean processKeyEvents(String[] values)

fireFinalEvents

public void fireFinalEvents()
Internal event trigger used by CGs. This Method is called internal and should not be called directly


fireKeyEvents

protected void fireKeyEvents()
Internal method to trigger firing of key events.


removeNotify

public void removeNotify()
Method called to notify this SComponent that it has no longer a parent component. This Method is called internal and should not be called directly, but can be overerloaded to react on this event.


addNotify

public void addNotify()
Method called to notify this SComponent that it has a new parent component. This Method is called internal and should not be called directly, but can be overerloaded to react on this event.


addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. The listener is registered for all properties.


removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list.


addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property.


removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property.



wingS Swings ;-)