Package com.groiss.gui
Class AbstractComponent
java.lang.Object
com.groiss.gui.AbstractComponent
- All Implemented Interfaces:
Component
,Serializable
,Cloneable
- Direct Known Subclasses:
AbstractContainer
,Checkbox
,ComparableComponent
,FileChooser
,Image
,Link
,RadioButton
,RadioGroup
,SelectList
,SubmitButton
,Text
,Textarea
,Textfield
abstract implementation of the component interface
with some common code for subclasses
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final short
some view modesprotected short
for which browser should the component be renderedstatic final short
some browser modesstatic final String
the id of attribute of a componentstatic final short
static final short
protected boolean
shows if the component can listen to eventsprotected Label
the reference to the component, which is the label of this componentstatic final short
static final String
static final String
some defined events specially for select listsstatic final String
some defined common eventsstatic final String
static final String
some defined events for components that can get the focusstatic final String
static final String
static final String
static final String
some defined events specially for the htmlpagestatic final String
static final String
static final String
static final String
static final String
static final String
some defined events specially for textareas and inputfieldsstatic final String
some defined events specially for the formcontainerstatic final String
protected Container
protected Element
the parent element of the components rootstatic final short
protected Element
the root element of the internal JDOM-Tree of the componentprotected short
how should the component be renderedFields inherited from interface com.groiss.gui.Component
LABELLEDBY
-
Constructor Summary
ConstructorDescriptionAbstractComponent
(String name) AbstractComponent
(String name, String id, String className) constructs a new empty component and creates an internal JDOM that consists of an empty root elementAbstractComponent
(Element root) constructs a new component from an existing JDOM the root element must have an id attribute -
Method Summary
Modifier and TypeMethodDescriptionadd the given CSS class(es) to the list of existing CSS-classesclone()
returns a copy of the Component objectstatic Component
Create element from domgetAttribute
(String name) returs the value of an attributeshort
getId()
getLabel()
getName()
getRoot()
returns the root element of the internal JDOMgetStyle()
short
void
void
initialize the component with an new jdom-treevoid
Initialize the component with a jdom-tree.boolean
removeAttribute
(String name) Remove the attribute from the component.removeClass
(String clazz) remove the given CSS class(es) from the list of existing CSS-classesvoid
setActionListener
(String event, String action) Sets the action to an event.setAttribute
(String name, String value) sets the attribute to the componentvoid
setBrowserMode
(short mode) sets the browserModeset the CSS-class attribute to the given valuevoid
setContent
(Object o) sets the content of the componentvoid
setEncoding
(boolean val) Deprecated.method does nothingvoid
setExpandEmptyElements
(boolean val) Deprecated.method does nothingvoid
set the unique identifier to a given value.void
setIndenting
(boolean val) Deprecated.method does nothingvoid
sets the label componentvoid
set the name to a given value.void
setNewLines
(boolean val) Deprecated.method does nothingvoid
sets the parent containervoid
setParentElement
(Element parent) sets the parent element of the components rootvoid
setRootName
(String name) set the name of the root element to a given value.void
Set the stylevoid
setViewMode
(short mode) sets the viewModeshow()
method for rendering the component as stringvoid
show
(PrintWriter pw) prints the rendered component to a PrintWritertoggleClass
(String clazz, boolean add) remove or add the given CSS class(es) from the list of existing CSS-classes depending on a conditiontoString()
Returns the classname followed by a colon and the title attribute.
-
Field Details
-
ACTIVE
public static final short ACTIVEsome view modes- See Also:
-
READONLY
public static final short READONLY- See Also:
-
INVISIBLE
public static final short INVISIBLE- See Also:
-
DEFAULT
public static final short DEFAULTsome browser modes- See Also:
-
NS
public static final short NS- See Also:
-
IE
public static final short IE- See Also:
-
ON_CLICK
some defined common events- See Also:
-
ON_DBLCLICK
- See Also:
-
ON_MOUSE_DOWN
- See Also:
-
ON_MOUSE_UP
- See Also:
-
ON_MOUSE_MOVE
- See Also:
-
ON_MOUSE_OUT
- See Also:
-
ON_KEY_PRESS
- See Also:
-
ON_KEY_DOWN
- See Also:
-
ON_KEY_UP
- See Also:
-
ON_FOCUS
some defined events for components that can get the focus- See Also:
-
ON_BLUR
- See Also:
-
ON_LOAD
some defined events specially for the htmlpage- See Also:
-
ON_UNLOAD
- See Also:
-
ON_SUBMIT
some defined events specially for the formcontainer- See Also:
-
ON_RESET
- See Also:
-
ON_SELECT
some defined events specially for textareas and inputfields- See Also:
-
ON_CHANGE
some defined events specially for select lists- See Also:
-
viewMode
protected short viewModehow should the component be rendered -
browserMode
protected short browserModefor which browser should the component be rendered -
isSensitive
protected boolean isSensitiveshows if the component can listen to events -
ID
the id of attribute of a component- See Also:
-
parentElem
the parent element of the components root -
parent
-
root
the root element of the internal JDOM-Tree of the component -
label
the reference to the component, which is the label of this component
-
-
Constructor Details
-
AbstractComponent
public AbstractComponent() -
AbstractComponent
constructs a new component from an existing JDOM the root element must have an id attribute- Parameters:
root
- - the root JDOM element
-
AbstractComponent
constructs a new empty component and creates an internal JDOM that consists of an empty root element- Parameters:
name
- - the name of the root elementid
- - the id of the componentclassName
- - the name of the component class
-
AbstractComponent
-
-
Method Details
-
init
Initialize the component with a jdom-tree. -
init
-
init
initialize the component with an new jdom-tree -
setAttribute
sets the attribute to the component- Specified by:
setAttribute
in interfaceComponent
- Parameters:
name
- - the name of the attributevalue
- - the value of the attribute- Returns:
- the updated component
-
getAttribute
returs the value of an attribute- Specified by:
getAttribute
in interfaceComponent
- Parameters:
name
- - the name of the attribute- Returns:
- - the value of the attribute
-
removeAttribute
Remove the attribute from the component.- Specified by:
removeAttribute
in interfaceComponent
- Parameters:
name
- - the name of the attribute- Returns:
- - true, if the attribute was found
-
setActionListener
Sets the action to an event. A synonym to setAttribute.- Specified by:
setActionListener
in interfaceComponent
- Parameters:
event
- the event to listenaction
- the action to perform
-
setId
set the unique identifier to a given value. Handle with care! -
getId
-
setName
set the name to a given value. -
getName
-
setRootName
set the name of the root element to a given value.- Parameters:
name
- - the new name of the root element
-
getRootName
- Returns:
- - the name of the root element
-
setLabel
sets the label component -
getLabel
-
setParentElement
sets the parent element of the components root- Specified by:
setParentElement
in interfaceComponent
- Parameters:
parent
- - the parent element
-
getParentElement
- Specified by:
getParentElement
in interfaceComponent
- Returns:
- - the parent element of the components root
-
setParent
sets the parent container -
getParent
-
setViewMode
public void setViewMode(short mode) sets the viewMode- Specified by:
setViewMode
in interfaceComponent
- Parameters:
mode
- - the new viewMode
-
getViewMode
public short getViewMode()- Specified by:
getViewMode
in interfaceComponent
- Returns:
- - the viewMode of the component
-
setBrowserMode
public void setBrowserMode(short mode) sets the browserMode- Specified by:
setBrowserMode
in interfaceComponent
- Parameters:
mode
- - the new browserMode
-
getBrowserMode
public short getBrowserMode()- Specified by:
getBrowserMode
in interfaceComponent
- Returns:
- - the browserMode of the component
-
setStyle
Set the style -
getStyle
-
show
Description copied from interface:Component
method for rendering the component as string -
show
prints the rendered component to a PrintWriter -
toString
Returns the classname followed by a colon and the title attribute. The string representation is sometimes used for sorting, e.g. TableRenderer. -
clone
returns a copy of the Component object -
getRoot
returns the root element of the internal JDOM -
setContent
sets the content of the component- Specified by:
setContent
in interfaceComponent
- Parameters:
o
- any object where the string representation is used for rendering
-
getContent
- Specified by:
getContent
in interfaceComponent
- Returns:
- the content object of the component
-
setNewLines
Deprecated.method does nothing- Parameters:
val
- - boolean value
-
setEncoding
Deprecated.method does nothing- Parameters:
val
- - boolean value
-
setExpandEmptyElements
Deprecated.method does nothing- Parameters:
val
- - boolean value
-
setIndenting
Deprecated.method does nothing- Parameters:
val
- - boolean value
-
create
Create element from dom- Parameters:
root
- - the root JDOM element- Returns:
- the new component
-
toggleClass
Description copied from interface:Component
remove or add the given CSS class(es) from the list of existing CSS-classes depending on a condition- Specified by:
toggleClass
in interfaceComponent
- Parameters:
clazz
- blank separated list of CSS classes to be added/removedadd
- - condition to add (true
) or remove (false
) the classes- Returns:
- the current CSS classes
-
addClass
Description copied from interface:Component
add the given CSS class(es) to the list of existing CSS-classes -
removeClass
Description copied from interface:Component
remove the given CSS class(es) from the list of existing CSS-classes- Specified by:
removeClass
in interfaceComponent
- Parameters:
clazz
- blank separated list of CSS classes to be removed- Returns:
- the current CSS classes
-
setClass
Description copied from interface:Component
set the CSS-class attribute to the given value
-