Class RecordActionTable<R extends PersistentRecord>
- java.lang.Object
-
- org.apache.wicket.Component
-
- org.apache.wicket.MarkupContainer
-
- org.apache.wicket.markup.html.WebMarkupContainer
-
- org.apache.wicket.markup.html.panel.Panel
-
- com.inductiveautomation.ignition.gateway.web.components.ConfigPanel
-
- com.inductiveautomation.ignition.gateway.web.components.RecordActionTable<R>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<org.apache.wicket.Component>
,org.apache.wicket.event.IEventSink
,org.apache.wicket.event.IEventSource
,org.apache.wicket.IConverterLocator
,org.apache.wicket.markup.html.IHeaderContributor
,org.apache.wicket.request.component.IRequestableComponent
,org.apache.wicket.util.IHierarchical<org.apache.wicket.Component>
,org.apache.wicket.util.io.IClusterable
- Direct Known Subclasses:
ExtensionPointPage
,SmtpSettingsPage
public abstract class RecordActionTable<R extends PersistentRecord> extends ConfigPanel
A RecordActionTable is commonly used in the Configure section of the gateway. It displays a table of each record for a given record type. By default, it includes edit and delete links next to each record, and an add link at the bottom. By default, the columns are created by looking at the record's RecordMeta and finding all fields marked with
SFieldFlags.SDESCRIPTIVE
This class is very customizable by subclassing it and overriding functions. Common points of overriding are:
- Override
addRecordInstanceActions(RepeatingView, PersistentRecord)
to add new action links next to each record. - Override
addRecordActions(RepeatingView)
To add new links below the table - Override
getCalculatedFields()
to add new columns to the table
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
RecordActionTable.ICalculatedField<R extends PersistentRecord>
class
RecordActionTable.RecordActionTableDelete
Subclass ofDeleteRecordAction
that delegates canDelete and onDelete to the RecordActionTable
-
Field Summary
Fields Modifier and Type Field Description protected IConfigPage
configPage
-
Fields inherited from class com.inductiveautomation.ignition.gateway.web.components.ConfigPanel
feedback, returnPanel
-
-
Constructor Summary
Constructors Constructor Description RecordActionTable(IConfigPage configPage)
Creates a RecordActionTable, using a default RecordListModelRecordActionTable(IConfigPage configPage, java.lang.String id)
RecordActionTable(IConfigPage configPage, org.apache.wicket.model.IModel<? extends java.util.List<? extends PersistentRecord>> model)
Creates a RecordActionTable using a custom model to list the records
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addRecordActions(org.apache.wicket.markup.repeater.RepeatingView view)
Provides a hook to add record actions, like "Add new.." to the bottom of the panel.protected void
addRecordInstanceActions(org.apache.wicket.markup.repeater.RepeatingView view, R record)
Provides an opportunity to add any actions that deal with specific record instances.protected void
canDelete(R record)
Verifies if a record can be deleted.protected org.apache.wicket.Component
createFooter(java.lang.String id)
Override this to return a Wicket component to display beneath the table.protected org.apache.wicket.model.IModel<java.util.List<R>>
createRecordModel(RecordMeta<R> meta)
protected void
doDeleteRelatedRecords(PersistenceSession session, R record)
Provides a chance for subclasses to delete any related records before this record is deleted.protected ConfigPanel
getActionParentPanel()
Returns the panel that will be used by actions as the parent.protected java.lang.String
getCalculatedFieldDisplayValue(java.lang.Object value)
protected java.util.List<RecordActionTable.ICalculatedField<R>>
getCalculatedFields()
Override this to add calculated fields (columns) to the table.protected java.util.List<SFieldMeta>
getDescriptiveFields()
Looks through the SFieldMeta's defined by the record's RecordMeta, finding all descriptive fields.protected java.util.Collection<RecordMeta<? extends PersistentRecord>>
getExemptForeignKeys()
protected java.lang.String
getFieldValue(R record, FormMeta formMeta)
protected int
getInstanceActionMaxRowCount()
Returns the maximum number of instance actions per row.protected java.lang.String
getNoDescriptiveFieldsKey()
protected java.lang.String
getNoRowsKey()
Override this to return a custom resource key for what to display when no records existprotected abstract RecordMeta<R>
getRecordMeta()
protected java.lang.String
getTitleKey()
protected void
initComponents(org.apache.wicket.model.IModel<? extends java.util.List<? extends PersistentRecord>> model)
protected org.apache.wicket.markup.html.WebMarkupContainer
newDeleteRecordAction(java.lang.String id, R record)
protected org.apache.wicket.markup.html.WebMarkupContainer
newEditRecordAction(java.lang.String id, R record)
protected org.apache.wicket.markup.html.WebMarkupContainer
newRecordAction(java.lang.String id)
Creates a link that will navigate to creating a new record.protected void
onBeforeRender()
protected void
onDelete(R record)
Called after a record is successfully deletedprotected void
setupNewRecord(R record)
Provides subclasses a chance to perform initialization on a new instance of of the record.-
Methods inherited from class com.inductiveautomation.ignition.gateway.web.components.ConfigPanel
getHelpResourceKey, getHelpTopicId, getMenuLocation, getMenuPath, getTipLabelKey, getTipLabelModel, getTitleModel, initTitleArea, isEscapeHtmlInTipLabel, isFeedbackEnabled, isTitleVisible, log, renderHead
-
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebPage, getWebRequest, getWebResponse, getWebSession
-
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
-
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onAfterRender, onComponentTag, onConfigure, onDetach, onEvent, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrap
-
-
-
-
Field Detail
-
configPage
protected IConfigPage configPage
-
-
Constructor Detail
-
RecordActionTable
public RecordActionTable(IConfigPage configPage)
Creates a RecordActionTable, using a default RecordListModel
-
RecordActionTable
public RecordActionTable(IConfigPage configPage, java.lang.String id)
-
RecordActionTable
public RecordActionTable(IConfigPage configPage, org.apache.wicket.model.IModel<? extends java.util.List<? extends PersistentRecord>> model)
Creates a RecordActionTable using a custom model to list the records
-
-
Method Detail
-
createRecordModel
protected org.apache.wicket.model.IModel<java.util.List<R>> createRecordModel(RecordMeta<R> meta)
-
getRecordMeta
protected abstract RecordMeta<R> getRecordMeta()
-
getActionParentPanel
protected ConfigPanel getActionParentPanel()
Returns the panel that will be used by actions as the parent. By default is "this", but can be overridden for cases where multiple record action tables are used inside of another panel.
-
getDescriptiveFields
protected java.util.List<SFieldMeta> getDescriptiveFields()
Looks through the SFieldMeta's defined by the record's RecordMeta, finding all descriptive fields.
-
initComponents
protected void initComponents(org.apache.wicket.model.IModel<? extends java.util.List<? extends PersistentRecord>> model)
-
onBeforeRender
protected void onBeforeRender()
- Overrides:
onBeforeRender
in classorg.apache.wicket.Component
-
getInstanceActionMaxRowCount
protected int getInstanceActionMaxRowCount()
Returns the maximum number of instance actions per row. If there are more actions than this, then a new column will be started. Default is 3
-
getCalculatedFieldDisplayValue
protected java.lang.String getCalculatedFieldDisplayValue(java.lang.Object value)
-
getCalculatedFields
protected java.util.List<RecordActionTable.ICalculatedField<R>> getCalculatedFields()
Override this to add calculated fields (columns) to the table. Default implementation returns null.
-
createFooter
protected org.apache.wicket.Component createFooter(java.lang.String id)
Override this to return a Wicket component to display beneath the table.
-
addRecordInstanceActions
protected void addRecordInstanceActions(org.apache.wicket.markup.repeater.RepeatingView view, R record)
Provides an opportunity to add any actions that deal with specific record instances. Default actions are added for edit and delete.
-
newEditRecordAction
protected org.apache.wicket.markup.html.WebMarkupContainer newEditRecordAction(java.lang.String id, R record)
-
newDeleteRecordAction
protected org.apache.wicket.markup.html.WebMarkupContainer newDeleteRecordAction(java.lang.String id, R record)
-
addRecordActions
protected void addRecordActions(org.apache.wicket.markup.repeater.RepeatingView view)
Provides a hook to add record actions, like "Add new.." to the bottom of the panel. Make sure that the wicket ids of the children are obtained viaview.newChildId()
. Default implementation adds a basic "New Record" action (which itself can be customized by overridingnewRecordAction(String)
-
newRecordAction
protected org.apache.wicket.markup.html.WebMarkupContainer newRecordAction(java.lang.String id)
Creates a link that will navigate to creating a new record. Uses a basicNewRecordAction
-
setupNewRecord
protected void setupNewRecord(R record)
Provides subclasses a chance to perform initialization on a new instance of of the record.
-
canDelete
protected void canDelete(R record) throws ConfirmedTaskVetoException
Verifies if a record can be deleted. Throw an exception if the record should not be deleted. The default implementation will check defined foreign keys and will throw an error if any records refer to the record in question.- Throws:
ConfirmedTaskVetoException
-
getExemptForeignKeys
protected java.util.Collection<RecordMeta<? extends PersistentRecord>> getExemptForeignKeys()
-
onDelete
protected void onDelete(R record)
Called after a record is successfully deleted
-
doDeleteRelatedRecords
protected void doDeleteRelatedRecords(PersistenceSession session, R record)
Provides a chance for subclasses to delete any related records before this record is deleted. Will be called with an active SimpleORM session.
-
getNoRowsKey
protected java.lang.String getNoRowsKey()
Override this to return a custom resource key for what to display when no records exist
-
getNoDescriptiveFieldsKey
protected java.lang.String getNoDescriptiveFieldsKey()
-
getTitleKey
protected java.lang.String getTitleKey()
- Overrides:
getTitleKey
in classConfigPanel
-
-