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-900] fix inspired by TemplateContentModal
Date Mon, 11 Jul 2016 13:18:00 GMT
Repository: syncope
Updated Branches:
  refs/heads/master 3f1206993 -> b1f757686


[SYNCOPE-900] fix inspired by TemplateContentModal


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

Branch: refs/heads/master
Commit: b1f7576868c528093c8d28168bedda8ba92738f9
Parents: 3f12069
Author: fmartelli <fabio.martelli@gmail.com>
Authored: Mon Jul 11 14:50:10 2016 +0200
Committer: fmartelli <fabio.martelli@gmail.com>
Committed: Mon Jul 11 14:50:10 2016 +0200

----------------------------------------------------------------------
 .../console/panels/CamelRoutesDetailsPanel.java | 11 +++--------
 .../panels/CamelRoutesDirectoryPanel.java       | 20 ++++++++++----------
 .../console/rest/CamelRoutesRestClient.java     | 13 +++++++++----
 .../console/panels/CamelRoutesDetailsPanel.html | 10 ++++------
 4 files changed, 26 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/b1f75768/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutesDetailsPanel.java
----------------------------------------------------------------------
diff --git a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutesDetailsPanel.java
b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutesDetailsPanel.java
index a25d49d..d6a2065 100644
--- a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutesDetailsPanel.java
+++ b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutesDetailsPanel.java
@@ -21,10 +21,8 @@ package org.apache.syncope.client.console.panels;
 import org.apache.syncope.common.lib.to.CamelRouteTO;
 import org.apache.wicket.markup.head.IHeaderResponse;
 import org.apache.wicket.markup.head.OnLoadHeaderItem;
-import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.markup.html.form.TextArea;
 import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.CompoundPropertyModel;
 import org.apache.wicket.model.PropertyModel;
 
 public class CamelRoutesDetailsPanel extends Panel {
@@ -34,12 +32,9 @@ public class CamelRoutesDetailsPanel extends Panel {
     public CamelRoutesDetailsPanel(final String id, final CamelRouteTO camelRoute) {
         super(id);
 
-        Form<CamelRouteTO> routeDefForm = new Form<>("routeDefForm");
-
         TextArea<String> routeDefArea = new TextArea<>("route", new PropertyModel<String>(camelRoute,
"content"));
-        routeDefForm.add(routeDefArea);
-        routeDefForm.setModel(new CompoundPropertyModel<>(camelRoute));
-        add(routeDefForm);
+        routeDefArea.setMarkupId("route").setOutputMarkupPlaceholderTag(true);
+        add(routeDefArea);
     }
 
     @Override
@@ -48,10 +43,10 @@ public class CamelRoutesDetailsPanel extends Panel {
         response.render(OnLoadHeaderItem.forScript(
                 "CodeMirror.fromTextArea(document.getElementById('route'), {"
                 + "  lineNumbers: true, "
+                + "  lineWrapping: true, "
                 + "  autoCloseTags: true, "
                 + "  mode: 'text/html', "
                 + "  autoRefresh: true"
                 + "}).on('change', updateTextArea);"));
     }
-
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/b1f75768/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutesDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutesDirectoryPanel.java
b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutesDirectoryPanel.java
index c4a33f9..9c6f201 100644
--- a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutesDirectoryPanel.java
+++ b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutesDirectoryPanel.java
@@ -81,15 +81,14 @@ public class CamelRoutesDirectoryPanel extends DirectoryPanel<
 
             @Override
             public WizardModalPanel<CamelRouteTO> build(final String id, final int
index, final AjaxWizard.Mode mode) {
-                final CamelRouteTO modelObject = newModelObject();
-                return new CamelRoutesModalPanel(modal, modelObject, pageRef) {
+                return new CamelRoutesModalPanel(modal, newModelObject(), pageRef) {
 
                     private static final long serialVersionUID = -6227956682141146095L;
 
                     @Override
                     public void onSubmit(final AjaxRequestTarget target, final Form<?>
form) {
                         try {
-                            restClient.update(modelObject);
+                            restClient.update(getItem());
                             info(getString(Constants.OPERATION_SUCCEEDED));
                             modal.close(target);
                         } catch (Exception e) {
@@ -144,14 +143,15 @@ public class CamelRoutesDirectoryPanel extends DirectoryPanel<
                 ActionLinksPanel<CamelRouteTO> panel = ActionLinksPanel.<CamelRouteTO>builder().
                         add(new ActionLink<CamelRouteTO>() {
 
-                            private static final long serialVersionUID = -3722207913631435501L;
+                    private static final long serialVersionUID = -3722207913631435501L;
 
-                            @Override
-                            public void onClick(final AjaxRequestTarget target, final CamelRouteTO
ignore) {
-                                send(CamelRoutesDirectoryPanel.this, Broadcast.EXACT,
-                                        new AjaxWizard.EditItemActionEvent<>(model.getObject(),
target));
-                            }
-                        }, ActionLink.ActionType.EDIT, CamelEntitlement.ROUTE_UPDATE).
+                    @Override
+                    public void onClick(final AjaxRequestTarget target, final CamelRouteTO
ignore) {
+                        CamelRouteTO actual = restClient.read(model.getObject().getKey());
+                        send(CamelRoutesDirectoryPanel.this, Broadcast.EXACT,
+                                new AjaxWizard.EditItemActionEvent<>(actual, target));
+                    }
+                }, ActionLink.ActionType.EDIT, CamelEntitlement.ROUTE_UPDATE).
                         build(componentId);
 
                 return panel;

http://git-wip-us.apache.org/repos/asf/syncope/blob/b1f75768/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRoutesRestClient.java
----------------------------------------------------------------------
diff --git a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRoutesRestClient.java
b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRoutesRestClient.java
index f1ddc0a..67bd1df 100644
--- a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRoutesRestClient.java
+++ b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRoutesRestClient.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.client.console.rest;
 
+import static org.apache.syncope.client.console.rest.BaseRestClient.getService;
 import java.util.Collections;
 import java.util.List;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
@@ -37,6 +38,10 @@ public class CamelRoutesRestClient extends BaseRestClient {
                 : Collections.<CamelRouteTO>emptyList();
     }
 
+    public CamelRouteTO read(final String key) {
+        return getService(CamelRouteService.class).read(key);
+    }
+
     public void update(final CamelRouteTO routeTO) {
         getService(CamelRouteService.class).update(routeTO);
     }
@@ -45,10 +50,10 @@ public class CamelRoutesRestClient extends BaseRestClient {
         return anyTypeKind == AnyTypeKind.USER
                 ? SyncopeConsoleSession.get().getPlatformInfo().getUserProvisioningManager().contains("Camel")
                 : anyTypeKind == AnyTypeKind.ANY_OBJECT
-                        ? SyncopeConsoleSession.get().getPlatformInfo().
-                        getAnyObjectProvisioningManager().contains("Camel")
-                        : SyncopeConsoleSession.get().getPlatformInfo().
-                        getGroupProvisioningManager().contains("Camel");
+                ? SyncopeConsoleSession.get().getPlatformInfo().
+                getAnyObjectProvisioningManager().contains("Camel")
+                : SyncopeConsoleSession.get().getPlatformInfo().
+                getGroupProvisioningManager().contains("Camel");
 
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/b1f75768/ext/camel/client-console/src/main/resources/org/apache/syncope/client/console/panels/CamelRoutesDetailsPanel.html
----------------------------------------------------------------------
diff --git a/ext/camel/client-console/src/main/resources/org/apache/syncope/client/console/panels/CamelRoutesDetailsPanel.html
b/ext/camel/client-console/src/main/resources/org/apache/syncope/client/console/panels/CamelRoutesDetailsPanel.html
index 8edd764..663a6b3 100644
--- a/ext/camel/client-console/src/main/resources/org/apache/syncope/client/console/panels/CamelRoutesDetailsPanel.html
+++ b/ext/camel/client-console/src/main/resources/org/apache/syncope/client/console/panels/CamelRoutesDetailsPanel.html
@@ -28,7 +28,7 @@ under the License.
     <script type="text/javascript" src="webjars/codemirror/${codemirror.version}/addon/edit/closetag.js"></script>
     <script type="text/javascript">
       function updateTextArea(editor) {
-        document.getElementById("routeDefForm").elements["route"].value = editor.getValue();
+        document.getElementById("routeDefForm").children["route"].value = editor.getValue();
       }
     </script>
     <style>
@@ -44,11 +44,9 @@ under the License.
   </wicket:head>
   <wicket:panel>
     <div style="padding: 1%;">
-      <div class="w_content_3">
-        <form wicket:id="routeDefForm" id="routeDefForm">
-          <textarea wicket:id="route" id="route" name="route" style="width: 100%; height:
350px;">
-          </textarea>
-        </form>
+      <div class="w_content_3" id="routeDefForm">
+        <textarea wicket:id="route" id="route" name="route" style="width: 100%; height:
350px;">
+        </textarea>
       </div>
     </div>
   </wicket:panel>


Mime
View raw message