net.sf.jzeno.echo.components
Class DynaGrid

java.lang.Object
  extended by nextapp.echo.Grid
      extended by net.sf.jzeno.echo.components.DynaGrid
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, PropertyComponent, Component, ComponentPeer, FastComponent
Direct Known Subclasses:
RebindableCompoundComponent, Screen

public class DynaGrid
extends Grid
implements PropertyComponent, FastComponent

Convencience grid that automatically generates Cells when adding a component, has support for adding viewers and editors, and allows easy retrieval of the child PropertyComponents based on the value of their property binding.

See Also:
Serialized Form

Nested Class Summary
static class DynaGrid.Cell
           
 
Nested classes/interfaces inherited from class nextapp.echo.Grid
Grid.ExternalState, Grid.GridCellOverlapException
 
Field Summary
 
Fields inherited from class nextapp.echo.Grid
BORDER_COLOR_CHANGED_PROPERTY, BORDER_SIZE_CHANGED_PROPERTY, CELL_LAYOUT_ORIENTATION_CHANGED_PROPERTY, CELL_LAYOUT_ORIENTATION_HORIZONTAL, CELL_LAYOUT_ORIENTATION_VERTICAL, CELL_MARGIN_CHANGED_PROPERTY, COLUMN_DELETED_PROPERTY, COLUMN_INSERTED_PROPERTY, COLUMN_WIDTH_CHANGED_PROPERTY, COLUMNS_CHANGED_PROPERTY, HEIGHT_CHANGED_PROPERTY, HEIGHT_UNITS_CHANGED_PROPERTY, PERCENT_INDIVIDUAL_PIXEL_TOTAL_UNITS, PERCENT_UNITS, PIXEL_UNITS, ROW_DELETED_PROPERTY, ROW_HEIGHT_CHANGED_PROPERTY, ROW_INSERTED_PROPERTY, ROWS_CHANGED_PROPERTY, STYLE_BORDER_COLOR, STYLE_BORDER_SIZE, STYLE_CELL_MARGIN, STYLE_COLUMN_WIDTHS, STYLE_HEIGHT, STYLE_HEIGHT_UNITS, STYLE_ROW_HEIGHTS, STYLE_WIDTH, STYLE_WIDTH_UNITS, UNKNOWN_SIZE, WIDTH_CHANGED_PROPERTY, WIDTH_UNITS_CHANGED_PROPERTY
 
Fields inherited from interface nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, SELECTABLE_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface nextapp.echoservlet.ComponentPeer
IGNORE_PROPERTY_CHANGE
 
Constructor Summary
DynaGrid()
           
DynaGrid(java.lang.Class beanClass, java.lang.String property, java.lang.String constructionHints)
           
 
Method Summary
 void add(Component arg0)
          Add component to grid, and wrap in cell if necessary.
 void add(Component component, int index)
          Add component to grid, and wrap in cell if necessary.
 DynaGrid.Cell add(Component comp, int verticalAlignment, int horizontalAlignment)
           
 DynaGrid.Cell add(Component comp, java.lang.String cellConstructionHints)
           
 DynaGrid.Cell addCentered(Component component)
           
 DynaGrid.Cell addCentered(Component component, java.lang.String cellConstructionHints)
           
 DynaGrid.Cell addLeft(Component component)
           
 DynaGrid.Cell addLeft(Component component, java.lang.String cellConstructionHints)
           
 DynaGrid.Cell addRight(Component component)
           
 DynaGrid.Cell addRight(Component component, java.lang.String cellConstructionHints)
           
 void addValidator(Validator validator)
           Add extra validators to this component.
 void applyStyle(Style style)
          Sets stylistic properties of this component based on a Style object.
 java.lang.Object getBean()
           Retrieve the root bean this editor is bound to.
 java.lang.Class getBeanClass()
           Determine the type of bean we are bound to.
 Decorator getDecorator()
          Implementation of the PropertyComponent interface
 java.lang.Object getNullObject()
           
 java.lang.String getProperty()
           Retrieve the property path to bind to on the domain model cluster.
 java.util.List getValidationErrors()
           Retrieves a list of currently pending validation errors on this component.
 java.util.List getValidators()
           Retrieve the list of active validators on this component.
 java.lang.Object getValue()
           Retrieve the property value from the domain model cluster.
 boolean isAllowLineWrap()
           
 boolean isBound()
           
 boolean isMarkedInvalid()
           
 boolean isReadOnly()
           
 boolean isRequired()
           Query if the editor is required to be filled in.
 boolean isValid()
           Check if this component contains valid user input.
 void markInvalid()
           Marks the component as invalid.
 void markValid()
           Marks the component as valid (remove error marking)
 void preRender()
           Make changes to the visual representation of this component before Echo starts rendering the component.
 void removeValidator(Validator validator)
           Remove an existing validator from this component.
 void render(RenderingContext rc, Element parent)
          Necessary for new Grid implementation
 void setAllowLineWrap(boolean allowLineWrap)
           
 void setBean(java.lang.Object bean)
           sets the root bean for property-binding.
 void setBeanClass(java.lang.Class beanClass)
           Change the type of model bean this property component will be bound to.
 void setDecorator(Decorator decorator)
           Sets the decorator.
 void setNullObject(java.lang.Object nullObject)
           
 void setProperty(java.lang.String propertyPath)
           Set the property(path) to bind to on the domain model cluster.
 void setReadOnly(boolean readOnly)
           Mark this component as read-only.
 void setRequired(boolean required)
           Determine if the editor is required to be filled in.
 void setValue(java.lang.Object value)
           Writes the supplied data into the property we are bound to.
 java.util.List traceValue()
           
 
