This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new ff9e6a777e ISIS-3272: move config entries 'js' and 'css' from
viewer/common/application to viewer/wicket
ff9e6a777e is described below
commit ff9e6a777e3ef3f9c0d1e2754c297d2452e41759
Author: Andi Huber <[email protected]>
AuthorDate: Fri Nov 4 12:15:40 2022 +0100
ISIS-3272: move config entries 'js' and 'css' from
viewer/common/application to viewer/wicket
---
.../core/config/CausewayConfiguration.java | 157 ++++++++++-----------
.../demo/domain/src/main/resources/application.yml | 9 +-
.../stable/src/main/resources/application.yml | 6 +-
.../wicket/model/models/HasCommonContext.java | 7 +-
.../wicket/ui/components/footer/FooterPanel.java | 4 +-
.../viewer/wicket/ui/pages/PageAbstract.java | 4 +-
.../accmngt/AccountManagementPageAbstract.java | 4 +-
.../wicket/ui/pages/mmverror/MmvErrorPage.java | 4 +-
8 files changed, 97 insertions(+), 98 deletions(-)
diff --git
a/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
b/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
index 80493968ae..810bdf6726 100644
---
a/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
+++
b/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
@@ -1889,18 +1889,6 @@ public class CausewayConfiguration {
@javax.validation.constraints.Pattern(regexp="^[^/].*$")
private Optional<String> brandLogoSignin = Optional.empty();
- /**
- * URL of file to read any custom CSS, relative to
<code>static</code> package on the class path.
- *
- * <p>
- * A typical value is <code>css/application.css</code>.
This will result in this file being read
- * from the <code>static/css</code> directory (because
static resources such as CSS are mounted by
- * Spring by default under <code>static</code> package).
- * </p>
- */
- @javax.validation.constraints.Pattern(regexp="^[^/].*$")
- private Optional<String> css = Optional.empty();
-
/**
* Specifies the URL to use of the favIcon.
*
@@ -1911,20 +1899,6 @@ public class CausewayConfiguration {
@javax.validation.constraints.Pattern(regexp="^[^/].*$")
private Optional<String> faviconUrl = Optional.empty();
- /**
- */
- /**
- * URL of file to read any custom JavaScript, relative to
<code>static</code> package on the class path.
- *
- * <p>
- * A typical value is <code>js/application.js</code>.
This will result in this file being read
- * from the <code>static/js</code> directory (because
static resources such as CSS are mounted by
- * Spring by default under <code>static</code> package).
- * </p>
- */
- @javax.validation.constraints.Pattern(regexp="^[^/].*$")
- private Optional<String> js = Optional.empty();
-
/**
* Specifies the file name containing the menubars.
*
@@ -1955,7 +1929,59 @@ public class CausewayConfiguration {
private String version;
}
+ /**
+ * List of organisations or individuals to give credit to, shown
as links and icons in the footer.
+ * A maximum of 3 credits can be specified.
+ *
+ * <p>
+ * IntelliJ unfortunately does not provide IDE completion for
lists of classes; YMMV.
+ * </p>
+ *
+ * <p>
+ * @implNote - For further discussion, see for example
+ * <a
href="https://stackoverflow.com/questions/41417933/spring-configuration-properties-metadata-json-for-nested-list-of-objects">this
stackoverflow question</a>
+ * and <a
href="https://github.com/spring-projects/spring-boot/wiki/IDE-binding-features#simple-pojo">this
wiki page</a>.
+ * </p>
+ */
+ private List<Credit> credit = new ArrayList<>();
+
+ @Data
+ public static class Credit {
+ /**
+ * URL of an organisation or individual to give credit to,
appearing as a link in the footer.
+ *
+ * <p>
+ * For the credit to appear, the {@link #getUrl() url}
must be provided along with either
+ * {@link #getName() name} and/or {@link #getImage()
image}.
+ * </p>
+ */
+
@javax.validation.constraints.Pattern(regexp="^http[s]?://[^:]+?(:\\d+)?.*$")
+ private String url;
+ /**
+ * URL of an organisation or individual to give credit to,
appearing as text in the footer.
+ *
+ * <p>
+ * For the credit to appear, the {@link #getUrl() url}
must be provided along with either
+ * {@link #getName() name} and/or {@link #getImage()
image}.
+ * </p>
+ */
+ private String name;
+ /**
+ * Name of an image resource of an organisation or individual,
appearing as an icon in the footer.
+ *
+ * <p>
+ * For the credit to appear, the {@link #getUrl() url}
must be provided along with either
+ * {@link #getName() name} and/or {@link #getImage()
image}.
+ * </p>
+ */
+ @javax.validation.constraints.Pattern(regexp="^[^/].*$")
+ private String image;
+ /**
+ * Whether enough information has been defined for the credit
to be appear.
+ */
+ public boolean isDefined() { return (name != null || image !=
null) && url != null; }
+ }
}
private final Restfulobjects restfulobjects = new Restfulobjects();
@@ -2131,6 +2157,18 @@ public class CausewayConfiguration {
*/
private boolean clearFieldButtonEnabled = true;
+ /**
+ * URL of file to read any custom CSS, relative to
<code>static</code> package on the class path.
+ *
+ * <p>
+ * A typical value is <code>css/application.css</code>. This
will result in this file being read
+ * from the <code>static/css</code> directory (because static
resources such as CSS are mounted by
+ * Spring by default under <code>static</code> package).
+ * </p>
+ */
+ @javax.validation.constraints.Pattern(regexp="^[^/].*$")
+ private Optional<String> css = Optional.empty();
+
/**
* Whether the dialog mode rendered when invoking actions on
domain objects should be to use
* the sidebar (the default) or to use a modal dialog.
@@ -2151,6 +2189,18 @@ public class CausewayConfiguration {
*/
private DialogMode dialogModeForMenu = DialogMode.MODAL;
+ /**
+ * URL of file to read any custom JavaScript, relative to
<code>static</code> package on the class path.
+ *
+ * <p>
+ * A typical value is <code>js/application.js</code>. This
will result in this file being read
+ * from the <code>static/js</code> directory (because static
resources such as CSS are mounted by
+ * Spring by default under <code>static</code> package).
+ * </p>
+ */
+ @javax.validation.constraints.Pattern(regexp="^[^/].*$")
+ private Optional<String> js = Optional.empty();
+
/**
* If specified, then is rendered on each page to enable live
reload.
*
@@ -2397,61 +2447,6 @@ public class CausewayConfiguration {
private int maxParentChainLength = 64;
}
- /**
- * List of organisations or individuals to give credit to, shown
as links and icons in the footer.
- * A maximum of 3 credits can be specified.
- *
- * <p>
- * IntelliJ unfortunately does not provide IDE completion for
lists of classes; YMMV.
- * </p>
- *
- * <p>
- * @implNote - For further discussion, see for example
- * <a
href="https://stackoverflow.com/questions/41417933/spring-configuration-properties-metadata-json-for-nested-list-of-objects">this
stackoverflow question</a>
- * and <a
href="https://github.com/spring-projects/spring-boot/wiki/IDE-binding-features#simple-pojo">this
wiki page</a>.
- * </p>
- */
- private List<Credit> credit = new ArrayList<>();
-
- @Data
- public static class Credit {
- /**
- * URL of an organisation or individual to give credit to,
appearing as a link in the footer.
- *
- * <p>
- * For the credit to appear, the {@link #getUrl() url}
must be provided along with either
- * {@link #getName() name} and/or {@link #getImage()
image}.
- * </p>
- */
-
@javax.validation.constraints.Pattern(regexp="^http[s]?://[^:]+?(:\\d+)?.*$")
- private String url;
- /**
- * URL of an organisation or individual to give credit to,
appearing as text in the footer.
- *
- * <p>
- * For the credit to appear, the {@link #getUrl() url}
must be provided along with either
- * {@link #getName() name} and/or {@link #getImage()
image}.
- * </p>
- */
- private String name;
- /**
- * Name of an image resource of an organisation or individual,
appearing as an icon in the footer.
- *
- * <p>
- * For the credit to appear, the {@link #getUrl() url}
must be provided along with either
- * {@link #getName() name} and/or {@link #getImage()
image}.
- * </p>
- */
- @javax.validation.constraints.Pattern(regexp="^[^/].*$")
- private String image;
-
- /**
- * Whether enough information has been defined for the credit
to be appear.
- */
- public boolean isDefined() { return (name != null || image !=
null) && url != null; }
- }
-
-
private final DatePicker datePicker = new DatePicker();
@Data
public static class DatePicker {
diff --git a/examples/demo/domain/src/main/resources/application.yml
b/examples/demo/domain/src/main/resources/application.yml
index 52ec794e45..9730fc957c 100644
--- a/examples/demo/domain/src/main/resources/application.yml
+++ b/examples/demo/domain/src/main/resources/application.yml
@@ -79,16 +79,15 @@ causeway:
# https://stackoverflow.com/a/38983935/56880
# in addition using special config with the project's
maven-resources-plugin
version: ${project.version}
- css: css/application.css
- js: scripts/application.js
about: This application demonstrates many aspects of the Apache
Causeway programming model, as well as some of the most significant domain
services and extensions such as the WrapperFactory, security, commands and
publishing.
- wicket:
-
credit:
- url: http://causeway.apache.org
image: images/apache-causeway/logo-48x48.png
name: Apache Causeway
-
+
+ wicket:
+ css: css/application.css
+ js: scripts/application.js
themes:
initial: Flatly
showChooser: true
diff --git a/regressiontests/stable/src/main/resources/application.yml
b/regressiontests/stable/src/main/resources/application.yml
index 6cf303616d..802987870f 100644
--- a/regressiontests/stable/src/main/resources/application.yml
+++ b/regressiontests/stable/src/main/resources/application.yml
@@ -53,14 +53,14 @@ causeway:
common:
application:
name: Smoke Tests
- css: css/application.css
- js: scripts/application.js
about: Smoke Tests
- credit:
+ credit:
- url: http://causeway.apache.org
image: images/apache-causeway/logo-48x48.png
name: Apache Causeway
wicket:
+ css: css/application.css
+ js: scripts/application.js
themes:
initial: Flatly
showChooser: true
diff --git
a/viewers/wicket/model/src/main/java/org/apache/causeway/viewer/wicket/model/models/HasCommonContext.java
b/viewers/wicket/model/src/main/java/org/apache/causeway/viewer/wicket/model/models/HasCommonContext.java
index 95d1a018ff..11bda649bb 100644
---
a/viewers/wicket/model/src/main/java/org/apache/causeway/viewer/wicket/model/models/HasCommonContext.java
+++
b/viewers/wicket/model/src/main/java/org/apache/causeway/viewer/wicket/model/models/HasCommonContext.java
@@ -19,18 +19,23 @@
package org.apache.causeway.viewer.wicket.model.models;
import org.apache.causeway.applib.services.i18n.TranslationContext;
+import org.apache.causeway.core.config.CausewayConfiguration.Viewer.Common;
import
org.apache.causeway.core.config.CausewayConfiguration.Viewer.Common.Application;
import org.apache.causeway.core.config.CausewayConfiguration.Viewer.Wicket;
import org.apache.causeway.core.metamodel.context.HasMetaModelContext;
public interface HasCommonContext extends HasMetaModelContext {
+ default Common getCommonViewerSettings() {
+ return getConfiguration().getViewer().getCommon();
+ }
+
default Wicket getWicketViewerSettings() {
return getConfiguration().getViewer().getWicket();
}
default Application getApplicationSettings() {
- return getConfiguration().getViewer().getCommon().getApplication();
+ return getCommonViewerSettings().getApplication();
}
/**
diff --git
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/FooterPanel.java
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/FooterPanel.java
index 60829f2015..14976e0ef4 100644
---
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/FooterPanel.java
+++
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/components/footer/FooterPanel.java
@@ -33,7 +33,7 @@ import
org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.causeway.commons.internal.base._NullSafe;
import org.apache.causeway.commons.internal.base._Strings;
-import
org.apache.causeway.core.config.CausewayConfiguration.Viewer.Wicket.Credit;
+import
org.apache.causeway.core.config.CausewayConfiguration.Viewer.Common.Credit;
import org.apache.causeway.viewer.wicket.model.util.PageParameterUtils;
import
org.apache.causeway.viewer.wicket.ui.components.widgets.breadcrumbs.BreadcrumbPanel;
import
org.apache.causeway.viewer.wicket.ui.components.widgets.themepicker.ThemeChooser;
@@ -79,7 +79,7 @@ extends PanelAbstract<String, Model<String>> {
private void addCredits() {
- val credits = super.getWicketViewerSettings().getCredit();
+ val credits = super.getCommonViewerSettings().getCredit();
val hasAnyCredits = !_NullSafe.isEmpty(credits);
val creditItems = new RepeatingView("creditItems");
diff --git
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/pages/PageAbstract.java
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/pages/PageAbstract.java
index a723b6c461..c8ce6356f1 100644
---
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/pages/PageAbstract.java
+++
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/pages/PageAbstract.java
@@ -261,12 +261,12 @@ implements ActionPromptProvider {
new JGrowlBehaviour(getMetaModelContext())
.renderFeedbackMessages(response);
- getApplicationSettings().getCss()
+ getWicketViewerSettings().getCss()
.ifPresent(applicationCss -> {
response.render(CssReferenceHeaderItem.forUrl(applicationCss));
});
- getApplicationSettings().getJs()
+ getWicketViewerSettings().getJs()
.ifPresent(applicationJs -> {
response.render(JavaScriptReferenceHeaderItem.forUrl(applicationJs));
});
diff --git
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.java
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.java
index 1eabf97c98..74567a8770 100644
---
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.java
+++
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/pages/accmngt/AccountManagementPageAbstract.java
@@ -112,10 +112,10 @@ public class AccountManagementPageAbstract extends
WebPageBase {
response.render(new
PriorityHeaderItem(JavaScriptHeaderItem.forReference(
BootstrapJavaScriptReference.instance())));
- getApplicationSettings().getCss()
+ getWicketViewerSettings().getCss()
.ifPresent(css -> response.render(CssReferenceHeaderItem.forUrl(css)));
- getApplicationSettings().getJs()
+ getWicketViewerSettings().getJs()
.ifPresent(js ->
response.render(JavaScriptReferenceHeaderItem.forUrl(js)));
}
diff --git
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/pages/mmverror/MmvErrorPage.java
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/pages/mmverror/MmvErrorPage.java
index 963b5679ff..cca23b8bc5 100644
---
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/pages/mmverror/MmvErrorPage.java
+++
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/pages/mmverror/MmvErrorPage.java
@@ -87,10 +87,10 @@ public class MmvErrorPage extends WebPageBase {
response.render(new
PriorityHeaderItem(JavaScriptHeaderItem.forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference())));
response.render(new
PriorityHeaderItem(JavaScriptHeaderItem.forReference(BootstrapJavaScriptReference.instance())));
- getApplicationSettings().getCss()
+ getWicketViewerSettings().getCss()
.ifPresent(css -> response.render(CssReferenceHeaderItem.forUrl(css)));
- getApplicationSettings().getJs()
+ getWicketViewerSettings().getJs()
.ifPresent(js ->
response.render(JavaScriptReferenceHeaderItem.forUrl(js)));
}