Class AbstractRecordEditPanel

  • 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:
    RecordEditForm, RecordEditWizard

    public abstract class AbstractRecordEditPanel
    extends ConfigPanel
    This class is the base for RecordEditForm and RecordEditWizard
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected IConfigPage configPage  
      protected ConfigPanel destinationPanel  
      protected static org.apache.log4j.Logger log  
      protected org.apache.wicket.model.IModel<java.lang.String> titleModel  
      • Fields inherited from class org.apache.wicket.markup.html.panel.Panel

        PANEL
      • Fields inherited from class org.apache.wicket.Component

        ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void commitRecords​(GatewayContext context, RecordEditMode editMode, java.util.List<SRecordInstance> records)
      Called by onSubmit() to commit the altered records.
      protected java.lang.String createErrorMessage​(GatewayContext context, java.lang.String noun, java.lang.String name)  
      protected org.apache.wicket.markup.html.WebMarkupContainer createFooterComponent​(java.lang.String id)
      Creates a component to use as a form footer.
      org.apache.commons.lang3.tuple.Pair<java.lang.String,​java.lang.String> getMenuLocation()  
      RecordEditMode getMode()  
      protected RecordEditMode getMode​(java.util.List<SRecordInstance> recs)  
      protected java.util.List<SRecordInstance> getModelObjectAsRecordList()  
      java.lang.String getRecordTypeNoun()
      Gets the name of the first record type.
      org.apache.wicket.model.IModel<java.lang.String> getTitleModel()  
      protected void notifyListeners​(GatewayContext context, RecordEditMode editMode, java.util.List<SRecordInstance> records)
      Called by onSubmit() if commitRecords() doesn't throw an error.
      protected void onAfterCommit​(java.util.List<SRecordInstance> records)  
      protected void onBeforeCommit​(PersistenceSession session, java.util.List<SRecordInstance> records)  
      protected void onError()
      Called when the wicket form calls onError().
      protected void onRecordEdited​(SRecordInstance record)
      Called after the record is successfully edited and saved to the database
      protected void onSubmit()  
      protected void onSubmit​(RecordEditMode mode, java.util.List<SRecordInstance> records)  
      • Methods inherited from class org.apache.wicket.markup.html.panel.Panel

        newMarkupSourcingStrategy
      • 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, onBeforeRender, 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • log

        protected static org.apache.log4j.Logger log
      • destinationPanel

        protected ConfigPanel destinationPanel
      • titleModel

        protected org.apache.wicket.model.IModel<java.lang.String> titleModel
    • Constructor Detail

      • AbstractRecordEditPanel

        public AbstractRecordEditPanel​(IConfigPage configPage,
                                       ConfigPanel destinationPanel,
                                       org.apache.wicket.model.IModel<java.lang.String> titleModel,
                                       SRecordInstance... records)
        Creates a new record edit component. The model must resolve to either a single SRecordInstance or a List containing one or more SRecordInstances
      • AbstractRecordEditPanel

        public AbstractRecordEditPanel​(IConfigPage configPage,
                                       ConfigPanel destinationPanel,
                                       org.apache.wicket.model.IModel<java.lang.String> titleModel,
                                       org.apache.wicket.model.IModel<? extends java.util.List<? extends SRecordInstance>> records)
        Creates a new record edit component. The model must resolve to either a single SRecordInstance or a List containing one or more SRecordInstances
    • Method Detail

      • getMenuLocation

        public org.apache.commons.lang3.tuple.Pair<java.lang.String,​java.lang.String> getMenuLocation()
        Overrides:
        getMenuLocation in class ConfigPanel
        Returns:
        Pair of strings representing categoryId (matching ConfigCategory.getName()) and item id (matching INamedTab.getTabName()) which lets the menu know where in the config menu should be highlighted when this config page is visible.
      • getTitleModel

        public org.apache.wicket.model.IModel<java.lang.String> getTitleModel()
        Overrides:
        getTitleModel in class ConfigPanel
      • getRecordTypeNoun

        public java.lang.String getRecordTypeNoun()
        Gets the name of the first record type. Public so the property resolver can see it
      • getModelObjectAsRecordList

        protected java.util.List<SRecordInstance> getModelObjectAsRecordList()
      • onSubmit

        protected void onSubmit()
      • onBeforeCommit

        protected void onBeforeCommit​(PersistenceSession session,
                                      java.util.List<SRecordInstance> records)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • onAfterCommit

        protected void onAfterCommit​(java.util.List<SRecordInstance> records)
      • notifyListeners

        protected void notifyListeners​(GatewayContext context,
                                       RecordEditMode editMode,
                                       java.util.List<SRecordInstance> records)
                                throws java.lang.Exception
        Called by onSubmit() if commitRecords() doesn't throw an error. Notifies record listeners of add/update, and then calls onRecordEdited()
        Throws:
        java.lang.Exception
      • commitRecords

        protected void commitRecords​(GatewayContext context,
                                     RecordEditMode editMode,
                                     java.util.List<SRecordInstance> records)
                              throws java.lang.Exception
        Called by onSubmit() to commit the altered records. Calls onBeforCommit() before committing (and detatching) the dataset, calls onAfterCommit() afterwards
        Throws:
        java.lang.Exception
      • onRecordEdited

        protected void onRecordEdited​(SRecordInstance record)
                               throws java.lang.Exception
        Called after the record is successfully edited and saved to the database
        Throws:
        java.lang.Exception
      • createErrorMessage

        protected java.lang.String createErrorMessage​(GatewayContext context,
                                                      java.lang.String noun,
                                                      java.lang.String name)
      • onError

        protected void onError()
        Called when the wicket form calls onError(). Default implementation is no-op.
      • createFooterComponent

        protected org.apache.wicket.markup.html.WebMarkupContainer createFooterComponent​(java.lang.String id)
        Creates a component to use as a form footer. Default implementation creates an InvisibleContainer.