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-841] fix for mapping item tansformers selection panel position
Date Mon, 09 May 2016 08:06:18 GMT
Repository: syncope
Updated Branches:
  refs/heads/master 4f44042cb -> b99b684ab


[SYNCOPE-841] fix for mapping item tansformers selection panel position


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

Branch: refs/heads/master
Commit: b99b684ab0e7a8f2df9fa4442937d870d1939e59
Parents: 4f44042
Author: fmartelli <fabio.martelli@gmail.com>
Authored: Mon May 9 09:58:11 2016 +0200
Committer: fmartelli <fabio.martelli@gmail.com>
Committed: Mon May 9 09:58:11 2016 +0200

----------------------------------------------------------------------
 .../client/console/panels/TogglePanel.java      | 11 +++++--
 .../console/tasks/TransformersTogglePanel.java  |  2 +-
 .../client/console/wizards/AjaxWizard.java      | 30 ++++++++++++++++++++
 .../console/wizards/AjaxWizardBuilder.java      | 13 ++++++++-
 .../resources/ProvisionWizardBuilder.java       | 11 +++++--
 .../wizards/resources/ResourceMappingPanel.java | 11 ++++---
 .../client/console/wizards/AjaxWizard.html      |  8 +++---
 .../wizards/resources/ResourceMappingPanel.html |  1 -
 .../syncope/fit/console/TopologyITCase.java     |  2 +-
 9 files changed, 71 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/b99b684a/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java
index 63343db..5ff6540 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java
@@ -54,14 +54,21 @@ public abstract class TogglePanel<T extends Serializable> extends
WizardMgtPanel
 
     private final Label header;
 
