com.tirsen.angkor
Class Component

java.lang.Object
  |
  +--com.tirsen.angkor.Component
All Implemented Interfaces:
java.io.Serializable, View
Direct Known Subclasses:
Button, CheckboxInput, Container, Image, ImageButton, ImageMap.Area, MenuItem, RadioButtons, TableScroller, TextInput, TextLabel

public abstract class Component
extends java.lang.Object
implements View, java.io.Serializable

The default implementation of the View interface, implements a set of functionality usable by most widgets in Angkor. These needs to be serializable to support being serialized in the session while being referenced as parsing components.

Version:
$Revision: 1.4 $
Author:
$Author: tirsen $
See Also:
Serialized Form

Constructor Summary
Component()
          Create with generated ID.
Component(java.lang.String id)
          Render with specified ID.
 
Method Summary
 void allocateUniqueId(RenderContext context)
          Forces this component to allocate a unique id.
 java.lang.Object getAttribute(java.lang.String name)
           
 View getContainer()
           
 java.lang.String getId()
           
protected  RenderContext getRenderContext()
           
 int getVisibleIndex()
          Returns which index this has of all visible elements of this container.
 boolean isDebugTables()
           
 boolean isParsing()
           
 boolean isVisible()
          Check whether this view is visible or not.
 void parse(RenderContext context)
          When a view has registered during rendering for parsing in the RenderContext the context will call this method on the next request.
abstract  void render(RenderContext context)
          Render this view on the given context if the view is visible.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Set an attribute which can be used by for example event-listeners to acquire more information about the event.
 void setContainer(View container)
           
 void setId(java.lang.String id)
          Sets a custom id to be used instead of a generated one.
 void setVisible(boolean visible)
          Specify whether this view is visible or not.
 java.lang.String uniqueId(RenderContext context)
          The unique id is unique over an application instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Component

public Component(java.lang.String id)
Render with specified ID. The ID is checked for uniqueness and an error will occur at render-time if it is not unique. This is id is useful when doing functional testing.


Component

public Component()
Create with generated ID.

Method Detail

getContainer

public View getContainer()
Specified by:
getContainer in interface View

setContainer

public void setContainer(View container)
Specified by:
setContainer in interface View

render

public abstract void render(RenderContext context)
                     throws java.io.IOException
Description copied from interface: View
Render this view on the given context if the view is visible. Performed during render-phase.

Specified by:
render in interface View
java.io.IOException
See Also:
View.setVisible(boolean), View.isVisible()

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Set an attribute which can be used by for example event-listeners to acquire more information about the event. For example a button or a link in a table could have an attribute for which object-id of the row that was clicked.


getAttribute

public java.lang.Object getAttribute(java.lang.String name)

uniqueId

public java.lang.String uniqueId(RenderContext context)
Deprecated. use getId() instead.

Description copied from interface: View
The unique id is unique over an application instance. Ie. unique over user/session and application instance.

Specified by:
uniqueId in interface View
Parameters:
context -
Returns:

setId

public void setId(java.lang.String id)
Sets a custom id to be used instead of a generated one. The custom id is checked for uniqueness at each use. Warning! This should really only be used when initializing the component, if the component has been registered for parsing it will


allocateUniqueId

public void allocateUniqueId(RenderContext context)
Forces this component to allocate a unique id.


getId

public java.lang.String getId()

setVisible

public void setVisible(boolean visible)
Description copied from interface: View
Specify whether this view is visible or not.

Specified by:
setVisible in interface View

isVisible

public boolean isVisible()
Description copied from interface: View
Check whether this view is visible or not.

Specified by:
isVisible in interface View

isParsing

public boolean isParsing()

parse

public void parse(RenderContext context)
Description copied from interface: View
When a view has registered during rendering for parsing in the RenderContext the context will call this method on the next request. The view is responsible for parsing the request based on it's unique id and update models and sending events based on the request. In most cases the EventQueue should be used to send the events. This ensures that the models are all correctly updated before the events are actually processed. This is important since controllers (whom processes the events) must rely on this to process events correctly.

Specified by:
parse in interface View

getVisibleIndex

public int getVisibleIndex()
Returns which index this has of all visible elements of this container.


isDebugTables

public boolean isDebugTables()

getRenderContext

protected RenderContext getRenderContext()


Copyright © 2002-2002 . All Rights Reserved.