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/05/15 15:07:50 UTC
[14/19] isis git commit: ISIS-1613: refactors the ActionParameters
and PropertyEdit forms and panels
ISIS-1613: refactors the ActionParameters and PropertyEdit forms and panels
- moves FormExecutorAbstract to panels package (out of a package specific to property)
- moves PromptFormAbstract (renamed from FormAbstract) out of PromptFormPanelAbstract
- moves ActionParametersForm and PropertyEditForm to top-level classes
- move addConfirmationDialogIfAreYouSureSemantics to a static utility method in PanelUtil so can be reused
- renames ActionPanelFactory to ActionInfoPanelFactory
- removes some unused code from ScalarPanelAbstract
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/0d81e11a
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/0d81e11a
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/0d81e11a
Branch: refs/heads/ISIS-1613
Commit: 0d81e11abe981a71d86caa9cb6228bce82edac81
Parents: 00cb228
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon May 15 12:27:54 2017 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon May 15 12:27:54 2017 +0100
----------------------------------------------------------------------
.../ComponentFactoryRegistrarDefault.java | 6 +-
.../components/actioninfo/ActionInfoPanel.html | 36 ++
.../components/actioninfo/ActionInfoPanel.java | 50 +++
.../actioninfo/ActionInfoPanelFactory.java | 52 +++
.../ui/components/actions/ActionInfoPanel.html | 36 --
.../ui/components/actions/ActionInfoPanel.java | 50 ---
.../actions/ActionInfoPanelFactory.java | 52 ---
.../ui/components/actions/ActionPanel.html | 36 --
.../ui/components/actions/ActionPanel.java | 170 --------
.../components/actions/ActionPanelFactory.java | 52 ---
.../actions/ActionParametersForm.java | 157 ++++++++
.../actions/ActionParametersFormExecutor.java | 2 +-
.../actions/ActionParametersFormPanel.java | 148 +------
.../actions/ActionParametersPanel.html | 36 ++
.../actions/ActionParametersPanel.java | 171 ++++++++
.../actions/ActionParametersPanelFactory.java | 52 +++
.../property/FormExecutorAbstract.java | 330 ----------------
.../components/property/PropertyEditForm.java | 91 +++++
.../property/PropertyEditFormExecutor.java | 1 +
.../property/PropertyEditFormPanel.java | 101 +----
.../property/PropertyEditFormPanel.properties | 22 ++
.../components/property/PropertyEditPanel.java | 15 +-
.../property/PropertyEditPromptHeaderPanel.html | 32 --
.../property/PropertyEditPromptHeaderPanel.java | 62 ---
.../PropertyEditPromptHeaderPanel.html | 32 ++
.../PropertyEditPromptHeaderPanel.java | 59 +++
.../components/scalars/ScalarPanelAbstract.java | 40 +-
.../scalars/ScalarPanelAbstract2.java | 2 +-
.../linkandlabel/ActionLinkFactoryAbstract.java | 18 +-
.../ui/pages/actionprompt/ActionPromptPage.java | 2 +-
.../viewer/wicket/ui/panels/FormAbstract.java | 13 +-
.../wicket/ui/panels/FormExecutorAbstract.java | 330 ++++++++++++++++
.../viewer/wicket/ui/panels/PanelAbstract.java | 31 +-
.../isis/viewer/wicket/ui/panels/PanelUtil.java | 38 ++
.../wicket/ui/panels/PromptFormAbstract.java | 392 +++++++++++++++++++
.../ui/panels/PromptFormPanelAbstract.java | 391 ------------------
36 files changed, 1572 insertions(+), 1536 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
index 38b63b3..b9a63c4 100644
--- a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
+++ b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
@@ -26,8 +26,8 @@ import org.apache.isis.viewer.wicket.ui.components.about.AboutPanelFactory;
import org.apache.isis.viewer.wicket.ui.components.actionlink.ActionLinkPanelFactory;
import org.apache.isis.viewer.wicket.ui.components.actionmenu.serviceactions.ServiceActionsPanelFactory;
import org.apache.isis.viewer.wicket.ui.components.actionmenu.serviceactions.TertiaryMenuPanelFactory;
-import org.apache.isis.viewer.wicket.ui.components.actions.ActionInfoPanelFactory;
-import org.apache.isis.viewer.wicket.ui.components.actions.ActionPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.actioninfo.ActionInfoPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.actions.ActionParametersPanelFactory;
import org.apache.isis.viewer.wicket.ui.components.actions.ActionParametersFormPanelFactory;
import org.apache.isis.viewer.wicket.ui.components.bookmarkedpages.BookmarkedPagesPanelFactory;
import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
@@ -236,7 +236,7 @@ public class ComponentFactoryRegistrarDefault implements ComponentFactoryRegistr
}
protected void addComponentFactoriesForAction(final ComponentFactoryList componentFactories) {
- componentFactories.add(new ActionPanelFactory());
+ componentFactories.add(new ActionParametersPanelFactory());
componentFactories.add(new StandaloneCollectionPanelFactory());
}
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actioninfo/ActionInfoPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actioninfo/ActionInfoPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actioninfo/ActionInfoPanel.html
new file mode 100644
index 0000000..18935b9
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actioninfo/ActionInfoPanel.html
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"
+ xml:lang="en"
+ lang="en">
+ <body>
+ <wicket:panel>
+ <div class="actionInfoPanel actionInfoComponentType">
+ <ul>
+ <li>Target: <span wicket:id="target">[target title here]</span></li>
+ <li>Action: <span wicket:id="actionName">[target title here]</span></li>
+ </ul>
+ <br/>
+ </div>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actioninfo/ActionInfoPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actioninfo/ActionInfoPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actioninfo/ActionInfoPanel.java
new file mode 100644
index 0000000..be63dbe
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actioninfo/ActionInfoPanel.java
@@ -0,0 +1,50 @@
+/*
+ * 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.ui.components.actioninfo;
+
+import org.apache.wicket.markup.html.basic.Label;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+/**
+ * Renders a panel providing summary information about an action.
+ */
+public class ActionInfoPanel extends PanelAbstract<ActionModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_ACTION_NAME = "actionName";
+ private static final String ID_TARGET = "target";
+
+ public ActionInfoPanel(final String id, final ActionModel actionModel) {
+ super(id, actionModel);
+
+ final ObjectAdapter targetAdapter = getModel().getTargetAdapter();
+ final ObjectAction objectAction = getModel().getActionMemento().getAction(getModel().getSpecificationLoader());
+
+ // TODO: render instead as links (providing isn't a service; provide a
+ // component for this?)
+ add(new Label(ID_TARGET, targetAdapter.titleString()));
+ add(new Label(ID_ACTION_NAME, objectAction.getName()));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actioninfo/ActionInfoPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actioninfo/ActionInfoPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actioninfo/ActionInfoPanelFactory.java
new file mode 100644
index 0000000..13ae466
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actioninfo/ActionInfoPanelFactory.java
@@ -0,0 +1,52 @@
+/*
+ * 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.ui.components.actioninfo;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+
+/**
+ * {@link ComponentFactory} for {@link ActionInfoPanel}.
+ */
+public class ActionInfoPanelFactory extends ComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public ActionInfoPanelFactory() {
+ super(ComponentType.ACTION_INFO, ActionInfoPanel.class);
+ }
+
+ @Override
+ public ApplicationAdvice appliesTo(final IModel<?> model) {
+ return appliesIf(model instanceof ActionModel);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final ActionModel actionModel = (ActionModel) model;
+ return new ActionInfoPanel(id, actionModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.html
deleted file mode 100644
index 18935b9..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"
- xml:lang="en"
- lang="en">
- <body>
- <wicket:panel>
- <div class="actionInfoPanel actionInfoComponentType">
- <ul>
- <li>Target: <span wicket:id="target">[target title here]</span></li>
- <li>Action: <span wicket:id="actionName">[target title here]</span></li>
- </ul>
- <br/>
- </div>
- </wicket:panel>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.java
deleted file mode 100644
index 055b8b6..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanel.java
+++ /dev/null
@@ -1,50 +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.ui.components.actions;
-
-import org.apache.wicket.markup.html.basic.Label;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.viewer.wicket.model.models.ActionModel;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-
-/**
- * Renders a panel providing summary information about an action.
- */
-public class ActionInfoPanel extends PanelAbstract<ActionModel> {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ID_ACTION_NAME = "actionName";
- private static final String ID_TARGET = "target";
-
- public ActionInfoPanel(final String id, final ActionModel actionModel) {
- super(id, actionModel);
-
- final ObjectAdapter targetAdapter = getModel().getTargetAdapter();
- final ObjectAction objectAction = getModel().getActionMemento().getAction(getModel().getSpecificationLoader());
-
- // TODO: render instead as links (providing isn't a service; provide a
- // component for this?)
- add(new Label(ID_TARGET, targetAdapter.titleString()));
- add(new Label(ID_ACTION_NAME, objectAction.getName()));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanelFactory.java
deleted file mode 100644
index ffc7094..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionInfoPanelFactory.java
+++ /dev/null
@@ -1,52 +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.ui.components.actions;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.model.IModel;
-
-import org.apache.isis.viewer.wicket.model.models.ActionModel;
-import org.apache.isis.viewer.wicket.ui.ComponentFactory;
-import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
-
-/**
- * {@link ComponentFactory} for {@link ActionInfoPanel}.
- */
-public class ActionInfoPanelFactory extends ComponentFactoryAbstract {
-
- private static final long serialVersionUID = 1L;
-
- public ActionInfoPanelFactory() {
- super(ComponentType.ACTION_INFO, ActionInfoPanel.class);
- }
-
- @Override
- public ApplicationAdvice appliesTo(final IModel<?> model) {
- return appliesIf(model instanceof ActionModel);
- }
-
- @Override
- public Component createComponent(final String id, final IModel<?> model) {
- final ActionModel actionModel = (ActionModel) model;
- return new ActionInfoPanel(id, actionModel);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.html
deleted file mode 100644
index de76cf2..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"
- xml:lang="en"
- lang="en">
- <body>
- <wicket:panel>
- <div class="actionPanel actionComponentType">
- <div wicket:id="header" class="iconAndTitle panel panel-default actionPanelHeaderNew">
- <wicket:container wicket:id="entityIconAndTitle">[icon and title]</wicket:container>
- <h3 wicket:id="actionName" class="actionName">[action name]</h3>
- </div>
- <div wicket:id="parameters"></div>
- </div>
- </wicket:panel>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/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
deleted file mode 100644
index 0ace71f..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanel.java
+++ /dev/null
@@ -1,170 +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.ui.components.actions;
-
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.model.Model;
-
-import org.apache.isis.core.commons.authentication.MessageBroker;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
-import org.apache.isis.viewer.wicket.model.models.ActionModel;
-import org.apache.isis.viewer.wicket.model.models.ActionPrompt;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-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.ActionResultResponseType;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-
-/**
- * {@link PanelAbstract Panel} representing an action invocation, backed by an
- * {@link ActionModel}.
- *
- * <p>
- * Based on the {@link ActionModel.Mode mode}, will render either parameter
- * dialog or the results.
- *
- * <p>
- * TODO: on results panel, have a button to resubmit?
- */
-public class ActionPanel extends PanelAbstract<ActionModel> {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ID_HEADER = "header";
-
- static final String ID_ACTION_NAME = "actionName";
-
-
- /**
- * Gives a chance to hide the header part of this action panel, e.g. when shown in an action prompt
- */
- private boolean showHeader = true;
-
- public ActionPanel(final String id, final ActionModel actionModel) {
- super(id, actionModel);
- actionModel.setFormExecutor(new ActionParametersFormExecutor(this, actionModel));
- buildGui(getActionModel());
- }
-
- /**
- * Sets the owning action prompt (modal window), if any.
- */
- public void setActionPrompt(ActionPrompt actionPrompt) {
- ActionParametersFormExecutor formExecutor =
- (ActionParametersFormExecutor) getActionModel().getFormExecutor();
- formExecutor.setActionPrompt(actionPrompt);
- }
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
-
- buildGui(getModel());
- }
-
- private void buildGui(final ActionModel actionModel) {
- if (actionModel.hasParameters()) {
- buildGuiForParameters(getActionModel());
- } else {
- buildGuiForNoParameters(actionModel);
- }
- }
-
- ActionModel getActionModel() {
- return super.getModel();
- }
-
- public ActionPanel setShowHeader(boolean showHeader) {
- this.showHeader = showHeader;
- return this;
- }
-
- private void buildGuiForParameters(final ActionModel actionModel) {
-
- WebMarkupContainer header = addHeader();
-
- ObjectAdapter targetAdapter = null;
- try {
- targetAdapter = actionModel.getTargetAdapter();
-
- getComponentFactoryRegistry().addOrReplaceComponent(this, ComponentType.PARAMETERS, getActionModel());
- getComponentFactoryRegistry().addOrReplaceComponent(header, ComponentType.ENTITY_ICON_AND_TITLE, new EntityModel(targetAdapter));
-
- final String actionName = getActionModel().getActionMemento().getAction(actionModel.getSpecificationLoader()).getName();
- header.add(new Label(ID_ACTION_NAME, Model.of(actionName)));
-
- } catch (final ConcurrencyException ex) {
-
- // second attempt should succeed, because the Oid would have
- // been updated in the attempt
- if (targetAdapter == null) {
- targetAdapter = getModel().getTargetAdapter();
- }
-
- // forward onto the target page with the concurrency exception
- ActionResultResponse resultResponse = ActionResultResponseType.OBJECT.interpretResult(this.getActionModel(), targetAdapter, ex);
- resultResponse.getHandlingStrategy().handleResults(this, resultResponse, getIsisSessionFactory());
-
- getMessageBroker().addWarning(ex.getMessage());
- }
- }
-
- private WebMarkupContainer addHeader() {
- WebMarkupContainer header = new WebMarkupContainer(ID_HEADER) {
- @Override
- protected void onConfigure() {
- super.onConfigure();
- setVisible(showHeader);
- }
- };
- addOrReplace(header);
- return header;
- }
-
- private void buildGuiForNoParameters(final ActionModel formExecutor) {
-
- boolean succeeded = formExecutor.getFormExecutor().executeAndProcessResults(null, null,
- formExecutor.getPromptStyle());
- if(succeeded) {
- // nothing to do
- } else {
-
- // render the target entity again
- //
- // (One way this can occur is if an event subscriber has a defect and throws an exception; in which case
- // the EventBus' exception handler will automatically veto. This results in a growl message rather than
- // an error page, but is probably 'good enough').
- final ObjectAdapter targetAdapter = formExecutor.getTargetAdapter();
-
- ActionResultResponse resultResponse = ActionResultResponseType.OBJECT.interpretResult(this.getActionModel(), targetAdapter, null);
- resultResponse.getHandlingStrategy().handleResults(this, resultResponse, getIsisSessionFactory());
- }
- }
-
-
-
- private MessageBroker getMessageBroker() {
- return getAuthenticationSession().getMessageBroker();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanelFactory.java
deleted file mode 100644
index 30af5e9..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionPanelFactory.java
+++ /dev/null
@@ -1,52 +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.ui.components.actions;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.model.IModel;
-
-import org.apache.isis.viewer.wicket.model.models.ActionModel;
-import org.apache.isis.viewer.wicket.ui.ComponentFactory;
-import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
-
-/**
- * {@link ComponentFactory} for {@link ActionPanel}.
- */
-public class ActionPanelFactory extends ComponentFactoryAbstract {
-
- private static final long serialVersionUID = 1L;
-
- public ActionPanelFactory() {
- super(ComponentType.ACTION_PROMPT, ActionPanel.class);
- }
-
- @Override
- public ApplicationAdvice appliesTo(final IModel<?> model) {
- return appliesIf(model instanceof ActionModel);
- }
-
- @Override
- public Component createComponent(final String id, final IModel<?> model) {
- final ActionModel actionModel = (ActionModel) model;
- return new ActionPanel(id, actionModel);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersForm.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersForm.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersForm.java
new file mode 100644
index 0000000..492b6c9
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersForm.java
@@ -0,0 +1,157 @@
+package org.apache.isis.viewer.wicket.ui.components.actions;
+
+import java.util.List;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.repeater.RepeatingView;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.applib.services.message.MessageService;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
+import org.apache.isis.core.metamodel.services.ServicesInjector;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.viewer.wicket.model.hints.IsisActionCompletedEvent;
+import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
+import org.apache.isis.viewer.wicket.model.mementos.ActionParameterMemento;
+import org.apache.isis.viewer.wicket.model.models.ActionArgumentModel;
+import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.scalars.PanelWithChoices;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelAbstract2;
+import org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage;
+import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
+import org.apache.isis.viewer.wicket.ui.panels.PromptFormAbstract;
+
+import de.agilecoders.wicket.extensions.markup.html.bootstrap.confirmation.ConfirmationBehavior;
+
+class ActionParametersForm extends PromptFormAbstract<ActionModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public ActionParametersForm(
+ final String id,
+ final Component parentPanel,
+ final WicketViewerSettings settings,
+ final ActionModel actionModel) {
+ super(id, parentPanel, settings, actionModel);
+ }
+
+ private ActionModel getActionModel() {
+ return (ActionModel) super.getModel();
+ }
+
+ @Override
+ protected void addParameters() {
+ final ActionModel actionModel = getActionModel();
+
+ final RepeatingView rv = new RepeatingView(ActionParametersFormPanel.ID_ACTION_PARAMETERS);
+ add(rv);
+
+ paramPanels.clear();
+ List<ActionParameterMemento> parameterMementos = actionModel.primeArgumentModels();
+ for (final ActionParameterMemento apm : parameterMementos) {
+ final WebMarkupContainer container = new WebMarkupContainer(rv.newChildId());
+ rv.add(container);
+
+ final ActionArgumentModel actionArgumentModel = actionModel.getArgumentModel(apm);
+ actionArgumentModel.setActionArgsHint(actionModel.getArgumentsAsArray());
+ final ScalarPanelAbstract2 paramPanel = newParamPanel(container, actionArgumentModel);
+ paramPanels.add(paramPanel);
+ }
+ }
+
+ private ScalarPanelAbstract2 newParamPanel(final WebMarkupContainer container, final IModel<?> model) {
+ final Component component = getComponentFactoryRegistry()
+ .addOrReplaceComponent(container, ComponentType.SCALAR_NAME_AND_VALUE, model);
+ final ScalarPanelAbstract2 paramPanel =
+ component instanceof ScalarPanelAbstract2
+ ? (ScalarPanelAbstract2) component
+ : null;
+ if (paramPanel != null) {
+ paramPanel.setOutputMarkupId(true);
+ paramPanel.notifyOnChange(this);
+ }
+ return paramPanel;
+ }
+
+ @Override
+ protected Object newCompletedEvent(final AjaxRequestTarget target, final Form<?> form) {
+ return new IsisActionCompletedEvent(getActionModel(), target, form);
+ }
+
+ @Override
+ protected void configureButtons(final AjaxButton okButton, final AjaxButton cancelButton) {
+ super.configureButtons(okButton, cancelButton);
+ applyAreYouSure(okButton);
+ }
+
+ /**
+ * If the {@literal @}Action has "are you sure?" semantics then apply {@link ConfirmationBehavior}
+ * that will ask for confirmation before executing the Ajax request.
+ *
+ * @param button The button which action should be confirmed
+ */
+ private void applyAreYouSure(AjaxButton button) {
+ ActionModel actionModel = getActionModel();
+ final ObjectAction action = actionModel.getActionMemento().getAction(getSpecificationLoader());
+ SemanticsOf semanticsOf = SemanticsOf.from(action.getSemantics());
+
+ final ServicesInjector servicesInjector = getPersistenceSession().getServicesInjector();
+
+ PanelUtil.addConfirmationDialogIfAreYouSureSemantics(button, semanticsOf, servicesInjector);
+ }
+
+ @Override
+ public void onUpdate(AjaxRequestTarget target, ScalarPanelAbstract2 scalarPanel) {
+
+ final ActionModel actionModel = getActionModel();
+
+ final ObjectAdapter[] pendingArguments = actionModel.getArgumentsAsArray();
+
+ try {
+ final ObjectAction action = actionModel.getActionMemento().getAction(getSpecificationLoader());
+ final int numParams = action.getParameterCount();
+ for (int i = 0; i < numParams; i++) {
+ final ScalarPanelAbstract2 paramPanel = paramPanels.get(i);
+ if (paramPanel != null && paramPanel instanceof PanelWithChoices) {
+ final PanelWithChoices panelWithChoices = (PanelWithChoices) paramPanel;
+
+ // this could throw a ConcurrencyException as we may have to reload the
+ // object adapter of the action in order to compute the choices
+ // (and that object adapter might have changed)
+ if (panelWithChoices.updateChoices(pendingArguments)) {
+ paramPanel.repaint(target);
+ }
+ }
+ }
+ } catch (ConcurrencyException ex) {
+
+ // 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);
+
+ setResponsePage(entityPage);
+
+ final MessageService messageService = getServicesInjector().lookupService(MessageService.class);
+ messageService.warnUser(ex.getMessage());
+ return;
+ }
+
+ // previously this method was also doing:
+ // target.add(this);
+ // ie to update the entire form (in addition to the updates to the individual impacted parameter fields
+ // done in the loop above). However, that logic is wrong, because any values entered in the browser
+ // get trampled over (ISIS-629).
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormExecutor.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormExecutor.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormExecutor.java
index 69d17e3..b4242ca 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormExecutor.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormExecutor.java
@@ -12,7 +12,7 @@ import org.apache.isis.viewer.wicket.model.models.BookmarkableModel;
import org.apache.isis.viewer.wicket.model.models.BookmarkedPagesModel;
import org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponse;
import org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseType;
-import org.apache.isis.viewer.wicket.ui.components.property.FormExecutorAbstract;
+import org.apache.isis.viewer.wicket.ui.panels.FormExecutorAbstract;
import org.apache.isis.viewer.wicket.ui.pages.BookmarkedPagesModelProvider;
public class ActionParametersFormExecutor extends FormExecutorAbstract<ActionModel> {
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.java
index 72e67bf..969e806 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersFormPanel.java
@@ -19,44 +19,24 @@
package org.apache.isis.viewer.wicket.ui.components.actions;
-import java.util.List;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.repeater.RepeatingView;
-
-import org.apache.isis.applib.annotation.SemanticsOf;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.viewer.wicket.model.hints.IsisActionCompletedEvent;
-import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
-import org.apache.isis.viewer.wicket.model.mementos.ActionParameterMemento;
-import org.apache.isis.viewer.wicket.model.models.ActionArgumentModel;
import org.apache.isis.viewer.wicket.model.models.ActionModel;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
import org.apache.isis.viewer.wicket.ui.components.property.PropertyEditFormPanel;
-import org.apache.isis.viewer.wicket.ui.components.scalars.PanelWithChoices;
-import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarModelSubscriber2;
-import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelAbstract2;
-import org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage;
import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
import org.apache.isis.viewer.wicket.ui.panels.PromptFormPanelAbstract;
-import de.agilecoders.wicket.extensions.markup.html.bootstrap.confirmation.ConfirmationBehavior;
-
/**
* {@link PanelAbstract Panel} to capture the arguments for an action
* invocation.
+ *
+ * <p>
+ * corresponding panel for property edits is {@link PropertyEditFormPanel}.
+ * </p>
*/
public class ActionParametersFormPanel extends PromptFormPanelAbstract<ActionModel> {
private static final long serialVersionUID = 1L;
- private static final String ID_ACTION_PARAMETERS = "parameters";
+ static final String ID_ACTION_PARAMETERS = "parameters";
public ActionParametersFormPanel(final String id, final ActionModel model) {
super(id, model);
@@ -66,123 +46,7 @@ public class ActionParametersFormPanel extends PromptFormPanelAbstract<ActionMod
private void buildGui() {
ActionModel model = getModel();
model.clearArguments(); // in case previously used, eg prompt displayed then cancelled
- add(new ActionParameterForm("inputForm", this, this.getSettings(), model));
- }
-
- class ActionParameterForm extends PropertyEditFormPanel.FormAbstract<ActionModel> implements
- ScalarModelSubscriber2 {
-
- private static final long serialVersionUID = 1L;
-
- public ActionParameterForm(
- final String id,
- final Component parentPanel,
- final WicketViewerSettings settings,
- final ActionModel actionModel) {
- super(id, parentPanel, settings, actionModel);
- }
-
- private ActionModel getActionModel() {
- return (ActionModel) super.getModel();
- }
-
- @Override
- protected void addParameters() {
- final ActionModel actionModel = getActionModel();
- List<ActionParameterMemento> parameterMementos = actionModel.primeArgumentModels();
-
- final RepeatingView rv = new RepeatingView(ID_ACTION_PARAMETERS);
- add(rv);
-
- paramPanels.clear();
- for (final ActionParameterMemento apm : parameterMementos) {
- final WebMarkupContainer container = new WebMarkupContainer(rv.newChildId());
- rv.add(container);
-
- final ActionArgumentModel actionArgumentModel = actionModel.getArgumentModel(apm);
- actionArgumentModel.setActionArgsHint(actionModel.getArgumentsAsArray());
- final Component component = getComponentFactoryRegistry().addOrReplaceComponent(container, ComponentType.SCALAR_NAME_AND_VALUE,
- actionArgumentModel);
- final ScalarPanelAbstract2 paramPanel = component instanceof ScalarPanelAbstract2 ? (ScalarPanelAbstract2) component : null;
- paramPanels.add(paramPanel);
- if(paramPanel != null) {
- paramPanel.setOutputMarkupId(true);
- paramPanel.notifyOnChange(this);
- }
- }
- }
-
- @Override
- protected void configureButtons(final AjaxButton okButton, final AjaxButton cancelButton) {
- super.configureButtons(okButton, cancelButton);
- applyAreYouSure(okButton);
- }
-
-
- @Override
- protected Object newCompletedEvent(final AjaxRequestTarget target, final Form<?> form) {
- return new IsisActionCompletedEvent(getActionModel(), target, form);
- }
-
- /**
- * If the {@literal @}Action has "are you sure?" semantics then apply {@link ConfirmationBehavior}
- * that will ask for confirmation before executing the Ajax request.
- *
- * @param button The button which action should be confirmed
- */
- private void applyAreYouSure(AjaxButton button) {
- ActionModel actionModel = getActionModel();
- final ObjectAction action = actionModel.getActionMemento().getAction(getSpecificationLoader());
- SemanticsOf semanticsOf = SemanticsOf.from(action.getSemantics());
-
- addConfirmationDialogIfAreYouSureSemantics(button, semanticsOf);
- }
-
- @Override
- public void onUpdate(AjaxRequestTarget target, ScalarPanelAbstract2 scalarPanel) {
-
- final ActionModel actionModel = getActionModel();
-
- final ObjectAdapter[] pendingArguments = actionModel.getArgumentsAsArray();
-
- try {
- final ObjectAction action = actionModel.getActionMemento().getAction(getSpecificationLoader());
- final int numParams = action.getParameterCount();
- for (int i = 0; i < numParams; i++) {
- final ScalarPanelAbstract2 paramPanel = paramPanels.get(i);
- if(paramPanel != null && paramPanel instanceof PanelWithChoices) {
- final PanelWithChoices panelWithChoices = (PanelWithChoices) paramPanel;
-
- // this could throw a ConcurrencyException as we may have to reload the
- // object adapter of the action in order to compute the choices
- // (and that object adapter might have changed)
- if (panelWithChoices.updateChoices(pendingArguments)) {
- paramPanel.repaint(target);
- }
- }
- }
- } catch(ConcurrencyException ex) {
-
- // 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;
- }
-
- // previously this method was also doing:
- // target.add(this);
- // ie to update the entire form (in addition to the updates to the individual impacted parameter fields
- // done in the loop above). However, that logic is wrong, because any values entered in the browser
- // get trampled over (ISIS-629).
- }
-
+ add(new ActionParametersForm("inputForm", this, this.getSettings(), model));
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersPanel.html
new file mode 100644
index 0000000..de76cf2
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersPanel.html
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"
+ xml:lang="en"
+ lang="en">
+ <body>
+ <wicket:panel>
+ <div class="actionPanel actionComponentType">
+ <div wicket:id="header" class="iconAndTitle panel panel-default actionPanelHeaderNew">
+ <wicket:container wicket:id="entityIconAndTitle">[icon and title]</wicket:container>
+ <h3 wicket:id="actionName" class="actionName">[action name]</h3>
+ </div>
+ <div wicket:id="parameters"></div>
+ </div>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersPanel.java
new file mode 100644
index 0000000..980af9d
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersPanel.java
@@ -0,0 +1,171 @@
+/*
+ * 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.ui.components.actions;
+
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.model.Model;
+
+import org.apache.isis.core.commons.authentication.MessageBroker;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
+import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.model.models.ActionPrompt;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+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.ActionResultResponseType;
+import org.apache.isis.viewer.wicket.ui.components.property.PropertyEditPanel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+/**
+ * {@link PanelAbstract Panel} representing an action invocation, backed by an
+ * {@link ActionModel}.
+ *
+ * <p>
+ * Based on the {@link ActionModel.Mode mode}, will render either parameter
+ * dialog or the results.
+ *
+ * <p>
+ * Corresponding component to edit properties is {@link PropertyEditPanel}.
+ */
+public class ActionParametersPanel extends PanelAbstract<ActionModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_HEADER = "header";
+
+ static final String ID_ACTION_NAME = "actionName";
+
+
+ /**
+ * Gives a chance to hide the header part of this action panel, e.g. when shown in an action prompt
+ */
+ private boolean showHeader = true;
+
+ public ActionParametersPanel(final String id, final ActionModel actionModel) {
+ super(id, actionModel);
+ actionModel.setFormExecutor(new ActionParametersFormExecutor(this, actionModel));
+ buildGui(getActionModel());
+ }
+
+ /**
+ * Sets the owning action prompt (modal window), if any.
+ */
+ public void setActionPrompt(ActionPrompt actionPrompt) {
+ ActionParametersFormExecutor formExecutor =
+ (ActionParametersFormExecutor) getActionModel().getFormExecutor();
+ formExecutor.setActionPrompt(actionPrompt);
+ }
+
+ @Override
+ protected void onConfigure() {
+ super.onConfigure();
+
+ buildGui(getModel());
+ }
+
+ private void buildGui(final ActionModel actionModel) {
+ if (actionModel.hasParameters()) {
+ buildGuiForParameters(getActionModel());
+ } else {
+ buildGuiForNoParameters(actionModel);
+ }
+ }
+
+ ActionModel getActionModel() {
+ return super.getModel();
+ }
+
+ public ActionParametersPanel setShowHeader(boolean showHeader) {
+ this.showHeader = showHeader;
+ return this;
+ }
+
+ private void buildGuiForParameters(final ActionModel actionModel) {
+
+ WebMarkupContainer header = addHeader();
+
+ ObjectAdapter targetAdapter = null;
+ try {
+ targetAdapter = actionModel.getTargetAdapter();
+
+ getComponentFactoryRegistry().addOrReplaceComponent(this, ComponentType.PARAMETERS, getActionModel());
+ getComponentFactoryRegistry().addOrReplaceComponent(header, ComponentType.ENTITY_ICON_AND_TITLE, new EntityModel(targetAdapter));
+
+ final String actionName = getActionModel().getActionMemento().getAction(actionModel.getSpecificationLoader()).getName();
+ header.add(new Label(ID_ACTION_NAME, Model.of(actionName)));
+
+ } catch (final ConcurrencyException ex) {
+
+ // second attempt should succeed, because the Oid would have
+ // been updated in the attempt
+ if (targetAdapter == null) {
+ targetAdapter = getModel().getTargetAdapter();
+ }
+
+ // forward onto the target page with the concurrency exception
+ ActionResultResponse resultResponse = ActionResultResponseType.OBJECT.interpretResult(this.getActionModel(), targetAdapter, ex);
+ resultResponse.getHandlingStrategy().handleResults(this, resultResponse, getIsisSessionFactory());
+
+ getMessageBroker().addWarning(ex.getMessage());
+ }
+ }
+
+ private WebMarkupContainer addHeader() {
+ WebMarkupContainer header = new WebMarkupContainer(ID_HEADER) {
+ @Override
+ protected void onConfigure() {
+ super.onConfigure();
+ setVisible(showHeader);
+ }
+ };
+ addOrReplace(header);
+ return header;
+ }
+
+ private void buildGuiForNoParameters(final ActionModel formExecutor) {
+
+ boolean succeeded = formExecutor.getFormExecutor().executeAndProcessResults(null, null,
+ formExecutor.getPromptStyle());
+ if(succeeded) {
+ // nothing to do
+ } else {
+
+ // render the target entity again
+ //
+ // (One way this can occur is if an event subscriber has a defect and throws an exception; in which case
+ // the EventBus' exception handler will automatically veto. This results in a growl message rather than
+ // an error page, but is probably 'good enough').
+ final ObjectAdapter targetAdapter = formExecutor.getTargetAdapter();
+
+ ActionResultResponse resultResponse = ActionResultResponseType.OBJECT.interpretResult(this.getActionModel(), targetAdapter, null);
+ resultResponse.getHandlingStrategy().handleResults(this, resultResponse, getIsisSessionFactory());
+ }
+ }
+
+
+
+ private MessageBroker getMessageBroker() {
+ return getAuthenticationSession().getMessageBroker();
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersPanelFactory.java
new file mode 100644
index 0000000..5d92915
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actions/ActionParametersPanelFactory.java
@@ -0,0 +1,52 @@
+/*
+ * 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.ui.components.actions;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+
+/**
+ * {@link ComponentFactory} for {@link ActionParametersPanel}.
+ */
+public class ActionParametersPanelFactory extends ComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public ActionParametersPanelFactory() {
+ super(ComponentType.ACTION_PROMPT, ActionParametersPanel.class);
+ }
+
+ @Override
+ public ApplicationAdvice appliesTo(final IModel<?> model) {
+ return appliesIf(model instanceof ActionModel);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final ActionModel actionModel = (ActionModel) model;
+ return new ActionParametersPanel(id, actionModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/FormExecutorAbstract.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/FormExecutorAbstract.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/FormExecutorAbstract.java
deleted file mode 100644
index 098f744..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/FormExecutorAbstract.java
+++ /dev/null
@@ -1,330 +0,0 @@
-package org.apache.isis.viewer.wicket.ui.components.property;
-
-import java.util.List;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.Lists;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.Page;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.util.visit.IVisit;
-import org.apache.wicket.util.visit.IVisitor;
-
-import org.apache.isis.applib.annotation.PromptStyle;
-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.version.ConcurrencyException;
-import org.apache.isis.core.metamodel.facets.properties.renderunchanged.UnchangingFacet;
-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.BookmarkableModel;
-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.util.Components;
-
-public abstract class FormExecutorAbstract<M extends BookmarkableModel<ObjectAdapter>> implements FormExecutor {
-
- protected final MarkupContainer panel;
- protected final M model;
-
- public FormExecutorAbstract(final MarkupContainer panel, final M model) {
- this.panel = panel;
- this.model = model;
- }
-
- @Override
- public boolean executeAndProcessResults(
- final AjaxRequestTarget target,
- final Form<?> feedbackForm,
- final PromptStyle promptStyle) {
-
- Components.permanentlyHide(panel, ComponentType.ENTITY_ICON_AND_TITLE);
-
- ObjectAdapter targetAdapter = null;
- try {
- targetAdapter = obtainTargetAdapter();
-
- // no concurrency exception, so continue...
- return doExecuteAndProcessResults(target, feedbackForm, promptStyle);
-
- } catch (ConcurrencyException ex) {
-
- // second attempt should succeed, because the Oid would have
- // been updated in the attempt
- if (targetAdapter == null) {
- targetAdapter = obtainTargetAdapter();
- }
-
- forwardOnConcurrencyException(targetAdapter, ex);
-
- getMessageBroker().addWarning(ex.getMessage());
- return false;
- }
- }
-
- /**
- * @param target
- * @return whether to clear args or not (they aren't if there was a validation exception)
- */
- private boolean doExecuteAndProcessResults(
- final AjaxRequestTarget target,
- final Form<?> feedbackForm,
- final PromptStyle promptStyle) {
-
- // validate the action parameters (if any)
- final String invalidReasonIfAny = 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
- final ObjectAdapter resultAdapter = obtainResultAdapter();
-
- // flush any queued changes, so concurrency or violation exceptions (if any)
- // will be thrown here
- getTransactionManager().flushTransaction();
-
-
- if(promptStyle == PromptStyle.INLINE) {
-
- final Page page = feedbackForm.getPage();
- addComponentsToRedraw(target, page);
-
- } else {
- forwardOntoResult(resultAdapter, target);
-
- }
-
- onExecuteAndProcessResults(target);
-
- 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 void addComponentsToRedraw(final AjaxRequestTarget target, final Page page) {
- final List<Component> componentsToRedraw = Lists.newArrayList();
- final List<Component> componentsNotToRedraw = Lists.newArrayList();
-
- page.visitChildren(new IVisitor<Component, Object>() {
- @Override
- public void component(final Component component, final IVisit<Object> visit) {
- if (component.getOutputMarkupId() && !(component instanceof Page)) {
- List<Component> listToAddTo =
- shouldRedraw(component)
- ? componentsToRedraw
- : componentsNotToRedraw;
- listToAddTo.add(component);
- }
- }
-
- private boolean shouldRedraw(final Component component) {
-
- // hmm... this doesn't work, because I think that the components
- // get removed after they've been added to target.
- // so.. still getting WARN log messages from XmlPartialPageUpdate
-
-// final Page page = component.findParent(Page.class);
-// if(page == null) {
-// // as per logic in XmlPartialPageUpdate, this has already been
-// // removed from page so don't attempt to redraw it
-// return false;
-// }
-
- final Object defaultModel = component.getDefaultModel();
- if (!(defaultModel instanceof ScalarModel)) {
- return true;
- }
- final ScalarModel scalarModel = (ScalarModel) defaultModel;
- final UnchangingFacet unchangingFacet = scalarModel.getFacet(UnchangingFacet.class);
- return unchangingFacet == null || ! unchangingFacet.value() ;
- }
- });
-
- for (Component componentNotToRedraw : componentsNotToRedraw) {
- MarkupContainer parent = componentNotToRedraw.getParent();
- while(parent != null) {
- parent = parent.getParent();
- }
-
- componentNotToRedraw.visitParents(MarkupContainer.class, new IVisitor<MarkupContainer, Object>() {
- @Override
- public void component(final MarkupContainer parent, final IVisit<Object> visit) {
- componentsToRedraw.remove(parent); // no-op if not in that list
- }
- });
- if(componentNotToRedraw instanceof MarkupContainer) {
- final MarkupContainer containerNotToRedraw = (MarkupContainer) componentNotToRedraw;
- containerNotToRedraw.visitChildren(new IVisitor<Component, Object>() {
- @Override
- public void component(final Component parent, final IVisit<Object> visit) {
- componentsToRedraw.remove(parent); // no-op if not in that list
- }
- });
- }
- }
-
- // debug(componentsToRedraw, componentsNotToRedraw);
-
- for (Component component : componentsToRedraw) {
- target.add(component);
- }
- }
-
- private void debug(
- final List<Component> componentsToRedraw,
- final List<Component> componentsNotToRedraw) {
- debug("Not redrawing", componentsNotToRedraw);
- debug("Redrawing", componentsToRedraw);
- }
-
- private void debug(final String title, final List<Component> list) {
- System.out.println(">>> " + title + ":");
- for (Component component : list) {
- System.out.println(
- String.format("%30s: %s",
- component.getClass().getSimpleName(),
- component.getPath()));
-
- }
- }
-
- 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();
- }
-
- private IsisTransactionManager getTransactionManager() {
- return getPersistenceSession().getTransactionManager();
- }
-
- private MessageBroker getMessageBroker() {
- return getAuthenticationSession().getMessageBroker();
- }
-
- protected IsisSessionFactory getIsisSessionFactory() {
- return IsisContext.getSessionFactory();
- }
-
- protected AuthenticationSession getAuthenticationSession() {
- return getIsisSessionFactory().getCurrentSession().getAuthenticationSession();
- }
-
-
- ///////////////////////////////////////////////////////////////////////////////
-
- protected abstract ObjectAdapter obtainTargetAdapter();
-
- protected abstract String getReasonInvalidIfAny();
-
- protected abstract void onExecuteAndProcessResults(final AjaxRequestTarget target);
-
- protected abstract ObjectAdapter obtainResultAdapter();
-
- protected abstract void forwardOnConcurrencyException(
- final ObjectAdapter targetAdapter,
- final ConcurrencyException ex);
-
- protected abstract void forwardOntoResult(
- final ObjectAdapter resultAdapter,
- final AjaxRequestTarget target);
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditForm.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditForm.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditForm.java
new file mode 100644
index 0000000..84e7cb5
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditForm.java
@@ -0,0 +1,91 @@
+package org.apache.isis.viewer.wicket.ui.components.property;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.applib.annotation.PromptStyle;
+import org.apache.isis.viewer.wicket.model.hints.IsisPropertyEditCompletedEvent;
+import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelAbstract2;
+import org.apache.isis.viewer.wicket.ui.panels.PromptFormAbstract;
+
+class PropertyEditForm extends PromptFormAbstract<ScalarModel> {
+
+ private static final long serialVersionUID = 1L;
+
+
+
+ public PropertyEditForm(
+ final String id,
+ final Component parentPanel,
+ final WicketViewerSettings settings,
+ final ScalarModel propertyModel) {
+ super(id, parentPanel, settings, propertyModel);
+ }
+
+ private ScalarModel getScalarModel() {
+ return (ScalarModel) super.getModel();
+ }
+
+
+
+ @Override
+ protected void addParameters() {
+ final ScalarModel scalarModel = getScalarModel();
+
+ final WebMarkupContainer container = new WebMarkupContainer(PropertyEditFormPanel.ID_PROPERTY);
+ add(container);
+
+ newParamPanel(container, scalarModel);
+ }
+
+ private ScalarPanelAbstract2 newParamPanel(final WebMarkupContainer container, final IModel<?> model) {
+
+ final Component component = getComponentFactoryRegistry()
+ .addOrReplaceComponent(container, ComponentType.SCALAR_NAME_AND_VALUE, model);
+ final ScalarPanelAbstract2 paramPanel =
+ component instanceof ScalarPanelAbstract2
+ ? (ScalarPanelAbstract2) component
+ : null;
+ if (paramPanel != null) {
+ paramPanel.setOutputMarkupId(true);
+ paramPanel.notifyOnChange(this);
+ }
+ return paramPanel;
+ }
+
+ @Override
+ protected Object newCompletedEvent(final AjaxRequestTarget target, final Form<?> form) {
+ return new IsisPropertyEditCompletedEvent(getScalarModel(), target, form);
+ }
+
+ @Override
+ public void onUpdate(
+ final AjaxRequestTarget target, final ScalarPanelAbstract2 scalarPanel) {
+
+ }
+
+ // REVIEW: this overload may not be necessary, recall that the important call needed is getScalarModel().reset(),
+ // which is called in the superclass.
+ @Override
+ public void onCancel(
+ final AjaxRequestTarget target, final AjaxButton cancelButton) {
+
+ final PromptStyle promptStyle = getScalarModel().getPromptStyle();
+
+ if (promptStyle == PromptStyle.INLINE) {
+
+ getScalarModel().toViewMode();
+ getScalarModel().clearPending();
+ }
+
+ super.onCancel(target, cancelButton);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/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
index 9e6cb44..9e5631e 100644
--- 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
@@ -9,6 +9,7 @@ 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.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.panels.FormExecutorAbstract;
import org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage;
public class PropertyEditFormExecutor extends FormExecutorAbstract<ScalarModel> {
http://git-wip-us.apache.org/repos/asf/isis/blob/0d81e11a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditFormPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditFormPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditFormPanel.java
index f9441a8..b6847a7 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditFormPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/property/PropertyEditFormPanel.java
@@ -19,33 +19,25 @@
package org.apache.isis.viewer.wicket.ui.components.property;
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.form.Form;
-
-import org.apache.isis.applib.annotation.PromptStyle;
-import org.apache.isis.viewer.wicket.model.hints.IsisPropertyEditCompletedEvent;
-import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
import org.apache.isis.viewer.wicket.model.models.ScalarModel;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
-import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarModelSubscriber2;
-import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelAbstract2;
+import org.apache.isis.viewer.wicket.ui.components.actions.ActionParametersFormPanel;
import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
import org.apache.isis.viewer.wicket.ui.panels.PromptFormPanelAbstract;
/**
* {@link PanelAbstract Panel} to capture the arguments for an action
* invocation.
+ *
+ * <p>
+ * corresponding panel for property edits is {@link ActionParametersFormPanel}.
+ * </p>
*/
-public class PropertyEditFormPanel extends PromptFormPanelAbstract<ScalarModel> {
+public class PropertyEditFormPanel
+ extends PromptFormPanelAbstract<ScalarModel> {
private static final long serialVersionUID = 1L;
- private static final String ID_PROPERTY = "property";
+ static final String ID_PROPERTY = "property";
public PropertyEditFormPanel(final String id, final ScalarModel model) {
super(id, model);
@@ -57,81 +49,4 @@ public class PropertyEditFormPanel extends PromptFormPanelAbstract<ScalarModel>
add(new PropertyEditForm("inputForm", this, this.getSettings(), model));
}
- class PropertyEditForm extends FormAbstract<ScalarModel> implements ScalarModelSubscriber2 {
-
- private static final long serialVersionUID = 1L;
-
- private final PropertyEditFormPanel propertyEditFormPanel;
-
- public PropertyEditForm(
- final String id,
- final PropertyEditFormPanel propertyEditFormPanel,
- final WicketViewerSettings settings,
- final ScalarModel propertyModel) {
- super(id, propertyEditFormPanel, settings, propertyModel);
- this.propertyEditFormPanel = propertyEditFormPanel;
- }
-
- private ScalarModel getScalarModel() {
- return (ScalarModel) super.getModel();
- }
-
- @Override
- public void renderHead(final IHeaderResponse response) {
- super.renderHead(response);
-
- response.render(OnDomReadyHeaderItem.forScript(
- String.format("Wicket.Event.publish(Isis.Topic.FOCUS_FIRST_PARAMETER, '%s')", getMarkupId())));
-
- }
-
-
- @Override
- protected void addParameters() {
- final ScalarModel scalarModel = getScalarModel();
-
- final WebMarkupContainer container = new WebMarkupContainer(ID_PROPERTY);
- add(container);
-
- final Component component =
- getComponentFactoryRegistry().addOrReplaceComponent(container, ComponentType.SCALAR_NAME_AND_VALUE, scalarModel);
- final ScalarPanelAbstract2 paramPanel = component instanceof ScalarPanelAbstract2 ? (ScalarPanelAbstract2) component : null;
- if(paramPanel != null) {
- paramPanel.setOutputMarkupId(true);
- paramPanel.notifyOnChange(this);
- }
- }
-
-
- @Override
- protected Object newCompletedEvent(final AjaxRequestTarget target, final Form<?> form) {
- return new IsisPropertyEditCompletedEvent(getScalarModel(), target, form);
- }
-
- @Override
- public void onUpdate(
- final AjaxRequestTarget target, final ScalarPanelAbstract2 scalarPanel) {
-
- }
-
- // REVIEW: this overload may not be necessary, recall that the important call needed is getScalarModel().reset(),
- // which is called in the superclass.
- @Override
- public void onCancel(
- final AjaxRequestTarget target, final AjaxButton cancelButton) {
-
- final PromptStyle promptStyle = getScalarModel().getPromptStyle();
-
- if(promptStyle == PromptStyle.INLINE) {
-
- getScalarModel().toViewMode();
- getScalarModel().clearPending();
- }
-
- super.onCancel(target, cancelButton);
- }
-
-
- }
-
}