|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectto.etc.domui.dom.css.CssBase
to.etc.domui.dom.html.NodeBase
to.etc.domui.dom.html.NodeContainer
to.etc.domui.dom.html.Div
to.etc.domui.component.tbl.TableModelTableBase<T>
to.etc.domui.component.ntbl.ExpandingEditTable<T>
public class ExpandingEditTable<T>
This component is a table, using a TableModel, which can also edit it's rows and expand them. It does not support pagination and is used for relatively small datasets.
The basic display is that of a normal table, with each row occupying a single table row, controlled by a RowRenderer as with the DataTable. This row usually displays a "summary" of the available data.
To edit a row the row is expanded by selecting it's index column; this makes the row enter EDIT mode. In edit mode the entire contents of the row is replaced with an edit form containing all of the data to enter on the row. When editing is complete the row can be collapsed again at which point the data will be moved to the underlying model and the result will be redisplayed in the "summary". If the data is in some way invalid the row cannot collapse until the data is valid.
Constructor Summary | |
---|---|
ExpandingEditTable(java.lang.Class<T> actualClass,
ITableModel<T> m,
IRowRenderer<T> r)
|
|
ExpandingEditTable(ITableModel<T> m,
IRowRenderer<T> r)
|
Method Summary | |
---|---|
void |
addNew(T instance)
Make the control enter ADD NEW mode for the specified instance. |
void |
cancelNew()
|
boolean |
collapseAllExpandedRows()
When executed, method would try to collapse all currently expanded rows. |
void |
collapseRow(int index)
|
protected void |
commitNewRow()
|
void |
createContent()
Create the structure [(div=self)][ErrorMessageDiv][table] |
void |
expandRow(int index)
|
IRowEditorFactory<T,? extends NodeContainer> |
getEditorFactory()
Return the editor factory to use to create the row editor. |
IRowEditorEvent<T,?> |
getOnRowChangeCompleted()
Set a handler to call when editing a row in an editable table component after editing is (somehow) marked as complete. |
protected java.util.List<T> |
getPageItems()
Returns all items in the list. |
IRowButtonFactory<T> |
getRowButtonFactory()
Returns the button factory to use to add buttons to a row, when needed. |
protected Table |
getTable()
Return the backing table for this data browser. |
boolean |
isDisableErrors()
Returns T if this control's error handling has been disabled, causing the parent to handle errors instead of showing the errors in the control. |
boolean |
isEnableAddingItems()
When set (the default) items are added to the table by calling IModifyableTableModel.add(Object) when the new row
action executed succesfully. |
boolean |
isEnableDeleteButton()
When T (the default) this component will render a 'delete' linkbutton in the button area after the row, for every row present. |
boolean |
isEnableExpandItems()
|
boolean |
isEnableRowEdit()
|
boolean |
isHideHeader()
When set the table will not render a THead. |
boolean |
isHideIndex()
When set the index number before the row is not shown. |
boolean |
isModified()
Returns the modified-by-user flag. |
boolean |
isNewAtStart()
By default new rows are edited @ the end; set this to edit @ the start. |
void |
modelChanged(ITableModel<T> model)
Called when there are sweeping changes to the model. |
void |
rowAdded(ITableModel<T> model,
int index,
T value)
A record is added. |
void |
rowDeleted(ITableModel<T> model,
int index,
T value)
Delete the row specified. |
void |
rowModified(ITableModel<T> model,
int index,
T value)
When a row is modified we redraw the row in collapsed mode; if it was in edit mode before bad luck. |
void |
setDisableErrors(boolean on)
When set to T this control no longer shows errors. |
void |
setEditorFactory(IRowEditorFactory<T,? extends NodeContainer> editorFactory)
|
void |
setEnableAddingItems(boolean enableAddingItems)
When set items are added to the table by calling IModifyableTableModel.add(Object) when the new row
action executed succesfully. |
void |
setEnableDeleteButton(boolean enableDeleteButton)
|
void |
setEnableExpandItems(boolean enableExpandItems)
|
void |
setEnableRowEdit(boolean enableRowEdit)
|
void |
setHideHeader(boolean hideHeader)
|
void |
setHideIndex(boolean hideIndex)
|
void |
setModified(boolean as)
Set or clear the modified by user flag. |
void |
setNewAtStart(boolean newAtStart)
|
void |
setOnRowChangeCompleted(IRowEditorEvent<T,?> onRowChangeCompleted)
Set a handler to call when editing a row in an editable table component after editing is (somehow) marked as complete. |
void |
setRowButtonFactory(IRowButtonFactory<T> rowButtonFactory)
Returns the button factory to use to add buttons to a row, when needed. |
void |
setTableWidth(java.lang.String w)
|
protected void |
toggleExpanded(int index)
If the selected row is collapsed it gets expanded; if it is expanded it's values get moved to the model and if that worked the row gets collapsed. |
Methods inherited from class to.etc.domui.component.tbl.TableModelTableBase |
---|
fireModelChanged, firePageChanged, getModel, getModelItem, onRefresh, onShelve, onUnshelve, setModel |
Methods inherited from class to.etc.domui.dom.html.Div |
---|
afterCreateContent, componentHandleWebAction, fadeIn, fadeOut, getCustomUpdatesCallJS, getDragHandler, getDropBody, getDropHandler, getDropMode, getReturnPressed, setDragHandler, setDropBody, setDropHandler, setReturnPressed, slideDown, slideUp, tb, visit |
Methods inherited from class to.etc.domui.dom.html.NodeContainer |
---|
add, add, add, addTable, canContain, delegateTo, findChildIndex, forceRebuild, getChild, getChildCount, getChildren, getDeepChild, getDeepChildren, getErrorFence, internalCheckNotDirty, internalClearDelta, internalClearDeltaFully, internalGetOldChildren, internalShelve, internalUnshelve, iterator, moveControlToModel, moveModelToControl, removeAllChildren, removeChild, removeChild, replaceChild, setControlsEnabled, setErrorFence, setErrorFence, setText, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ExpandingEditTable(@Nonnull java.lang.Class<T> actualClass, @Nonnull ITableModel<T> m, @Nonnull IRowRenderer<T> r)
public ExpandingEditTable(@Nonnull ITableModel<T> m, @Nonnull IRowRenderer<T> r)
Method Detail |
---|
public void createContent() throws java.lang.Exception
createContent
in class NodeBase
java.lang.Exception
NodeBase.createContent()
@Nonnull protected java.util.List<T> getPageItems() throws java.lang.Exception
java.lang.Exception
protected void toggleExpanded(int index) throws java.lang.Exception
index
-
java.lang.Exception
public void collapseRow(int index) throws java.lang.Exception
java.lang.Exception
public void expandRow(int index) throws java.lang.Exception
java.lang.Exception
public void addNew(@Nonnull T instance) throws java.lang.Exception
IModifyableTableModel
to do the actual adding
of the item to the model.
instance
-
java.lang.Exception
public void cancelNew()
protected void commitNewRow() throws java.lang.Exception
java.lang.Exception
public void modelChanged(@Nullable ITableModel<T> model)
modelChanged
in interface ITableModelListener<T>
public void rowAdded(@Nonnull ITableModel<T> model, int index, @Nullable T value) throws java.lang.Exception
rowAdded
in interface ITableModelListener<T>
java.lang.Exception
ITableModelListener.rowAdded(to.etc.domui.component.tbl.ITableModel, int, java.lang.Object)
public void rowDeleted(@Nonnull ITableModel<T> model, int index, @Nullable T value) throws java.lang.Exception
rowDeleted
in interface ITableModelListener<T>
index
- The index of the deleted row in the table.value
- The deleted value.
java.lang.Exception
ITableModelListener.rowDeleted(to.etc.domui.component.tbl.ITableModel, int, java.lang.Object)
public void rowModified(@Nonnull ITableModel<T> model, int index, @Nullable T value) throws java.lang.Exception
rowModified
in interface ITableModelListener<T>
java.lang.Exception
ITableModelListener.rowModified(to.etc.domui.component.tbl.ITableModel, int, java.lang.Object)
public boolean isModified()
isModified
in interface IHasModifiedIndication
IHasModifiedIndication.isModified()
public void setModified(boolean as)
setModified
in interface IHasModifiedIndication
IHasModifiedIndication.setModified(boolean)
@Nonnull protected Table getTable()
public void setTableWidth(@Nullable java.lang.String w)
public boolean isHideHeader()
public void setHideHeader(boolean hideHeader)
public boolean isHideIndex()
public void setHideIndex(boolean hideIndex)
public void setDisableErrors(boolean on)
on
- public boolean isDisableErrors()
public boolean isNewAtStart()
public void setNewAtStart(boolean newAtStart)
@Nullable public IRowEditorFactory<T,? extends NodeContainer> getEditorFactory()
public void setEditorFactory(@Nullable IRowEditorFactory<T,? extends NodeContainer> editorFactory)
@Nullable public IRowButtonFactory<T> getRowButtonFactory()
public void setRowButtonFactory(@Nullable IRowButtonFactory<T> rowButtonFactory)
rowButtonFactory
- @Nullable public IRowEditorEvent<T,?> getOnRowChangeCompleted()
MetaManager.hasDuplicates(java.util.List, Object, String)
.
public void setOnRowChangeCompleted(@Nullable IRowEditorEvent<T,?> onRowChangeCompleted)
MetaManager.hasDuplicates(java.util.List, Object, String)
.
onNewComplete
- public boolean isEnableDeleteButton()
This is only very basic functionality. To make it better just disable the this and use setRowButtonFactory(IRowButtonFactory)
to define your own method to add buttons; allowing for way more complex interactions.
public void setEnableDeleteButton(boolean enableDeleteButton)
public boolean isEnableAddingItems()
IModifyableTableModel.add(Object)
when the new row
action executed succesfully.
public void setEnableAddingItems(boolean enableAddingItems)
IModifyableTableModel.add(Object)
when the new row
action executed succesfully.
enableAddingItems
- public boolean collapseAllExpandedRows() throws java.lang.Exception
java.lang.Exception
public boolean isEnableExpandItems()
public void setEnableExpandItems(boolean enableExpandItems)
public boolean isEnableRowEdit()
public void setEnableRowEdit(boolean enableRowEdit)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |