You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2017/04/28 09:21:14 UTC
[09/43] isis git commit: ISIS-1603: renaames ExecutingPanel to
FormExecutor,
and moves implementation of PropertyEditPanel to new class
(PropertyEditFormExecutor) so will be able to reuse.
ISIS-1603: renaames ExecutingPanel to FormExecutor, and moves implementation of PropertyEditPanel to new class (PropertyEditFormExecutor) so will be able to reuse.
Also:
- started work on setting up the edit form in ScalarPanelAbstract#addEditPropertyTo ... not yet complete.
- renamed some local vars so consistent across all subclasses of ScalarPanelAbstract
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/6a5c6f6e
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/6a5c6f6e
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/6a5c6f6e
Branch: refs/heads/master
Commit: 6a5c6f6e928a8d714194bc8d56d30a2262aa9593
Parents: f65f45c
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Apr 23 10:26:22 2017 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Apr 27 13:25:37 2017 +0100
----------------------------------------------------------------------
.../viewer/wicket/model/models/ActionModel.java | 12 +-
.../wicket/model/models/ExecutingPanel.java | 42 ----
.../wicket/model/models/FormExecutor.java | 42 ++++
.../wicket/model/models/HasExecutingPanel.java | 2 +-
.../viewer/wicket/model/models/ScalarModel.java | 10 +-
.../ui/components/actions/ActionPanel.java | 6 +-
.../property/PropertyEditFormExecutor.java | 231 +++++++++++++++++++
.../components/property/PropertyEditPanel.java | 158 +------------
.../components/scalars/ScalarPanelAbstract.html | 13 ++
.../components/scalars/ScalarPanelAbstract.java | 24 +-
.../scalars/ScalarPanelTextFieldAbstract.html | 15 --
.../scalars/ScalarPanelTextFieldAbstract.java | 21 +-
.../isisapplib/IsisBlobOrClobPanelAbstract.java | 26 +--
.../scalars/primitive/BooleanPanel.java | 22 +-
.../scalars/reference/ReferencePanel.java | 20 +-
.../valuechoices/ValueChoicesSelect2Panel.java | 28 +--
.../ui/panels/PromptFormPanelAbstract.java | 10 +-
17 files changed, 385 insertions(+), 297 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ActionModel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ActionModel.java b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ActionModel.java
index 0219729..981026b 100644
--- a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ActionModel.java
+++ b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ActionModel.java
@@ -340,7 +340,7 @@ public class ActionModel extends BookmarkableModel<ObjectAdapter> implements Has
setArgument(argumentModel.getKey(), argumentModel.getValue().getObject());
}
- this.executingPanel = actionModel.executingPanel;
+ this.formExecutor = actionModel.formExecutor;
}
private void setArgumentsIfPossible(
@@ -677,19 +677,19 @@ public class ActionModel extends BookmarkableModel<ObjectAdapter> implements Has
//////////////////////////////////////////////////
- private ExecutingPanel executingPanel;
+ private FormExecutor formExecutor;
/**
* A hint passed from one Wicket UI component to another.
*
* Mot actually used by the model itself.
*/
- public ExecutingPanel getExecutingPanel() {
- return executingPanel;
+ public FormExecutor getFormExecutor() {
+ return formExecutor;
}
- public void setExecutingPanel(final ExecutingPanel executingPanel) {
- this.executingPanel = executingPanel;
+ public void setFormExecutor(final FormExecutor formExecutor) {
+ this.formExecutor = formExecutor;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ExecutingPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ExecutingPanel.java b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ExecutingPanel.java
deleted file mode 100644
index bc6c06e..0000000
--- a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ExecutingPanel.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.model.models;
-
-import java.io.Serializable;
-
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.markup.html.form.Form;
-
-/**
- * Passed through the {@link ActionModel} or {@link ScalarModel}, allowing
- * two different Wicket UI components (eg owning <code>ActionPanel</code> and
- * <code>ActionParametersFormPanel</code> to interact.
- *
- * <p>
- * REVIEW: this is a rather clunky design. The executing panel
- * isn't used by the model, and one panel is parent/creates of the other;
- * is it necessary to decouple them to this degree?
- * </p>
- */
-public interface ExecutingPanel extends Serializable {
-
- boolean executeAndProcessResults(AjaxRequestTarget target, Form<?> feedbackForm);
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/FormExecutor.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/FormExecutor.java b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/FormExecutor.java
new file mode 100644
index 0000000..43802b7
--- /dev/null
+++ b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/FormExecutor.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.model.models;
+
+import java.io.Serializable;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.markup.html.form.Form;
+
+/**
+ * Passed through the {@link ActionModel} or {@link ScalarModel}, allowing
+ * two different Wicket UI components (eg owning <code>ActionPanel</code> and
+ * <code>ActionParametersFormPanel</code> to interact.
+ *
+ * <p>
+ * REVIEW: this is a rather clunky design. The executing panel
+ * isn't used by the model, and one panel is parent/creates of the other;
+ * is it necessary to decouple them to this degree?
+ * </p>
+ */
+public interface FormExecutor extends Serializable {
+
+ boolean executeAndProcessResults(AjaxRequestTarget target, Form<?> feedbackForm);
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/HasExecutingPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/HasExecutingPanel.java b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/HasExecutingPanel.java
index 2d0826f..33b376d 100644
--- a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/HasExecutingPanel.java
+++ b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/HasExecutingPanel.java
@@ -20,5 +20,5 @@
package org.apache.isis.viewer.wicket.model.models;
public interface HasExecutingPanel {
- ExecutingPanel getExecutingPanel();
+ FormExecutor getFormExecutor();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModel.java b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModel.java
index 06040a3..18e2830 100644
--- a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModel.java
+++ b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModel.java
@@ -1008,18 +1008,18 @@ public class ScalarModel extends EntityModel implements LinksProvider,HasExecuti
// //////////////////////////////////////
- private ExecutingPanel executingPanel;
+ private FormExecutor formExecutor;
/**
* A hint passed from one Wicket UI component to another.
*
* Mot actually used by the model itself.
*/
- public ExecutingPanel getExecutingPanel() {
- return executingPanel;
+ public FormExecutor getFormExecutor() {
+ return formExecutor;
}
- public void setExecutingPanel(final ExecutingPanel executingPanel) {
- this.executingPanel = executingPanel;
+ public void setFormExecutor(final FormExecutor formExecutor) {
+ this.formExecutor = formExecutor;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.java
index 1959ce6..aa0b8d5 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.java
@@ -43,7 +43,7 @@ import org.apache.isis.viewer.wicket.model.models.ActionPrompt;
import org.apache.isis.viewer.wicket.model.models.BookmarkableModel;
import org.apache.isis.viewer.wicket.model.models.BookmarkedPagesModel;
import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.model.models.ExecutingPanel;
+import org.apache.isis.viewer.wicket.model.models.FormExecutor;
import org.apache.isis.viewer.wicket.ui.ComponentType;
import org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponse;
import org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseHandlingStrategy;
@@ -62,7 +62,7 @@ import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
* <p>
* TODO: on results panel, have a button to resubmit?
*/
-public class ActionPanel extends PanelAbstract<ActionModel> implements ExecutingPanel {
+public class ActionPanel extends PanelAbstract<ActionModel> implements FormExecutor {
private static final long serialVersionUID = 1L;
@@ -79,7 +79,7 @@ public class ActionPanel extends PanelAbstract<ActionModel> implements Executing
public ActionPanel(final String id, final ActionModel actionModel) {
super(id, actionModel);
- actionModel.setExecutingPanel(this);
+ actionModel.setFormExecutor(this);
buildGui(getActionModel());
}
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditFormExecutor.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditFormExecutor.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditFormExecutor.java
new file mode 100644
index 0000000..ac26554
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditFormExecutor.java
@@ -0,0 +1,231 @@
+package org.apache.isis.viewer.wicket.ui.components.property;
+
+import java.util.List;
+import java.util.concurrent.Callable;
+
+import com.google.common.base.Throwables;
+
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.markup.html.form.Form;
+
+import org.apache.isis.applib.services.command.Command;
+import org.apache.isis.applib.services.command.CommandContext;
+import org.apache.isis.applib.services.exceprecog.ExceptionRecognizer;
+import org.apache.isis.applib.services.exceprecog.ExceptionRecognizerComposite;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.authentication.MessageBroker;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
+import org.apache.isis.core.metamodel.services.ServicesInjector;
+import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.core.runtime.system.session.IsisSessionFactory;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
+import org.apache.isis.viewer.wicket.model.models.FormExecutor;
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseHandlingStrategy;
+import org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage;
+import org.apache.isis.viewer.wicket.ui.util.Components;
+
+public class PropertyEditFormExecutor implements FormExecutor {
+
+ private MarkupContainer panel;
+ private final ScalarModel scalarModel;
+
+ public PropertyEditFormExecutor(final MarkupContainer panel, final ScalarModel scalarModel) {
+ this.panel = panel;
+ this.scalarModel = scalarModel;
+ }
+
+ @Override
+ public boolean executeAndProcessResults(
+ final AjaxRequestTarget target,
+ final Form<?> feedbackForm) {
+
+ Components.permanentlyHide(panel, ComponentType.ENTITY_ICON_AND_TITLE);
+
+ ObjectAdapter targetAdapter = null;
+ try {
+ targetAdapter = scalarModel.getParentObjectAdapterMemento().getObjectAdapter(
+ AdapterManager.ConcurrencyChecking.CHECK,
+ getPersistenceSession(), getSpecificationLoader());
+
+ // no concurrency exception, so continue...
+ return editTargetAndProcessResults(target, feedbackForm);
+
+ } catch (ConcurrencyException ex) {
+
+ // second attempt should succeed, because the Oid would have
+ // been updated in the attempt
+ if (targetAdapter == null) {
+ targetAdapter = scalarModel.getParentObjectAdapterMemento().getObjectAdapter(
+ AdapterManager.ConcurrencyChecking.CHECK,
+ getPersistenceSession(), getSpecificationLoader());
+ }
+
+ // page redirect/handling
+ final EntityPage entityPage = new EntityPage(targetAdapter, null);
+ panel.setResponsePage(entityPage);
+
+ getMessageBroker().addWarning(ex.getMessage());
+ return false;
+ }
+
+ }
+
+ private boolean editTargetAndProcessResults(
+ final AjaxRequestTarget target,
+ final Form<?> feedbackForm) {
+
+ // validate the action parameters (if any)
+ final String invalidReasonIfAny = this.scalarModel.getReasonInvalidIfAny();
+
+ if (invalidReasonIfAny != null) {
+ raiseWarning(target, feedbackForm, invalidReasonIfAny);
+ return false;
+ }
+
+ final CommandContext commandContext = getServicesInjector().lookupService(CommandContext.class);
+ final Command command;
+ if (commandContext != null) {
+ command = commandContext.getCommand();
+ command.setExecutor(Command.Executor.USER);
+ } else {
+ command = null;
+ }
+
+ // the object store could raise an exception (eg uniqueness constraint)
+ // so we handle it here.
+ try {
+ // could be programmatic flushing, so must include in the try... finally
+
+ ObjectAdapter adapter = this.scalarModel.getParentObjectAdapterMemento().getObjectAdapter(
+ AdapterManager.ConcurrencyChecking.CHECK,
+ getPersistenceSession(), getSpecificationLoader());
+
+ final ObjectAdapter objectAdapter = this.scalarModel.applyValue(adapter);
+ // (borrowed some code previously in EntityModel)
+ if (objectAdapter != adapter) {
+ this.scalarModel.getParentObjectAdapterMemento().setAdapter(adapter);
+ }
+
+ // flush any queued changes, so concurrency or violation exceptions (if any)
+ // will be thrown here
+ getTransactionManager().flushTransaction();
+
+ // disabling concurrency checking after the layout XML (grid) feature
+ // was throwing an exception when rebuild grid after invoking edit prompt.
+ // not certain why that would be the case, but (following similar code for action prompt)
+ // think it should be safe to simply disable while recreating the page to re-render back to user.
+ final EntityPage entityPage =
+ AdapterManager.ConcurrencyChecking.executeWithConcurrencyCheckingDisabled(
+ new Callable<EntityPage>() {
+ @Override public EntityPage call() throws Exception {
+ return new EntityPage(objectAdapter, null);
+ }
+ }
+ );
+
+ panel.setResponsePage(entityPage);
+
+ return true;
+
+ } catch (RuntimeException ex) {
+
+ String message = recognizeException(ex, target, feedbackForm);
+
+ if (message != null) {
+ // no need to add to message broker, should already have been added...
+
+ if (feedbackForm == null) {
+ // forward on instead to void page
+ // (otherwise, we'll have rendered an action parameters page
+ // and so we'll be staying on that page)
+ ActionResultResponseHandlingStrategy.REDIRECT_TO_VOID
+ .handleResults(panel, null, getIsisSessionFactory());
+ }
+
+ return false;
+ }
+
+ // not handled, so capture and propagate
+ if (command != null) {
+ command.setException(Throwables.getStackTraceAsString(ex));
+ }
+
+ throw ex;
+ }
+ }
+
+ private String recognizeException(RuntimeException ex, AjaxRequestTarget target, Form<?> feedbackForm) {
+
+ // REVIEW: this code is similar to stuff in EntityPropertiesForm, perhaps move up to superclass?
+ // REVIEW: similar code also in WebRequestCycleForIsis; combine?
+
+ // see if the exception is recognized as being a non-serious error
+ // (nb: similar code in WebRequestCycleForIsis, as a fallback)
+ List<ExceptionRecognizer> exceptionRecognizers = getServicesInjector()
+ .lookupServices(ExceptionRecognizer.class);
+ String recognizedErrorIfAny = new ExceptionRecognizerComposite(exceptionRecognizers).recognize(ex);
+ if (recognizedErrorIfAny != null) {
+
+ // recognized
+ raiseWarning(target, feedbackForm, recognizedErrorIfAny);
+
+ getTransactionManager().getCurrentTransaction().clearAbortCause();
+
+ // there's no need to abort the transaction, it will have already been done
+ // (in IsisTransactionManager#executeWithinTransaction(...)).
+ }
+ return recognizedErrorIfAny;
+ }
+
+ private void raiseWarning(AjaxRequestTarget target, Form<?> feedbackForm, String error) {
+ if(target != null && feedbackForm != null) {
+ target.add(feedbackForm);
+ feedbackForm.error(error);
+ } else {
+ getMessageBroker().addWarning(error);
+ }
+ }
+
+
+
+ // ///////////////////////////////////////////////////////////////////
+ // Dependencies (from IsisContext)
+ // ///////////////////////////////////////////////////////////////////
+
+ protected PersistenceSession getPersistenceSession() {
+ return getIsisSessionFactory().getCurrentSession().getPersistenceSession();
+ }
+
+ protected ServicesInjector getServicesInjector() {
+ return getIsisSessionFactory().getServicesInjector();
+ }
+
+ protected SpecificationLoader getSpecificationLoader() {
+ return getIsisSessionFactory().getSpecificationLoader();
+ }
+
+ protected IsisTransactionManager getTransactionManager() {
+ return getPersistenceSession().getTransactionManager();
+ }
+
+ protected MessageBroker getMessageBroker() {
+ return getAuthenticationSession().getMessageBroker();
+ }
+
+ protected IsisSessionFactory getIsisSessionFactory() {
+ return IsisContext.getSessionFactory();
+ }
+
+ protected AuthenticationSession getAuthenticationSession() {
+ return getIsisSessionFactory().getCurrentSession().getAuthenticationSession();
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditPanel.java
index 5570903..146b4d0 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditPanel.java
@@ -19,21 +19,12 @@
package org.apache.isis.viewer.wicket.ui.components.property;
-import java.util.List;
-import java.util.concurrent.Callable;
-
-import com.google.common.base.Throwables;
-
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.Model;
-import org.apache.isis.applib.services.command.Command;
-import org.apache.isis.applib.services.command.CommandContext;
-import org.apache.isis.applib.services.exceprecog.ExceptionRecognizer;
-import org.apache.isis.applib.services.exceprecog.ExceptionRecognizerComposite;
import org.apache.isis.core.commons.authentication.MessageBroker;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
@@ -42,15 +33,14 @@ import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.model.models.ExecutingPanel;
+import org.apache.isis.viewer.wicket.model.models.FormExecutor;
import org.apache.isis.viewer.wicket.model.models.ScalarModel;
import org.apache.isis.viewer.wicket.ui.ComponentType;
-import org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseHandlingStrategy;
import org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage;
import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
public class PropertyEditPanel extends PanelAbstract<ScalarModel>
- implements ExecutingPanel {
+ implements FormExecutor {
private static final long serialVersionUID = 1L;
@@ -65,7 +55,7 @@ public class PropertyEditPanel extends PanelAbstract<ScalarModel>
public PropertyEditPanel(final String id, final ScalarModel scalarModel) {
super(id, new ScalarModel(scalarModel.getParentObjectAdapterMemento(), scalarModel.getPropertyMemento()));
- getScalarModel().setExecutingPanel(this);
+ getScalarModel().setFormExecutor(this);
buildGui(getScalarModel());
}
@@ -153,155 +143,15 @@ public class PropertyEditPanel extends PanelAbstract<ScalarModel>
@Override
public boolean executeAndProcessResults(AjaxRequestTarget target, Form<?> feedbackForm) {
- permanentlyHide(ComponentType.ENTITY_ICON_AND_TITLE);
-
- ObjectAdapter targetAdapter = null;
- try {
- targetAdapter = getModel().getParentObjectAdapterMemento().getObjectAdapter(
- AdapterManager.ConcurrencyChecking.CHECK, getModel().getPersistenceSession(), getSpecificationLoader());
-
- // no concurrency exception, so continue...
- return editTargetAndProcessResults(target, feedbackForm);
-
- } catch (ConcurrencyException ex) {
+ return new PropertyEditFormExecutor(this, getModel()).executeAndProcessResults(target, feedbackForm);
- // second attempt should succeed, because the Oid would have
- // been updated in the attempt
- if (targetAdapter == null) {
- targetAdapter = getModel().getParentObjectAdapterMemento().getObjectAdapter(
- AdapterManager.ConcurrencyChecking.CHECK, getModel().getPersistenceSession(),
- getSpecificationLoader());
- }
-
- // page redirect/handling
- final EntityPage entityPage = new EntityPage(targetAdapter, null);
- setResponsePage(entityPage);
- getMessageBroker().addWarning(ex.getMessage());
- return false;
- }
}
- private boolean editTargetAndProcessResults(
- final AjaxRequestTarget target,
- final Form<?> feedbackForm) {
-
- final ScalarModel scalarModel = getScalarModel();
-
- // validate the action parameters (if any)
- final String invalidReasonIfAny = scalarModel.getReasonInvalidIfAny();
-
- if (invalidReasonIfAny != null) {
- raiseWarning(target, feedbackForm, invalidReasonIfAny);
- return false;
- }
-
- final CommandContext commandContext = getServicesInjector().lookupService(CommandContext.class);
- final Command command;
- if (commandContext != null) {
- command = commandContext.getCommand();
- command.setExecutor(Command.Executor.USER);
- } else {
- command = null;
- }
-
-
- // the object store could raise an exception (eg uniqueness constraint)
- // so we handle it here.
- try {
- // could be programmatic flushing, so must include in the try... finally
- ObjectAdapter adapter = getScalarModel().getParentObjectAdapterMemento()
- .getObjectAdapter(AdapterManager.ConcurrencyChecking.CHECK, getPersistenceSession(),
- getSpecificationLoader());
- final ObjectAdapter objectAdapter = getScalarModel().applyValue(adapter);
- // (borrowed some code previously in EntityModel)
- if(objectAdapter != adapter) {
- getModel().getParentObjectAdapterMemento().setAdapter(adapter);
- }
-
- // flush any queued changes, so concurrency or violation exceptions (if any)
- // will be thrown here
- getTransactionManager().flushTransaction();
-
-
- // disabling concurrency checking after the layout XML (grid) feature
- // was throwing an exception when rebuild grid after invoking edit prompt.
- // not certain why that would be the case, but (following similar code for action prompt)
- // think it should be safe to simply disable while recreating the page to re-render back to user.
- final EntityPage entityPage =
- AdapterManager.ConcurrencyChecking.executeWithConcurrencyCheckingDisabled(
- new Callable<EntityPage>() {
- @Override public EntityPage call() throws Exception {
- return new EntityPage(objectAdapter, null);
- }
- }
- );
-
- setResponsePage(entityPage);
-
- return true;
-
- } catch (RuntimeException ex) {
-
- String message = recognizeException(ex, target, feedbackForm);
-
- if (message != null) {
- // no need to add to message broker, should already have been added...
-
- if(feedbackForm == null) {
- // forward on instead to void page
- // (otherwise, we'll have rendered an action parameters page
- // and so we'll be staying on that page)
- ActionResultResponseHandlingStrategy.REDIRECT_TO_VOID.handleResults(this, null, getIsisSessionFactory());
- }
-
- return false;
- }
-
- // not handled, so capture and propagate
- if(command != null) {
- command.setException(Throwables.getStackTraceAsString(ex));
- }
-
- throw ex;
- }
- }
-
-
- private String recognizeException(RuntimeException ex, AjaxRequestTarget target, Form<?> feedbackForm) {
-
- // REVIEW: this code is similar to stuff in EntityPropertiesForm, perhaps move up to superclass?
- // REVIEW: similar code also in WebRequestCycleForIsis; combine?
-
- // see if the exception is recognized as being a non-serious error
- // (nb: similar code in WebRequestCycleForIsis, as a fallback)
- List<ExceptionRecognizer> exceptionRecognizers = getServicesInjector().lookupServices(ExceptionRecognizer.class);
- String recognizedErrorIfAny = new ExceptionRecognizerComposite(exceptionRecognizers).recognize(ex);
- if(recognizedErrorIfAny != null) {
-
- // recognized
- raiseWarning(target, feedbackForm, recognizedErrorIfAny);
-
- getTransactionManager().getCurrentTransaction().clearAbortCause();
-
- // there's no need to abort the transaction, it will have already been done
- // (in IsisTransactionManager#executeWithinTransaction(...)).
- }
- return recognizedErrorIfAny;
- }
-
- public void raiseWarning(AjaxRequestTarget target, Form<?> feedbackForm, String error) {
- if(target != null && feedbackForm != null) {
- target.add(feedbackForm);
- feedbackForm.error(error);
- } else {
- getMessageBroker().addWarning(error);
- }
- }
///////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.html
index 3e5887f..8029649 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.html
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.html
@@ -39,6 +39,19 @@
<a wicket:id="editProperty"
href="#"
class="edit fa fa-pencil-square-o"/>
+ <div wicket:id="scalarValueEditInlineContainer">
+ <a
+ href="#"
+ name="scalarValueEditInline"
+ class="form-control input-sm scalarValueEditInline"
+ wicket:id="scalarValueEditInline">
+ <span wicket:id="scalarValueEditInlineLabel"></span>
+ </a>
+
+ <div wicket:id="propertyEditForm">
+ <div><span>property edit form</span></div>
+ </div>
+ </div>
</span>
</span>
<span wicket:id="associatedActionLinksRight"
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.java
index 140a587..135e9a2 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.java
@@ -296,7 +296,11 @@ public abstract class ScalarPanelAbstract extends PanelAbstract<ScalarModel> imp
markupContainer.addOrReplace(new NotificationPanel(ID_FEEDBACK, component, new ComponentFeedbackMessageFilter(component)));
}
- protected void addEditPropertyTo(final MarkupContainer markupContainer) {
+ protected void addEditPropertyTo(
+ final MarkupContainer markupContainer,
+ final WebMarkupContainer editInlineLink,
+ final Component scalarValueEditInlineContainer,
+ final Component propertyEditForm) {
final PropertyEditStyle editStyle = this.scalarModel.getEditStyle();
if(editStyle == PropertyEditStyle.DIALOG) {
@@ -331,6 +335,24 @@ public abstract class ScalarPanelAbstract extends PanelAbstract<ScalarModel> imp
markupContainer.addOrReplace(editProperty);
} else {
+
+ if(editInlineLink != null) {
+ editInlineLink.add(new AjaxEventBehavior("click") {
+ @Override
+ protected void onEvent(final AjaxRequestTarget target) {
+ editInlineLink.setVisible(false);
+ propertyEditForm.setVisible(true);
+ target.add(scalarValueEditInlineContainer);
+ }
+
+ @Override
+ public boolean isEnabled(final Component component) {
+ return true;
+ }
+ });
+ }
+
+
Components.permanentlyHide(markupContainer, ID_EDIT_PROPERTY);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.html
index 8f4cc42..673e6e1 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.html
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.html
@@ -26,21 +26,6 @@
<wicket:extend>
<wicket:container wicket:id="scalarValueContainer"/>
- <div wicket:id="scalarValueEditInlineContainer">
- <a
- href="#"
- name="scalarValueEditInline"
- class="form-control input-sm scalarValueEditInline"
- wicket:id="scalarValueEditInline">
- <span wicket:id="scalarValueEditInlineLabel"></span>
- </a>
-
- <div wicket:id="propertyEditForm">
- <div><span>property edit form</span></div>
- </div>
-
- </div>
-
<wicket:fragment wicket:id="text">
<input
type="text"
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.java
index e00a34b..7e91968 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.java
@@ -27,8 +27,6 @@ import com.google.common.base.Strings;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.ajax.AjaxEventBehavior;
-import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.Behavior;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -81,7 +79,7 @@ public abstract class ScalarPanelTextFieldAbstract<T extends Serializable> exten
private WebMarkupContainer scalarValueEditInlineContainer;
private WebMarkupContainer editInlineLink;
- private WebMarkupContainer propertyEditForm;
+ private Component propertyEditForm;
public ScalarPanelTextFieldAbstract(final String id, final ScalarModel scalarModel, final Class<T> cls) {
super(id, scalarModel);
@@ -152,24 +150,13 @@ public abstract class ScalarPanelTextFieldAbstract<T extends Serializable> exten
scalarValueEditInlineContainer.add(editInlineLink);
propertyEditForm = new WebMarkupContainer("propertyEditForm");
+ //propertyEditForm = getComponentFactoryRegistry().addOrReplaceComponent(this, ComponentType.PROPERTY_EDIT_FORM, scalarModel);
+
scalarValueEditInlineContainer.add(propertyEditForm);
final Label editInlineLinkLabel = new Label(ID_SCALAR_VALUE_EDIT_INLINE_LABEL, textFieldModel);
editInlineLink.add(editInlineLinkLabel);
- editInlineLink.add(new AjaxEventBehavior("click") {
- @Override
- protected void onEvent(final AjaxRequestTarget target) {
- editInlineLink.setVisible(false);
- propertyEditForm.setVisible(true);
- target.add(scalarValueEditInlineContainer);
- }
-
- @Override public boolean isEnabled(final Component component) {
- return true;
- }
- });
-
propertyEditForm.setVisible(false);
final MarkupContainer scalarIfRegularFormGroup = createScalarIfRegularFormGroup();
@@ -203,7 +190,7 @@ public abstract class ScalarPanelTextFieldAbstract<T extends Serializable> exten
}
addFeedbackOnlyTo(scalarIfRegularFormGroup, getEditComponent());
- addEditPropertyTo(scalarIfRegularFormGroup);
+ addEditPropertyTo(scalarIfRegularFormGroup, editInlineLink, scalarValueEditInlineContainer, propertyEditForm);
// ... add entity links to panel (below and to right)
addEntityActionLinksBelowAndRight(scalarIfRegularFormGroup, entityActions);
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisBlobOrClobPanelAbstract.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisBlobOrClobPanelAbstract.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisBlobOrClobPanelAbstract.java
index 4090730..ba54edf 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisBlobOrClobPanelAbstract.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisBlobOrClobPanelAbstract.java
@@ -92,36 +92,36 @@ public abstract class IsisBlobOrClobPanelAbstract<T extends NamedWithMimeType> e
fileUploadField = createFileUploadField(ID_SCALAR_VALUE);
fileUploadField.setLabel(Model.of(getModel().getName()));
- final FormGroup labelIfRegular = new FormGroup(ID_SCALAR_IF_REGULAR, fileUploadField);
- labelIfRegular.add(fileUploadField);
+ final FormGroup scalarIfRegularFormGroup = new FormGroup(ID_SCALAR_IF_REGULAR, fileUploadField);
+ scalarIfRegularFormGroup.add(fileUploadField);
final Label scalarName = new Label(ID_SCALAR_NAME, getModel().getName());
- labelIfRegular.add(scalarName);
+ scalarIfRegularFormGroup.add(scalarName);
// find the links...
final List<LinkAndLabel> entityActions = EntityActionUtil.getEntityActionLinksForAssociation(this.scalarModel, getDeploymentCategory());
- addPositioningCssTo(labelIfRegular, entityActions);
+ addPositioningCssTo(scalarIfRegularFormGroup, entityActions);
wicketImage = asWicketImage(ID_IMAGE);
if(wicketImage != null) {
wicketImage.setOutputMarkupId(true);
- labelIfRegular.addOrReplace(wicketImage);
+ scalarIfRegularFormGroup.addOrReplace(wicketImage);
} else {
- Components.permanentlyHide(labelIfRegular, ID_IMAGE);
+ Components.permanentlyHide(scalarIfRegularFormGroup, ID_IMAGE);
}
- updateFileNameLabel(ID_FILE_NAME, labelIfRegular);
- updateDownloadLink(ID_SCALAR_IF_REGULAR_DOWNLOAD, labelIfRegular);
+ updateFileNameLabel(ID_FILE_NAME, scalarIfRegularFormGroup);
+ updateDownloadLink(ID_SCALAR_IF_REGULAR_DOWNLOAD, scalarIfRegularFormGroup);
- addOrReplace(labelIfRegular);
- addFeedbackOnlyTo(labelIfRegular, fileUploadField);
- addEditPropertyTo(labelIfRegular);
+ addOrReplace(scalarIfRegularFormGroup);
+ addFeedbackOnlyTo(scalarIfRegularFormGroup, fileUploadField);
+ addEditPropertyTo(scalarIfRegularFormGroup, null, null, null);
// ... add entity links to panel (below and to right)
- addEntityActionLinksBelowAndRight(labelIfRegular, entityActions);
+ addEntityActionLinksBelowAndRight(scalarIfRegularFormGroup, entityActions);
- return labelIfRegular;
+ return scalarIfRegularFormGroup;
}
private Image asWicketImage(String id) {
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/primitive/BooleanPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/primitive/BooleanPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/primitive/BooleanPanel.java
index 75f766e..1e27073 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/primitive/BooleanPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/primitive/BooleanPanel.java
@@ -72,19 +72,19 @@ public class BooleanPanel extends ScalarPanelAbstract {
checkBox.setLabel(Model.of(name));
- final FormGroup labelIfRegular = new FormGroup(ID_SCALAR_IF_REGULAR, checkBox);
- labelIfRegular.add(checkBox);
+ final FormGroup scalarIfRegularFormGroup = new FormGroup(ID_SCALAR_IF_REGULAR, checkBox);
+ scalarIfRegularFormGroup.add(checkBox);
if(getModel().isRequired()) {
- labelIfRegular.add(new CssClassAppender("mandatory"));
+ scalarIfRegularFormGroup.add(new CssClassAppender("mandatory"));
}
final String describedAs = getModel().getDescribedAs();
if(describedAs != null) {
- labelIfRegular.add(new AttributeModifier("title", Model.of(describedAs)));
+ scalarIfRegularFormGroup.add(new AttributeModifier("title", Model.of(describedAs)));
}
final Label scalarName = new Label(ID_SCALAR_NAME, getRendering().getLabelCaption(checkBox));
- labelIfRegular.add(scalarName);
+ scalarIfRegularFormGroup.add(scalarName);
NamedFacet namedFacet = getModel().getFacet(NamedFacet.class);
if (namedFacet != null) {
scalarName.setEscapeModelStrings(namedFacet.escaped());
@@ -92,16 +92,16 @@ public class BooleanPanel extends ScalarPanelAbstract {
final List<LinkAndLabel> entityActions = EntityActionUtil.getEntityActionLinksForAssociation(this.scalarModel, getDeploymentCategory());
- addPositioningCssTo(labelIfRegular, entityActions);
+ addPositioningCssTo(scalarIfRegularFormGroup, entityActions);
- addOrReplace(labelIfRegular);
- addFeedbackOnlyTo(labelIfRegular, checkBox);
- addEditPropertyTo(labelIfRegular);
+ addOrReplace(scalarIfRegularFormGroup);
+ addFeedbackOnlyTo(scalarIfRegularFormGroup, checkBox);
+ addEditPropertyTo(scalarIfRegularFormGroup, null, null, null);
// ... add entity links to panel (below and to right)
- addEntityActionLinksBelowAndRight(labelIfRegular, entityActions);
+ addEntityActionLinksBelowAndRight(scalarIfRegularFormGroup, entityActions);
- return labelIfRegular;
+ return scalarIfRegularFormGroup;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.java
index fc4326e..114f3dd 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.java
@@ -136,16 +136,16 @@ public class ReferencePanel extends ScalarPanelAbstract {
select2.component().setOutputMarkupId(true);
select2.component().setLabel(Model.of(name));
- final FormGroup labelIfRegular = new FormGroup(ID_SCALAR_IF_REGULAR, entityLink);
- labelIfRegular.add(entityLink);
+ final FormGroup scalarIfRegularFormGroup = new FormGroup(ID_SCALAR_IF_REGULAR, entityLink);
+ scalarIfRegularFormGroup.add(entityLink);
final String describedAs = getModel().getDescribedAs();
if(describedAs != null) {
- labelIfRegular.add(new AttributeModifier("title", Model.of(describedAs)));
+ scalarIfRegularFormGroup.add(new AttributeModifier("title", Model.of(describedAs)));
}
final Label scalarName = new Label(ID_SCALAR_NAME, getRendering().getLabelCaption(select2.component()));
- labelIfRegular.add(scalarName);
+ scalarIfRegularFormGroup.add(scalarName);
NamedFacet namedFacet = getModel().getFacet(NamedFacet.class);
if (namedFacet != null) {
scalarName.setEscapeModelStrings(namedFacet.escaped());
@@ -156,14 +156,14 @@ public class ReferencePanel extends ScalarPanelAbstract {
final List<LinkAndLabel> entityActions =
EntityActionUtil.getEntityActionLinksForAssociation(this.scalarModel, getDeploymentCategory());
- addPositioningCssTo(labelIfRegular, entityActions);
+ addPositioningCssTo(scalarIfRegularFormGroup, entityActions);
- addOrReplace(labelIfRegular);
- addFeedbackOnlyTo(labelIfRegular, select2.component()); // this is a placeholder; when select2.component() is available, we use that instead
- addEditPropertyTo(labelIfRegular);
+ addOrReplace(scalarIfRegularFormGroup);
+ addFeedbackOnlyTo(scalarIfRegularFormGroup, select2.component()); // this is a placeholder; when select2.component() is available, we use that instead
+ addEditPropertyTo(scalarIfRegularFormGroup, null, null, null);
// ... add entity links to panel (below and to right)
- addEntityActionLinksBelowAndRight(labelIfRegular, entityActions);
+ addEntityActionLinksBelowAndRight(scalarIfRegularFormGroup, entityActions);
// add semantics
entityLink.setRequired(getModel().isRequired());
@@ -186,7 +186,7 @@ public class ReferencePanel extends ScalarPanelAbstract {
if(getModel().isRequired()) {
scalarName.add(new CssClassAppender("mandatory"));
}
- return labelIfRegular;
+ return scalarIfRegularFormGroup;
}
private Select2 createSelect2() {
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/valuechoices/ValueChoicesSelect2Panel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/valuechoices/ValueChoicesSelect2Panel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/valuechoices/ValueChoicesSelect2Panel.java
index c642413..75d8ed7 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/valuechoices/ValueChoicesSelect2Panel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/valuechoices/ValueChoicesSelect2Panel.java
@@ -80,12 +80,12 @@ public class ValueChoicesSelect2Panel extends ScalarPanelAbstract implements Sca
}
- final MarkupContainer labelIfRegular = createFormComponentLabel();
+ final MarkupContainer scalarIfRegularFormGroup = createScalarIfRegularFormGroup();
if(getModel().isRequired()) {
- labelIfRegular.add(new CssClassAppender("mandatory"));
+ scalarIfRegularFormGroup.add(new CssClassAppender("mandatory"));
}
- addOrReplace(labelIfRegular);
+ addOrReplace(scalarIfRegularFormGroup);
final Label scalarName = new Label(ID_SCALAR_NAME, getRendering().getLabelCaption(select2.component()));
if(getModel().isRequired()) {
@@ -94,7 +94,7 @@ public class ValueChoicesSelect2Panel extends ScalarPanelAbstract implements Sca
scalarName.add(new CssClassAppender("mandatory"));
}
}
- labelIfRegular.addOrReplace(scalarName);
+ scalarIfRegularFormGroup.addOrReplace(scalarName);
NamedFacet namedFacet = getModel().getFacet(NamedFacet.class);
if (namedFacet != null) {
scalarName.setEscapeModelStrings(namedFacet.escaped());
@@ -103,15 +103,15 @@ public class ValueChoicesSelect2Panel extends ScalarPanelAbstract implements Sca
// find the links...
final List<LinkAndLabel> entityActions = EntityActionUtil.getEntityActionLinksForAssociation(this.scalarModel, getDeploymentCategory());
- addPositioningCssTo(labelIfRegular, entityActions);
+ addPositioningCssTo(scalarIfRegularFormGroup, entityActions);
- addFeedbackOnlyTo(labelIfRegular, select2.component());
- addEditPropertyTo(labelIfRegular);
+ addFeedbackOnlyTo(scalarIfRegularFormGroup, select2.component());
+ addEditPropertyTo(scalarIfRegularFormGroup, null, null, null);
// ... add entity links to panel (below and to right)
- addEntityActionLinksBelowAndRight(labelIfRegular, entityActions);
+ addEntityActionLinksBelowAndRight(scalarIfRegularFormGroup, entityActions);
- return labelIfRegular;
+ return scalarIfRegularFormGroup;
}
private List<ObjectAdapterMemento> getChoiceMementos(final ObjectAdapter[] argumentsIfAvailable) {
@@ -132,20 +132,20 @@ public class ValueChoicesSelect2Panel extends ScalarPanelAbstract implements Sca
select2.setRequired(required);
}
- protected MarkupContainer createFormComponentLabel() {
+ protected MarkupContainer createScalarIfRegularFormGroup() {
final String name = getModel().getName();
select2.setLabel(Model.of(name));
- final FormGroup labelIfRegular = new FormGroup(ID_SCALAR_IF_REGULAR, select2.component());
+ final FormGroup formGroup = new FormGroup(ID_SCALAR_IF_REGULAR, select2.component());
final String describedAs = getModel().getDescribedAs();
if(describedAs != null) {
- labelIfRegular.add(new AttributeModifier("title", Model.of(describedAs)));
+ formGroup.add(new AttributeModifier("title", Model.of(describedAs)));
}
- labelIfRegular.add(select2.component());
+ formGroup.add(select2.component());
- return labelIfRegular;
+ return formGroup;
}
@Override
http://git-wip-us.apache.org/repos/asf/isis/blob/6a5c6f6e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PromptFormPanelAbstract.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PromptFormPanelAbstract.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PromptFormPanelAbstract.java
index c815cb0..6447940 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PromptFormPanelAbstract.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PromptFormPanelAbstract.java
@@ -38,7 +38,7 @@ import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
import org.apache.isis.viewer.wicket.model.models.ActionPrompt;
import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
-import org.apache.isis.viewer.wicket.model.models.ExecutingPanel;
+import org.apache.isis.viewer.wicket.model.models.FormExecutor;
import org.apache.isis.viewer.wicket.model.models.HasExecutingPanel;
import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarModelSubscriber;
import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelAbstract;
@@ -57,7 +57,7 @@ import static org.hamcrest.CoreMatchers.nullValue;
*/
public abstract class PromptFormPanelAbstract<T extends IModel<?> & HasExecutingPanel> extends PanelAbstract<T> {
- protected final ExecutingPanel executingPanel;
+ protected final FormExecutor formExecutor;
private static final String ID_OK_BUTTON = "okButton";
private static final String ID_CANCEL_BUTTON = "cancelButton";
@@ -65,8 +65,8 @@ public abstract class PromptFormPanelAbstract<T extends IModel<?> & HasExecuting
public PromptFormPanelAbstract(final String id, final T model) {
super(id, model);
- Ensure.ensureThatArg(model.getExecutingPanel(), is(not(nullValue())));
- this.executingPanel = model.getExecutingPanel();
+ Ensure.ensureThatArg(model.getFormExecutor(), is(not(nullValue())));
+ this.formExecutor = model.getFormExecutor();
}
public static abstract class FormAbstract<T extends IModel<?>> extends Form<ObjectAdapter>
@@ -173,7 +173,7 @@ public abstract class PromptFormPanelAbstract<T extends IModel<?> & HasExecuting
final Form<?> form,
final AjaxButton ajaxButton,
final PromptFormPanelAbstract<?> parentPanel) {
- boolean succeeded = parentPanel.executingPanel.executeAndProcessResults(target, form);
+ boolean succeeded = parentPanel.formExecutor.executeAndProcessResults(target, form);
if(succeeded) {
// the Wicket ajax callbacks will have just started to hide the veil
// we now show it once more, so that a veil continues to be shown until the