From 0dc908707e93021d05e9012f11d06a7d3074b24d Mon Sep 17 00:00:00 2001 From: stephanrauh Date: Sat, 11 Jul 2015 10:59:22 +0200 Subject: [PATCH] added a b:selectMultiMenu demo --- AddingPrimeFaces5.3/.gitignore | 8 + AddingPrimeFaces5.3/README.md | 9 + AddingPrimeFaces5.3/pom.xml | 116 ++++++ .../bootsfaces/examples/Person.java | 34 ++ .../component/output/cache/Cache.java | 121 +++++++ .../component/output/cache/CacheEntry.java | 115 ++++++ .../component/output/cache/CacheFactory.java | 87 +++++ .../cache/CacheInstancePerScopeProvider.java | 115 ++++++ .../component/output/cache/CacheProvider.java | 50 +++ .../component/output/cache/DefaultCache.java | 50 +++ .../output/cache/DefaultCacheProvider.java | 36 ++ .../output/cache/TimeToLiveCache.java | 128 +++++++ .../CombinedResourceInputStream.java | 268 ++++++++++++++ .../src/main/webapp/WEB-INF/faces-config.xml | 8 + .../src/main/webapp/WEB-INF/web.xml | 29 ++ .../src/main/webapp/index.xhtml | 26 ++ .../src/main/webapp/steps.xhtml | 25 ++ .../de/beyondjava/jsf/sample/carshop/Car.java | 101 ++++++ .../jsf/sample/carshop/CarBean.java | 73 ++++ .../jsf/sample/carshop/CarPool.java | 110 ++++++ .../jsf/sample/carshop/DynamicOptionBean.java | 116 ++++++ .../jsf/sample/carshop/SelectionBean.java | 56 +++ .../jsf/sample/carshop/SettingsBean.java | 54 +++ .../jsf/sample/carshop/StaticOptionBean.java | 137 +++++++ SelectMultiMenu/.gitignore | 8 + SelectMultiMenu/README.md | 11 + SelectMultiMenu/pom.xml | 86 +++++ .../src/main/webapp/WEB-INF/faces-config.xml | 8 + .../src/main/webapp/WEB-INF/web.xml | 12 + SelectMultiMenu/src/main/webapp/index.xhtml | 69 ++++ SelectMultiMenu/src/main/webapp/navbar.xhtml | 37 ++ .../main/webapp/resources/sh/css/shCore.css | 226 ++++++++++++ .../webapp/resources/sh/css/shCoreEclipse.css | 339 ++++++++++++++++++ .../resources/sh/css/shThemeEclipse.css | 128 +++++++ .../main/webapp/resources/sh/js/shBrushCss.js | 91 +++++ .../webapp/resources/sh/js/shBrushGroovy.js | 67 ++++ .../webapp/resources/sh/js/shBrushJScript.js | 52 +++ .../webapp/resources/sh/js/shBrushJava.js | 57 +++ .../main/webapp/resources/sh/js/shBrushXml.js | 69 ++++ .../src/main/webapp/resources/sh/js/shCore.js | 17 + 40 files changed, 3149 insertions(+) create mode 100644 AddingPrimeFaces5.3/.gitignore create mode 100644 AddingPrimeFaces5.3/README.md create mode 100644 AddingPrimeFaces5.3/pom.xml create mode 100644 AddingPrimeFaces5.3/src/main/java/de/beyondjava/bootsfaces/examples/Person.java create mode 100644 AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/Cache.java create mode 100644 AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheEntry.java create mode 100644 AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheFactory.java create mode 100644 AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheInstancePerScopeProvider.java create mode 100644 AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheProvider.java create mode 100644 AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/DefaultCache.java create mode 100644 AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/DefaultCacheProvider.java create mode 100644 AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/TimeToLiveCache.java create mode 100644 AddingPrimeFaces5.3/src/main/java/org/omnifaces/resourcehandler/CombinedResourceInputStream.java create mode 100644 AddingPrimeFaces5.3/src/main/webapp/WEB-INF/faces-config.xml create mode 100644 AddingPrimeFaces5.3/src/main/webapp/WEB-INF/web.xml create mode 100644 AddingPrimeFaces5.3/src/main/webapp/index.xhtml create mode 100644 AddingPrimeFaces5.3/src/main/webapp/steps.xhtml create mode 100644 PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/Car.java create mode 100644 PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/CarBean.java create mode 100644 PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/CarPool.java create mode 100644 PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/DynamicOptionBean.java create mode 100644 PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/SelectionBean.java create mode 100644 PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/SettingsBean.java create mode 100644 PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/StaticOptionBean.java create mode 100644 SelectMultiMenu/.gitignore create mode 100644 SelectMultiMenu/README.md create mode 100644 SelectMultiMenu/pom.xml create mode 100644 SelectMultiMenu/src/main/webapp/WEB-INF/faces-config.xml create mode 100644 SelectMultiMenu/src/main/webapp/WEB-INF/web.xml create mode 100644 SelectMultiMenu/src/main/webapp/index.xhtml create mode 100644 SelectMultiMenu/src/main/webapp/navbar.xhtml create mode 100644 SelectMultiMenu/src/main/webapp/resources/sh/css/shCore.css create mode 100644 SelectMultiMenu/src/main/webapp/resources/sh/css/shCoreEclipse.css create mode 100644 SelectMultiMenu/src/main/webapp/resources/sh/css/shThemeEclipse.css create mode 100644 SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushCss.js create mode 100644 SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushGroovy.js create mode 100644 SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushJScript.js create mode 100644 SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushJava.js create mode 100644 SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushXml.js create mode 100644 SelectMultiMenu/src/main/webapp/resources/sh/js/shCore.js diff --git a/AddingPrimeFaces5.3/.gitignore b/AddingPrimeFaces5.3/.gitignore new file mode 100644 index 0000000..8d629d4 --- /dev/null +++ b/AddingPrimeFaces5.3/.gitignore @@ -0,0 +1,8 @@ +/target/ +rebel.xml +.metadata +.settings +dist +.faces-config.xml.jsfdia +.project +.classpath \ No newline at end of file diff --git a/AddingPrimeFaces5.3/README.md b/AddingPrimeFaces5.3/README.md new file mode 100644 index 0000000..c6110e9 --- /dev/null +++ b/AddingPrimeFaces5.3/README.md @@ -0,0 +1,9 @@ +# BootsFaces-Examples: PanelGrid, PrimeFaces and AngularFaces +This demo shows demonstrates some of the features covered in the "What's new in PrimeFaces 5.2" article on http://www.beyondJava.net. + +Run this as a Tomcat application. The URL to start typically is http://localhost:8080/AddingPrimeFaces52/index.jsf + +Tested on: + diff --git a/AddingPrimeFaces5.3/pom.xml b/AddingPrimeFaces5.3/pom.xml new file mode 100644 index 0000000..5d50cbd --- /dev/null +++ b/AddingPrimeFaces5.3/pom.xml @@ -0,0 +1,116 @@ + + 4.0.0 + de.beyondjava + AddingPrimeFaces52 + 1.0.0-SNAPSHOT + war + AddingPrimeFaces52 + http://www.beyondjava.net + + UTF-8 + 1.7 + 1.7 + + + + prime-repo + PrimeFaces Maven Repository + http://repository.primefaces.org + default + + + + + net.bootsfaces + bootsfaces + 0.6.7-SNAPSHOT + + + org.omnifaces + omnifaces + 1.10 + compile + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + + org.primefaces + primefaces + 5.2.RC3 + compile + + + org.primefaces.themes + bootstrap + 1.0.10 + runtime + + + de.beyondjava + angularFaces-core + 2.1.5 + + + + + ApplicationServer + + false + + + + com.sun.faces + jsf-api + 2.2.11 + provided + + + + + Mojarra + + true + + + + com.sun.faces + jsf-api + 2.2.11 + compile + + + com.sun.faces + jsf-impl + 2.2.11 + runtime + + + + + MyFaces + + false + + + + org.apache.myfaces.core + myfaces-api + 2.2.7 + compile + + + org.apache.myfaces.core + myfaces-impl + 2.2.7 + runtime + + + + + \ No newline at end of file diff --git a/AddingPrimeFaces5.3/src/main/java/de/beyondjava/bootsfaces/examples/Person.java b/AddingPrimeFaces5.3/src/main/java/de/beyondjava/bootsfaces/examples/Person.java new file mode 100644 index 0000000..62ddd3e --- /dev/null +++ b/AddingPrimeFaces5.3/src/main/java/de/beyondjava/bootsfaces/examples/Person.java @@ -0,0 +1,34 @@ +package de.beyondjava.bootsfaces.examples; + +import java.util.Date; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +@ViewScoped +@ManagedBean +public class Person { + + private String firstName; + private String lastName; + private Date birthdate; + public Date getBirthdate() { + return birthdate; + } + public void setBirthdate(Date birthdate) { + this.birthdate = birthdate; + } + public String getLastName() { + return lastName; + } + public void setLastName(String lastName) { + this.lastName = lastName; + } + public String getFirstName() { + return firstName; + } + public void setFirstName(String firstName) { + this.firstName = firstName; + } + +} diff --git a/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/Cache.java b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/Cache.java new file mode 100644 index 0000000..b43161c --- /dev/null +++ b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/Cache.java @@ -0,0 +1,121 @@ +/* + * Copyright 2012 OmniFaces. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.omnifaces.component.output.cache; + +import java.io.Serializable; + +/** + * Interface that abstracts a simple get and put operation for a concrete cache implementation. + *

+ * Note that this takes Strings for both key and value since it's not intended as a general cache solution, but is + * something specific for the {@link Cache} component which caches rendered output. + * + * @since 1.1 + * @author Arjan Tijms + * + */ +public interface Cache extends Serializable { + + /** + * Gets a value from the cache + * + * @param key + * the key under which a value was previously stored + * @return The previously stored value, or null if no such value exists + */ + String get(String key); + + /** + * Gets a value from the cache + * + * @param key + * the key under which a value was previously stored + * @return The previously stored value, or null if no such value exists + */ + Object getObject(String key); + + /** + * Stores a value in the cache + * + * @param key + * the key under which a value is to be stored + * @param value + * the value that is to be stored + */ + void put(String key, String value); + + /** + * Stores a value in the cache + * + * @param key + * the key under which a value is to be stored + * @param value + * the value that is to be stored + */ + void putObject(String key, Object value, int timeToLive); + + /** + * Stores a value in the cache + * + * @param key + * the key under which a value is to be stored + * @param value + * the value that is to be stored + * @param timeToLive + * the amount of time in seconds for which the cached value is valid from the time it's being added to + * the cache. It's provider specific whether the cache implementation will actually remove (evict) the + * entry after this time has elapsed or will only perform a check upon accessing the cache entry. + * Whatever method the implementation chooses; after this time is elapsed a call to + * {@link Cache#get(String)} should return null. + */ + void put(String key, String value, int timeToLive); + + /** + * Gets a named attribute from the cache entry identified by the key parameter. + *

