com.groiss.gui
Class AbstractComponent

java.lang.Object
  extended by com.groiss.gui.AbstractComponent
All Implemented Interfaces:
Component, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
AbstractContainer, Checkbox, ComparableComponent, FileChooser, Image, Link, RadioButton, RadioGroup, SelectList, SubmitButton, Text, Textarea, Textfield

public abstract class AbstractComponent
extends java.lang.Object
implements Component

abstract implementation of the component interface with some common code for subclasses

See Also:
Serialized Form

Field Summary
protected  java.util.Map actions
           
static short ACTIVE
          some view modes
protected  short browserMode
          for which browser should the component be rendered
static short DEFAULT
          some browser modes
static java.lang.String ID
          the id of attribute of a component
static short IE
           
static short INVISIBLE
           
protected  boolean isSensitive
          shows if the component can listen to events
protected  Label label
          the reference to the component, which is the label of this component
static short NS
           
static java.lang.String ON_BLUR
           
static java.lang.String ON_CHANGE
          some defined events specially for select lists
static java.lang.String ON_CLICK
          some defined common events
static java.lang.String ON_DBLCLICK
           
static java.lang.String ON_FOCUS
          some defined events for components that can get the focus
static java.lang.String ON_KEY_DOWN
           
static java.lang.String ON_KEY_PRESS
           
static java.lang.String ON_KEY_UP
           
static java.lang.String ON_LOAD
          some defined events specially for the htmlpage
static java.lang.String ON_MOUSE_DOWN
           
static java.lang.String ON_MOUSE_MOVE
           
static java.lang.String ON_MOUSE_OUT
           
static java.lang.String ON_MOUSE_UP
           
static java.lang.String ON_RESET
           
static java.lang.String ON_SELECT
          some defined events specially for textareas and inputfields
static java.lang.String ON_SUBMIT
          some defined events specially for the formcontainer
static java.lang.String ON_UNLOAD
           
protected static org.jdom.output.XMLOutputter outputter
          the renderer for the JDOM-Tree
protected  Container parent
           
protected  org.jdom.Element parentElem
          the parent element of the components root
static short READONLY
           
protected  org.jdom.Element root
          the root element of the internal JDOM-Tree of the component
protected  short viewMode
          how should the component be rendered
 
Constructor Summary
AbstractComponent()
           
AbstractComponent(org.jdom.Element root)
          constructs a new component from an existing JDOM the root element must have an id attribute
AbstractComponent(java.lang.String name)
           
AbstractComponent(java.lang.String name, java.lang.String id, java.lang.String className)
          constructs a new empty component and creates an internal JDOM that consists of an empty root element
 
Method Summary
 java.lang.Object clone()
          returns a copy of the Component object
static Component create(org.jdom.Element root)
          Create element from dom
 java.lang.String getActionListener(java.lang.String event)
          returs the value of an attribute
 java.lang.String getAttribute(java.lang.String name)
          returs the value of an attribute
 short getBrowserMode()
           
 java.lang.Object getContent()
           
 java.lang.String getId()
           
 Label getLabel()
           
 java.lang.String getName()
           
 Container getParent()
           
 org.jdom.Element getParentElement()
           
 org.jdom.Element getRoot()
          returns the root element of the internal JDOM
 java.lang.String getRootName()
           
 java.lang.String getStyle()
           
 short getViewMode()
           
 void init(org.jdom.Element element)
          Initialize the component with a jdom-tree.
 void init(java.lang.String name)
           
 void init(java.lang.String name, java.lang.String id, java.lang.String className)
          initialize the component with an new jdom-tree
 boolean removeAttribute(java.lang.String name)
          Remove the attribute from the component.
 void setActionListener(java.lang.String event, java.lang.String action)
          Sets the action to an event.
 Component setAttribute(java.lang.String name, java.lang.String value)
          sets the attribute to the component
 void setBrowserMode(short mode)
          sets the browserMode
 void setContent(java.lang.Object o)
          sets the content of the component
 void setEncoding(boolean val)
           
 void setExpandEmptyElements(boolean val)
           
 void setId(java.lang.String id)
          set the unique identifier to a given value.
 void setIndenting(boolean val)
           
 void setLabel(Label c)
          sets the label component
 void setName(java.lang.String name)
          set the name to a given value.
 void setNewLines(boolean val)
           
 void setParent(Container parent)
          sets the parent container
 void setParentElement(org.jdom.Element parent)
          sets the parent element of the components root
 void setRootName(java.lang.String name)
          set the name of the root element to a given value.
 void setStyle(java.lang.String style)
          Set the style
 void setViewMode(short mode)
          sets the viewMode
 java.lang.String show()
          method for rendering the component as string
 void show(java.io.PrintWriter pw)
          prints the rendered component to a PrintWriter
 java.lang.String toString()
          Returns the classname followed by a colon and the title attribute.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTIVE

public static final short ACTIVE
some view modes

See Also:
Constant Field Values

READONLY

public static final short READONLY
See Also:
Constant Field Values

INVISIBLE

public static final short INVISIBLE
See Also:
Constant Field Values

DEFAULT

public static final short DEFAULT
some browser modes

See Also:
Constant Field Values

NS

public static final short NS
See Also:
Constant Field Values

IE

public static final short IE
See Also:
Constant Field Values

ON_CLICK

public static final java.lang.String ON_CLICK
some defined common events

See Also:
Constant Field Values

ON_DBLCLICK

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

ON_MOUSE_DOWN

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

ON_MOUSE_UP

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

ON_MOUSE_MOVE

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

ON_MOUSE_OUT

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

ON_KEY_PRESS

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

ON_KEY_DOWN

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

ON_KEY_UP

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

ON_FOCUS

public static final java.lang.String ON_FOCUS
some defined events for components that can get the focus

See Also:
Constant Field Values

ON_BLUR

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

ON_LOAD

public static final java.lang.String ON_LOAD
some defined events specially for the htmlpage

See Also:
Constant Field Values

ON_UNLOAD

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

ON_SUBMIT

public static final java.lang.String ON_SUBMIT
some defined events specially for the formcontainer

See Also:
Constant Field Values

ON_RESET

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

ON_SELECT

public static final java.lang.String ON_SELECT
some defined events specially for textareas and inputfields

See Also:
Constant Field Values

ON_CHANGE

public static final java.lang.String ON_CHANGE
some defined events specially for select lists

See Also:
Constant Field Values

viewMode

protected short viewMode
how should the component be rendered


browserMode

protected short browserMode
for which browser should the component be rendered


isSensitive

protected boolean isSensitive
shows if the component can listen to events


ID

public static final java.lang.String ID
the id of attribute of a component

See Also:
Constant Field Values

parentElem

protected org.jdom.Element parentElem
the parent element of the components root


parent

protected Container parent

root

protected org.jdom.Element root
the root element of the internal JDOM-Tree of the component


outputter

protected static org.jdom.output.XMLOutputter outputter
the renderer for the JDOM-Tree


label

protected Label label
the reference to the component, which is the label of this component


actions

protected java.util.Map actions
Constructor Detail

AbstractComponent

public AbstractComponent()

AbstractComponent

public AbstractComponent(org.jdom.Element root)
constructs a new component from an existing JDOM the root element must have an id attribute


AbstractComponent

public AbstractComponent(java.lang.String name,
                         java.lang.String id,
                         java.lang.String className)
constructs a new empty component and creates an internal JDOM that consists of an empty root element

Parameters:
name - - the name of the root element
id - - the id of the component
className - - the name of the component class

AbstractComponent

public AbstractComponent(java.lang.String name)
Method Detail

init

public void init(org.jdom.Element element)
Initialize the component with a jdom-tree.

Specified by:
init in interface Component
Parameters:
element - - the root-element of the tree, must not be null

init

public void init(java.lang.String name)

init

public void init(java.lang.String name,
                 java.lang.String id,
                 java.lang.String className)
initialize the component with an new jdom-tree

Specified by:
init in interface Component
Parameters:
name - - the name of the root-element of the tree, must not be null
id - - the id of the component
className - - the name of the component class

setAttribute

public Component setAttribute(java.lang.String name,
                              java.lang.String value)
sets the attribute to the component

Specified by:
setAttribute in interface Component
Parameters:
name - - the name of the attribute
value - - the value of the attribute

getAttribute

public java.lang.String getAttribute(java.lang.String name)
returs the value of an attribute

Specified by:
getAttribute in interface Component
Parameters:
name - - the name of the attribute
Returns:
- the value of the attribute

removeAttribute

public boolean removeAttribute(java.lang.String name)
Remove the attribute from the component.

