You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by fm...@apache.org on 2017/08/17 14:52:11 UTC
syncope git commit: [SYNCOPE-1190] provides action toggle panel
header reload
Repository: syncope
Updated Branches:
refs/heads/master 9deba7134 -> 4f7cb969c
[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/4f7cb969
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4f7cb969
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4f7cb969
Branch: refs/heads/master
Commit: 4f7cb969c55acf9b154923490279701984e17459
Parents: 9deba71
Author: fmartelli <fa...@gmail.com>
Authored: Thu Aug 17 16:51:43 2017 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Thu Aug 17 16:51:43 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/4f7cb969/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/4f7cb969/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;