Methods inherited from class nextapp.echo.Grid
add, add, add, addAncillaryService, addHierarchyListener, addPropertyChangeListener, deleteColumn, deleteRow, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, generateId, get, get, getBackground, getBorderColor, getBorderSize, getCalculatedBackground, getCalculatedFont, getCalculatedForeground, getCellLayoutOrientation, getCellMargin, getCellPosition, getClientId, getColumns, getColumnWidth, getComponent, getComponent, getComponentCount, getComponents, getCssClass, getEchoInstance, getFocusedElementId, getFont, getForeground, getHeight, getHeightUnits, getId, getIdentifier, getInstancePeer, getListenerList, getLocale, getParent, getParentComponentPeer, getPeer, getRowHeight, getRows, getSize, getUseInternalBorders, getWidth, getWidthUnits, indexOf, init, insertColumn, insertRow, invalidate, isAncestorOf, isEnabled, isFocused, isInitialized, isRecursivelyVisible, isRegistered, isSelectableForScriptRecorder, isShowing, isVisible, iterator, processHierarchyEvent, propertyChange, redraw, registerAncillaryServices, registered, remove, remove, remove, remove, removeAll, removeAncillaryService, removeHierarchyListener, removePropertyChangeListener, setBackground, setBorderColor, setBorderSize, setCellLayoutOrientation, setCellMargin, setClientId, setColumns, setColumnWidth, setComponent, setCssClass, setEnabled, setFocused, setFont, setForeground, setHeight, setHeightUnits, setId, setIdentifier, setInitialized, setInstancePeer, setLocale, setParent, setRegistered, setRowHeight, setRows, setSelectableForScriptRecorder, setUseInternalBorders, setVisible, setWidth, setWidthUnits, superAdd, superApplyStyle, superRemove, unregisterAncillaryServices, unregistered, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynaGrid

public DynaGrid()

DynaGrid

public DynaGrid(java.lang.Class beanClass,
                java.lang.String property,
                java.lang.String constructionHints)
Method Detail

add

public void add(Component component,
                int index)
Add component to grid, and wrap in cell if necessary.

Specified by:
add in interface Component
Overrides:
add in class Grid
Parameters:
component - The child component to add.
index - The index at which to add the child component, or -1 to add the component at the end.
See Also:
Component.add(Component, int)

add

public void add(Component arg0)
Add component to grid, and wrap in cell if necessary.

Specified by:
add in interface Component
Overrides:
add in class Grid
Parameters:
arg0 - The child component to add.

add

public DynaGrid.Cell add(Component comp,
                         int verticalAlignment,
                         int horizontalAlignment)

add

public DynaGrid.Cell add(Component comp,
                         java.lang.String cellConstructionHints)

addCentered

public DynaGrid.Cell addCentered(Component component)

addCentered

public DynaGrid.Cell addCentered(Component component,
                                 java.lang.String cellConstructionHints)

addLeft

public DynaGrid.Cell addLeft(Component component)

addLeft

public DynaGrid.Cell addLeft(Component component,
                             java.lang.String cellConstructionHints)

addRight

public DynaGrid.Cell addRight(Component component)

addRight

public DynaGrid.Cell addRight(Component component,
                              java.lang.String cellConstructionHints)

getDecorator

public Decorator getDecorator()
Implementation of the PropertyComponent interface

Specified by:
getDecorator in interface PropertyComponent

setDecorator

public void setDecorator(Decorator decorator)
Description copied from interface: PropertyComponent

Sets the decorator.

Specified by:
setDecorator in interface PropertyComponent

getBean

public java.lang.Object getBean()
Description copied from interface: PropertyComponent

Retrieve the root bean this editor is bound to.

Specified by:
getBean in interface PropertyComponent

getProperty

public java.lang.String getProperty()
Description copied from interface: PropertyComponent

Retrieve the property path to bind to on the domain model cluster.

Specified by:
getProperty in interface PropertyComponent

getValue

public java.lang.Object getValue()
Description copied from interface: PropertyComponent