Specified by:
removeAttribute in interface Component
Parameters:
name - - the name of the attribute
Returns:
- true, if the attribute was found

setActionListener

public void setActionListener(java.lang.String event,
                              java.lang.String action)
Sets the action to an event.

Specified by:
setActionListener in interface Component
Parameters:
event - the event to listen
action - the action to perform

getActionListener

public java.lang.String getActionListener(java.lang.String event)
returs the value of an attribute

Specified by:
getActionListener in interface Component
Parameters:
event - - the event to listen
Returns:
- the action to perform

setId

public void setId(java.lang.String id)
set the unique identifier to a given value. Handle with care!

Specified by:
setId in interface Component
Parameters:
id - the new id of this component

getId

public java.lang.String getId()
Specified by:
getId in interface Component
Returns:
- the unique identifier of the component

setName

public void setName(java.lang.String name)
set the name to a given value.

Specified by:
setName in interface Component
Parameters:
name - - the new name of this component

getName

public java.lang.String getName()
Specified by:
getName in interface Component
Returns:
- the name of the component

setRootName

public void setRootName(java.lang.String name)
set the name of the root element to a given value.

Parameters:
name - - the new name of the root element

getRootName

public java.lang.String getRootName()
Returns:
- the name of the root element

setLabel

public void setLabel(Label c)
sets the label component

Specified by:
setLabel in interface Component
Parameters:
c - - the label component

getLabel

public Label getLabel()
Specified by:
getLabel in interface Component
Returns:
- the label component of the component

setParentElement

public void setParentElement(org.jdom.Element parent)
sets the parent element of the components root

Specified by:
setParentElement in interface Component
Parameters:
parent - - the parent element

getParentElement

public org.jdom.Element getParentElement()
Specified by:
getParentElement in interface Component
Returns:
- the parent element of the components root

setParent

public void setParent(Container parent)
sets the parent container

Specified by:
setParent in interface Component
Parameters:
parent - - the parent container

getParent

public Container getParent()
Specified by:
getParent in interface Component
Returns:
- the parent container

setViewMode

public void setViewMode(short mode)
sets the viewMode

Specified by:
setViewMode in interface Component
Parameters:
mode - - the new viewMode

getViewMode

public short getViewMode()
Specified by:
getViewMode in interface Component
Returns:
- the viewMode of the component

setBrowserMode

public void setBrowserMode(short mode)
sets the browserMode

Specified by:
setBrowserMode in interface Component
Parameters:
mode - - the new browserMode

getBrowserMode

public short getBrowserMode()
Specified by:
getBrowserMode in interface Component
Returns:
- the browserMode of the component

setStyle

public void setStyle(java.lang.String style)
Set the style

Specified by:
setStyle in interface Component
Parameters:
style - - the new style

getStyle

public java.lang.String getStyle()
Specified by:
getStyle in interface Component
Returns:
- the style of the component

show

public java.lang.String show()
Description copied from interface: Component
method for rendering the component as string

Specified by:
show in interface Component
Returns:
- the rendered component as String

show

public void show(java.io.PrintWriter pw)
prints the rendered component to a PrintWriter

Specified by:
show in interface Component
Parameters:
pw - - the Printwriter

toString

public java.lang.String toString()
Returns the classname followed by a colon and the title attribute. The string representation is sometimes used for sorting, e.g. TableRenderer.

Specified by:
toString in interface Component
Overrides:
toString in class java.lang.Object
Returns:
- the rendered component as string

clone

public java.lang.Object clone()
returns a copy of the Component object

Specified by:
clone in interface Component
Overrides:
clone in class java.lang.Object
Returns:
the Component clone

getRoot

public org.jdom.Element getRoot()
returns the root element of the internal JDOM

Specified by:
getRoot in interface Component
Returns:
the root element

setContent

public void setContent(java.lang.Object o)
sets the content of the component

Specified by:
setContent in interface Component
Parameters:
o - any object where the string representation is used for rendering

getContent

public java.lang.Object getContent()
Specified by:
getContent in interface Component
Returns:
the content object of the component

setNewLines

public void setNewLines(boolean val)

setEncoding

public void setEncoding(boolean val)

setExpandEmptyElements

public void setExpandEmptyElements(boolean val)

setIndenting

public void setIndenting(boolean val)

create

public static Component create(org.jdom.Element root)
Create element from dom

Parameters:
root -
Returns:
the new component


@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.