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 2013/03/15 15:21:23 UTC

svn commit: r1456962 - in /syncope/branches/1_0_X/console/src/main: java/org/apache/syncope/console/pages/ java/org/apache/syncope/console/pages/panels/ java/org/apache/syncope/console/wicket/markup/html/form/ resources/org/apache/syncope/console/wicke...

Author: fmartelli
Date: Fri Mar 15 14:21:22 2013
New Revision: 1456962

URL: http://svn.apache.org/r1456962
Log:
SYNCOPE-326 some fixes for the branch 1_0_X

Modified:
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/RoleModalPage.java
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleAttributesPanel.java
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java
    syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/ActionLinksPanel.html
    syncope/branches/1_0_X/console/src/main/webapp/css/style.css

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/RoleModalPage.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/RoleModalPage.java?rev=1456962&r1=1456961&r2=1456962&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/RoleModalPage.java (original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/RoleModalPage.java Fri Mar 15 14:21:22 2013
@@ -70,42 +70,43 @@ public class RoleModalPage extends BaseM
 
         form.add(attributesPanel);
 
-        final AjaxButton submit = new ClearIndicatingAjaxButton("submit", new ResourceModel("submit"), pageRef) {
+        final AjaxButton submit =
+                new ClearIndicatingAjaxButton("submit", new ResourceModel("submit"), getPageReference()) {
 
-            private static final long serialVersionUID = -958724007591692537L;
+                    private static final long serialVersionUID = -958724007591692537L;
 
-            @Override
-            protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
-                final RoleTO roleTO = (RoleTO) form.getDefaultModelObject();
-                try {
-                    final List<String> entitlementList =
-                            new ArrayList<String>(attributesPanel.getEntitlementsPalette().getModelCollection());
-                    roleTO.setEntitlements(entitlementList);
-
-                    if (createFlag) {
-                        roleRestClient.createRole(roleTO);
-                    } else {
-                        RoleMod roleMod = AttributableOperations.diff(roleTO, originalRoleTO);
-
-                        // update role just if it is changed
-                        if (!roleMod.isEmpty()) {
-                            roleRestClient.updateRole(roleMod);
+                    @Override
+                    protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
+                        final RoleTO roleTO = (RoleTO) form.getDefaultModelObject();
+                        try {
+                            final List<String> entitlementList =
+                                    new ArrayList<String>(attributesPanel.getSelectedEntitlements());
+                            roleTO.setEntitlements(entitlementList);
+
+                            if (createFlag) {
+                                roleRestClient.createRole(roleTO);
+                            } else {
+                                RoleMod roleMod = AttributableOperations.diff(roleTO, originalRoleTO);
+
+                                // update role just if it is changed
+                                if (!roleMod.isEmpty()) {
+                                    roleRestClient.updateRole(roleMod);
+                                }
+                            }
+                            ((Roles) pageRef.getPage()).setModalResult(true);
+
+                            window.close(target);
+                        } catch (Exception e) {
+                            error(getString("error") + ":" + e.getMessage());
+                            target.add(feedbackPanel);
                         }
                     }
-                    ((Roles) pageRef.getPage()).setModalResult(true);
 
-                    window.close(target);
-                } catch (Exception e) {
-                    error(getString("error") + ":" + e.getMessage());
-                    target.add(feedbackPanel);
-                }
-            }
-
-            @Override
-            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
-                target.add(feedbackPanel);
-            }
-        };
+                    @Override
+                    protected void onError(final AjaxRequestTarget target, final Form<?> form) {
+                        target.add(feedbackPanel);
+                    }
+                };
 
         MetaDataRoleAuthorizationStrategy.authorize(submit, ENABLE, xmlRolesReader.getAllAllowedRoles("Roles",
                 createFlag

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java?rev=1456962&r1=1456961&r2=1456962&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java (original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java Fri Mar 15 14:21:22 2013
@@ -20,16 +20,16 @@ package org.apache.syncope.console.pages
 
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.syncope.client.to.AbstractAttributableTO;
+import org.apache.syncope.client.to.ResourceTO;
+import org.apache.syncope.console.rest.ResourceRestClient;
+import org.apache.syncope.console.wicket.markup.html.form.AjaxPalettePanel;
 import org.apache.wicket.markup.html.panel.Panel;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.LoadableDetachableModel;
 import org.apache.wicket.model.PropertyModel;
 import org.apache.wicket.model.util.ListModel;
 import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.syncope.client.to.AbstractAttributableTO;
-import org.apache.syncope.client.to.ResourceTO;
-import org.apache.syncope.console.rest.ResourceRestClient;
-import org.apache.syncope.console.wicket.markup.html.form.AjaxPalettePanel;
 
 public class ResourcesPanel extends Panel {
 

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleAttributesPanel.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleAttributesPanel.java?rev=1456962&r1=1456961&r2=1456962&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleAttributesPanel.java (original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/RoleAttributesPanel.java Fri Mar 15 14:21:22 2013
@@ -18,12 +18,12 @@
  */
 package org.apache.syncope.console.pages.panels;
 
+import java.util.Collection;
 import org.apache.syncope.client.to.RoleTO;
-import org.apache.syncope.console.commons.SelectChoiceRenderer;
 import org.apache.syncope.console.rest.EntitlementRestClient;
 import org.apache.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
+import org.apache.syncope.console.wicket.markup.html.form.AjaxPalettePanel;
 import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
-import org.apache.wicket.extensions.markup.html.form.palette.Palette;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.markup.html.panel.Panel;
 import org.apache.wicket.model.PropertyModel;
@@ -37,7 +37,7 @@ public class RoleAttributesPanel extends
     @SpringBean
     private EntitlementRestClient entitlementRestClient;
 
-    final Palette<String> entitlementsPalette;
+    final AjaxPalettePanel entitlementsPalette;
 
     public RoleAttributesPanel(final String id, final Form form, final RoleTO roleTO) {
         super(id);
@@ -82,14 +82,12 @@ public class RoleAttributesPanel extends
         //--------------------------------
         // Security container
         //--------------------------------
-
         this.add(new RoleSecurityPanel("security", roleTO));
         //--------------------------------
 
         //--------------------------------
         // Resources container
         //--------------------------------
-
         this.add(new ResourcesPanel("resources", roleTO));
         //--------------------------------
 
@@ -97,13 +95,12 @@ public class RoleAttributesPanel extends
 
         ListModel<String> availableEntitlements = new ListModel<String>(entitlementRestClient.getAllEntitlements());
 
-        entitlementsPalette = new Palette<String>("entitlementsPalette", selectedEntitlements, availableEntitlements,
-                new SelectChoiceRenderer(), 20, false);
+        entitlementsPalette = new AjaxPalettePanel("entitlementsPalette", selectedEntitlements, availableEntitlements);
 
         this.add(entitlementsPalette);
     }
 
-    public Palette<String> getEntitlementsPalette() {
-        return this.entitlementsPalette;
+    public Collection<String> getSelectedEntitlements() {
+        return this.entitlementsPalette.getModelCollection();
     }
 }

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java?rev=1456962&r1=1456961&r2=1456962&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java (original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java Fri Mar 15 14:21:22 2013
@@ -19,6 +19,7 @@
 package org.apache.syncope.console.wicket.markup.html.form;
 
 import java.io.Serializable;
+import java.util.Collection;
 import java.util.List;
 import org.apache.syncope.console.commons.SelectChoiceRenderer;
 import org.apache.wicket.extensions.markup.html.form.palette.Palette;
@@ -57,4 +58,8 @@ public class AjaxPalettePanel<T> extends
         palette.setDefaultModelObject(object);
         return this;
     }
+
+    public Collection<T> getModelCollection() {
+        return palette.getModelCollection();
+    }
 }

Modified: syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/ActionLinksPanel.html
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/ActionLinksPanel.html?rev=1456962&r1=1456961&r2=1456962&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/ActionLinksPanel.html (original)
+++ syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/ActionLinksPanel.html Fri Mar 15 14:21:22 2013
@@ -13,60 +13,60 @@
  under the License.
 -->
 <wicket:head>
-    <style>
-        span#action{
-            margin-left: 1px;
-            margin-right: 1px;
-        }
-    </style>
+  <style>
+    img#action{
+      margin-left: 1px;
+      margin-right: 1px;
+    }
+  </style>
 </wicket:head>
 <wicket:panel>
-    <span id="action" wicket:id="panelClaim">[plus]</span>
-    <span id="action" wicket:id="panelDryRun">[plus]</span>
-    <span id="action" wicket:id="panelExecute">[plus]</span>
-    <span id="action" wicket:id="panelSearch">[plus]</span>
-    <span id="action" wicket:id="panelCreate">[plus]</span>
-    <span id="action" wicket:id="panelTemplate">[plus]</span>
-    <span id="action" wicket:id="panelEdit">[plus]</span>
-    <span id="action" wicket:id="panelExport">[plus]</span>
-    <span id="action" wicket:id="panelDelete">[plus]</span>
-
-    <wicket:fragment wicket:id="fragmentClaim">
-        <a href="#" wicket:id="claimLink"><img src="img/actions/claim.png" alt="claim icon" title="Claim"/></a>
-    </wicket:fragment>
-
-    <wicket:fragment wicket:id="fragmentCreate">
-        <a href="#" wicket:id="createLink"><img src="img/actions/create.png" alt="create icon"  title="Create"/></a>
-    </wicket:fragment>
-
-    <wicket:fragment wicket:id="fragmentSearch">
-        <a href="#" wicket:id="searchLink"><img src="img/actions/search.png" alt="search icon"  title="Search and modify" /></a>
-    </wicket:fragment>
-
-    <wicket:fragment wicket:id="fragmentEdit">
-        <a href="#" wicket:id="editLink"><img src="img/actions/edit.png" alt="edit icon"  title="Edit"/></a>
-    </wicket:fragment>
-
-    <wicket:fragment wicket:id="fragmentTemplate">
-        <a href="#" wicket:id="templateLink"><img src="img/actions/template.png" alt="template icon"  title="Specify template"/></a>
-    </wicket:fragment>
-
-    <wicket:fragment wicket:id="fragmentDelete">
-        <a href="#" wicket:id="deleteLink"><img src="img/actions/delete.png" alt="delete icon"  title="Delete"/></a>
-    </wicket:fragment>
-
-    <wicket:fragment wicket:id="fragmentDryRun">
-        <a href="#" wicket:id="dryRunLink"><img src="img/actions/dryrun.png" alt="dryrun icon"  title="DryRun"/></a>
-    </wicket:fragment>
-
-    <wicket:fragment wicket:id="fragmentExecute">
-        <a href="#" wicket:id="executeLink"><img src="img/actions/execute.png" alt="execute icon"  title="Execute"/></a>
-    </wicket:fragment>
-
-    <wicket:fragment wicket:id="fragmentExport">
-        <a href="#" wicket:id="exportLink"><img src="img/actions/export.png" alt="export icon"  title="Export"/></a>
-    </wicket:fragment>
+  <span wicket:id="panelClaim">[plus]</span>
+  <span wicket:id="panelDryRun">[plus]</span>
+  <span wicket:id="panelExecute">[plus]</span>
+  <span wicket:id="panelSearch">[plus]</span>
+  <span wicket:id="panelCreate">[plus]</span>
+  <span wicket:id="panelTemplate">[plus]</span>
+  <span wicket:id="panelEdit">[plus]</span>
+  <span wicket:id="panelExport">[plus]</span>
+  <span wicket:id="panelDelete">[plus]</span>
+
+  <wicket:fragment wicket:id="fragmentClaim">
+    <a href="#" wicket:id="claimLink"><img id="action" src="img/actions/claim.png" alt="claim icon" title="Claim"/></a>
+  </wicket:fragment>
+
+  <wicket:fragment wicket:id="fragmentCreate">
+    <a href="#" wicket:id="createLink"><img id="action" src="img/actions/create.png" alt="create icon"  title="Create"/></a>
+  </wicket:fragment>
+
+  <wicket:fragment wicket:id="fragmentSearch">
+    <a href="#" wicket:id="searchLink"><img id="action" src="img/actions/search.png" alt="search icon"  title="Search and modify" /></a>
+  </wicket:fragment>
+
+  <wicket:fragment wicket:id="fragmentEdit">
+    <a href="#" wicket:id="editLink"><img id="action" src="img/actions/edit.png" alt="edit icon"  title="Edit"/></a>
+  </wicket:fragment>
+
+  <wicket:fragment wicket:id="fragmentTemplate">
+    <a href="#" wicket:id="templateLink"><img id="action" src="img/actions/template.png" alt="template icon"  title="Specify template"/></a>
+  </wicket:fragment>
+
+  <wicket:fragment wicket:id="fragmentDelete">
+    <a href="#" wicket:id="deleteLink"><img id="action" src="img/actions/delete.png" alt="delete icon"  title="Delete"/></a>
+  </wicket:fragment>
+
+  <wicket:fragment wicket:id="fragmentDryRun">
+    <a href="#" wicket:id="dryRunLink"><img id="action" src="img/actions/dryrun.png" alt="dryrun icon"  title="DryRun"/></a>
+  </wicket:fragment>
+
+  <wicket:fragment wicket:id="fragmentExecute">
+    <a href="#" wicket:id="executeLink"><img id="action" src="img/actions/execute.png" alt="execute icon"  title="Execute"/></a>
+  </wicket:fragment>
+
+  <wicket:fragment wicket:id="fragmentExport">
+    <a href="#" wicket:id="exportLink"><img id="action" src="img/actions/export.png" alt="export icon"  title="Export"/></a>
+  </wicket:fragment>
 
-    <wicket:fragment wicket:id="emptyFragment">
-    </wicket:fragment>
+  <wicket:fragment wicket:id="emptyFragment">
+  </wicket:fragment>
 </wicket:panel>

Modified: syncope/branches/1_0_X/console/src/main/webapp/css/style.css
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/webapp/css/style.css?rev=1456962&r1=1456961&r2=1456962&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/webapp/css/style.css (original)
+++ syncope/branches/1_0_X/console/src/main/webapp/css/style.css Fri Mar 15 14:21:22 2013
@@ -37,7 +37,7 @@ body {
     font-size: 14px;
 }
 
-#splash a img {
+a img {
     border: none;
 }