syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmarte...@apache.org
Subject syncope git commit: [SYNCOPE-1190] provides action toggle panel header reload
Date Thu, 17 Aug 2017 14:52:41 GMT
Repository: syncope
Updated Branches:
  refs/heads/2_0_X 31e884a9f -> 223f14397


[SYNCOPE-1190] provides action toggle panel header reload


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

Branch: refs/heads/2_0_X
Commit: 223f14397a2a8e5b5689bde706020d5d641b3f9c
Parents: 31e884a
Author: fmartelli <fabio.martelli@gmail.com>
Authored: Thu Aug 17 16:51:43 2017 +0200
Committer: fmartelli <fabio.martelli@gmail.com>
Committed: Thu Aug 17 16:52:28 2017 +0200

----------------------------------------------------------------------
 .../console/panels/AnyDirectoryPanel.java       | 17 +++++++++++++++
 .../html/form/ActionLinksTogglePanel.java       | 22 ++++++++++++++++----
 2 files changed, 35 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/223f1439/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyDirectoryPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyDirectoryPanel.java
index 5a481ff..ad02b53 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyDirectoryPanel.java
@@ -44,6 +44,7 @@ import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.
 import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
 import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
 import org.apache.syncope.client.console.wizards.any.AnyWrapper;
+import org.apache.syncope.client.console.wizards.any.ResultPage;
 import org.apache.syncope.client.console.wizards.any.StatusPanel;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.AnyTO;
@@ -55,6 +56,7 @@ import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
 import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
 import org.apache.wicket.markup.html.panel.Panel;
@@ -125,6 +127,21 @@ public abstract class AnyDirectoryPanel<A extends AnyTO, E extends
AbstractAnyRe
         }
 
         initResultTable();
+        
+        // cahnge close callback in order to update header after model update
+        modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
+
+            private static final long serialVersionUID = 8804221891699487139L;
+
+            @Override
+            public void onClose(final AjaxRequestTarget target) {
+                if (actionTogglePanel.isVisibleInHierarchy() && modal.getContent()
instanceof ResultPage) {
+                    actionTogglePanel.updateHeader(
+                            target, ResultPage.class.cast(modal.getContent()).getItem());
+                }
+                modal.show(false);
+            }
+        });
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/223f1439/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java
index aac5942..87f184d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java
@@ -26,6 +26,9 @@ import org.apache.syncope.client.console.commons.status.StatusBean;
 import org.apache.syncope.client.console.panels.TogglePanel;
 import org.apache.syncope.client.console.policies.PolicyRuleDirectoryPanel.PolicyRuleWrapper;
 import org.apache.syncope.client.console.reports.ReportletDirectoryPanel.ReportletWrapper;
+import org.apache.syncope.client.console.wizards.any.AnyWrapper;
+import org.apache.syncope.client.console.wizards.any.GroupWrapper;
+import org.apache.syncope.client.console.wizards.any.UserWrapper;
 import org.apache.syncope.client.console.wizards.resources.ResourceProvision;
 import org.apache.syncope.common.lib.to.AnyObjectTO;
 import org.apache.syncope.common.lib.to.EntityTO;
@@ -68,19 +71,26 @@ public class ActionLinksTogglePanel<T extends Serializable> extends
TogglePanel<
         container.add(getEmptyFragment());
     }
 
-    public void toggleWithContent(
-            final AjaxRequestTarget target, final ActionsPanel<T> actionsPanel, final
T modelObject) {
+    public void updateHeader(
+            final AjaxRequestTarget target, final Serializable modelObject) {
         final String header;
         if (modelObject == null) {
             header = new ResourceModel("actions", StringUtils.EMPTY).getObject();
         } else if (modelObject instanceof UserTO) {
             header = ((UserTO) modelObject).getUsername();
+        } else if (modelObject instanceof UserWrapper) {
+            header = ((UserWrapper) modelObject).getInnerObject().getUsername();
         } else if (modelObject instanceof GroupTO) {
             header = ((GroupTO) modelObject).getName();
-        } else if (modelObject instanceof ReportTO) {
-            header = ((ReportTO) modelObject).getName();
+        } else if (modelObject instanceof GroupWrapper) {
+            header = ((GroupWrapper) modelObject).getInnerObject().getName();
         } else if (modelObject instanceof AnyObjectTO) {
             header = ((AnyObjectTO) modelObject).getName();
+        } else if (modelObject instanceof AnyWrapper
+                && AnyWrapper.class.cast(modelObject).getInnerObject() instanceof
AnyObjectTO) {
+            header = ((AnyObjectTO) ((AnyWrapper) modelObject).getInnerObject()).getName();
+        } else if (modelObject instanceof ReportTO) {
+            header = ((ReportTO) modelObject).getName();
         } else if (modelObject instanceof AttrTO) {
             header = ((AttrTO) modelObject).getSchema();
         } else if (modelObject instanceof AbstractPolicyTO) {
@@ -116,7 +126,11 @@ public class ActionLinksTogglePanel<T extends Serializable> extends
TogglePanel<
             header = new ResourceModel("actions", StringUtils.EMPTY).getObject();
         }
         setHeader(target, StringUtils.abbreviate(header, 25));
+    }
 
+    public void toggleWithContent(
+            final AjaxRequestTarget target, final ActionsPanel<T> actionsPanel, final
T modelObject) {
+        updateHeader(target, modelObject);
         modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
 
             private static final long serialVersionUID = 8804221891699487139L;


Mime
View raw message