Retrieve the property value from the domain model cluster.

Specified by:
getValue in interface PropertyComponent

isRequired

public boolean isRequired()
Description copied from interface: PropertyComponent

Query if the editor is required to be filled in.

Specified by:
isRequired in interface PropertyComponent

setBean

public void setBean(java.lang.Object bean)
Description copied from interface: PropertyComponent

sets the root bean for property-binding.

Specified by:
setBean in interface PropertyComponent

setProperty

public void setProperty(java.lang.String propertyPath)
Description copied from interface: PropertyComponent

Set the property(path) to bind to on the domain model cluster.

Specified by:
setProperty in interface PropertyComponent

setRequired

public void setRequired(boolean required)
Description copied from interface: PropertyComponent

Determine if the editor is required to be filled in.

Specified by:
setRequired in interface PropertyComponent

setValue

public void setValue(java.lang.Object value)
Description copied from interface: PropertyComponent

Writes the supplied data into the property we are bound to.

Specified by:
setValue in interface PropertyComponent

isValid

public boolean isValid()
Description copied from interface: PropertyComponent

Check if this component contains valid user input. In itself this operation will not mark the component in error. In order to apply error marking on invalid components you should use EchoSupport.doValidationRecursively(Component).

Specified by:
isValid in interface PropertyComponent

getBeanClass

public java.lang.Class getBeanClass()
Description copied from interface: PropertyComponent

Determine the type of bean we are bound to.

During the lifecycle of a property component, this may NOT change ! In other words, if this component has been bound to, let's say, an Address object, this component must at all times remain bound to Address components ! (It may ofcourse change the specific instance to which it is bound, by calling setBean.)

Specified by:
getBeanClass in interface PropertyComponent

setBeanClass

public void setBeanClass(java.lang.Class beanClass)
Description copied from interface: PropertyComponent

Change the type of model bean this property component will be bound to.

Specified by:
setBeanClass in interface PropertyComponent

getNullObject

public java.lang.Object getNullObject()

setNullObject

public void setNullObject(java.lang.Object nullObject)

getValidationErrors

public final java.util.List getValidationErrors()
Description copied from interface: PropertyComponent

Retrieves a list of currently pending validation errors on this component.

Specified by:
getValidationErrors in interface PropertyComponent

addValidator

public void addValidator(Validator validator)
Description copied from interface: PropertyComponent

Add extra validators to this component.

Specified by:
addValidator in interface PropertyComponent

removeValidator

public void removeValidator(Validator validator)
Description copied from interface: PropertyComponent

Remove an existing validator from this component.

Specified by:
removeValidator in interface PropertyComponent

getValidators

public java.util.List getValidators()
Description copied from interface: PropertyComponent

Retrieve the list of active validators on this component.

Specified by:
getValidators in interface PropertyComponent

isAllowLineWrap

public boolean isAllowLineWrap()

setAllowLineWrap

public void setAllowLineWrap(boolean allowLineWrap)

isReadOnly

public boolean isReadOnly()
Specified by:
isReadOnly in interface PropertyComponent

setReadOnly

public void setReadOnly(boolean readOnly)
Description copied from interface: PropertyComponent

Mark this component as read-only.

Specified by:
setReadOnly in interface PropertyComponent

preRender

public void preRender()
Description copied from interface: PropertyComponent

Make changes to the visual representation of this component before Echo starts rendering the component.

Do not modify any bound javabeans in this method, as the changes to these will not be reflected properly on the screen.

Specified by:
preRender in interface PropertyComponent

markInvalid

public void markInvalid()
Description copied from interface: PropertyComponent

Marks the component as invalid. Typically puts a colored border around it to indicate the error.

Specified by:
markInvalid in interface PropertyComponent

markValid

public void markValid()
Description copied from interface: PropertyComponent

Marks the component as valid (remove error marking)

Specified by:
markValid in interface PropertyComponent

isMarkedInvalid

public boolean isMarkedInvalid()
Specified by:
isMarkedInvalid in interface PropertyComponent

traceValue

public java.util.List traceValue()

isBound

public boolean isBound()

applyStyle

public void applyStyle(Style style)
Description copied from interface: Component
Sets stylistic properties of this component based on a Style object. The version of this method in Component will set foreground and background colors and the font from the style if they are present. Components should override this method if they allow more properties to be set from a style object, and should call super.applyStyle() if necessary.

Specified by:
applyStyle in interface Component
Overrides:
applyStyle in class Grid
Parameters:
style - The style object from which to retrieve properties for this Component.
See Also:
Component.applyStyle(Style)

render

public void render(RenderingContext rc,
                   Element parent)
Necessary for new Grid implementation

Specified by:
render in interface ComponentPeer
Overrides:
render in class Grid
Parameters:
rc - A rendering context provided by the Connection.
parent - The element that will contain content rendered by this ComponentPeer.