Package org.apache.isis.viewer.wicket.ui.pages.entity

Examples of org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage


                // second attempt should succeed, because the Oid would have
                // been updated in the attempt
                ObjectAdapter targetAdapter = getActionModel().getTargetAdapter();

                // forward onto the target page with the concurrency exception
                final EntityPage entityPage = new EntityPage(targetAdapter, ex);
               
                ActionParametersFormPanel.this.setResponsePage(entityPage);
               
                getAuthenticationSession().getMessageBroker().addWarning(ex.getMessage());
                return;
View Full Code Here


                // second attempt should succeed, because the Oid would have
                // been updated in the attempt
                ObjectAdapter targetAdapter = getActionModel().getTargetAdapter();

                // forward onto the target page with the concurrency exception
                final EntityPage entityPage = new EntityPage(targetAdapter, ex);
               
                ActionParametersFormPanel.this.setResponsePage(entityPage);
               
                getAuthenticationSession().getMessageBroker().addWarning(ex.getMessage());
                return;
View Full Code Here

            if(preValidationErrorIfAny != null) {
                feedbackOrNotifyAnyRecognizedError(preValidationErrorIfAny, form);
                // skip validation, because would relate to old values

                final EntityPage entityPage = new EntityPage(EntityPropertiesForm.this.getModelObject(), null);
                EntityPropertiesForm.this.setResponsePage(entityPage);
            } else {
                // run Wicket's validation
                super.validate();
            }
View Full Code Here

                // we obtain the adapter from the entity model because (if a view model) then the entity model may contain
                // a different adapter (the cloned view model) to the one with which we started with.
                objectAdapter = getEntityModel().getObjectAdapterMemento().getObjectAdapter(ConcurrencyChecking.NO_CHECK);
            }

            final EntityPage entityPage = new EntityPage(objectAdapter, null);
            EntityPropertiesForm.this.setResponsePage(entityPage);
        }
View Full Code Here

            if(preValidationErrorIfAny != null) {
                feedbackOrNotifyAnyRecognizedError(preValidationErrorIfAny, form);
                // skip validation, because would relate to old values

                final EntityPage entityPage = new EntityPage(EntityPropertiesForm.this.getModelObject(), null);
                EntityPropertiesForm.this.setResponsePage(entityPage);
            } else {
                // run Wicket's validation
                super.validate();
            }
View Full Code Here

                // we obtain the adapter from the entity model because (if a view model) then the entity model may contain
                // a different adapter (the cloned view model) to the one with which we started with.
                objectAdapter = getEntityModel().getObjectAdapterMemento().getObjectAdapter(ConcurrencyChecking.NO_CHECK);
            }

            final EntityPage entityPage = new EntityPage(objectAdapter, null);
            EntityPropertiesForm.this.setResponsePage(entityPage);
        }
View Full Code Here

                // second attempt should succeed, because the Oid would have
                // been updated in the attempt
                ObjectAdapter targetAdapter = getActionModel().getTargetAdapter();

                // forward onto the target page with the concurrency exception
                final EntityPage entityPage = new EntityPage(targetAdapter, ex);
               
                ActionParametersFormPanel.this.setResponsePage(entityPage);
               
                getAuthenticationSession().getMessageBroker().addWarning(ex.getMessage());
                return;