+    private final String activeId;
+
     public TogglePanel(final String id) {
+        this(id, id);
+    }
+
+    public TogglePanel(final String id, final String markupId) {
         super(id, true);
+        this.activeId = markupId;
         setRenderBodyOnly(true);
         setOutputMarkupId(true);
         disableContainerAutoRefresh();
 
         container = new WebMarkupContainer("togglePanelContainer");
-        super.addInnerObject(container.setMarkupId(id));
+        super.addInnerObject(container.setMarkupId(markupId == null ? id : markupId));
 
         header = new Label("label", StringUtils.EMPTY);
         header.setOutputMarkupId(true);
@@ -121,7 +128,7 @@ public abstract class TogglePanel<T extends Serializable> extends
WizardMgtPanel
      * @param toggle toggle action.
      */
     public void toggle(final AjaxRequestTarget target, final boolean toggle) {
-        final String selector = String.format("$(\"div#%s\")", getId());
+        final String selector = String.format("$(\"div#%s\")", activeId);
         if (toggle) {
             if (status == Status.INACTIVE) {
                 target.add(TogglePanel.this.container);

http://git-wip-us.apache.org/repos/asf/syncope/blob/b99b684a/client/console/src/main/java/org/apache/syncope/client/console/tasks/TransformersTogglePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/TransformersTogglePanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/tasks/TransformersTogglePanel.java
index 7b68996..72c2bd8 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/TransformersTogglePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/TransformersTogglePanel.java
@@ -46,7 +46,7 @@ public class TransformersTogglePanel extends TogglePanel<Serializable>
{
     private MappingItemTO mapItem;
 
     public TransformersTogglePanel(final WebMarkupContainer container) {
-        super("transformersTogglePanel");
+        super("outer", "transformersTogglePanel");
         this.container = container;
 
         final LoadableDetachableModel<List<String>> model = new LoadableDetachableModel<List<String>>()
{

http://git-wip-us.apache.org/repos/asf/syncope/blob/b99b684a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizard.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizard.java
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizard.java
index a988fd2..897e27f 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizard.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizard.java
@@ -19,7 +19,9 @@
 package org.apache.syncope.client.console.wizards;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.wicket.Component;
@@ -38,12 +40,16 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.syncope.client.console.panels.SubmitableModalPanel;
 import org.apache.syncope.client.console.panels.WizardModalPanel;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
 
 public abstract class AjaxWizard<T extends Serializable> extends Wizard
         implements SubmitableModalPanel, WizardModalPanel<T> {
 
     private static final long serialVersionUID = -1272120742876833520L;
 
+    private final List<Component> outerObjects = new ArrayList<>();
+
     public enum Mode {
         CREATE,
         EDIT,
@@ -76,11 +82,35 @@ public abstract class AjaxWizard<T extends Serializable> extends
Wizard
             model.setCancelVisible(false);
         }
 
+        add(new ListView<Component>("outerObjectsRepeater", outerObjects) {
+
+            private static final long serialVersionUID = -9180479401817023838L;
+
+            @Override
+            protected void populateItem(final ListItem<Component> item) {
+                item.add(item.getModelObject());
+            }
+
+        });
+
         setOutputMarkupId(true);
         setDefaultModel(new CompoundPropertyModel<>(this));
         init(model);
     }
 
+    /**
+     * Add object outside the main container.
+     * Use this method just to be not influenced by specific inner object css'.
+     * Be sure to provide <tt>outer</tt> as id.
+     *
+     * @param childs components to be added.
+     * @return the current panel instance.
+     */
+    public final AjaxWizard<T> addOuterObject(final List<Component> childs) {
+        outerObjects.addAll(childs);
+        return this;
+    }
+
     protected AjaxWizard<T> setEventSink(final IEventSink eventSink) {
         this.eventSink = eventSink;
         return this;

http://git-wip-us.apache.org/repos/asf/syncope/blob/b99b684a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java
index 65dc06a..7afef4d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java
@@ -19,6 +19,10 @@
 package org.apache.syncope.client.console.wizards;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.wicket.Component;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.event.Broadcast;
@@ -37,6 +41,8 @@ public abstract class AjaxWizardBuilder<T extends Serializable> extends
Abstract
 
     protected IEventSink eventSink = null;
 
+    private final List<Component> outerObjects = new ArrayList<>();
+
     /**
      * Construct.
      *
@@ -47,6 +53,11 @@ public abstract class AjaxWizardBuilder<T extends Serializable> extends
Abstract
         super(defaultItem, pageRef);
     }
 
+    public final AjaxWizardBuilder<T> addOuterObject(final Component... childs) {
+        outerObjects.addAll(Arrays.asList(childs));
+        return this;
+    }
+
     /**
      * {@inheritDoc }
      */
@@ -113,7 +124,7 @@ public abstract class AjaxWizardBuilder<T extends Serializable>
extends Abstract
 
                 return res;
             }
-        }.setEventSink(eventSink);
+        }.setEventSink(eventSink).addOuterObject(outerObjects);
     }
 
     protected abstract WizardModel buildModelSteps(final T modelObject, final WizardModel
wizardModel);

http://git-wip-us.apache.org/repos/asf/syncope/blob/b99b684a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java
index 68f8c92..aee3908 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java
@@ -28,6 +28,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.panels.ProvisionAuxClassesPanel;
 import org.apache.syncope.client.console.rest.AnyTypeRestClient;
+import org.apache.syncope.client.console.tasks.TransformersTogglePanel;
 import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
@@ -163,7 +164,6 @@ public class ProvisionWizardBuilder extends AjaxWizardBuilder<ProvisionTO>
imple
         Mapping(final ProvisionTO item) {
             setTitleModel(new ResourceModel("mapping.title"));
             setSummaryModel(new StringResourceModel("mapping.summary", this, new Model<>(item)));
-            add(new ResourceMappingPanel("mapping", resourceTO, item));
         }
     }
 
@@ -243,7 +243,14 @@ public class ProvisionWizardBuilder extends AjaxWizardBuilder<ProvisionTO>
imple
     protected WizardModel buildModelSteps(final ProvisionTO modelObject, final WizardModel
wizardModel) {
         wizardModel.add(new ObjectType(modelObject));
         wizardModel.add(new AuxClasses(modelObject));
-        wizardModel.add(new Mapping(modelObject));
+
+        final Mapping mapping = new Mapping(modelObject);
+        mapping.setOutputMarkupId(true);
+        wizardModel.add(mapping);
+        final TransformersTogglePanel transformers = new TransformersTogglePanel(mapping);
+        addOuterObject(transformers);
+        mapping.add(new ResourceMappingPanel("mapping", resourceTO, modelObject, transformers));
+
         wizardModel.add(new ConnObjectLink(modelObject));
         return wizardModel;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/b99b684a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceMappingPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceMappingPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceMappingPanel.java
index 76fcef2..fd6ca46 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceMappingPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceMappingPanel.java
@@ -123,8 +123,6 @@ public class ResourceMappingPanel extends Panel {
      */
     private final WebMarkupContainer mappingContainer;
 
-    private final TransformersTogglePanel transformers;
-
     private MappingTO getMapping() {
         if (provisionTO.getMapping() == null) {
             provisionTO.setMapping(new MappingTO());
@@ -140,7 +138,11 @@ public class ResourceMappingPanel extends Panel {
      * @param resourceTO external resource to be updated.
      * @param provisionTO external resource provisioning configuration instance.
      */
-    public ResourceMappingPanel(final String id, final ResourceTO resourceTO, final ProvisionTO
provisionTO) {
+    public ResourceMappingPanel(
+            final String id,
+            final ResourceTO resourceTO,
+            final ProvisionTO provisionTO,
+            final TransformersTogglePanel transformers) {
         super(id);
         setOutputMarkupId(true);
 
@@ -157,9 +159,6 @@ public class ResourceMappingPanel extends Panel {
         this.mappingContainer.setVisible(provisionTO != null);
         add(this.mappingContainer);
 
-        transformers = new TransformersTogglePanel(this.mappingContainer);
-        add(this.transformers);
-
         mappingContainer.add(Constants.getJEXLPopover(this, TooltipConfig.Placement.bottom));
 
         passwordLabel = new Label("passwordLabel", new ResourceModel("password"));

http://git-wip-us.apache.org/repos/asf/syncope/blob/b99b684a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard.html
b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard.html
index bca42d8..96f296e 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard.html
@@ -32,15 +32,15 @@ under the License.
           </div>
           <div class="wizard-view">
             <div wicket:id="view"></div>
-          </div>	
-<!--          <div class="wizard-feedback">
-            <div wicket:id="feedback"></div>
-          </div>-->
+          </div>
           <div class="wizard-buttons">
             <div wicket:id="buttons"></div>
           </div>
         </form>
       </div>
+      <span wicket:id="outerObjectsRepeater">
+        <div wicket:id="outer"/>
+      </span>
     </wicket:panel>
   </body>
 </html>

http://git-wip-us.apache.org/repos/asf/syncope/blob/b99b684a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceMappingPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceMappingPanel.html
b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceMappingPanel.html
index 4214ee5..b087541 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceMappingPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ResourceMappingPanel.html
@@ -90,7 +90,6 @@ under the License.
           </tfoot>
         </table>
       </div>
-      <span wicket:id="transformersTogglePanel">[TRANSFORMERS]</span>
     </wicket:panel>
   </body>
 </html>

http://git-wip-us.apache.org/repos/asf/syncope/blob/b99b684a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
index 05527bc..c462b59 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java
@@ -101,7 +101,7 @@ public class TopologyITCase extends AbstractConsoleITCase {
                 + "wizard:form:view:mapping:mappingContainer:mappings:0:transformers:alertsLink");
 
         wicketTester.assertComponent("body:toggle:outerObjectsRepeater:2:outer:form:content:provision:container:"
-                + "content:wizard:form:view:mapping:transformersTogglePanel:container:content:togglePanelContainer:"
+                + "content:wizard:outerObjectsRepeater:0:outer:container:content:togglePanelContainer:"
                 + "form:classes:paletteField", NonI18nPalette.class);
     }
 


Mime
View raw message