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/07/24 17:07:17 UTC

[4/4] isis git commit: ISIS-1667: tidies up defunct comments etc in ActionParametersPanel

ISIS-1667: tidies up defunct comments etc in ActionParametersPanel


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/a36a5205
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/a36a5205
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/a36a5205

Branch: refs/heads/master
Commit: a36a5205e0318f28893933155c8b3cbe541ff03c
Parents: ebe678f
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Jul 24 18:05:09 2017 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Jul 24 18:05:09 2017 +0100

----------------------------------------------------------------------
 .../actions/ActionParametersPanel.java          | 96 ++++++++------------
 1 file changed, 40 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/a36a5205/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
index a962370..dc17e3c 100644
--- 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
@@ -50,20 +50,14 @@ 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;
+    private static final String ID_ACTION_NAME = "actionName";
 
     public ActionParametersPanel(final String id, final ActionModel actionModel) {
         super(id, actionModel);
+    }
 
-        //buildGui(getActionModel());
+    ActionModel getActionModel() {
+        return super.getModel();
     }
 
     /**
@@ -80,68 +74,58 @@ public class ActionParametersPanel extends PanelAbstract<ActionModel> {
     protected void onInitialize() {
         super.onInitialize();
 
-
-        //
-        // <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>
-        //
-
-
-        // buildGui(getModel());
         final ActionModel actionModel = getModel();
 
         if (!actionModel.hasParameters()) {
-            // buildGuiForNoParameters(actionModel);
-
+            // the factory should check for this already, so this should never occur...
             throw new IllegalStateException("model has no parameters!");
-        } else {
-
-            // buildGuiForParameters(getActionModel());
+        }
 
-            WebMarkupContainer header = new WebMarkupContainer(ID_HEADER) {
-                @Override
-                protected void onConfigure() {
-                    super.onConfigure();
-                    setVisible(showHeader);
-                }
-            };
-            addOrReplace(header);
 
-            ObjectAdapter targetAdapter = null;
-            try {
-                targetAdapter = actionModel.getTargetAdapter();
+        WebMarkupContainer header = new WebMarkupContainer(ID_HEADER) {
+            @Override
+            protected void onConfigure() {
+                super.onConfigure();
+                setVisible(showHeader);
+            }
+        };
 
-                getComponentFactoryRegistry().addOrReplaceComponent(this, ComponentType.PARAMETERS, getActionModel());
-                getComponentFactoryRegistry().addOrReplaceComponent(header, ComponentType.ENTITY_ICON_AND_TITLE, actionModel
-                        .getParentEntityModel());
+        addOrReplace(header);
 
-                final String actionName = getActionModel().getActionMemento().getAction(actionModel.getSpecificationLoader()).getName();
-                header.add(new Label(ID_ACTION_NAME, Model.of(actionName)));
+        ObjectAdapter targetAdapter = null;
+        try {
+            targetAdapter = actionModel.getTargetAdapter();
 
-            } catch (final ConcurrencyException ex) {
+            getComponentFactoryRegistry().addOrReplaceComponent(this, ComponentType.PARAMETERS, getActionModel());
+            getComponentFactoryRegistry().addOrReplaceComponent(header, ComponentType.ENTITY_ICON_AND_TITLE, actionModel
+                    .getParentEntityModel());
 
-                // second attempt should succeed, because the Oid would have
-                // been updated in the attempt
-                if (targetAdapter == null) {
-                    targetAdapter = getModel().getTargetAdapter();
-                }
+            final String actionName = getActionModel().getActionMemento().getAction(actionModel.getSpecificationLoader()).getName();
+            header.add(new Label(ID_ACTION_NAME, Model.of(actionName)));
 
-                // forward onto the target page with the concurrency exception
-                ActionResultResponse resultResponse = ActionResultResponseType.OBJECT.interpretResult(this.getActionModel(), targetAdapter, ex);
-                resultResponse.getHandlingStrategy().handleResults(resultResponse, getIsisSessionFactory());
+        } catch (final ConcurrencyException ex) {
 
-                final MessageService messageService = getServicesInjector().lookupService(MessageService.class);
-                messageService.warnUser(ex.getMessage());
+            // 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(resultResponse, getIsisSessionFactory());
+
+            final MessageService messageService = getServicesInjector().lookupService(MessageService.class);
+            messageService.warnUser(ex.getMessage());
         }
     }
 
-    ActionModel getActionModel() {
-        return super.getModel();
-    }
+
+    /**
+     * 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 void setShowHeader(boolean showHeader) {
         this.showHeader = showHeader;