e.g. the Prism API plugin can read properties and use a default theme based on this
- * information.
- *
- * @param artifactId the plugin to retrieve the properties for
- * @return the properties associated with the plugin requested
- */
- public List e.g. the Prism API plugin can read properties and use a default theme based on this
- * information.
- *
- * @param artifactId the plugin to retrieve the properties for
- * @param propertyName the property to retrieve
- * @return the properties associated with the plugin requested
- */
- public Optional The URL must be absolute (i.e. not just contain the path)
- *
- * It is recommended that you serve the CSS file with Jenkins so that users update the theme
- * by updating the plugin.
- *
- * There is a convenience method {@link ThemeManagerFactory#getCssUrl()}, which will
- * determine the full url if you follow the convention: {@code
- * $JENKINS_URL/theme-$themeId/theme.css}.
- *
- * The {@code theme.css} suffix can be changed by overriding {@link
- * ThemeManagerFactoryDescriptor#getThemeCssSuffix()}.
- *
- * @param cssUrl url to a CSS file that you want loaded.
- * @return the current builder with a CSS URL added to it.
- */
- public Builder withCssUrl(String cssUrl) {
- this.cssUrls = singletonList(cssUrl);
- return this;
+ for (String javascriptUrl : javascriptUrls) {
+ headerElements.add(MessageFormat.format(JS_HTML, javascriptUrl));
+ }
+
+ return headerElements;
}
/**
- * See {@link #withCssUrl(String)}
+ * See {@link Builder#withCssUrl(String)}
*
- * @param cssUrls a list of urls to CSS files that you want loaded.
- * @return the current builder with CSS URLs added to it.
+ * @return list of CSS URLs for the theme.
*/
- public Builder withCssUrls(List e.g. the Prism API plugin can read properties and use a default theme based on this
+ * information.
*
- * @param pluginId artifact ID of the plugin the property is associated with
- * @param name property name this will be namespaced with the artifactId automatically
- * @param value the property value
- * @return the current builder with the new property
+ * @param artifactId the plugin to retrieve the properties for
+ * @return the properties associated with the plugin requested
*/
- public Builder withProperty(String pluginId, String name, String value) {
- this.properties.put(pluginId + ":" + name, value);
- return this;
+ public List The URL must be absolute (i.e. not just contain the path)
- *
- * It is recommended that you serve the JavaScript file with Jenkins so that users update the
- * theme by updating the plugin.
+ * Additional information that theme authors can provide to influence other plugins
*
- * There is a convenience method {@link ThemeManagerFactory#getJavaScriptUrl()}, which will
- * determine the full url if you follow the convention: {@code
- * $JENKINS_URL/theme-$themeId/theme.js}.
+ * e.g. the Prism API plugin can read properties and use a default theme based on this
+ * information.
*
- * The {@code theme.css} suffix can be changed by overriding {@link
- * ThemeManagerFactoryDescriptor#getThemeJsSuffix()}.
- *
- * @param javascriptUrl url to a JavaScript file that you want loaded.
- * @return the current builder with a JavaScript URL added to it.
+ * @param artifactId the plugin to retrieve the properties for
+ * @param propertyName the property to retrieve
+ * @return the properties associated with the plugin requested
*/
- public Builder withJavascriptUrl(String javascriptUrl) {
- this.javascriptUrls = singletonList(javascriptUrl);
- return this;
+ public Optional The URL must be absolute (i.e. not just contain the path)
+ *
+ * It is recommended that you serve the CSS file with Jenkins so that users update the theme
+ * by updating the plugin.
+ *
+ * There is a convenience method {@link ThemeManagerFactory#getCssUrl()}, which will
+ * determine the full url if you follow the convention: {@code
+ * $JENKINS_URL/theme-$themeId/theme.css}.
+ *
+ * The {@code theme.css} suffix can be changed by overriding {@link
+ * ThemeManagerFactoryDescriptor#getThemeCssSuffix()}.
+ *
+ * @param cssUrl url to a CSS file that you want loaded.
+ * @return the current builder with a CSS URL added to it.
+ */
+ public Builder withCssUrl(String cssUrl) {
+ this.cssUrls = singletonList(cssUrl);
+ return this;
+ }
+
+ /**
+ * See {@link #withCssUrl(String)}
+ *
+ * @param cssUrls a list of urls to CSS files that you want loaded.
+ * @return the current builder with CSS URLs added to it.
+ */
+ public Builder withCssUrls(List The URL must be absolute (i.e. not just contain the path)
+ *
+ * It is recommended that you serve the JavaScript file with Jenkins so that users update the
+ * theme by updating the plugin.
+ *
+ * There is a convenience method {@link ThemeManagerFactory#getJavaScriptUrl()}, which will
+ * determine the full url if you follow the convention: {@code
+ * $JENKINS_URL/theme-$themeId/theme.js}.
+ *
+ * The {@code theme.css} suffix can be changed by overriding {@link
+ * ThemeManagerFactoryDescriptor#getThemeJsSuffix()}.
+ *
+ * @param javascriptUrl url to a JavaScript file that you want loaded.
+ * @return the current builder with a JavaScript URL added to it.
+ */
+ public Builder withJavascriptUrl(String javascriptUrl) {
+ this.javascriptUrls = singletonList(javascriptUrl);
+ return this;
+ }
+
+ /**
+ * See {@link #withJavascriptUrl(String)}.
+ *
+ * @param javascriptUrls a list of urls to JavaScript files that you want loaded.
+ * @return the current builder with JavaScript URLs added to it.
+ */
+ public Builder withJavascriptUrls(List See {@link #toAssetUrl(String)} for arbitrary files
- *
- * @return CSS url in the form '$JENKINS_URL/theme-$themeId/theme.css.
- */
- public String getCssUrl() {
- ThemeManagerFactoryDescriptor descriptor = getDescriptor();
- return toAssetUrl(descriptor.getThemeCssSuffix());
- }
+ /**
+ * Expected CSS URL assuming your CSS file is named after your theme. You can also change the CSS
+ * file name by overriding: {@link ThemeManagerFactoryDescriptor#getThemeCssSuffix()}
+ *
+ * See {@link #toAssetUrl(String)} for arbitrary files
+ *
+ * @return CSS url in the form '$JENKINS_URL/theme-$themeId/theme.css.
+ */
+ public String getCssUrl() {
+ ThemeManagerFactoryDescriptor descriptor = getDescriptor();
+ return toAssetUrl(descriptor.getThemeCssSuffix());
+ }
- /**
- * Arbitrary asset URL. Useful if you want additional css or js files
- *
- * @param asset additional-stylesheet.css
- * @return Asset url in the form '$JENKINS_URL/theme-$themeId/$asset-parameter
- */
- public String toAssetUrl(String asset) {
- ThemeManagerFactoryDescriptor descriptor = getDescriptor();
- return Jenkins.get().getRootUrl() + "theme-" + descriptor.getThemeId() + "/" + asset;
- }
+ /**
+ * Arbitrary asset URL. Useful if you want additional css or js files
+ *
+ * @param asset additional-stylesheet.css
+ * @return Asset url in the form '$JENKINS_URL/theme-$themeId/$asset-parameter
+ */
+ public String toAssetUrl(String asset) {
+ ThemeManagerFactoryDescriptor descriptor = getDescriptor();
+ return Jenkins.get().getRootUrl() + "theme-" + descriptor.getThemeId() + "/" + asset;
+ }
- /**
- * Expected JavaScript URL assuming your JavaScript file is named after your theme. You can also
- * change the CSS file name by overriding: {@link
- * ThemeManagerFactoryDescriptor#getThemeJsSuffix()}
- *
- * See {@link #toAssetUrl(String)} for arbitrary files
- *
- * @return JavaScript url in the form '$JENKINS_URL/theme-$themeId/theme.js.
- */
- public String getJavaScriptUrl() {
- ThemeManagerFactoryDescriptor descriptor = getDescriptor();
- return toAssetUrl(descriptor.getThemeJsSuffix());
- }
+ /**
+ * Expected JavaScript URL assuming your JavaScript file is named after your theme. You can also
+ * change the CSS file name by overriding: {@link
+ * ThemeManagerFactoryDescriptor#getThemeJsSuffix()}
+ *
+ * See {@link #toAssetUrl(String)} for arbitrary files
+ *
+ * @return JavaScript url in the form '$JENKINS_URL/theme-$themeId/theme.js.
+ */
+ public String getJavaScriptUrl() {
+ ThemeManagerFactoryDescriptor descriptor = getDescriptor();
+ return toAssetUrl(descriptor.getThemeJsSuffix());
+ }
- @Override
- public ThemeManagerFactoryDescriptor getDescriptor() {
- return (ThemeManagerFactoryDescriptor) super.getDescriptor();
- }
+ @Override
+ public ThemeManagerFactoryDescriptor getDescriptor() {
+ return (ThemeManagerFactoryDescriptor) super.getDescriptor();
+ }
}
diff --git a/src/main/java/io/jenkins/plugins/thememanager/ThemeManagerFactoryDescriptor.java b/src/main/java/io/jenkins/plugins/thememanager/ThemeManagerFactoryDescriptor.java
index 6eeaf76..75ffe6f 100644
--- a/src/main/java/io/jenkins/plugins/thememanager/ThemeManagerFactoryDescriptor.java
+++ b/src/main/java/io/jenkins/plugins/thememanager/ThemeManagerFactoryDescriptor.java
@@ -11,84 +11,84 @@
*/
public abstract class ThemeManagerFactoryDescriptor extends Descriptor This should be all lower case and URL safe, i.e. 'dark', 'neo2'
- *
- * The ID can be re-used inside of your plugin if you are serving multiple variations of the
- * theme, i.e. 'Dark', 'Dark (System)' could both be 'dark'.
- *
- * Used in generating URLs for Jenkins to find your theme files.
- *
- * @return the theme ID.
- */
- public abstract String getThemeId();
+ /**
+ * A name for a theme plugin
+ *
+ * This should be all lower case and URL safe, i.e. 'dark', 'neo2'
+ *
+ * The ID can be re-used inside of your plugin if you are serving multiple variations of the
+ * theme, i.e. 'Dark', 'Dark (System)' could both be 'dark'.
+ *
+ * Used in generating URLs for Jenkins to find your theme files.
+ *
+ * @return the theme ID.
+ */
+ public abstract String getThemeId();
- /**
- * A unique key for a theme plugin
- *
- * This should be all lower case and URL safe, i.e. 'dark-system', 'neo2'
- *
- * Used in the html dataset namespace for the theme.
- *
- * @return the theme key
- */
- public String getThemeKey() {
- return getThemeId();
- }
+ /**
+ * A unique key for a theme plugin
+ *
+ * This should be all lower case and URL safe, i.e. 'dark-system', 'neo2'
+ *
+ * Used in the html dataset namespace for the theme.
+ *
+ * @return the theme key
+ */
+ public String getThemeKey() {
+ return getThemeId();
+ }
- /**
- * If the theme's CSS will only be selected under the '[data-theme=theme-key]' selector
- *
- * It will be served on all pages even if not activated, ensure all selectors are behind the
- * dataset selector.
- *
- * All new themes should be namespaced
- *
- * @return if it's namespaced.
- */
- public boolean isNamespaced() {
- return false;
- }
+ /**
+ * If the theme's CSS will only be selected under the '[data-theme=theme-key]' selector
+ *
+ * It will be served on all pages even if not activated, ensure all selectors are behind the
+ * dataset selector.
+ *
+ * All new themes should be namespaced
+ *
+ * @return if it's namespaced.
+ */
+ public boolean isNamespaced() {
+ return false;
+ }
- /**
- * Name of the theme resource file.
- *
- * Used in generating URLs for Jenkins to find your theme files.
- *
- * @return name of the theme resource file.
- */
- public String getThemeCssSuffix() {
- return "theme.css";
- }
+ /**
+ * Name of the theme resource file.
+ *
+ * Used in generating URLs for Jenkins to find your theme files.
+ *
+ * @return name of the theme resource file.
+ */
+ public String getThemeCssSuffix() {
+ return "theme.css";
+ }
- /**
- * Name of the theme resource file.
- *
- * Used in generating URLs for Jenkins to find your theme files.
- *
- * @return name of the theme resource file.
- */
- public String getThemeJsSuffix() {
- return "theme.js";
- }
+ /**
+ * Name of the theme resource file.
+ *
+ * Used in generating URLs for Jenkins to find your theme files.
+ *
+ * @return name of the theme resource file.
+ */
+ public String getThemeJsSuffix() {
+ return "theme.js";
+ }
- /**
- * All implementations of {@link ThemeManagerFactory} and {@link ThemeManagerFactoryDescriptor}.
- *
- * @return descriptor extension list containing all themes.
- */
- public static DescriptorExtensionList