View Full Code Here

               
                if(preValidationErrorIfAny != null) {
                    feedbackOrNotifyAnyRecognizedError(preValidationErrorIfAny, form);
                    // skip validation, because would relate to old values
                   
                    final EntityPage entityPage = new EntityPage(EntityPropertiesForm.this.getModelObject(), null);
                    EntityPropertiesForm.this.setResponsePage(entityPage);
                } else {
                    // run Wicket's validation
                    super.validate();
                }
            }
           
            @Override
            public void onSubmit() {
                if (getForm().hasError()) {
                    // stay in edit mode
                    return;
                }
               
                final ObjectAdapter object = getEntityModel().getObject();
                final Memento snapshotToRollbackToIfInvalid = new Memento(object);
                // to perform object-level validation, we must apply the
                // changes first
                // contrast this with ActionPanel (for validating action
                // arguments) where
                // we do the validation prior to the execution of the
                // action
                getEntityModel().apply();
                final String invalidReasonIfAny = getEntityModel().getReasonInvalidIfAny();
                if (invalidReasonIfAny != null) {
                    getForm().error(invalidReasonIfAny);
                    snapshotToRollbackToIfInvalid.recreateObject();
                    toEditMode(null);
                    return;
                }
               
                try {
                    EntityPropertiesForm.this.getTransactionManager().flushTransaction();
                } catch(RuntimeException ex) {
                   
                    // There's no need to abort the transaction here, as it will have already been done
                    // (in IsisTransactionManager#executeWithinTransaction(...)).

                    String message = recognizeExceptionAndNotify(ex, EntityPropertiesForm.this);
                    if(message == null) {
                        throw ex;
                    }
                    toEditMode(null);
                    return;
                }

                try {
                    getEntityModel().resetPropertyModels();
                } catch(RuntimeException ex) {
                    throw ex;
                }

                toViewMode(null);
               
                // "redirect-after-post"
                //
                // RequestCycle.get().getActiveRequestHandler() indicates this is handled by the ListenerInterfaceRequestHandler
                // which renders page at end.
                //
                // it's necessary to zap the page parameters (so mapping is to just wicket/page?nn)
                // otherwise (what I think happens) is that the httpServletResponse.sendRedirect ends up being to the same URL,
                // and this is rejected as invalid either by the browser or by the servlet container (perhaps only if running remotely).
                //
                final EntityPage entityPage = new EntityPage(EntityPropertiesForm.this.getModelObject(), null);
                EntityPropertiesForm.this.setResponsePage(entityPage);
               
            }

        };
View Full Code Here

               
                if(preValidationErrorIfAny != null) {
                    feedbackOrNotifyAnyRecognizedError(preValidationErrorIfAny, form);
                    // skip validation, because would relate to old values
                   
                    final EntityPage entityPage = new EntityPage(EntityPropertiesForm.this.getModelObject(), null);
                    EntityPropertiesForm.this.setResponsePage(entityPage);
                } else {
                    // run Wicket's validation
                    super.validate();
                }
            }

            @Override
            protected void onError(AjaxRequestTarget target, Form<?> form) {
                super.onError(target, form);
                toEditMode(target);
            }

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                if (getForm().hasError()) {
                    // stay in edit mode
                    return;
                }
               
                final ObjectAdapter object = getEntityModel().getObject();
                final Memento snapshotToRollbackToIfInvalid = new Memento(object);
                // to perform object-level validation, we must apply the
                // changes first
                // contrast this with ActionPanel (for validating action
                // arguments) where
                // we do the validation prior to the execution of the
                // action
                getEntityModel().apply();
                final String invalidReasonIfAny = getEntityModel().getReasonInvalidIfAny();
                if (invalidReasonIfAny != null) {
                    getForm().error(invalidReasonIfAny);
                    snapshotToRollbackToIfInvalid.recreateObject();
                    toEditMode(null);
                    return;
                }
               
                try {
                    EntityPropertiesForm.this.getTransactionManager().flushTransaction();
                } catch(RuntimeException ex) {
                   
                    // There's no need to abort the transaction here, as it will have already been done
                    // (in IsisTransactionManager#executeWithinTransaction(...)).

                    String message = recognizeExceptionAndNotify(ex, EntityPropertiesForm.this);
                    if(message == null) {
                        throw ex;
                    }

                    toEditMode(target);
                    return;
                }

                try {
                    getEntityModel().resetPropertyModels();
                } catch(RuntimeException ex) {
                    throw ex;
                }

                toViewMode(null);
               
                // "redirect-after-post"
                //
                // RequestCycle.get().getActiveRequestHandler() indicates this is handled by the ListenerInterfaceRequestHandler
                // which renders page at end.
                //
                // it's necessary to zap the page parameters (so mapping is to just wicket/page?nn)
                // otherwise (what I think happens) is that the httpServletResponse.sendRedirect ends up being to the same URL,
                // and this is rejected as invalid either by the browser or by the servlet container (perhaps only if running remotely).
                //
                final EntityPage entityPage = new EntityPage(EntityPropertiesForm.this.getModelObject(), null);
                EntityPropertiesForm.this.setResponsePage(entityPage);
               
            }

        };
View Full Code Here

                // second attempt should succeed, because the Oid would have
                // been updated in the attempt
                ObjectAdapter targetAdapter = getActionModel().getTargetAdapter();

                // forward onto the target page with the concurrency exception
                final EntityPage entityPage = new EntityPage(targetAdapter, ex);
               
                ActionParametersFormPanel.this.setResponsePage(entityPage);
               
                getAuthenticationSession().getMessageBroker().addWarning(ex.getMessage());
                return;
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.