You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2016/01/31 11:57:20 UTC

[04/18] isis git commit: ISIS-1300: new configuration property to enable the wicketsource plugin. Also updated docs.

ISIS-1300: new configuration property to enable the wicketsource plugin.  Also updated docs.


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

Branch: refs/heads/ISIS-993
Commit: dbfa9e29c88b59320552f27f7355b4c78f7ce532
Parents: 5de42bb
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Jan 28 08:41:22 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Jan 28 08:41:22 2016 +0000

----------------------------------------------------------------------
 .../guides/_ugvw_configuration-properties.adoc  | 13 ++++++++
 .../wicket/viewer/IsisWicketApplication.java    | 34 ++++++++++++--------
 2 files changed, 34 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/dbfa9e29/adocs/documentation/src/main/asciidoc/guides/_ugvw_configuration-properties.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_ugvw_configuration-properties.adoc b/adocs/documentation/src/main/asciidoc/guides/_ugvw_configuration-properties.adoc
index d82c5d6..f4bb645 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_ugvw_configuration-properties.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_ugvw_configuration-properties.adoc
@@ -33,6 +33,11 @@ If you prefer you can place all configuration properties into `WEB-INF/isis.prop
 |Description
 
 |`isis.viewer.wicket.` +
+`ajaxDebugMode`
+| `true`,`false` (`_false_`)
+| whether the Wicket debug mode should be enabled.
+
+|`isis.viewer.wicket.` +
 `bookmarkedPages`
 | +ve int (`_15_`)
 | number of pages to bookmark
@@ -99,6 +104,14 @@ Note that action pages are still used for bookmarked actions.
 | `true`,`false` (`_false_`)
 | Whether to show chooser for Bootstrap themes.  See discussion xref:ugvw.adoc#_ugvw_configuration-properties_showing-theme-chooser[below]
 
+|`isis.viewer.wicket.` +
+`wicketSourcePlugin`
+| `true`,`false` (`_false_`)
+| (`1.12.0-SNAPSHOT`) whether the Wicketsource plugin should be enabled; by default it is not enabled.
+
+Prior to `1.12.0` this was enabled by default for prototyping (not production).  However it can significantly
+slow down rendering, hence the introduction of this configuration setting.
+
 |===
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/dbfa9e29/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
index 4209f38..fb0cc96 100644
--- a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
+++ b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
@@ -154,6 +154,8 @@ public class IsisWicketApplication
     private static final boolean STRIP_WICKET_TAGS_DEFAULT = true;
     private static final String AJAX_DEBUG_MODE_KEY = "isis.viewer.wicket.ajaxDebugMode";
     private static final boolean AJAX_DEBUG_MODE_DEFAULT = false;
+    private static final String WICKET_SOURCE_PLUGIN_KEY = "isis.viewer.wicket.wicketSourcePlugin";
+    private static final boolean WICKET_SOURCE_PLUGIN_DEFAULT = false;
 
     private final IsisLoggingConfigurer loggingConfigurer = new IsisLoggingConfigurer();
 
@@ -279,7 +281,7 @@ public class IsisWicketApplication
 
             filterJavascriptContributions();
 
-            configureWicketSourcePlugin();
+            configureWicketSourcePluginIfNecessary(configuration);
 
             // TODO ISIS-987 Either make the API better (no direct access to the map) or use DB records
             int maxEntries = 1000;
@@ -321,18 +323,13 @@ public class IsisWicketApplication
         select2Settings.setIncludeJqueryUI(false);
     }
 
-    /**
-     * as temporary measure, this method now does nothing.
-     *
-     * the original behaviour can be re-enabled by overriding this method and calling doConfigureWicketSourcePlugin();
-     */
-    protected void configureWicketSourcePlugin() {
-        // see Javadoc above.
-        //
-        // doConfigureWicketSourcePlugin();
+    protected void configureWicketSourcePluginIfNecessary(final IsisConfiguration configuration) {
+        if(isEnabledWicketSourcePluginEnabled(configuration)) {
+            configureWicketSourcePlugin();
+        }
     }
 
-    protected void doConfigureWicketSourcePlugin() {
+    protected void configureWicketSourcePlugin() {
         if(!deploymentType.isProduction()) {
             WicketSource.configure(this);
         }
@@ -661,8 +658,19 @@ public class IsisWicketApplication
      * If the <tt>isis.viewer.wicket.ajaxDebugMode</tt> is set, then this is used, otherwise the default is to disable.
      */
     private boolean determineAjaxDebugModeEnabled(IsisConfiguration configuration) {
-        final boolean debugMode = configuration.getBoolean(AJAX_DEBUG_MODE_KEY, AJAX_DEBUG_MODE_DEFAULT);
-        return debugMode;
+        final boolean debugModeEnabled = configuration.getBoolean(AJAX_DEBUG_MODE_KEY, AJAX_DEBUG_MODE_DEFAULT);
+        return debugModeEnabled;
+    }
+
+    /**
+     * Whether the Wicket source plugin should be enabled, as specified by configuration settings.
+     *
+     * <p>
+     * If the <tt>isis.viewer.wicket.wicketSourcePlugin</tt> is set, then this is used, otherwise the default is to disable.
+     */
+    private boolean isEnabledWicketSourcePluginEnabled(IsisConfiguration configuration) {
+        final boolean pluginEnabled = configuration.getBoolean(WICKET_SOURCE_PLUGIN_KEY, WICKET_SOURCE_PLUGIN_DEFAULT);
+        return pluginEnabled;
     }
 
     // //////////////////////////////////////