You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by md...@apache.org on 2017/05/25 10:48:20 UTC
[2/2] syncope git commit: [SYNCOPE-1095] Provide preview for json and
xml binary field
[SYNCOPE-1095] Provide preview for json and xml binary field
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/a7bf2af6
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/a7bf2af6
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/a7bf2af6
Branch: refs/heads/2_0_X
Commit: a7bf2af6df8308830ee1c3a2aa513bbb1cb0f095
Parents: 98a3f3b
Author: Marco Di Sabatino Di Diodoro <ma...@tirasa.net>
Authored: Thu May 25 12:46:21 2017 +0200
Committer: Marco Di Sabatino Di Diodoro <ma...@tirasa.net>
Committed: Thu May 25 12:46:21 2017 +0200
----------------------------------------------------------------------
.../markup/html/form/preview/BinaryTextPreviewer.java | 11 +++++++----
.../markup/html/form/preview/BinaryTextPreviewer.html | 5 ++---
2 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/a7bf2af6/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryTextPreviewer.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryTextPreviewer.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryTextPreviewer.java
index ebde17c..33558d1 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryTextPreviewer.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryTextPreviewer.java
@@ -37,6 +37,8 @@ public class BinaryTextPreviewer extends AbstractBinaryPreviewer {
private static final long serialVersionUID = 3808379310090668773L;
+ private String jsonEditorInfoId;
+
public BinaryTextPreviewer(final String id, final String mimeType) {
super(id, mimeType);
}
@@ -51,7 +53,8 @@ public class BinaryTextPreviewer extends AbstractBinaryPreviewer {
InputStream stream = new ByteArrayInputStream(uploadedBytes);
TextArea<String> jsonEditor =
new TextArea<>("jsonEditorInfo", new Model<>(IOUtils.toString(stream)));
- jsonEditor.setMarkupId("jsonEditorInfo").setOutputMarkupPlaceholderTag(true);
+ jsonEditor.setOutputMarkupPlaceholderTag(true);
+ jsonEditorInfoId = jsonEditor.getMarkupId();
fragment.add(jsonEditor);
} catch (IOException e) {
LOG.error("Error evaluating text file", e);
@@ -81,13 +84,13 @@ public class BinaryTextPreviewer extends AbstractBinaryPreviewer {
}
response.render(OnLoadHeaderItem.forScript(
- "var editor = CodeMirror.fromTextArea(document.getElementById('jsonEditorInfo'), {"
+ "var editor = CodeMirror.fromTextArea(document.getElementById('" + jsonEditorInfoId + "'), {"
+ " readOnly: true, "
+ " lineNumbers: true, "
- + " lineWrapping: true, "
+ + " lineWrapping: false, "
+ options
+ " autoRefresh: true"
+ "});"
- + "editor.setSize('100%', 100)"));
+ + "editor.setSize('500', 100)"));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/a7bf2af6/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryTextPreviewer.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryTextPreviewer.html b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryTextPreviewer.html
index 63e71c7..aa730cf 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryTextPreviewer.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryTextPreviewer.html
@@ -33,7 +33,6 @@ under the License.
font-family: Verdana,Tahoma,sans-serif;
font-size: 100%;
border: 1px solid #BBBBBB;
- padding: 1%;
}
</style>
</wicket:head>
@@ -42,8 +41,8 @@ under the License.
<span wicket:id="preview"/>
</div>
<wicket:fragment wicket:id="previewFragment">
- <div>
- <textarea wicket:id="jsonEditorInfo" id="consoleLayoutInfo" name="jsonEditorInfo" style="width: 100%; height: 100px;"></textarea>
+ <div style="w_content_3">
+ <textarea wicket:id="jsonEditorInfo" name="jsonEditorInfo" ></textarea>
</div>
</wicket:fragment>
<wicket:fragment wicket:id="noPreviewFragment">