|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnextapp.echo.AbstractComponent
net.sf.jzeno.echo.components.CustomComponent
net.sf.jzeno.echo.databinding.DynaTable
public final class DynaTable
A 'data grid' that displays a list of java beans. Multiple columns visualize different properties (or property paths).
The individual columns can be configured to use unique dynamic components .
When creating an instance of DynaTable, you need to specify which columns the
table should display. To specify these columns DynaTable
uses
a helper class
.
Create an instance of this class, and specify the columns by using the 4
argument ConstructionList
add
method for each column to add to the
DynaTable
. The arguments you pass in are :
Field Summary | |
---|---|
static int |
BOTTOM
A constant value to indicate alignment/positioning toward the bottom. |
static int |
CENTER
A constant value to indicate centered alignment/positioning. |
static int |
COMPARATOR_STYLE_BEAN
|
static int |
COMPARATOR_STYLE_PROPERTYCOMPONENT
Deprecated. |
static int |
COMPARATOR_STYLE_VALUE
|
static int |
LEFT
A constant value to indicate alignment/positioning toward the left. |
static int |
PERCENT_UNITS
|
static int |
PIXEL_UNITS
|
static int |
RIGHT
A constant value to indicate alignment/positioning toward the right. |
static int |
SELECTION_MULTI
|
static int |
SELECTION_NONE
|
static int |
SELECTION_SINGLE
|
static int |
TOP
A constant value to indicate alignment/positioning toward the top. |
Constructor Summary | |
---|---|
DynaTable()
Creates an unbound component. |
|
DynaTable(java.lang.Class beanClass,
java.lang.String property,
java.lang.String constructionHints)
Creates a databound component, but does not specify the columns of the DynaTable . |
|
DynaTable(java.lang.Class beanClass,
java.lang.String property,
java.lang.String tableConstructionHints,
ConstructionList constructionList)
Creates a databound component, and specifies the columns of the DynaTable . |
|
DynaTable(ConstructionList constructionList)
Creates an unbound component, but specifies the columns of the DynaTable . |
Method Summary | |
---|---|
void |
actionPerformed(ActionEvent e)
Invoked when an action occurs. |
void |
addListSelectionListener(ListSelectionListener listener)
|
void |
addNew(java.lang.Object beanToAdd)
Add the given java bean to the list we are currently viewing, and make it editable. |
void |
apply()
Apply the current changes, and exit edit/add mode. |
void |
applyContext()
|
void |
cancel()
Revert to state before edit/add operation. |
void |
changed(java.util.Collection collection)
|
void |
clearSelection()
Clear the current selection. |
void |
clearSorting()
Remove any sort order that is currently applied. |
void |
delete(java.lang.Object deleteMe)
Delete a given object from the editable table. |
void |
edit(java.lang.Object beanToMakeEditable)
Make the row, corresponding to the given java bean, editable. |
int |
getAllowSelection()
Deprecated. use setSelectionMode |
Color |
getBorderColor()
Gets the color of the border (between cells). |
int |
getBorderSize()
Gets the size of the border (between cells). |
int |
getCellMargin()
|
int |
getColumnCount()
|
int |
getColumnHorizontalAlignment(int column)
Gets the horizontal text alignment of a column. |
TableColumnModel |
getColumnModel()
|
int |
getColumnPadding(int direction)
|
int |
getColumnPadding(int column,
int direction)
|
AbstractPaddingController |
getColumnPaddingController()
|
AbstractPaddingController |
getColumnPaddingController(int column)
|
int |
getColumnVerticalAlignment(int column)
Gets the vertical text alignment of a column. |
int |
getColumnWidthUnits()
|
int |
getColumnWidthUnits(int column)
Returns the unit in which a column's width is specified. |
java.util.Comparator |
getComparator()
Gets the current comparator that specifies the sort order. |
int |
getComparatorStyle()
|
java.lang.String |
getCssClass()
|
java.lang.String |
getCssClassEven()
|
java.lang.String |
getCssClassOdd()
|
Color |
getEvenBackgroundColor()
Gets the color that is used for the even rows in the table. |
Font |
getFont()
Returns the font. |
ImageReference |
getHeaderBackgroundImage()
|
void |
getHeight(int height)
|
int |
getHeightUnits()
|
java.lang.String[] |
getLabelNames()
|
java.util.List |
getList()
Gets the list of java beans this DynaTable is showing. |
BoundTableModel |
getModel()
Gets the that is used by this
table to generate cells in the table. |
java.lang.String |
getNextIcon()
|
Color |
getOddBackgroundColor()
Gets the color that is used for the odd rows in the table. |
SortablePagedTableModel |
getPagedSortableModel()
|
boolean |
getPagerVisible()
Deprecated. use isPagerVisible |
int |
getPreferredRowsPerPage()
|
java.lang.String |
getPreviousIcon()
|
Color |
getRolloverBackground()
|
int |
getRowCount()
|
int |
getRowHeight(int row)
|
int |
getRowsPerPage()
Gets the number of rows per page, if paging in active. |
java.util.List |
getSelection()
Gets a list of java beans that are currently selected. |
Color |
getSelectionBackground()
|
int |
getSelectionMode()
Gets the selection mode of this table. |
int |
getSorterAlignment()
|
boolean |
getSorterVisible()
Deprecated. use isSorterVisible |
int[] |
getSortState()
Gets the sorting mode of the table. |
int |
getWidth()
|
int |
getWidthUnits()
|
boolean |
isAllowShowAll()
|
boolean |
isAsync()
|
boolean |
isContainsFastColumns()
|
boolean |
isFastColumn(int column)
|
boolean |
isFixedLayout()
|
boolean |
isHeaderVisible()
Gets whether or not this table has a header at the top. |
boolean |
isPagerVisible()
Gets whether or not the paging control is shown on the screen. |
boolean |
isReadOnly()
|
boolean |
isRemoveSelectionHandlesIfReadOnly()
|
boolean |
isRolloverEnabled()
|
boolean |
isRowClickSelection()
|
boolean |
isSelectionHandlesShown()
|
boolean |
isShowRowNumber()
|
boolean |
isSorterVisible()
|
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 |
propagateEvent(ActionEvent event)
|
void |
rebind()
This operation causes the component to reset it's content to that of the domain model. |
void |
removeListSelectionListener(ListSelectionListener listener)
|
void |
setActionCommand(java.lang.String actionCommand)
|
void |
setAllowSelection(int selectionMode)
Deprecated. use setSelectionMode |
void |
setAllowShowAll(boolean allowShowAll)
|
void |
setAsync(boolean async)
|
void |
setBorderColor(Color color)
Sets the color of the border (between cells). |
void |
setBorderSize(int borderSize)
Sets the size of the border (between cells). |
void |
setCellMargin(int i)
|
void |
setColumnHorizontalAlignment(int column,
int alignment)
Sets the horizontal text alignment of a column. |
void |
setColumnPadding(int direction,
int padding)
Sets the padding for all the columns. |
void |
setColumnPadding(int column,
int direction,
int padding)
Sets the padding for a specific column. |
void |
setColumnPaddingController(AbstractPaddingController paddingController)
Sets the padding controller for all columns. |
void |
setColumnPaddingController(int column,
AbstractPaddingController paddingController)
Sets the padding controller for a specific column. |
void |
setColumnVerticalAlignment(int column,
int alignment)
Sets the vertical text alignment of a column. |
void |
setColumnWidth(int column,
int width)
|
void |
setColumnWidthUnits(int columnWidthUnits)
Set the default column width units. |
void |
setColumnWidthUnits(int column,
int columnWidthUnits)
Sets the units in which width for an individual column is specified. |
void |
setComparator(java.util.Comparator comparator)
Sets a comparator for specifying custom sort orders. |
void |
setComparatorStyle(int comparatorStyle)
Selects the type of value you receive in you custom comparator. |
void |
setConstructionList(ConstructionList cl)
|
void |
setContainsFastColumns(boolean value)
A table's memory consumption can be optimized by activating this option (it is by default). |
void |
setCssClass(java.lang.String newValue)
|
void |
setCssClassEven(java.lang.String newValue)
|
void |
setCssClassOdd(java.lang.String newValue)
|
void |
setEvenBackgroundColor(Color evenBackgroundColor)
Sets the color that is used for the even rows in the table. |
void |
setFastColumn(int column,
boolean value)
Marks an individual column as not optimized. |
void |
setFixedLayout(boolean fixedLayout)
If a table is configured with fixed layout, none of the cell components will cause a colum to expand. |
void |
setFont(Font f)
Sets the font of the component. |
void |
setHeaderAlignment(int newValue)
Sets the text alignment of all the headers at once. |
void |
setHeaderAlignment(int column,
int newValue)
Sets the text alignment of an individual header. |
void |
setHeaderBackgroundImage(ImageReference headerBackgroundImage)
Set this property to a background image you want to show in the header of the table. |
void |
setHeaderCellRenderer(SortableTableHeaderRenderer cellRenderer)
|
void |
setHeaderVisible(boolean headerVisible)
Sets whether or not this table has a header at the top. |
void |
setHeight(int height)
|
void |
setHeightUnits(int heightUnits)
|
void |
setList(java.util.List beans)
Gets the list of java beans this DynaTable is showing. |
void |
setModel(BoundTableModel model)
Sets the that is used by this
table to generate cells in the table. |
void |
setNextIcon(java.lang.String nextIcon)
|
void |
setOddBackgroundColor(Color oddBackgroundColor)
Sets the color that is used for the odd rows in the table. |
void |
setPagerThreshold(int i)
The minimum number of rows of data that automatically triggers the visibility of the pager. |
void |
setPagerVisible(boolean b)
Sets whether or not the paging control is shown on the screen. |
void |
setPreferredRowsPerPage(int preferredRowsPerPage)
|
void |
setPreviousIcon(java.lang.String previousIcon)
|
void |
setReadOnly(boolean readOnly)
Mark this component as read-only. |
void |
setRemoveSelectionHandlesIfReadOnly(boolean removeSelectionHandlesIfReadOnly)
Should the selection handles on the table be removed if it is marked read-only ? |
void |
setRolloverBackground(Color color)
|
void |
setRolloverEnabled(boolean enabled)
Sets whether or not moving your mouse over the rows in the table highlights that row. |
void |
setRowClickSelection(boolean rowClickSelects)
Sets whether or not clicking in a row will select it. |
void |
setRowHeight(int row,
int height)
|
void |
setRowsPerPage(int rowsPerPage)
Sets the number of rows per page, if paging is active. |
void |
setSelectableTable(SelectableTable newTable)
Used internally. |
void |
setSelection(java.util.List beans)
Set which java beans are currently selected. |
void |
setSelectionBackground(Color color)
|
void |
setSelectionHandlesShown(boolean b)
|
void |
setSelectionMode(int selectionMode)
Sets the selection mode of this table. |
void |
setShowRowNumber(boolean showRowNumber)
|
void |
setSorterAlignment(int alignment)
|
void |
setSorterIconName(java.lang.String sorterIconName)
Sets the name of the icon to show on the multi-sort button. |
void |
setSorterVisible(boolean b)
|
void |
setSortState(int[] sortStates)
Sets the sorting mode of the table. |
void |
setTableWidthUnits(int newValue)
Deprecated. |
void |
setWidth(int width)
|
void |
setWidthUnits(int widthUnit)
|
void |
sort(int column,
boolean ascending)
Sorts the table ascending/descending on the specified column. |
Methods inherited from class net.sf.jzeno.echo.components.CustomComponent |
---|
addValidator, fireActionEvent, fireActionEvent, fireActionEvent, getActionCommand, getBean, getBeanClass, getDecorator, getNullObject, getProperty, getValidationErrors, getValidators, getValue, isBound, isMarkedInvalid, isRequired, isValid, markInvalid, removeValidator, setBean, setBeanClass, setDecorator, setNullObject, setProperty, setRequired, setValue, traceValue, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LEFT
public static final int CENTER
public static final int RIGHT
public static final int BOTTOM
public static final int TOP
public static final int PIXEL_UNITS
public static final int PERCENT_UNITS
public static final int SELECTION_NONE
public static final int SELECTION_SINGLE
public static final int SELECTION_MULTI
public static final int COMPARATOR_STYLE_PROPERTYCOMPONENT
public static final int COMPARATOR_STYLE_VALUE
public static final int COMPARATOR_STYLE_BEAN
Constructor Detail |
---|
public DynaTable()
Creates an unbound component. Use
to manually set a list of java beans.
setList(List)
public DynaTable(ConstructionList constructionList)
Creates an unbound component, but specifies the columns of the
DynaTable
. Use
to
manually set a list of java beans.
setList(List)
public DynaTable(java.lang.Class beanClass, java.lang.String property, java.lang.String constructionHints)
Creates a databound component, but does not specify the columns of the
DynaTable
.
public DynaTable(java.lang.Class beanClass, java.lang.String property, java.lang.String tableConstructionHints, ConstructionList constructionList)
Creates a databound component, and specifies the columns of the
DynaTable
.
Method Detail |
---|
public int getRowsPerPage()
Gets the number of rows per page, if paging in active.
public void setRowsPerPage(int rowsPerPage)
Sets the number of rows per page, if paging is active.
public java.util.List getList()
Gets the list of java beans this DynaTable
is showing.
public void setList(java.util.List beans)
Gets the list of java beans this DynaTable
is showing.
public void rebind()
RebindableComponent
This operation causes the component to reset it's content to that of the domain model.
rebind
in interface RebindableComponent
rebind
in class CustomComponent
public void setPagerVisible(boolean b)
Sets whether or not the paging control is shown on the screen.
public boolean isPagerVisible()
Gets whether or not the paging control is shown on the screen.
public boolean getPagerVisible()
public void setSorterVisible(boolean b)
public void setSorterAlignment(int alignment)
public int getSorterAlignment()
public boolean isSorterVisible()
public boolean getSorterVisible()
public BoundTableModel getModel()
Gets the
that is used by this
table to generate cells in the table.
BoundTableModel
public void setModel(BoundTableModel model)
Sets the
that is used by this
table to generate cells in the table.
BoundTableModel
public Color getEvenBackgroundColor()
Gets the color that is used for the even rows in the table.
public void setEvenBackgroundColor(Color evenBackgroundColor)
Sets the color that is used for the even rows in the table.
public Color getOddBackgroundColor()
Gets the color that is used for the odd rows in the table.
public void setOddBackgroundColor(Color oddBackgroundColor)
Sets the color that is used for the odd rows in the table.
public void setTableWidthUnits(int newValue)
Set the units (pixel/percent) of the widths specified on this table.
public void setHeaderAlignment(int newValue)
Sets the text alignment of all the headers at once.
public void setHeaderAlignment(int column, int newValue)
Sets the text alignment of an individual header.
public void setColumnPaddingController(AbstractPaddingController paddingController)
public AbstractPaddingController getColumnPaddingController()
public void setColumnPaddingController(int column, AbstractPaddingController paddingController)
column
- column indexpublic AbstractPaddingController getColumnPaddingController(int column)
public void setColumnPadding(int direction, int padding)
direction
- LEFT
/ RIGHT
/
TOP
/ BOTTOM
padding
- padding value (a negative number will be ignored)public int getColumnPadding(int direction)
public void setColumnPadding(int column, int direction, int padding)
column
- column indexdirection
- LEFT
/ RIGHT
/
TOP
/ BOTTOM
padding
- padding value (a negative number will be ignored)public int getColumnPadding(int column, int direction)
public void setColumnHorizontalAlignment(int column, int alignment)
Sets the horizontal text alignment of a column.
column
- index of the columnalignment
- must be TableColumn.LEFT
, TableColumn.CENTER
or TableColumn.RIGHT
public int getColumnHorizontalAlignment(int column)
Gets the horizontal text alignment of a column.
Returns -1 if table
is not properly initialized.
public void setColumnVerticalAlignment(int column, int alignment)
Sets the vertical text alignment of a column.
column
- index of the columnalignment
- must be TableColumn.TOP
, TableColumn.CENTER
or TableColumn.BOTTOM
public int getColumnVerticalAlignment(int column)
Gets the vertical text alignment of a column.
Returns -1 if table
is not properly initialized.
public int getSelectionMode()
Gets the selection mode of this table.
public void setAllowSelection(int selectionMode)
public int getAllowSelection()
public void setSelectionMode(int selectionMode)
Sets the selection mode of this table.
public java.util.List getSelection()
Gets a list of java beans that are currently selected.
public void setSelection(java.util.List beans)
Set which java beans are currently selected.
public void clearSelection()
Clear the current selection.
public boolean isReadOnly()
isReadOnly
in interface PropertyComponent
isReadOnly
in class CustomComponent
public void setReadOnly(boolean readOnly)
PropertyComponent
Mark this component as read-only.
setReadOnly
in interface PropertyComponent
setReadOnly
in class CustomComponent
public void sort(int column, boolean ascending)
Sorts the table ascending/descending on the specified column.
public int[] getSortState()
Gets the sorting mode of the table. Handy for doing state management in
your screens. See
.
net.sf.jzeno.echo.components.Screen#savePersistentState()
public void setSortState(int[] sortStates)
Sets the sorting mode of the table. Handy for doing state management in
your screens. See
.
It requires an array of integers that are set to the constants
net.sf.jzeno.echo.components.Screen#loadPersistentState(Object[])
public void setSelectableTable(SelectableTable newTable)
Used internally.
public void setBorderColor(Color color)
Sets the color of the border (between cells).
public Color getBorderColor()
Gets the color of the border (between cells).
public void setBorderSize(int borderSize)
Sets the size of the border (between cells).
public int getBorderSize()
Gets the size of the border (between cells).
public void setComparator(java.util.Comparator comparator)
Sets a comparator for specifying custom sort orders. By default an
instance of
is configured.
DynaTableComparator
public java.util.Comparator getComparator()
Gets the current comparator that specifies the sort order. By default an
instance of
is configured.
DynaTableComparator
public boolean isHeaderVisible()
Gets whether or not this table has a header at the top.
public void setHeaderVisible(boolean headerVisible)
Sets whether or not this table has a header at the top.
public SortablePagedTableModel getPagedSortableModel()
getPagedSortableModel
in interface MultiSortTable
public void setRowClickSelection(boolean rowClickSelects)
Sets whether or not clicking in a row will select it.
public boolean isRowClickSelection()
public void propagateEvent(ActionEvent event)
propagateEvent
in interface EventPropagator
public void setSorterIconName(java.lang.String sorterIconName)
Sets the name of the icon to show on the multi-sort button. Specify the name of the png/gif/jpg/.. you want to use. Specify the name of the gif/jpg/png/... image you want to show. Images should be located in the images folder, in the root of your web application.
public int getHeightUnits()
public void setHeightUnits(int heightUnits)
public void setHeight(int height)
public void getHeight(int height)
public int getRowHeight(int row)
public void setRowHeight(int row, int height)
public java.lang.String[] getLabelNames()
getLabelNames
in interface MultiSortTable
public void setActionCommand(java.lang.String actionCommand)
setActionCommand
in interface EventSource
setActionCommand
in class CustomComponent
public void actionPerformed(ActionEvent e)
ActionListener
actionPerformed
in interface ActionListener
e
- The event describing the action.public void setRolloverBackground(Color color)
public Color getRolloverBackground()
public void setSelectionBackground(Color color)
public Color getSelectionBackground()
public void setRolloverEnabled(boolean enabled)
Sets whether or not moving your mouse over the rows in the table highlights that row.
public boolean isRolloverEnabled()
public void setSelectionHandlesShown(boolean b)
public boolean isSelectionHandlesShown()
public void edit(java.lang.Object beanToMakeEditable)
Make the row, corresponding to the given java bean, editable.
public void addNew(java.lang.Object beanToAdd)
Add the given java bean to the list we are currently viewing, and make it editable. Will also clear the sort order, and go the last page in the table.
public void clearSorting()
Remove any sort order that is currently applied.
public void cancel()
Revert to state before edit/add operation.
public void delete(java.lang.Object deleteMe)
Delete a given object from the editable table. Will cancel any pending add/edit.
public void apply()
Apply the current changes, and exit edit/add mode.
public void markValid()
PropertyComponent
Marks the component as valid (remove error marking)
markValid
in interface PropertyComponent
markValid
in class CustomComponent
public void setWidth(int width)
public int getWidth()
public void setWidthUnits(int widthUnit)
public int getWidthUnits()
public void addListSelectionListener(ListSelectionListener listener)
public void removeListSelectionListener(ListSelectionListener listener)
public int getPreferredRowsPerPage()
public void setPreferredRowsPerPage(int preferredRowsPerPage)
public void setHeaderCellRenderer(SortableTableHeaderRenderer cellRenderer)
public java.lang.String getNextIcon()
public void setNextIcon(java.lang.String nextIcon)
public java.lang.String getPreviousIcon()
public void setPreviousIcon(java.lang.String previousIcon)
public void preRender()
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.
preRender
in interface PropertyComponent
preRender
in class CustomComponent
public void setPagerThreshold(int i)
The minimum number of rows of data that automatically triggers the visibility of the pager.
public void setFont(Font f)
Component
setFont
in interface Component
setFont
in class AbstractComponent
f
- The new font of the component.public Font getFont()
Component
getFont
in interface Component
getFont
in class AbstractComponent
public void setCellMargin(int i)
public int getCellMargin()
public boolean isAllowShowAll()
public void setAllowShowAll(boolean allowShowAll)
public int getRowCount()
public int getColumnCount()
public TableColumnModel getColumnModel()
public void applyContext()
applyContext
in interface Precreation
public void setConstructionList(ConstructionList cl)
public void setColumnWidth(int column, int width)
public boolean isAsync()
public void setAsync(boolean async)
public void changed(java.util.Collection collection)
changed
in interface CollectionChangeListener
public int getColumnWidthUnits()
public void setColumnWidthUnits(int columnWidthUnits)
columnWidthUnits
- public int getColumnWidthUnits(int column)
column
-
public void setColumnWidthUnits(int column, int columnWidthUnits)
column
- columnWidthUnits
- public boolean isRemoveSelectionHandlesIfReadOnly()
public void setRemoveSelectionHandlesIfReadOnly(boolean removeSelectionHandlesIfReadOnly)
removeSelectionHandlesIfReadOnly
- public boolean isContainsFastColumns()
public void setContainsFastColumns(boolean value)
setFastColumn()
public boolean isFastColumn(int column)
public void setFastColumn(int column, boolean value)
column
- value
- public boolean isFixedLayout()
setFixedLayout()
public void setFixedLayout(boolean fixedLayout)
public ImageReference getHeaderBackgroundImage()
public void setHeaderBackgroundImage(ImageReference headerBackgroundImage)
headerBackgroundImage
- public java.lang.String getCssClass()
public void setCssClass(java.lang.String newValue)
public java.lang.String getCssClassEven()
public void setCssClassEven(java.lang.String newValue)
public java.lang.String getCssClassOdd()
public void setCssClassOdd(java.lang.String newValue)
public int getComparatorStyle()
public void setComparatorStyle(int comparatorStyle)
comparatorStyle
- public boolean isShowRowNumber()
public void setShowRowNumber(boolean showRowNumber)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |