public class ExpandingEditTable<T> extends TableModelTableBase<T> implements IHasModifiedIndication
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 and Description |
|---|
ExpandingEditTable(Class<T> actualClass,
ITableModel<T> m,
IRowRenderer<T> r) |
ExpandingEditTable(ITableModel<T> m,
IRowRenderer<T> r) |
| Modifier and Type | Method and Description |
|---|---|
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 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(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.
|
addChangeListener, fireModelChanged, firePageChanged, fireSelectionUIChanged, getList, getModel, getModelItem, handleChange, isDisableClipboardSelection, onRefresh, onRemoveFromPage, onShelve, onUnshelve, removeChangeListener, resetState, setDisableClipboardSelection, setList, setModelafterCreateContent, componentHandleWebAction, fadeIn, fadeOut, getCustomUpdatesCallJS, getDragHandler, getDropBody, getDropHandler, getDropMode, getReturnPressed, setDragHandler, setDropBody, setDropHandler, setReturnPressed, slideDown, slideUp, tb, visitadd, add, add, addTable, addTableForLayout, addTableForLayout, appendTreeErrors, canContain, createFrame, delegateTo, disableAllChildControlsDeep, findChildIndex, forceRebuild, getChild, getChildCount, getChildren, getDeepChildren, getDelegate, getErrorFence, getTextContents, hasError, internalAdd, internalCheckNotDirty, internalClearDelta, internalClearDeltaFully, internalCreateFrame, internalGetNodeCount, internalGetOldChildren, internalOnBeforeRender, internalShelve, internalUnshelve, iterator, removeAllChildren, removeChild, removeChild, replaceChild, setErrorFence, setErrorFence, setText, setValue, undelegatedAdd, undelegatedGetChild$, acceptRequestParameter, addBinding, addCssClass, addGlobalMessage, addNotificationListener, alignToLeft, alignToLeft, alignToMiddle, alignToMiddle, alignTopToBottom, alignTopToBottom, alignToRight, alignToRight, alignToTop, alignToTop, appendAfterMe, appendBeforeMe, appendCreateJS, appendJavascript, appendJQuerySelector, appendJsCustomUpdatesContributor, appendShowOverflowTextAsTitleJs, appendStatement, beforeCreateContent, bind, bind, bindErrors, build, calcTestID, changed, changedJavascriptState, clearFocusRequested, clearGlobalMessage, clearGlobalMessage, clearGlobalMessage, clearMessage, clearValidationFailure, componentHandleWebDataRequest, createStatement, findComponentBundle, findParent, getActualID, getAllocationTracepoint, getBindingErrors, getBindingList, getBrowserWindowSize, getCalculatedTestID, getClicked, getClientBounds, getComponentBundle, getComponentDataURL, getComponentDataURL, getComponentInfo, getComponentJSONURL, getCreateJS, getCssClass, getErrorList, getErrorLocation, getFocusID, getMessage, getOnClickJS, getOnMouseDownJS, getOnSizeAndPositionChange, getPage, getParent, getParent, getParent, getParentOfTypes, getSharedContext, getSharedContextFactory, getSpecialAttribute, getSpecialAttributeList, getTag, getTestID, getTestRepeatId, getThemedResourceRURL, getTitle, getUserObject, handleDrop, hasCssClass, hasParent, internalGetOldParent, internalGetParent, internalHasChangedAttributes, internalNeedClickHandler, internalOnClicked, internalOnValueChanged, internalRenderJavascriptDelta, internalRenderJavascriptState, internalSetHasChangedAttributes, internalSetHasChangedAttributes, internalSetLogAllocations, internalSetTag, isAttached, isBuilt, isFocusable, isFocusRequested, isRendersOwnClose, isStretchHeight, lc, notify, notifyParentOrOpenerPage, onAddedToPage, onBeforeFullRender, onBeforeRender, onForceRebuild, onHeaderContributors, refresh, remove, removeBinding, removeCssClass, renderJavascriptDelta, renderJavascriptState, renderJavascriptState, replaceWith, setBrowserWindowSize, setCalculcatedId, setCalculcatedId, setClicked, setClientBounds, setComponentBundle, setCssClass, setErrorLocation, setFocus, setMessage, setOnClickJS, setOnMouseDownJS, setOnSizeAndPositionChange, setOverrideTitle, setSpecialAttribute, setStretchHeight, setTestID, setTestRepeatID, setTitle, setUserObject, toStringgetBackgroundAttachment, getBackgroundColor, getBackgroundImage, getBackgroundPosition, getBackgroundRepeat, getBorderBottomColor, getBorderBottomStyle, getBorderBottomWidth, getBorderLeftColor, getBorderLeftStyle, getBorderLeftWidth, getBorderRightColor, getBorderRightStyle, getBorderRightWidth, getBorderTopColor, getBorderTopStyle, getBorderTopWidth, getBottom, getCachedStyle, getClear, getColor, getDisplay, getFloat, getFontFamily, getFontSize, getFontSizeAdjust, getFontStyle, getFontVariant, getFontWeight, getHeight, getLeft, getLineHeight, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOverflow, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getPosition, getRight, getTextAlign, getTop, getTransform, getVerticalAlign, getVisibility, getWidth, getZIndex, internalSetDisplay, setBackgroundAttachment, setBackgroundColor, setBackgroundImage, setBackgroundPosition, setBackgroundRepeat, setBorder, setBorder, setBorderBottomColor, setBorderBottomStyle, setBorderBottomWidth, setBorderColor, setBorderLeftColor, setBorderLeftStyle, setBorderLeftWidth, setBorderRightColor, setBorderRightStyle, setBorderRightWidth, setBorderStyle, setBorderTopColor, setBorderTopStyle, setBorderTopWidth, setBorderWidth, setBottom, setBottom, setCachedStyle, setClear, setColor, setDisplay, setFloat, setFontFamily, setFontSize, setFontSizeAdjust, setFontStyle, setFontVariant, setFontWeight, setHeight, setLeft, setLeft, setLineHeight, setMargin, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setOverflow, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddingTop, setPosition, setRight, setRight, setTextAlign, setTop, setTop, setTransform, setVerticalAlign, setVisibility, setWidth, setZIndexclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic ExpandingEditTable(@Nonnull Class<T> actualClass, @Nonnull ITableModel<T> m, @Nonnull IRowRenderer<T> r)
public ExpandingEditTable(@Nonnull ITableModel<T> m, @Nonnull IRowRenderer<T> r)
public void createContent()
throws Exception
createContent in class NodeBaseExceptionNodeBase.createContent()@Nonnull protected List<T> getPageItems() throws Exception
Exceptionprotected void toggleExpanded(int index)
throws Exception
index - Exceptionpublic void addNew(@Nonnull T instance) throws Exception
IModifyableTableModel to do the actual adding
of the item to the model.instance - Exceptionpublic void cancelNew()
public void modelChanged(@Nullable ITableModel<T> model)
modelChanged in interface ITableModelListener<T>public void rowAdded(@Nonnull ITableModel<T> model, int index, @Nonnull T value) throws Exception
rowAdded in interface ITableModelListener<T>ExceptionITableModelListener.rowAdded(to.etc.domui.component.tbl.ITableModel, int, java.lang.Object)public void rowDeleted(@Nonnull ITableModel<T> model, int index, @Nullable T value) throws Exception
rowDeleted in interface ITableModelListener<T>index - The index of the deleted row in the table.value - The deleted value.ExceptionITableModelListener.rowDeleted(to.etc.domui.component.tbl.ITableModel, int, java.lang.Object)public void rowModified(@Nonnull ITableModel<T> model, int index, @Nonnull T value) throws Exception
rowModified in interface ITableModelListener<T>ExceptionITableModelListener.rowModified(to.etc.domui.component.tbl.ITableModel, int, java.lang.Object)public boolean isModified()
isModified in interface IHasModifiedIndicationIHasModifiedIndication.isModified()public void setModified(boolean as)
setModified in interface IHasModifiedIndicationIHasModifiedIndication.setModified(boolean)@Nonnull protected Table getTable()
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)
@Nonnull 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 Exception
Exceptionpublic boolean isEnableExpandItems()
public void setEnableExpandItems(boolean enableExpandItems)
public boolean isEnableRowEdit()
public void setEnableRowEdit(boolean enableRowEdit)
Copyright © 2017 etc.to. All rights reserved.