+ * This in effect implements a 2-level multi-map, which the single main value stored in the first level, and the + * optional attributes stored in the second level. + * + * @param key + * key that identifies the first level cache entry + * @param name + * name of the attribute in the second level + * @return the value associated with the {key, name} hierarchy. + * @since 1.2 + */ + Object getAttribute(String key, String name); + + /** + * Stores a named attribute in the cache entry identified by the key parameter. + * + * @param key + * key that identifies the first level cache entry + * @param name + * name of the attribute in the second level + * @param value + * value associated with the {key, name} hierarchy. + * @param timeToLive + * the amount of time in seconds for which the cached value is valid. Only used when there's no first + * level entry yet. See {@link Cache#putAttribute(String, String, Object, int)} + * @since 1.2 + */ + void putAttribute(String key, String name, Object value, int timeToLive); + + /** + * Removes a value from the cache + * + * @param key + * the key under which a value is to be stored + */ + void remove(String key); +} diff --git a/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheEntry.java b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheEntry.java new file mode 100644 index 0000000..be798c9 --- /dev/null +++ b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheEntry.java @@ -0,0 +1,115 @@ +/* + * Copyright 2012 OmniFaces. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.omnifaces.component.output.cache; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * Meta data for a value that's stored in a cache. Can be used for cache implementations that don't support both validity + * and attributes natively. Cache implementations are not required to use this type. + * + * @since 1.1 + * @author Arjan Tijms + * + */ +public class CacheEntry implements Serializable { + + private static final long serialVersionUID = -4602586599152573869L; + + private Object value; + private Date validTill; + private Map attributes; + + public CacheEntry(Object value, Date validTill) { + super(); + this.value = value; + this.validTill = validTill; + } + + /** + * Returns the value for which this object is keeping meta data + * + * @return The value for which meta data is kept + */ + public Object getValue() { + return value; + } + + /** + * Sets the value for which this object is keeping meta data + * + * @param value + * The value for which meta data is kept + */ + public void setValue(Object value) { + this.value = value; + } + + /** + * Returns the date that's the last moment in time the value obtained via getValue() is valid. After that moment, + * the value should not be used. + * + * @return date indicating last moment value hold by this object is valid. + */ + public Date getValidTill() { + return validTill; + } + + /** + * Sets the date that's the last moment in time the value obtained via getValue() is valid. After that moment, the + * value should not be used. + * + * @param validTill + * date indicating last moment value hold by this object is valid. + * @since 1.2 + */ + public void setValidTill(Date validTill) { + this.validTill = validTill; + } + + /** + * Returns whether this entry holds a valid value. If false is returned, the value should not be used and the cache + * implementation should try to remove this entry and its associated value from the cache. + * + * @return true if this entry is still valid, false otherwise. + */ + public boolean isValid() { + return validTill == null ? true : new Date().before(validTill); + } + + /** + * Gets a map of attributes associated with this entry. + *

+ * Attributes are general key,value pairs, that are currently mainly used to store the result of EL expressions that + * appear in the rendering represented by the main value this entry represents. + * + * @return a map of attributes associated with this entry. + * @since 1.2 + */ + public Map getAttributes() { + if (attributes == null) { + // NOTE: lazy initialization means the map can be created multiple times + // in case of concurrent access (likely with application scoped caches on + // popular pages). We assume here that it being cached data that can be created + // by one request or the other, eventually one request will create the lasting one + // and the Maps that are lost don't matter. + attributes = new HashMap<>(); + } + + return attributes; + } + +} \ No newline at end of file diff --git a/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheFactory.java b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheFactory.java new file mode 100644 index 0000000..d69194f --- /dev/null +++ b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheFactory.java @@ -0,0 +1,87 @@ +/* + * Copyright 2012 OmniFaces. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.omnifaces.component.output.cache; + +import javax.faces.context.FacesContext; +import javax.servlet.ServletContext; + +/** + * Factory used to obtain {@link Cache} instance and to register the {@link CacheProvider} that is used to obtain that. + * + * @since 1.1 + * @author Arjan Tijms + * + */ +public final class CacheFactory { + + public static final String CACHE_PROVIDER_PARAM_NAME = "org.omnifaces.cacheprovider"; + private static final CacheProvider DEFAULT_PROVIDER = new DefaultCacheProvider(); + + private CacheFactory() { + } + + /** + * Gets an instance of a Cache using the configured cache provider. + * + * @param context + * faces context used for retrieving the cache provider and for resolving the given scope. + * @param scope + * scope for which the cache should be obtained. Supported scopes are dependent on the specific caching + * provider, but generally at least "session" and "application" should be supported. + * + * @return a cache provider specific Cache instance + */ + public static Cache getCache(FacesContext context, String scope) { + return getCacheProvider(context).getCache(context, scope); + } + + /** + * Gets the cache provider as it has been set in the ServletContext. Does NOT return the default cache provider if + * none is present. + * + * @param servletContext + * the servlet context where the cache provider is retrieved from + * @return the previously set provider if one is set, null otherwise + */ + public static CacheProvider getCacheProvider(ServletContext servletContext) { + return (CacheProvider) servletContext.getAttribute(CACHE_PROVIDER_PARAM_NAME); + } + + public static void setCacheProvider(CacheProvider cacheProvider, ServletContext servletContext) { + servletContext.setAttribute(CACHE_PROVIDER_PARAM_NAME, cacheProvider); + } + + /** + * Gets the cache provider that has been set, or the default provider if none is present. + * + * @param context + * the faces context where the cache provider is retrieved from + * @return the previously set provider if one is set, otherwise the default provider + */ + public static CacheProvider getCacheProvider(FacesContext context) { + CacheProvider provider = (CacheProvider) context.getExternalContext().getApplicationMap().get(CACHE_PROVIDER_PARAM_NAME); + return provider != null ? provider : DEFAULT_PROVIDER; + } + + /** + * Returns an instance of the default cache provider. This is the provider that is used in + * {@link CacheFactory#getCache(FacesContext, String)} and {@link CacheFactory#getCacheProvider(FacesContext)} if no + * explicit provider has been set. + * + * @return the default cache provider + */ + public static CacheProvider getDefaultCacheProvider() { + return DEFAULT_PROVIDER; + } + +} diff --git a/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheInstancePerScopeProvider.java b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheInstancePerScopeProvider.java new file mode 100644 index 0000000..3edd40e --- /dev/null +++ b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheInstancePerScopeProvider.java @@ -0,0 +1,115 @@ +/* + * Copyright 2012 OmniFaces. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.omnifaces.component.output.cache; + +import java.util.Map; + +import javax.faces.context.FacesContext; + +/** + * Base class for Cache providers where for each scope a new instance of the cache is created if for that scope no instance + * is present yet. + *

+ * This kind of cache provider is suitable for simple in-memory cache implementations, where the cache is very cheap + * to create. This is in contrast to caches where there is typically one expensive to create instance active per JVM, + * and where scoped caches are better expressed as nodes in a tree structure. + * + * @since 1.1 + * @author Arjan Tijms + * + */ +public abstract class CacheInstancePerScopeProvider implements CacheProvider { + + public static final String DEFAULT_CACHE_PARAM_NAME = "org.omnifaces.defaultcache"; + + public static final String APP_TTL_PARAM_NAME = "APPLICATION_TTL"; + public static final String SESSION_TTL_PARAM_NAME = "SESSION_TTL"; + + public static final String APP_MAX_CAP_PARAM_NAME = "APPLICATION_MAX_CAPACITY"; + public static final String SESSION_MAX_CAP_PARAM_NAME = "SESSION_MAX_CAPACITY"; + + private Integer appDefaultTimeToLive; + private Integer sessionDefaultTimeToLive; + + private Integer appMaxCapacity; + private Integer sessionMaxCapacity; + + private Map parameters; + + @Override + public Cache getCache(FacesContext context, String scope) { + + if ("application".equals(scope)) { + return getAppScopeCache(context); + } else if ("session".equals(scope)) { + return getSessionScopeCache(context); + } + + throw new IllegalArgumentException("Scope " + scope + " not supported by provider" + DefaultCacheProvider.class.getName()); + } + + @Override + public void setParameters(Map parameters) { + this.parameters = parameters; + + if (parameters.containsKey(APP_TTL_PARAM_NAME)) { + appDefaultTimeToLive = Integer.valueOf(parameters.get(APP_TTL_PARAM_NAME)); + } + if (parameters.containsKey(SESSION_TTL_PARAM_NAME)) { + sessionDefaultTimeToLive = Integer.valueOf(parameters.get(SESSION_TTL_PARAM_NAME)); + } + if (parameters.containsKey(APP_MAX_CAP_PARAM_NAME)) { + appMaxCapacity = Integer.valueOf(parameters.get(APP_MAX_CAP_PARAM_NAME)); + } + if (parameters.containsKey(SESSION_MAX_CAP_PARAM_NAME)) { + sessionMaxCapacity = Integer.valueOf(parameters.get(SESSION_MAX_CAP_PARAM_NAME)); + } + } + + public Map getParameters() { + return parameters; + } + + private Cache getAppScopeCache(FacesContext context) { + + Map applicationMap = context.getExternalContext().getApplicationMap(); + if (!applicationMap.containsKey(DEFAULT_CACHE_PARAM_NAME)) { + synchronized (DefaultCacheProvider.class) { + if (!applicationMap.containsKey(DEFAULT_CACHE_PARAM_NAME)) { + applicationMap.put(DEFAULT_CACHE_PARAM_NAME, createCache(appDefaultTimeToLive, appMaxCapacity)); + } + + } + } + + return (Cache) applicationMap.get(DEFAULT_CACHE_PARAM_NAME); + } + + private Cache getSessionScopeCache(FacesContext context) { + + Map sessionMap = context.getExternalContext().getSessionMap(); + if (!sessionMap.containsKey(DEFAULT_CACHE_PARAM_NAME)) { + Object session = context.getExternalContext().getSession(true); + synchronized (session) { + if (!sessionMap.containsKey(DEFAULT_CACHE_PARAM_NAME)) { + sessionMap.put(DEFAULT_CACHE_PARAM_NAME, createCache(sessionDefaultTimeToLive, sessionMaxCapacity)); + } + } + } + + return (Cache) sessionMap.get(DEFAULT_CACHE_PARAM_NAME); + } + + protected abstract Cache createCache(Integer timeToLive, Integer maxCapacity); + +} \ No newline at end of file diff --git a/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheProvider.java b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheProvider.java new file mode 100644 index 0000000..60333bf --- /dev/null +++ b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/CacheProvider.java @@ -0,0 +1,50 @@ +/* + * Copyright 2012 OmniFaces. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.omnifaces.component.output.cache; + +import java.util.Map; + +import javax.faces.context.FacesContext; + +/** + * A provider for a specific {@link Cache} implementation. Via this plug-in construct, the OmniFaces Cache component can + * make use of different kinds of cache implementations. + * + * @since 1.1 + * @author Arjan Tijms + * + */ +public interface CacheProvider { + + /** + * Gets an instance of a Cache using the configured cache provider. + * + * @param context + * faces context used for resolving the given scope. + * @param scope + * scope for which the cache should be obtained. Supported scopes are dependent on the specific caching + * provider, but generally at least "session" and "application" should be supported. + * + * @return Cache instance encapsulating the cache represented by this CacheProvider + */ + Cache getCache(FacesContext context, String scope); + + /** + * Passes parameters to the cache provider implementation. This is mainly intended for configuration of things + * like LRU and global TTL. Settings are mainly implementation specific. + * + * @param parameters map of parameters used to configure the cache. + */ + void setParameters(Map parameters); + +} diff --git a/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/DefaultCache.java b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/DefaultCache.java new file mode 100644 index 0000000..fac1e61 --- /dev/null +++ b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/DefaultCache.java @@ -0,0 +1,50 @@ +/* + * Copyright 2012 OmniFaces. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.omnifaces.component.output.cache; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.omnifaces.util.concurrentlinkedhashmap.ConcurrentLinkedHashMap; + +/** + * An in-memory cache implementation that's used if the user did not configure an explicit caching provider. + *

+ * For the actual implementation, a repackaged {@link ConcurrentLinkedHashMap} is used if a maximum capacity is requested, + * otherwise a plain {@link ConcurrentHashMap} is used. + *

+ * See: http://code.google.com/p/concurrentlinkedhashmap + * + * @since 1.1 + * @author Arjan Tijms + * + */ +public class DefaultCache extends TimeToLiveCache { + + private static final long serialVersionUID = 9043165102510796018L; + + public DefaultCache(Integer defaultTimeToLive, Integer maxCapacity) { + super(defaultTimeToLive); + setCacheStore(createCacheStore(maxCapacity)); + } + + private Map createCacheStore(Integer maxCapacity) { + if (maxCapacity != null) { + return new ConcurrentLinkedHashMap.Builder() + .maximumWeightedCapacity(maxCapacity) + .build(); + } else { + return new ConcurrentHashMap<>(); + } + } +} \ No newline at end of file diff --git a/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/DefaultCacheProvider.java b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/DefaultCacheProvider.java new file mode 100644 index 0000000..01a6402 --- /dev/null +++ b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/DefaultCacheProvider.java @@ -0,0 +1,36 @@ +/* + * Copyright 2012 OmniFaces. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.omnifaces.component.output.cache; + +import org.omnifaces.util.concurrentlinkedhashmap.ConcurrentLinkedHashMap; + +/** + * A default cache provider that will be used by the OmniFaces Cache component if no explicit provider has been + * configured. + *

+ * This will create a Cache instance that uses a repackaged {@link ConcurrentLinkedHashMap} for the actual implementation. + *

+ * See: http://code.google.com/p/concurrentlinkedhashmap + * + * @since 1.1 + * @author Arjan Tijms + * + */ +public class DefaultCacheProvider extends CacheInstancePerScopeProvider { + + @Override + protected Cache createCache(Integer timeToLive, Integer maxCapacity) { + return new DefaultCache(timeToLive, maxCapacity); + } + +} diff --git a/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/TimeToLiveCache.java b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/TimeToLiveCache.java new file mode 100644 index 0000000..27c02aa --- /dev/null +++ b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/component/output/cache/TimeToLiveCache.java @@ -0,0 +1,128 @@ +/* + * Copyright 2012 OmniFaces. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.omnifaces.component.output.cache; + +import static java.lang.System.currentTimeMillis; +import static java.util.concurrent.TimeUnit.SECONDS; + +import java.util.Date; +import java.util.Map; + +/** + * Base class that can be used by Map based caches that don't support time to live semantics and arbitrary attributes natively. + * + * @since 1.1 + * @author Arjan Tijms + * + */ +public abstract class TimeToLiveCache implements Cache { + + private static final long serialVersionUID = 6637500586287606410L; + + private final Integer defaultTimeToLive; + private Map cacheStore; + + public TimeToLiveCache(Integer defaultTimeToLive) { + this.defaultTimeToLive = defaultTimeToLive; + } + + @Override + public String get(String key) { + return (String) getObject(key); + } + + public Object getObject(String key) { + CacheEntry entry = cacheStore.get(key); + + if (entry != null) { + if (entry.isValid()) { + return entry.getValue(); + } else { + cacheStore.remove(key); + } + } + + return null; + } + + @Override + public void put(String key, String value) { + if (defaultTimeToLive != null) { + put(key, value, defaultTimeToLive); + } else { + put(key, value, -1); + } + } + + @Override + public void put(String key, String value, int timeToLive) { + putObject(key, value, timeToLive); + } + + public void putObject(String key, Object value, int timeToLive) { + CacheEntry entry = cacheStore.get(key); + + if (entry == null || !entry.isValid()) { + cacheStore.put(key, new CacheEntry(value, timeToLiveToDate(timeToLive))); + } else { + entry.setValue(value); + entry.setValidTill(timeToLiveToDate(timeToLive)); + } + } + + @Override + public void putAttribute(String key, String name, Object value, int timeToLive) { + CacheEntry entry = cacheStore.get(key); + + if (entry == null || !entry.isValid()) { + // NOTE: timeToLive is only used when a new entry is created + entry = new CacheEntry(null, timeToLiveToDate(timeToLive)); + cacheStore.put(key, entry); + } + + entry.getAttributes().put(name, value); + } + + @Override + public Object getAttribute(String key, String name) { + CacheEntry entry = cacheStore.get(key); + + if (entry != null) { + if (entry.isValid()) { + return entry.getAttributes().get(name); + } else { + cacheStore.remove(key); + } + } + + return null; + } + + @Override + public void remove(String key) { + cacheStore.remove(key); + } + + protected void setCacheStore(Map cacheStore) { + this.cacheStore = cacheStore; + } + + private Date timeToLiveToDate(int timeToLive) { + if (timeToLive != -1) { + return new Date(currentTimeMillis() + SECONDS.toMillis(timeToLive)); + } else { + return null; + } + } + +} \ No newline at end of file diff --git a/AddingPrimeFaces5.3/src/main/java/org/omnifaces/resourcehandler/CombinedResourceInputStream.java b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/resourcehandler/CombinedResourceInputStream.java new file mode 100644 index 0000000..778c69d --- /dev/null +++ b/AddingPrimeFaces5.3/src/main/java/org/omnifaces/resourcehandler/CombinedResourceInputStream.java @@ -0,0 +1,268 @@ +package org.omnifaces.resourcehandler; +/* + * Copyright 2012 OmniFaces. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + + +import static org.omnifaces.util.Faces.getRequestDomainURL; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.faces.application.Resource; +import javax.faces.context.FacesContext; + +import org.omnifaces.component.output.cache.CacheFactory; +import org.omnifaces.util.Faces; +import org.omnifaces.util.Utils; + +/** + * This {@link InputStream} implementation takes care that all in the constructor given resources are been read in sequence. + * + * @author Bauke Scholtz + */ +final class CombinedResourceInputStream extends InputStream { + + // Constants ------------------------------------------------------------------------------------------------------ + + private static final String TIME_TO_LIVE_CONTEXT_PARAM = "org.omnifaces.CACHE_SETTING_APPLICATION_TTL"; + private final static String DEFAULT_SCOPE = "application"; + + /* 16.02.2015 Caching added by Stephan Rauh, http://www.beyondjava.net */ + /** The context parameter name to specify whether the resources are to be cached or not. */ + public static final String PARAM_NAME_ACTIVATE_RESOURCE_CACHING = "org.omnifaces.COMBINED_RESOURCE_ACTIVATE_RESOURCE_CACHING"; + /* 16.02.2015 end of modification */ + + private static final byte[] CRLF = { '\r', '\n' }; + + // Properties ----------------------------------------------------------------------------------------------------- + + private List streams; + private Iterator streamIterator; + private InputStream currentStream; + + static Map cachedResources = new HashMap(); + + /* 16.02.2015 Caching added by Stephan Rauh, http://www.beyondjava.net */ + private byte[] combinedResource = null; + private int pointer = 0; + /* 16.02.2015 end of pull request */ + + // Constructors --------------------------------------------------------------------------------------------------- + + /** + * Creates an instance of {@link CombinedResourceInputStream} based on the given resources. For each resource, the {@link InputStream} + * will be obtained and hold in an iterable collection. + * + * @param resources + * The resources to be read. + * @throws IOException + * If something fails at I/O level. + */ + public CombinedResourceInputStream(Set resources) throws IOException { + prepareStreaming(resources); + + /* 16.02.2015 Caching added by Stephan Rauh, http://www.beyondjava.net */ + if ("true".equals(Faces.getInitParameter(PARAM_NAME_ACTIVATE_RESOURCE_CACHING))) { + combinedResource = prepareStreamingFromCache(streamIterator, resources); + pointer = 0; + currentStream = null; + } + else + { + streamIterator.hasNext(); // We assume it to be always true, see also CombinedResource#getInputStream(). + currentStream = streamIterator.next(); + } + /* 16.02.2015 end of pull request */ + } + + /** + * Collects the list of Stream that have to be read. + * @param resources The resources to be read. + * @throws IOException If something fails at I/O level. + */ + private void prepareStreaming(Set resources) throws IOException { + streams = new ArrayList<>(); + String domainURL = getRequestDomainURL(); + + for (Resource resource : resources) { + InputStream stream; + + try { + stream = resource.getInputStream(); + } catch (Exception richFacesDoesNotSupportThis) { + stream = new URL(domainURL + resource.getRequestPath()).openStream(); + } + + streams.add(stream); + streams.add(new ByteArrayInputStream(CRLF)); + } + + streamIterator = streams.iterator(); + } + + /* 16.02.2015 Caching added by Stephan Rauh, http://www.beyondjava.net */ + // Eclipse doesn't detect that the resource are closed in the close() method + /** + * This method collects the resources eagerly and combines them into a byte array. The byte array is cached. + * @param streamIterator The stream iterator iterates over the resources to be read. + * @param resources The resources to be read. + * @return a byte array containing the combined resources. Can't be null. + * @throws IOException + If something fails at I/O level. + */ + @SuppressWarnings("resource") + private static byte[] prepareStreamingFromCache(Iterator streamIterator, Set resources) + throws IOException { + String key = ""; + + for (Resource resource : resources) { + key += resource.getLibraryName() + "/" + resource.getResourceName() + " "; + } + + org.omnifaces.component.output.cache.Cache scopedCache = CacheFactory.getCache(FacesContext.getCurrentInstance(), DEFAULT_SCOPE); + + byte[] _combinedResource; + synchronized(CombinedResourceHandler.class){ + _combinedResource = (byte[]) scopedCache.getObject(key); + } + + if (null != _combinedResource) { + return _combinedResource; + } + + streamIterator.hasNext(); // We assume it to be always true, see also CombinedResource#getInputStream(). + InputStream currentStream = streamIterator.next(); + // Caching added by Stephan Rauh, www.beyondjava.net, Feb 02, 2015 + if (null == _combinedResource) { + ByteArrayOutputStream collector = new ByteArrayOutputStream(); + int read = -1; + + while (true) { + read = currentStream.read(); + if (read == -1) { + if (streamIterator.hasNext()) { + currentStream = streamIterator.next(); + } else { + break; + } + } else + collector.write(read); + } + _combinedResource = collector.toByteArray(); + synchronized(CombinedResourceHandler.class){ + if (null==scopedCache.getObject(key)) + scopedCache.putObject(key, _combinedResource, getTimeToLiveOfCacheEntries()); + } + } + return _combinedResource; + } + + /** + * How many seconds are cache entries supposed to live in the cache? Default: 1 hour. + * @return the number of seconds + */ + private static int getTimeToLiveOfCacheEntries() { + int timeToLive=3600; // one hour by default + + String ttl = Faces.getInitParameter(TIME_TO_LIVE_CONTEXT_PARAM); + if (null !=ttl) { + try { + timeToLive=Integer.parseInt(ttl); + } + catch (Exception weirdEntry) { + // this error has already been reported on startup, so we can safely ignore it here + } + + } + return timeToLive; + } + /* 16.02.2015 end of pull request */ + + // Actions -------------------------------------------------------------------------------------------------------- + + // Caching added by Stephan Rauh, www.beyondjava.net, Feb 02, 2015 + /** + * For each resource, read until its {@link InputStream#read()} returns -1 and then iterate to the {@link InputStream} of + * the next resource, if any available, else return -1. + */ + @Override + public int read() throws IOException { + // Hint on performance: this method will run "hot", i.e. will be inlined and compiled to assembler code by the JIT. So introducing + // the additional methods doesn't + // reduce performance. + if (null != combinedResource) + return readFromCache(); + else + return readFromStreamIterator(); + } + + /** + * For each resource, read until its {@link InputStream#read()} returns -1 and then iterate to the {@link InputStream} of + * the next resource, if any available, else return -1. + */ + public int readFromStreamIterator() throws IOException { + int read = -1; + + while ((read = currentStream.read()) == -1) { + if (streamIterator.hasNext()) { + currentStream = streamIterator.next(); + } else { + break; + } + } + + return read; + } + + public int readFromCache() throws IOException { + // Caching added by Stephan Rauh, www.beyondjava.net, Feb 02, 2015 + if (pointer < combinedResource.length) { + return combinedResource[pointer++]; + } else { + return -1; + } + } + + /* 16.02.2015 end of pull request */ + + /** + * Closes the {@link InputStream} of each resource. Whenever the {@link InputStream#close()} throws an {@link IOException} for the first + * time, it will be caught and be thrown after all resources have been closed. Any {@link IOException} which is thrown by a subsequent + * close will be ignored by design. + */ + @Override + public void close() throws IOException { + IOException caught = null; + + for (InputStream stream : streams) { + IOException e = Utils.close(stream); + + if (caught == null) { + caught = e; // Don't throw it yet. We have to continue closing all other streams. + } + } + + if (caught != null) { + throw caught; + } + } +} \ No newline at end of file diff --git a/AddingPrimeFaces5.3/src/main/webapp/WEB-INF/faces-config.xml b/AddingPrimeFaces5.3/src/main/webapp/WEB-INF/faces-config.xml new file mode 100644 index 0000000..a2e08aa --- /dev/null +++ b/AddingPrimeFaces5.3/src/main/webapp/WEB-INF/faces-config.xml @@ -0,0 +1,8 @@ + + + + org.omnifaces.resourcehandler.CombinedResourceHandler + + + \ No newline at end of file diff --git a/AddingPrimeFaces5.3/src/main/webapp/WEB-INF/web.xml b/AddingPrimeFaces5.3/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..09e08fa --- /dev/null +++ b/AddingPrimeFaces5.3/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,29 @@ + + + + + javax.faces.FACELETS_DECORATORS + + de.beyondjava.angularFaces.core.tagTransformer.AngularTagDecorator + + + + primefaces.THEME + bootstrap + + + primefaces.FONT_AWESOME + true + + + + + + BootsFaces_USETHEME + true + + + index.jsf + + \ No newline at end of file diff --git a/AddingPrimeFaces5.3/src/main/webapp/index.xhtml b/AddingPrimeFaces5.3/src/main/webapp/index.xhtml new file mode 100644 index 0000000..47192cc --- /dev/null +++ b/AddingPrimeFaces5.3/src/main/webapp/index.xhtml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/AddingPrimeFaces5.3/src/main/webapp/steps.xhtml b/AddingPrimeFaces5.3/src/main/webapp/steps.xhtml new file mode 100644 index 0000000..bcfd894 --- /dev/null +++ b/AddingPrimeFaces5.3/src/main/webapp/steps.xhtml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/Car.java b/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/Car.java new file mode 100644 index 0000000..bcca711 --- /dev/null +++ b/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/Car.java @@ -0,0 +1,101 @@ +/** + * (C) 2013-2014 Stephan Rauh http://www.beyondjava.net + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package de.beyondjava.jsf.sample.carshop; + +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; + +public class Car { + String brand; + + public int getMileage() { + return mileage; + } + + public void setMileage(int mileage) { + this.mileage = mileage; + } + + public String getFuel() { + return fuel; + } + + public void setFuel(String fuel) { + this.fuel = fuel; + } + + public int getPrice() { + return price; + } + + public void setPrice(int price) { + this.price = price; + } + + String type; + + @Min(1886) + @Max(2014) + int year; + + @Min(0) + @Max(1000000) + int mileage; + + String fuel; + + @Min(1) + @Max(5000000) + int price; + + public Car() { + } + + public Car(String brand, String type, int year, String color, int mileage, String fuel, int price) { + this.brand = brand; + this.type = type; + this.year = year; + this.mileage = mileage; + this.fuel = fuel; + this.price = price; + } + + public String getBrand() { + return brand; + } + + + public String getType() { + return type; + } + + public int getYear() { + return year; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + public void setType(String type) { + this.type = type; + } + + public void setYear(int year) { + this.year = year; + } +} diff --git a/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/CarBean.java b/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/CarBean.java new file mode 100644 index 0000000..e6a1359 --- /dev/null +++ b/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/CarBean.java @@ -0,0 +1,73 @@ +package de.beyondjava.jsf.sample.carshop; + +import java.io.Serializable; +import java.util.Map; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.context.FacesContext; + +@ManagedBean +@SessionScoped +public class CarBean implements Serializable { + private static final long serialVersionUID = 1L; + + + private Car car; + + public CarBean() { + + } + + public String showDetails(Car car) { + this.car = car; + return "details.jsf"; + } + + public String getBrand() { + return car.getBrand(); + } + + public void setBrand(String brand) { + car.setBrand(brand); + } + + public String getType() { + return car.getType(); + } + + public void setType(String type) { + car.setType(type); + } + + public int getPrice() { + return car.getPrice(); + } + + public void setPrice(int price) { + car.setPrice(price); + } + + public int getMileage() { + return car.getMileage(); + } + + public void setMileage(int mileage) { + car.setMileage(mileage); + } + + public int getYear() { + return car.getYear(); + } + + public void setYear(int year) { + car.setYear(year); + } + + public String getFuel() { + return car.getFuel(); + } + public void setFuel(String fuel) { + car.setFuel(fuel); + } +} diff --git a/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/CarPool.java b/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/CarPool.java new file mode 100644 index 0000000..05ce928 --- /dev/null +++ b/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/CarPool.java @@ -0,0 +1,110 @@ +/** + * (C) 2013-2014 Stephan Rauh http://www.beyondjava.net + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package de.beyondjava.jsf.sample.carshop; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.SessionScoped; + +@ManagedBean +@SessionScoped +public class CarPool implements Serializable { + private static final long serialVersionUID = 1L; + + private final static int SIZE_OF_INITIAL_CAR_POOL = 10; + + @ManagedProperty("#{staticOptionBean}") + private StaticOptionBean staticOptions; + + public StaticOptionBean getStaticOptions() { + return staticOptions; + } + + public void setStaticOptions(StaticOptionBean staticOptions) { + this.staticOptions = staticOptions; + } + + public DynamicOptionBean getDynamicOptions() { + return dynamicOptions; + } + + public void setDynamicOptions(DynamicOptionBean dynamicOptions) { + this.dynamicOptions = dynamicOptions; + } + + @ManagedProperty("#{dynamicOptionBean}") + private DynamicOptionBean dynamicOptions; + + private List types; + + private int currentYear = Calendar.getInstance().get(Calendar.YEAR); + + private List carPool; + + public List getCarPool() { + return carPool; + } + + private List selectedCars; + + public List getSelectedCars() { + return selectedCars; + } + + /** This method is also used as actionListener */ + @PostConstruct + public void initRandomCarPool() { + types = dynamicOptions.getTypesToBrand(null); + carPool = new ArrayList(); + for (int i = 0; i < SIZE_OF_INITIAL_CAR_POOL; i++) { + carPool.add(getRandomCar()); + } + selectedCars = carPool; + } + + public void setCarPool(List carpool) { + this.carPool = carpool; + } + + private Car getRandomCar() { + int typeIndex = (int) Math.floor(Math.random() * (types.size() - 1)); + String type = types.get(typeIndex + 1); + String brand = dynamicOptions.getBrandToType(type); + int year = (int) (Math.floor((currentYear - 1980) * Math.random())) + 1980; + int age = currentYear - year; + + int price = 60000 / (1 + age) + (int) Math.floor(Math.random() * 10000); + + int mileage = (int) (Math.floor((age + 1) * 20000 * Math.random())); + + int colorIndex = (int) Math.floor(Math.random() * (staticOptions.getColors().size() - 1)); + String color = staticOptions.getColors().get(colorIndex + 1); + + int fuelIndex = (int) Math.floor(Math.random() * (staticOptions.getFuels().size() - 1)); + String fuel = staticOptions.getFuels().get(fuelIndex + 1); + + Car c = new Car(brand, type, year, color, mileage, fuel, price); + return c; + } + +} diff --git a/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/DynamicOptionBean.java b/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/DynamicOptionBean.java new file mode 100644 index 0000000..04da58a --- /dev/null +++ b/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/DynamicOptionBean.java @@ -0,0 +1,116 @@ +/** + * (C) 2013-2014 Stephan Rauh http://www.beyondjava.net + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package de.beyondjava.jsf.sample.carshop; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean +@SessionScoped +public class DynamicOptionBean implements Serializable { + + private static final long serialVersionUID = 1L; + private Map brand2Type = new HashMap(); + + private List types = new ArrayList(); + + public DynamicOptionBean() { + initBrandsAndTypes(); + + types.add(""); + types.add("Civic"); + types.add("Golf"); + types.add("320"); + types.add("V50"); + types.add("Astra"); + types.add("Megane"); + types.add("Picasso"); + types.add("Ibiza"); + types.add("Punto"); + } + + + public String getBrandToType(String type) { + if (type == null) + return ""; + return brand2Type.get(type); + } + + public List getTypes() { + return getTypesToBrand(brand); + } + + public List getTypesToBrand(String brand) { + if (brand == null || brand.length() == 0) + return types; + List l = new ArrayList(); + + Set> entrySet = brand2Type.entrySet(); + Iterator> iter = entrySet.iterator(); + while (iter.hasNext()) { + Entry entry = iter.next(); + if (entry.getValue().equals(brand)) { + l.add(entry.getKey()); + } + } + if (l.size() > 0) + l.add(0, ""); + return l; + } + + public void initBrandsAndTypes() { + brand2Type.put("Civic", "Honda"); + brand2Type.put("Jazz", "Honda"); + brand2Type.put("Golf", "VW"); + brand2Type.put("Passat", "VW"); + brand2Type.put("Polo", "VW"); + brand2Type.put("320", "BMW"); + brand2Type.put("C40", "Volvo"); + brand2Type.put("V50", "Volvo"); + brand2Type.put("C60", "Volvo"); + brand2Type.put("V70", "Volvo"); + brand2Type.put("Corsa", "Opel"); + brand2Type.put("Astra", "Opel"); + brand2Type.put("Vectra", "Opel"); + brand2Type.put("Picasso", "Citroen"); + brand2Type.put("León", "Seat"); + brand2Type.put("Ibiza", "Seat"); + brand2Type.put("Exeo", "Seat"); + brand2Type.put("Punto", "Fiat"); + brand2Type.put("500", "Fiat"); + brand2Type.put("Panda", "Fiat"); + brand2Type.put("Megane", "Renault"); + } + + private String brand=null; + private String type=null; + public void setBrandAndType(String brand, String type) { + this.brand=brand; + this.type=type; + + } +} diff --git a/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/SelectionBean.java b/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/SelectionBean.java new file mode 100644 index 0000000..dbee4f9 --- /dev/null +++ b/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/SelectionBean.java @@ -0,0 +1,56 @@ +package de.beyondjava.jsf.sample.carshop; + +import java.util.List; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.RequestScoped; + +import de.beyondjava.angularFaces.components.puiSync.JSONUtilities; + +@ManagedBean +@RequestScoped +public class SelectionBean { + + @ManagedProperty("#{carPool.selectedCars}") + private List selectedCars; + + @ManagedProperty("#{carBean}") + private CarBean carBean; + + public CarBean getCarBean() { + return carBean; + } + + public void setCarBean(CarBean carBean) { + this.carBean = carBean; + } + + public List getSelectedCars() { + return selectedCars; + } + + public void setSelectedCars(List selectedCars) { + this.selectedCars = selectedCars; + } + + private String carAsJSon; + + public String getCarAsJSon() { + return carAsJSon; + } + + public void setCarAsJSon(String carAsJSon) { + this.carAsJSon = carAsJSon; + } + + public String showDetails() { + int pos = carAsJSon.indexOf(",\"$$hashKey\""); + if (pos > 0) + carAsJSon = carAsJSon.substring(0, pos) + "}"; + + Car car = (Car) JSONUtilities.readObjectFromJSONString(carAsJSon, Car.class); + return getCarBean().showDetails(car); + } + +} diff --git a/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/SettingsBean.java b/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/SettingsBean.java new file mode 100644 index 0000000..d586760 --- /dev/null +++ b/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/SettingsBean.java @@ -0,0 +1,54 @@ +package de.beyondjava.jsf.sample.carshop; + +import java.io.Serializable; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean +@SessionScoped +public class SettingsBean implements Serializable { + + private static final long serialVersionUID = 1L; + + private boolean updateImmediately = true; + + private boolean useAngularFacesAJAX = true; + + private boolean useHTML5Style = true; + + private boolean usePrimeFaces = true; + + public boolean isUpdateImmediately() { + return updateImmediately; + } + + public boolean isUseAngularFacesAJAX() { + return useAngularFacesAJAX; + } + + public boolean isUseHTML5Style() { + return useHTML5Style; + } + + public boolean isUsePrimeFaces() { + return usePrimeFaces; + } + + public void setUpdateImmediately(boolean immediateUpdate) { + this.updateImmediately = immediateUpdate; + } + + public void setUseAngularFacesAJAX(boolean useAngularFacesAJAX) { + this.useAngularFacesAJAX = useAngularFacesAJAX; + } + + public void setUseHTML5Style(boolean useHTML5Style) { + this.useHTML5Style = useHTML5Style; + } + + public void setUsePrimeFaces(boolean usePrimeFaces) { + this.usePrimeFaces = usePrimeFaces; + } + +} diff --git a/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/StaticOptionBean.java b/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/StaticOptionBean.java new file mode 100644 index 0000000..9788256 --- /dev/null +++ b/PanelGrid/src/main/java/de/beyondjava/jsf/sample/carshop/StaticOptionBean.java @@ -0,0 +1,137 @@ +/** + * (C) 2013-2014 Stephan Rauh http://www.beyondjava.net + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package de.beyondjava.jsf.sample.carshop; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean +@SessionScoped +public class StaticOptionBean implements Serializable { + + private static final long serialVersionUID = 1L; + + private List brands = new ArrayList(); + + private List colors = new ArrayList(); + + private List fuels = new ArrayList(); + + private List mileages = new ArrayList(); + private List prices = new ArrayList(); + private List years = new ArrayList(); + + public StaticOptionBean() { + brands.add(""); + brands.add("Honda"); + brands.add("VW"); + brands.add("BMW"); + brands.add("Volvo"); + brands.add("Opel"); + brands.add("Renault"); + brands.add("Citroen"); + brands.add("Seat"); + brands.add("Fiat"); + + colors.add(""); + colors.add("red"); + colors.add("white"); + colors.add("blue"); + colors.add("yellow"); + colors.add("green"); + colors.add("black"); + colors.add("white"); + colors.add("silver"); + + prices.add(""); + prices.add("< €500"); + prices.add("< €1000"); + prices.add("< €2000"); + prices.add("< €3000"); + prices.add("< €4000"); + prices.add("< €5000"); + prices.add("< €7500"); + prices.add("< €10000"); + prices.add("< €15000"); + prices.add("< €20000"); + prices.add("< €30000"); + prices.add("< €40000"); + prices.add("< €50000"); + + mileages.add(""); + mileages.add("< 100 km"); + mileages.add("< 2000 km"); + mileages.add("< 5000 km"); + mileages.add("< 10000 km"); + mileages.add("< 25000 km"); + mileages.add("< 50000 km"); + mileages.add("< 100000 km"); + mileages.add("< 200000 km"); + + fuels.add(""); + fuels.add("gasoline"); + fuels.add("diesel"); + fuels.add("hybrid"); + fuels.add("electric"); + + years.add(""); + int year = Calendar.getInstance().get(Calendar.YEAR); + for (int i = 0; i < 10; i++) { + years.add(new Integer(year - i).toString() + " or younger"); + } + for (int i = 10; i < 20; i += 3) { + years.add(new Integer(year - i).toString() + " or younger"); + } + for (int i = 20; i < 50; i += 5) { + years.add(new Integer(year - i).toString() + " or younger"); + } + } + + public List getBrands() { + return brands; + } + + public List getColors() { + return colors; + } + + public List getFuels() { + return fuels; + } + + public List getMileages() { + return mileages; + } + + public List getPrices() { + return prices; + } + + public List getYears() { + return years; + } +} diff --git a/SelectMultiMenu/.gitignore b/SelectMultiMenu/.gitignore new file mode 100644 index 0000000..8d629d4 --- /dev/null +++ b/SelectMultiMenu/.gitignore @@ -0,0 +1,8 @@ +/target/ +rebel.xml +.metadata +.settings +dist +.faces-config.xml.jsfdia +.project +.classpath \ No newline at end of file diff --git a/SelectMultiMenu/README.md b/SelectMultiMenu/README.md new file mode 100644 index 0000000..cebcf5b --- /dev/null +++ b/SelectMultiMenu/README.md @@ -0,0 +1,11 @@ +# BootsFaces-Examples: SelectMultiMenu +This demo shows how to use a SelectMultiMenu. Originally, the purpose of this project was to +reproduce a bug reported +on StackOverflow.com. + +Run this as a Tomcat application. The URL to start typically is http://localhost:8080/SelectMultiMenu. + +Tested on: +

diff --git a/SelectMultiMenu/pom.xml b/SelectMultiMenu/pom.xml new file mode 100644 index 0000000..e586411 --- /dev/null +++ b/SelectMultiMenu/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + de.beyondjava + SelectMultiMenu + 1.0.0-SNAPSHOT + war + SelectMultiMenu + http://www.beyondjava.net + + UTF-8 + 1.7 + 1.7 + + + + prime-repo + PrimeFaces Maven Repository + http://repository.primefaces.org + default + + + + + net.bootsfaces + bootsfaces + 0.7.0 + + + + + ApplicationServer + + false + + + + com.sun.faces + jsf-api + 2.2.11 + provided + + + + + Mojarra + + false + + + + com.sun.faces + jsf-api + 2.2.11 + compile + + + com.sun.faces + jsf-impl + 2.2.11 + runtime + + + + + MyFaces + + true + + + + org.apache.myfaces.core + myfaces-api + 2.2.7 + compile + + + org.apache.myfaces.core + myfaces-impl + 2.2.7 + runtime + + + + + \ No newline at end of file diff --git a/SelectMultiMenu/src/main/webapp/WEB-INF/faces-config.xml b/SelectMultiMenu/src/main/webapp/WEB-INF/faces-config.xml new file mode 100644 index 0000000..e5deaf7 --- /dev/null +++ b/SelectMultiMenu/src/main/webapp/WEB-INF/faces-config.xml @@ -0,0 +1,8 @@ + + + + diff --git a/SelectMultiMenu/src/main/webapp/WEB-INF/web.xml b/SelectMultiMenu/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..d0ab826 --- /dev/null +++ b/SelectMultiMenu/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,12 @@ + + + + + BootsFaces_USETHEME + true + + + index.jsf + + \ No newline at end of file diff --git a/SelectMultiMenu/src/main/webapp/index.xhtml b/SelectMultiMenu/src/main/webapp/index.xhtml new file mode 100644 index 0000000..ab70a5c --- /dev/null +++ b/SelectMultiMenu/src/main/webapp/index.xhtml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ As of BootsFaces 0.7.0, the + <b:selectMultiMenu /> + needs a little help to work properly. You have three choices: +

+
    +
  • Add a <b:dropDownMenu />. If your + application has a NavBar menu, add a drop down menu there. +
  • +
  • You can add the forgotten dependencies in the head + section of your JSF page: +
  • +
  • Wait until BootsFaces 0.8 arrives :).
  • +
+ + + + + +
+
+
+
+
+ +
+ \ No newline at end of file diff --git a/SelectMultiMenu/src/main/webapp/navbar.xhtml b/SelectMultiMenu/src/main/webapp/navbar.xhtml new file mode 100644 index 0000000..a631ab9 --- /dev/null +++ b/SelectMultiMenu/src/main/webapp/navbar.xhtml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SelectMultiMenu/src/main/webapp/resources/sh/css/shCore.css b/SelectMultiMenu/src/main/webapp/resources/sh/css/shCore.css new file mode 100644 index 0000000..34f6864 --- /dev/null +++ b/SelectMultiMenu/src/main/webapp/resources/sh/css/shCore.css @@ -0,0 +1,226 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter a, +.syntaxhighlighter div, +.syntaxhighlighter code, +.syntaxhighlighter table, +.syntaxhighlighter table td, +.syntaxhighlighter table tr, +.syntaxhighlighter table tbody, +.syntaxhighlighter table thead, +.syntaxhighlighter table caption, +.syntaxhighlighter textarea { + -moz-border-radius: 0 0 0 0 !important; + -webkit-border-radius: 0 0 0 0 !important; + background: none !important; + border: 0 !important; + bottom: auto !important; + float: none !important; + height: auto !important; + left: auto !important; + line-height: 1.1em !important; + margin: 0 !important; + outline: 0 !important; + overflow: visible !important; + padding: 0 !important; + position: static !important; + right: auto !important; + text-align: left !important; + top: auto !important; + vertical-align: baseline !important; + width: auto !important; + box-sizing: content-box !important; + font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; + font-weight: normal !important; + font-style: normal !important; + font-size: 1em !important; + min-height: inherit !important; + min-height: auto !important; +} + +.syntaxhighlighter { + width: 100% !important; + margin: 1em 0 1em 0 !important; + position: relative !important; + overflow: auto !important; + font-size: 1em !important; +} +.syntaxhighlighter.source { + overflow: hidden !important; +} +.syntaxhighlighter .bold { + font-weight: bold !important; +} +.syntaxhighlighter .italic { + font-style: italic !important; +} +.syntaxhighlighter .line { + white-space: pre !important; +} +.syntaxhighlighter table { + width: 100% !important; +} +.syntaxhighlighter table caption { + text-align: left !important; + padding: .5em 0 0.5em 1em !important; +} +.syntaxhighlighter table td.code { + width: 100% !important; +} +.syntaxhighlighter table td.code .container { + position: relative !important; +} +.syntaxhighlighter table td.code .container textarea { + box-sizing: border-box !important; + position: absolute !important; + left: 0 !important; + top: 0 !important; + width: 100% !important; + height: 100% !important; + border: none !important; + background: white !important; + padding-left: 1em !important; + overflow: hidden !important; + white-space: pre !important; +} +.syntaxhighlighter table td.gutter .line { + text-align: right !important; + padding: 0 0.5em 0 1em !important; +} +.syntaxhighlighter table td.code .line { + padding: 0 1em !important; +} +.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { + padding-left: 0em !important; +} +.syntaxhighlighter.show { + display: block !important; +} +.syntaxhighlighter.collapsed table { + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar { + padding: 0.1em 0.8em 0em 0.8em !important; + font-size: 1em !important; + position: static !important; + width: auto !important; + height: auto !important; +} +.syntaxhighlighter.collapsed .toolbar span { + display: inline !important; + margin-right: 1em !important; +} +.syntaxhighlighter.collapsed .toolbar span a { + padding: 0 !important; + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar span a.expandSource { + display: inline !important; +} +.syntaxhighlighter .toolbar { + position: absolute !important; + right: 1px !important; + top: 1px !important; + width: 11px !important; + height: 11px !important; + font-size: 10px !important; + z-index: 10 !important; +} +.syntaxhighlighter .toolbar span.title { + display: inline !important; +} +.syntaxhighlighter .toolbar a { + display: block !important; + text-align: center !important; + text-decoration: none !important; + padding-top: 1px !important; +} +.syntaxhighlighter .toolbar a.expandSource { + display: none !important; +} +.syntaxhighlighter.ie { + font-size: .9em !important; + padding: 1px 0 1px 0 !important; +} +.syntaxhighlighter.ie .toolbar { + line-height: 8px !important; +} +.syntaxhighlighter.ie .toolbar a { + padding-top: 0px !important; +} +.syntaxhighlighter.printing .line.alt1 .content, +.syntaxhighlighter.printing .line.alt2 .content, +.syntaxhighlighter.printing .line.highlighted .number, +.syntaxhighlighter.printing .line.highlighted.alt1 .content, +.syntaxhighlighter.printing .line.highlighted.alt2 .content { + background: none !important; +} +.syntaxhighlighter.printing .line .number { + color: #bbbbbb !important; +} +.syntaxhighlighter.printing .line .content { + color: black !important; +} +.syntaxhighlighter.printing .toolbar { + display: none !important; +} +.syntaxhighlighter.printing a { + text-decoration: none !important; +} +.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { + color: black !important; +} +.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { + color: #008200 !important; +} +.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { + color: blue !important; +} +.syntaxhighlighter.printing .keyword { + color: #006699 !important; + font-weight: bold !important; +} +.syntaxhighlighter.printing .preprocessor { + color: gray !important; +} +.syntaxhighlighter.printing .variable { + color: #aa7700 !important; +} +.syntaxhighlighter.printing .value { + color: #009900 !important; +} +.syntaxhighlighter.printing .functions { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .constants { + color: #0066cc !important; +} +.syntaxhighlighter.printing .script { + font-weight: bold !important; +} +.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { + color: gray !important; +} +.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { + color: red !important; +} +.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { + color: black !important; +} diff --git a/SelectMultiMenu/src/main/webapp/resources/sh/css/shCoreEclipse.css b/SelectMultiMenu/src/main/webapp/resources/sh/css/shCoreEclipse.css new file mode 100644 index 0000000..a45de9f --- /dev/null +++ b/SelectMultiMenu/src/main/webapp/resources/sh/css/shCoreEclipse.css @@ -0,0 +1,339 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter a, +.syntaxhighlighter div, +.syntaxhighlighter code, +.syntaxhighlighter table, +.syntaxhighlighter table td, +.syntaxhighlighter table tr, +.syntaxhighlighter table tbody, +.syntaxhighlighter table thead, +.syntaxhighlighter table caption, +.syntaxhighlighter textarea { + -moz-border-radius: 0 0 0 0 !important; + -webkit-border-radius: 0 0 0 0 !important; + background: none !important; + border: 0 !important; + bottom: auto !important; + float: none !important; + height: auto !important; + left: auto !important; + line-height: 1.1em !important; + margin: 0 !important; + outline: 0 !important; + overflow: visible !important; + padding: 0 !important; + position: static !important; + right: auto !important; + text-align: left !important; + top: auto !important; + vertical-align: baseline !important; + width: auto !important; + box-sizing: content-box !important; + font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; + font-weight: normal !important; + font-style: normal !important; + font-size: 1em !important; + min-height: inherit !important; + min-height: auto !important; +} + +.syntaxhighlighter { + width: 100% !important; + margin: 1em 0 1em 0 !important; + position: relative !important; + overflow: auto !important; + font-size: 1em !important; +} +.syntaxhighlighter.source { + overflow: hidden !important; +} +.syntaxhighlighter .bold { + font-weight: bold !important; +} +.syntaxhighlighter .italic { + font-style: italic !important; +} +.syntaxhighlighter .line { + white-space: pre !important; +} +.syntaxhighlighter table { + width: 100% !important; +} +.syntaxhighlighter table caption { + text-align: left !important; + padding: .5em 0 0.5em 1em !important; +} +.syntaxhighlighter table td.code { + width: 100% !important; +} +.syntaxhighlighter table td.code .container { + position: relative !important; +} +.syntaxhighlighter table td.code .container textarea { + box-sizing: border-box !important; + position: absolute !important; + left: 0 !important; + top: 0 !important; + width: 100% !important; + height: 100% !important; + border: none !important; + background: white !important; + padding-left: 1em !important; + overflow: hidden !important; + white-space: pre !important; +} +.syntaxhighlighter table td.gutter .line { + text-align: right !important; + padding: 0 0.5em 0 1em !important; +} +.syntaxhighlighter table td.code .line { + padding: 0 1em !important; +} +.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { + padding-left: 0em !important; +} +.syntaxhighlighter.show { + display: block !important; +} +.syntaxhighlighter.collapsed table { + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar { + padding: 0.1em 0.8em 0em 0.8em !important; + font-size: 1em !important; + position: static !important; + width: auto !important; + height: auto !important; +} +.syntaxhighlighter.collapsed .toolbar span { + display: inline !important; + margin-right: 1em !important; +} +.syntaxhighlighter.collapsed .toolbar span a { + padding: 0 !important; + display: none !important; +} +.syntaxhighlighter.collapsed .toolbar span a.expandSource { + display: inline !important; +} +.syntaxhighlighter .toolbar { + position: absolute !important; + right: 1px !important; + top: 1px !important; + width: 11px !important; + height: 11px !important; + font-size: 10px !important; + z-index: 10 !important; +} +.syntaxhighlighter .toolbar span.title { + display: inline !important; +} +.syntaxhighlighter .toolbar a { + display: block !important; + text-align: center !important; + text-decoration: none !important; + padding-top: 1px !important; +} +.syntaxhighlighter .toolbar a.expandSource { + display: none !important; +} +.syntaxhighlighter.ie { + font-size: .9em !important; + padding: 1px 0 1px 0 !important; +} +.syntaxhighlighter.ie .toolbar { + line-height: 8px !important; +} +.syntaxhighlighter.ie .toolbar a { + padding-top: 0px !important; +} +.syntaxhighlighter.printing .line.alt1 .content, +.syntaxhighlighter.printing .line.alt2 .content, +.syntaxhighlighter.printing .line.highlighted .number, +.syntaxhighlighter.printing .line.highlighted.alt1 .content, +.syntaxhighlighter.printing .line.highlighted.alt2 .content { + background: none !important; +} +.syntaxhighlighter.printing .line .number { + color: #bbbbbb !important; +} +.syntaxhighlighter.printing .line .content { + color: black !important; +} +.syntaxhighlighter.printing .toolbar { + display: none !important; +} +.syntaxhighlighter.printing a { + text-decoration: none !important; +} +.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { + color: black !important; +} +.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { + color: #008200 !important; +} +.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { + color: blue !important; +} +.syntaxhighlighter.printing .keyword { + color: #006699 !important; + font-weight: bold !important; +} +.syntaxhighlighter.printing .preprocessor { + color: gray !important; +} +.syntaxhighlighter.printing .variable { + color: #aa7700 !important; +} +.syntaxhighlighter.printing .value { + color: #009900 !important; +} +.syntaxhighlighter.printing .functions { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .constants { + color: #0066cc !important; +} +.syntaxhighlighter.printing .script { + font-weight: bold !important; +} +.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { + color: gray !important; +} +.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { + color: red !important; +} +.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { + color: black !important; +} + +.syntaxhighlighter { + background-color: white !important; +} +.syntaxhighlighter .line.alt1 { + background-color: white !important; +} +.syntaxhighlighter .line.alt2 { + background-color: white !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #c3defe !important; +} +.syntaxhighlighter .line.highlighted.number { + color: white !important; +} +.syntaxhighlighter table caption { + color: black !important; +} +.syntaxhighlighter .gutter { + color: #787878 !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #d4d0c8 !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #d4d0c8 !important; + color: white !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #3f5fbf !important; + background: white !important; + border: 1px solid #d4d0c8 !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #3f5fbf !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: #aa7700 !important; +} +.syntaxhighlighter .toolbar { + color: #a0a0a0 !important; + background: #d4d0c8 !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: #a0a0a0 !important; +} +.syntaxhighlighter .toolbar a:hover { + color: red !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: black !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #3f5fbf !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: #2a00ff !important; +} +.syntaxhighlighter .keyword { + color: #7f0055 !important; +} +.syntaxhighlighter .preprocessor { + color: #646464 !important; +} +.syntaxhighlighter .variable { + color: #aa7700 !important; +} +.syntaxhighlighter .value { + color: #009900 !important; +} +.syntaxhighlighter .functions { + color: #ff1493 !important; +} +.syntaxhighlighter .constants { + color: #0066cc !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #7f0055 !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: gray !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: red !important; +} + +.syntaxhighlighter .keyword { + font-weight: bold !important; +} +.syntaxhighlighter .xml .keyword { + color: #3f7f7f !important; + font-weight: normal !important; +} +.syntaxhighlighter .xml .color1, .syntaxhighlighter .xml .color1 a { + color: #7f007f !important; +} +.syntaxhighlighter .xml .string { + font-style: italic !important; + color: #2a00ff !important; +} diff --git a/SelectMultiMenu/src/main/webapp/resources/sh/css/shThemeEclipse.css b/SelectMultiMenu/src/main/webapp/resources/sh/css/shThemeEclipse.css new file mode 100644 index 0000000..77377d9 --- /dev/null +++ b/SelectMultiMenu/src/main/webapp/resources/sh/css/shThemeEclipse.css @@ -0,0 +1,128 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +.syntaxhighlighter { + background-color: white !important; +} +.syntaxhighlighter .line.alt1 { + background-color: white !important; +} +.syntaxhighlighter .line.alt2 { + background-color: white !important; +} +.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { + background-color: #c3defe !important; +} +.syntaxhighlighter .line.highlighted.number { + color: white !important; +} +.syntaxhighlighter table caption { + color: black !important; +} +.syntaxhighlighter .gutter { + color: #787878 !important; +} +.syntaxhighlighter .gutter .line { + border-right: 3px solid #d4d0c8 !important; +} +.syntaxhighlighter .gutter .line.highlighted { + background-color: #d4d0c8 !important; + color: white !important; +} +.syntaxhighlighter.printing .line .content { + border: none !important; +} +.syntaxhighlighter.collapsed { + overflow: visible !important; +} +.syntaxhighlighter.collapsed .toolbar { + color: #3f5fbf !important; + background: white !important; + border: 1px solid #d4d0c8 !important; +} +.syntaxhighlighter.collapsed .toolbar a { + color: #3f5fbf !important; +} +.syntaxhighlighter.collapsed .toolbar a:hover { + color: #aa7700 !important; +} +.syntaxhighlighter .toolbar { + color: #a0a0a0 !important; + background: #d4d0c8 !important; + border: none !important; +} +.syntaxhighlighter .toolbar a { + color: #a0a0a0 !important; +} +.syntaxhighlighter .toolbar a:hover { + color: red !important; +} +.syntaxhighlighter .plain, .syntaxhighlighter .plain a { + color: black !important; +} +.syntaxhighlighter .comments, .syntaxhighlighter .comments a { + color: #3f5fbf !important; +} +.syntaxhighlighter .string, .syntaxhighlighter .string a { + color: #2a00ff !important; +} +.syntaxhighlighter .keyword { + color: #7f0055 !important; +} +.syntaxhighlighter .preprocessor { + color: #646464 !important; +} +.syntaxhighlighter .variable { + color: #aa7700 !important; +} +.syntaxhighlighter .value { + color: #009900 !important; +} +.syntaxhighlighter .functions { + color: #ff1493 !important; +} +.syntaxhighlighter .constants { + color: #0066cc !important; +} +.syntaxhighlighter .script { + font-weight: bold !important; + color: #7f0055 !important; + background-color: none !important; +} +.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { + color: gray !important; +} +.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { + color: #ff1493 !important; +} +.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { + color: red !important; +} + +.syntaxhighlighter .keyword { + font-weight: bold !important; +} +.syntaxhighlighter .xml .keyword { + color: #3f7f7f !important; + font-weight: normal !important; +} +.syntaxhighlighter .xml .color1, .syntaxhighlighter .xml .color1 a { + color: #7f007f !important; +} +.syntaxhighlighter .xml .string { + font-style: italic !important; + color: #2a00ff !important; +} diff --git a/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushCss.js b/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushCss.js new file mode 100644 index 0000000..4297a9a --- /dev/null +++ b/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushCss.js @@ -0,0 +1,91 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +;(function() +{ + // CommonJS + typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; + + function Brush() + { + function getKeywordsCSS(str) + { + return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b'; + }; + + function getValuesCSS(str) + { + return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b'; + }; + + var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' + + 'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' + + 'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' + + 'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' + + 'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' + + 'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' + + 'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' + + 'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' + + 'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' + + 'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' + + 'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' + + 'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' + + 'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' + + 'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index'; + + var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+ + 'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+ + 'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double '+ + 'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+ + 'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+ + 'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+ + 'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+ + 'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+ + 'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+ + 'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+ + 'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+ + 'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+ + 'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+ + 'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow'; + + var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif'; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings + { regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors + { regex: /(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)/g, css: 'value' }, // sizes + { regex: /!important/g, css: 'color3' }, // !important + { regex: new RegExp(getKeywordsCSS(keywords), 'gm'), css: 'keyword' }, // keywords + { regex: new RegExp(getValuesCSS(values), 'g'), css: 'value' }, // values + { regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts + ]; + + this.forHtmlScript({ + left: /(<|<)\s*style.*?(>|>)/gi, + right: /(<|<)\/\s*style\s*(>|>)/gi + }); + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['css']; + + SyntaxHighlighter.brushes.CSS = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); diff --git a/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushGroovy.js b/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushGroovy.js new file mode 100644 index 0000000..6ec5c18 --- /dev/null +++ b/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushGroovy.js @@ -0,0 +1,67 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +;(function() +{ + // CommonJS + typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; + + function Brush() + { + // Contributed by Andres Almiray + // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter + + var keywords = 'as assert break case catch class continue def default do else extends finally ' + + 'if in implements import instanceof interface new package property return switch ' + + 'throw throws try while public protected private static'; + var types = 'void boolean byte char short int long float double'; + var constants = 'null'; + var methods = 'allProperties count get size '+ + 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' + + 'findIndexOf grep inject max min reverseEach sort ' + + 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' + + 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' + + 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' + + 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' + + 'transformChar transformLine withOutputStream withPrintWriter withStream ' + + 'withStreams withWriter withWriterAppend write writeLine '+ + 'dump inspect invokeMethod print println step times upto use waitForOrKill '+ + 'getText'; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments + { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings + { regex: /""".*"""/g, css: 'string' }, // GStrings + { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword + { regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type + { regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants + { regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods + ]; + + this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); + } + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['groovy']; + + SyntaxHighlighter.brushes.Groovy = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); diff --git a/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushJScript.js b/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushJScript.js new file mode 100644 index 0000000..5b8bdc6 --- /dev/null +++ b/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushJScript.js @@ -0,0 +1,52 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (Wed, 16 Apr 2014 03:56:09 GMT) + * + * @copyright + * Copyright (C) 2004-2013 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +;(function() +{ + // CommonJS + SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null); + + function Brush() + { + var keywords = 'break case catch class continue ' + + 'default delete do else enum export extends false ' + + 'for function if implements import in instanceof ' + + 'interface let new null package private protected ' + + 'static return super switch ' + + 'this throw true try typeof var while with yield'; + + var r = SyntaxHighlighter.regexLib; + + this.regexList = [ + { regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings + { regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings + { regex: r.singleLineCComments, css: 'comments' }, // one line comments + { regex: r.multiLineCComments, css: 'comments' }, // multiline comments + { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords + ]; + + this.forHtmlScript(r.scriptScriptTags); + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['js', 'jscript', 'javascript', 'json']; + + SyntaxHighlighter.brushes.JScript = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); diff --git a/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushJava.js b/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushJava.js new file mode 100644 index 0000000..d692fd6 --- /dev/null +++ b/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushJava.js @@ -0,0 +1,57 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +;(function() +{ + // CommonJS + typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; + + function Brush() + { + var keywords = 'abstract assert boolean break byte case catch char class const ' + + 'continue default do double else enum extends ' + + 'false final finally float for goto if implements import ' + + 'instanceof int interface long native new null ' + + 'package private protected public return ' + + 'short static strictfp super switch synchronized this throw throws true ' + + 'transient try void volatile while'; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments + { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments + { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings + { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers + { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno + { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword + ]; + + this.forHtmlScript({ + left : /(<|<)%[@!=]?/g, + right : /%(>|>)/g + }); + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['java']; + + SyntaxHighlighter.brushes.Java = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); diff --git a/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushXml.js b/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushXml.js new file mode 100644 index 0000000..69d9fd0 --- /dev/null +++ b/SelectMultiMenu/src/main/webapp/resources/sh/js/shBrushXml.js @@ -0,0 +1,69 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +;(function() +{ + // CommonJS + typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; + + function Brush() + { + function process(match, regexInfo) + { + var constructor = SyntaxHighlighter.Match, + code = match[0], + tag = new XRegExp('(<|<)[\\s\\/\\?]*(?[:\\w-\\.]+)', 'xg').exec(code), + result = [] + ; + + if (match.attributes != null) + { + var attributes, + regex = new XRegExp('(? [\\w:\\-\\.]+)' + + '\\s*=\\s*' + + '(? ".*?"|\'.*?\'|\\w+)', + 'xg'); + + while ((attributes = regex.exec(code)) != null) + { + result.push(new constructor(attributes.name, match.index + attributes.index, 'color1')); + result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string')); + } + } + + if (tag != null) + result.push( + new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword') + ); + + return result; + } + + this.regexList = [ + { regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // + { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // + { regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process } + ]; + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['xml', 'xhtml', 'xslt', 'html']; + + SyntaxHighlighter.brushes.Xml = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); diff --git a/SelectMultiMenu/src/main/webapp/resources/sh/js/shCore.js b/SelectMultiMenu/src/main/webapp/resources/sh/js/shCore.js new file mode 100644 index 0000000..b47b645 --- /dev/null +++ b/SelectMultiMenu/src/main/webapp/resources/sh/js/shCore.js @@ -0,0 +1,17 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (July 02 2010) + * + * @copyright + * Copyright (C) 2004-2010 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('K M;I(M)1S 2U("2a\'t 4k M 4K 2g 3l 4G 4H");(6(){6 r(f,e){I(!M.1R(f))1S 3m("3s 15 4R");K a=f.1w;f=M(f.1m,t(f)+(e||""));I(a)f.1w={1m:a.1m,19:a.19?a.19.1a(0):N};H f}6 t(f){H(f.1J?"g":"")+(f.4s?"i":"")+(f.4p?"m":"")+(f.4v?"x":"")+(f.3n?"y":"")}6 B(f,e,a,b){K c=u.L,d,h,g;v=R;5K{O(;c--;){g=u[c];I(a&g.3r&&(!g.2p||g.2p.W(b))){g.2q.12=e;I((h=g.2q.X(f))&&h.P===e){d={3k:g.2b.W(b,h,a),1C:h};1N}}}}5v(i){1S i}5q{v=11}H d}6 p(f,e,a){I(3b.Z.1i)H f.1i(e,a);O(a=a||0;a-1},3d:6(g){e+=g}};c1&&p(e,"")>-1){a=15(J.1m,n.Q.W(t(J),"g",""));n.Q.W(f.1a(e.P),a,6(){O(K c=1;c<14.L-2;c++)I(14[c]===1d)e[c]=1d})}I(J.1w&&J.1w.19)O(K b=1;be.P&&J.12--}H e};I(!D)15.Z.1A=6(f){(f=n.X.W(J,f))&&J.1J&&!f[0].L&&J.12>f.P&&J.12--;H!!f};1r.Z.1C=6(f){M.1R(f)||(f=15(f));I(f.1J){K e=n.1C.1p(J,14);f.12=0;H e}H f.X(J)};1r.Z.Q=6(f,e){K a=M.1R(f),b,c;I(a&&1j e.58()==="3f"&&e.1i("${")===-1&&y)H n.Q.1p(J,14);I(a){I(f.1w)b=f.1w.19}Y f+="";I(1j e==="6")c=n.Q.W(J,f,6(){I(b){14[0]=1f 1r(14[0]);O(K d=0;dd.L-3;){i=1r.Z.1a.W(g,-1)+i;g=1Q.3i(g/10)}H(g?d[g]||"":"$")+i}Y{g=+i;I(g<=d.L-3)H d[g];g=b?p(b,i):-1;H g>-1?d[g+1]:h}})})}I(a&&f.1J)f.12=0;H c};1r.Z.1e=6(f,e){I(!M.1R(f))H n.1e.1p(J,14);K a=J+"",b=[],c=0,d,h;I(e===1d||+e<0)e=5D;Y{e=1Q.3i(+e);I(!e)H[]}O(f=M.3c(f);d=f.X(a);){I(f.12>c){b.U(a.1a(c,d.P));d.L>1&&d.P=e)1N}f.12===d.P&&f.12++}I(c===a.L){I(!n.1A.W(f,"")||h)b.U("")}Y b.U(a.1a(c));H b.L>e?b.1a(0,e):b};M.1h(/\\(\\?#[^)]*\\)/,6(f){H n.1A.W(A,f.2S.1a(f.P+f[0].L))?"":"(?:)"});M.1h(/\\((?!\\?)/,6(){J.19.U(N);H"("});M.1h(/\\(\\?<([$\\w]+)>/,6(f){J.19.U(f[1]);J.2N=R;H"("});M.1h(/\\\\k<([\\w$]+)>/,6(f){K e=p(J.19,f[1]);H e>-1?"\\\\"+(e+1)+(3R(f.2S.3a(f.P+f[0].L))?"":"(?:)"):f[0]});M.1h(/\\[\\^?]/,6(f){H f[0]==="[]"?"\\\\b\\\\B":"[\\\\s\\\\S]"});M.1h(/^\\(\\?([5A]+)\\)/,6(f){J.3d(f[1]);H""});M.1h(/(?:\\s+|#.*)+/,6(f){H n.1A.W(A,f.2S.1a(f.P+f[0].L))?"":"(?:)"},M.1B,6(){H J.2K("x")});M.1h(/\\./,6(){H"[\\\\s\\\\S]"},M.1B,6(){H J.2K("s")})})();1j 2e!="1d"&&(2e.M=M);K 1v=6(){6 r(a,b){a.1l.1i(b)!=-1||(a.1l+=" "+b)}6 t(a){H a.1i("3e")==0?a:"3e"+a}6 B(a){H e.1Y.2A[t(a)]}6 p(a,b,c){I(a==N)H N;K d=c!=R?a.3G:[a.2G],h={"#":"1c",".":"1l"}[b.1o(0,1)]||"3h",g,i;g=h!="3h"?b.1o(1):b.5u();I((a[h]||"").1i(g)!=-1)H a;O(a=0;d&&a\'+c+""});H a}6 n(a,b){a.1e("\\n");O(K c="",d=0;d<50;d++)c+=" ";H a=v(a,6(h){I(h.1i("\\t")==-1)H h;O(K g=0;(g=h.1i("\\t"))!=-1;)h=h.1o(0,g)+c.1o(0,b-g%b)+h.1o(g+1,h.L);H h})}6 x(a){H a.Q(/^\\s+|\\s+$/g,"")}6 D(a,b){I(a.Pb.P)H 1;Y I(a.Lb.L)H 1;H 0}6 y(a,b){6 c(k){H k[0]}O(K d=N,h=[],g=b.2D?b.2D:c;(d=b.1I.X(a))!=N;){K i=g(d,b);I(1j i=="3f")i=[1f e.2L(i,d.P,b.23)];h=h.1O(i)}H h}6 E(a){K b=/(.*)((&1G;|&1y;).*)/;H a.Q(e.3A.3M,6(c){K d="",h=N;I(h=b.X(c)){c=h[1];d=h[2]}H\'\'+c+""+d})}6 z(){O(K a=1E.36("1k"),b=[],c=0;c<1z 4I="1Z://2y.3L.3K/4L/5L"><3J><4N 1Z-4M="5G-5M" 6K="2O/1z; 6J=6I-8" /><1t>6L 1v<3B 1L="25-6M:6Q,6P,6O,6N-6F;6y-2f:#6x;2f:#6w;25-22:6v;2O-3D:3C;">1v3v 3.0.76 (72 73 3x)1Z://3u.2w/1v70 17 6U 71.6T 6X-3x 6Y 6D.6t 61 60 J 1k, 5Z 5R 5V <2R/>5U 5T 5S!\'}},1Y:{2j:N,2A:{}},1U:{},3A:{6n:/\\/\\*[\\s\\S]*?\\*\\//2c,6m:/\\/\\/.*$/2c,6l:/#.*$/2c,6k:/"([^\\\\"\\n]|\\\\.)*"/g,6o:/\'([^\\\\\'\\n]|\\\\.)*\'/g,6p:1f M(\'"([^\\\\\\\\"]|\\\\\\\\.)*"\',"3z"),6s:1f M("\'([^\\\\\\\\\']|\\\\\\\\.)*\'","3z"),6q:/(&1y;|<)!--[\\s\\S]*?--(&1G;|>)/2c,3M:/\\w+:\\/\\/[\\w-.\\/?%&=:@;]*/g,6a:{18:/(&1y;|<)\\?=?/g,1b:/\\?(&1G;|>)/g},69:{18:/(&1y;|<)%=?/g,1b:/%(&1G;|>)/g},6d:{18:/(&1y;|<)\\s*1k.*?(&1G;|>)/2T,1b:/(&1y;|<)\\/\\s*1k\\s*(&1G;|>)/2T}},16:{1H:6(a){6 b(i,k){H e.16.2o(i,k,e.13.1x[k])}O(K c=\'\',d=e.16.2x,h=d.2X,g=0;g";H c},2o:6(a,b,c){H\'<2W>\'+c+""},2b:6(a){K b=a.1F,c=b.1l||"";b=B(p(b,".20",R).1c);K d=6(h){H(h=15(h+"6f(\\\\w+)").X(c))?h[1]:N}("6g");b&&d&&e.16.2x[d].2B(b);a.3N()},2x:{2X:["21","2P"],21:{1H:6(a){I(a.V("2l")!=R)H"";K b=a.V("1t");H e.16.2o(a,"21",b?b:e.13.1x.21)},2B:6(a){a=1E.6j(t(a.1c));a.1l=a.1l.Q("47","")}},2P:{2B:6(){K a="68=0";a+=", 18="+(31.30-33)/2+", 32="+(31.2Z-2Y)/2+", 30=33, 2Z=2Y";a=a.Q(/^,/,"");a=1P.6Z("","38",a);a.2C();K b=a.1E;b.6W(e.13.1x.37);b.6V();a.2C()}}}},35:6(a,b){K c;I(b)c=[b];Y{c=1E.36(e.13.34);O(K d=[],h=0;h(.*?))\\\\]$"),s=1f M("(?<27>[\\\\w-]+)\\\\s*:\\\\s*(?<1T>[\\\\w-%#]+|\\\\[.*?\\\\]|\\".*?\\"|\'.*?\')\\\\s*;?","g");(j=s.X(k))!=N;){K o=j.1T.Q(/^[\'"]|[\'"]$/g,"");I(o!=N&&m.1A(o)){o=m.X(o);o=o.2V.L>0?o.2V.1e(/\\s*,\\s*/):[]}l[j.27]=o}g={1F:g,1n:C(i,l)};g.1n.1D!=N&&d.U(g)}H d},1M:6(a,b){K c=J.35(a,b),d=N,h=e.13;I(c.L!==0)O(K g=0;g")==o-3){m=m.4h(0,o-3);s=R}l=s?m:l}I((i.1t||"")!="")k.1t=i.1t;k.1D=j;d.2Q(k);b=d.2F(l);I((i.1c||"")!="")b.1c=i.1c;i.2G.74(b,i)}}},2E:6(a){w(1P,"4k",6(){e.1M(a)})}};e.2E=e.2E;e.1M=e.1M;e.2L=6(a,b,c){J.1T=a;J.P=b;J.L=a.L;J.23=c;J.1V=N};e.2L.Z.1q=6(){H J.1T};e.4l=6(a){6 b(j,l){O(K m=0;md)1N;Y I(g.P==c.P&&g.L>c.L)a[b]=N;Y I(g.P>=c.P&&g.P\'+c+""},3Q:6(a,b){K c="",d=a.1e("\\n").L,h=2u(J.V("2i-1s")),g=J.V("2z-1s-2t");I(g==R)g=(h+d-1).1q().L;Y I(3R(g)==R)g=0;O(K i=0;i\'+j+"":"")+i)}H a},4f:6(a){H a?"<4a>"+a+"":""},4b:6(a,b){6 c(l){H(l=l?l.1V||g:g)?l+" ":""}O(K d=0,h="",g=J.V("1D",""),i=0;i|&1y;2R\\s*\\/?&1G;/2T;I(e.13.46==R)b=b.Q(h,"\\n");I(e.13.44==R)b=b.Q(h,"");b=b.1e("\\n");h=/^\\s*/;g=4Q;O(K i=0;i0;i++){K k=b[i];I(x(k).L!=0){k=h.X(k);I(k==N){a=a;1N a}g=1Q.4q(k[0].L,g)}}I(g>0)O(i=0;i\'+(J.V("16")?e.16.1H(J):"")+\'<3Z 5z="0" 5H="0" 5J="0">\'+J.4f(J.V("1t"))+"<3T><3P>"+(1u?\'<2d 1g="1u">\'+J.3Q(a)+"":"")+\'<2d 1g="17">\'+b+""},2F:6(a){I(a===N)a="";J.17=a;K b=J.3Y("T");b.3X=J.1H(a);J.V("16")&&w(p(b,".16"),"5c",e.16.2b);J.V("3V-17")&&w(p(b,".17"),"56",f);H b},2Q:6(a){J.1c=""+1Q.5d(1Q.5n()*5k).1q();e.1Y.2A[t(J.1c)]=J;J.1n=C(e.2v,a||{});I(J.V("2k")==R)J.1n.16=J.1n.1u=11},5j:6(a){a=a.Q(/^\\s+|\\s+$/g,"").Q(/\\s+/g,"|");H"\\\\b(?:"+a+")\\\\b"},5f:6(a){J.28={18:{1I:a.18,23:"1k"},1b:{1I:a.1b,23:"1k"},17:1f M("(?<18>"+a.18.1m+")(?<17>.*?)(?<1b>"+a.1b.1m+")","5o")}}};H e}();1j 2e!="1d"&&(2e.1v=1v);',62,441,'||||||function|||||||||||||||||||||||||||||||||||||return|if|this|var|length|XRegExp|null|for|index|replace|true||div|push|getParam|call|exec|else|prototype||false|lastIndex|config|arguments|RegExp|toolbar|code|left|captureNames|slice|right|id|undefined|split|new|class|addToken|indexOf|typeof|script|className|source|params|substr|apply|toString|String|line|title|gutter|SyntaxHighlighter|_xregexp|strings|lt|html|test|OUTSIDE_CLASS|match|brush|document|target|gt|getHtml|regex|global|join|style|highlight|break|concat|window|Math|isRegExp|throw|value|brushes|brushName|space|alert|vars|http|syntaxhighlighter|expandSource|size|css|case|font|Fa|name|htmlScript|dA|can|handler|gm|td|exports|color|in|href|first|discoveredBrushes|light|collapse|object|cache|getButtonHtml|trigger|pattern|getLineHtml|nbsp|numbers|parseInt|defaults|com|items|www|pad|highlighters|execute|focus|func|all|getDiv|parentNode|navigator|INSIDE_CLASS|regexList|hasFlag|Match|useScriptTags|hasNamedCapture|text|help|init|br|input|gi|Error|values|span|list|250|height|width|screen|top|500|tagName|findElements|getElementsByTagName|aboutDialog|_blank|appendChild|charAt|Array|copyAsGlobal|setFlag|highlighter_|string|attachEvent|nodeName|floor|backref|output|the|TypeError|sticky|Za|iterate|freezeTokens|scope|type|textarea|alexgorbatchev|version|margin|2010|005896|gs|regexLib|body|center|align|noBrush|require|childNodes|DTD|xhtml1|head|org|w3|url|preventDefault|container|tr|getLineNumbersHtml|isNaN|userAgent|tbody|isLineHighlighted|quick|void|innerHTML|create|table|links|auto|smart|tab|stripBrs|tabs|bloggerMode|collapsed|plain|getCodeLinesHtml|caption|getMatchesHtml|findMatches|figureOutLineNumbers|removeNestedMatches|getTitleHtml|brushNotHtmlScript|substring|createElement|Highlighter|load|HtmlScript|Brush|pre|expand|multiline|min|Can|ignoreCase|find|blur|extended|toLowerCase|aliases|addEventListener|innerText|textContent|wasn|select|createTextNode|removeChild|option|same|frame|xmlns|dtd|twice|1999|equiv|meta|htmlscript|transitional|1E3|expected|PUBLIC|DOCTYPE|on|W3C|XHTML|TR|EN|Transitional||configured|srcElement|Object|after|run|dblclick|matchChain|valueOf|constructor|default|switch|click|round|execAt|forHtmlScript|token|gimy|functions|getKeywords|1E6|escape|within|random|sgi|another|finally|supply|MSIE|ie|toUpperCase|catch|returnValue|definition|event|border|imsx|constructing|one|Infinity|from|when|Content|cellpadding|flags|cellspacing|try|xhtml|Type|spaces|2930402|hosted_button_id|lastIndexOf|donate|active|development|keep|to|xclick|_s|Xml|please|like|you|paypal|cgi|cmd|webscr|bin|highlighted|scrollbars|aspScriptTags|phpScriptTags|sort|max|scriptScriptTags|toolbar_item|_|command|command_|number|getElementById|doubleQuotedString|singleLinePerlComments|singleLineCComments|multiLineCComments|singleQuotedString|multiLineDoubleQuotedString|xmlComments|alt|multiLineSingleQuotedString|If|https|1em|000|fff|background|5em|xx|bottom|75em|Gorbatchev|large|serif|CDATA|continue|utf|charset|content|About|family|sans|Helvetica|Arial|Geneva|3em|nogutter|Copyright|syntax|close|write|2004|Alex|open|JavaScript|highlighter|July|02|replaceChild|offset|83'.split('|'),0,{}))