Author: amarkhel
Date: 2010-04-17 13:42:12 -0400 (Sat, 17 Apr 2010)
New Revision: 16773
Added:
root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/common/SkinBean.java
root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/skin.xhtml
root/framework/trunk/impl/src/main/java/org/richfaces/context/PreRenderViewListener.java
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/InputErrorIcon.java
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java
root/framework/trunk/impl/src/main/java/org/richfaces/resource/CSSCompiler.java
root/framework/trunk/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java
root/framework/trunk/impl/src/main/java/org/richfaces/resource/Xcss2EcssConverter.java
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.Base2WayGradient.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.BaseGradient.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.CustomizeableGradient.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.GradientA.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.ButtonGradientImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.ButtonInverseGradientImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.HeaderGradientImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.HeaderInverseGradientImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.InputGradientImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.MenuGradientImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.MenuInverseGradientImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.TabGradientImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.TabInverseGradientImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.BaseControlBackgroundImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.ButtonBackgroundImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.ButtonDisabledBackgroundImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.GradientAlignment.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.GradientType.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.InputBackgroundImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.StandardButtonBgImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.StandardButtonPressedBgImage.resource.properties
root/framework/trunk/impl/src/main/resources/META-INF/prerenderview-listener.faces-config.xml
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/basic.ecss
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/basic_both.ecss
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/basic_classes.ecss
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/extended.ecss
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/extended_both.ecss
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/extended_classes.ecss
Modified:
root/examples/trunk/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
root/examples/trunk/richfaces-demo/src/main/webapp/WEB-INF/web.xml
root/examples/trunk/richfaces-demo/src/main/webapp/templates/includes/navigation.xhtml
root/framework/trunk/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/resource/Java2Dresource.java
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/CustomizeableGradient.java
root/framework/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
root/framework/trunk/impl/src/main/java/org/richfaces/util/Util.java
root/framework/trunk/pom.xml
Log:
Skins initial commit
Added:
root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/common/SkinBean.java
===================================================================
---
root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/common/SkinBean.java
(rev 0)
+++
root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/common/SkinBean.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,35 @@
+/**
+ *
+ */
+package org.richfaces.demo.common;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.model.SelectItem;
+
+
+/**
+ * @author sim
+ *
+ */
+public class SkinBean implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2399884208294434812L;
+ private String skin;
+ public String getSkin() {
+ return skin;
+ }
+
+
+
+ public void setSkin(String skin) {
+ this.skin = skin;
+ }
+
+}
Modified: root/examples/trunk/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-04-17
13:25:25 UTC (rev 16772)
+++ root/examples/trunk/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-04-17
17:42:12 UTC (rev 16773)
@@ -20,6 +20,15 @@
<managed-bean-class>org.richfaces.demo.outputPanel.OutputPanelBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
-
+ <managed-bean>
+ <managed-bean-name>skinBean</managed-bean-name>
+
<managed-bean-class>org.richfaces.demo.common.SkinBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>skin</property-name>
+ <property-class>java.lang.String</property-class>
+ <value>blueSky</value>
+ </managed-property>
+ </managed-bean>
</faces-config>
\ No newline at end of file
Modified: root/examples/trunk/richfaces-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/webapp/WEB-INF/web.xml 2010-04-17 13:25:25
UTC (rev 16772)
+++ root/examples/trunk/richfaces-demo/src/main/webapp/WEB-INF/web.xml 2010-04-17 17:42:12
UTC (rev 16773)
@@ -23,8 +23,18 @@
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
- </context-param>
-
+ </context-param>
+
+ <context-param>
+ <param-name>org.richfaces.CONTROL_SKINNING</param-name>
+ <param-value>enable</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.richfaces.CONTROL_SKINNING_CLASSES</param-name>
+ <param-value>enable</param-value>
+ </context-param>
+
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
Added: root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/skin.xhtml
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/skin.xhtml
(rev 0)
+++ root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/skin.xhtml 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <ui:composition template="/templates/main.xhtml">
+ <ui:define name="body">
+ <h:form>
+ <p> Sample of skinning</p>
+ Type in input name of skin. For example laguna, wine, ruby etc.. and press Change skin
button.
+ <h:inputText value="#{skinBean.skin}" />
+ <h:commandButton value="Change skin"/>
+ <h:outputText styleClass="rich-fieldset" value="Panel Background
color sample" />
+ <h:outputText styleClass="rich-link" value="General Link color
sample" />
+ </h:form>
+ </ui:define>
+ </ui:composition>
+</html>
\ No newline at end of file
Modified:
root/examples/trunk/richfaces-demo/src/main/webapp/templates/includes/navigation.xhtml
===================================================================
---
root/examples/trunk/richfaces-demo/src/main/webapp/templates/includes/navigation.xhtml 2010-04-17
13:25:25 UTC (rev 16772)
+++
root/examples/trunk/richfaces-demo/src/main/webapp/templates/includes/navigation.xhtml 2010-04-17
17:42:12 UTC (rev 16773)
@@ -4,7 +4,7 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://java.sun.com/jsf/composite/rich">
- <rich:panel>
+ <rich:panel bodyClass="">
<f:facet name="header">
<h:outputText value="Navigation" />
</f:facet>
@@ -29,7 +29,9 @@
value="#{facesContext.externalContext.requestContextPath}/richfaces/log.jsf">a4j:log</h:outputLink>
<hr/>
<h:outputLink
- value="#{facesContext.externalContext.requestContextPath}/richfaces/dataTable.jsf">h:dataTable
vs Ajax</h:outputLink>
+ value="#{facesContext.externalContext.requestContextPath}/richfaces/dataTable.jsf">h:dataTable
vs Ajax</h:outputLink>
+ <h:outputLink
+ value="#{facesContext.externalContext.requestContextPath}/richfaces/skin.jsf">Skin
sample</h:outputLink>
</h:panelGrid>
</rich:panel>
</ui:composition>
Modified:
root/framework/trunk/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java 2010-04-17
13:25:25 UTC (rev 16772)
+++
root/framework/trunk/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -39,7 +39,9 @@
* If is it equals "true" , framework should proparate exception to
client-side.
*/
public static final String HANDLE_VIEW_EXPIRED_ON_CLIENT =
"org.ajax4jsf.handleViewExpiredOnClient";
-
+ public static final String[] STD_CONTROLS_SKINNING_PARAM =
{"org.richfaces.CONTROL_SKINNING"};
+ public static final String[] STD_CONTROLS_SKINNING_CLASSES_PARAM =
{"org.richfaces.CONTROL_SKINNING_CLASSES"};
+ public static final String[] CONTROL_SKINNING_LEVEL =
{"org.richfaces.CONTROL_SKINNING_LEVEL"};
/**
*
*/
@@ -59,7 +61,37 @@
public static boolean isDatatableUsesViewLocale(FacesContext context) {
return getBoolean(context, DATATABLE_USES_VIEW_LOCALE, false);
}
+
+ /**
+ * Defines what the skinning level used
+ *
+ * @param context
+ * @return value of CONTROL_SKINNING_LEVEL parameter if present
+ */
+ public static String getSkinningLevel(FacesContext context) {
+ return getInitParameter(context, CONTROL_SKINNING_LEVEL);
+ }
+ /**
+ * Method for determining STD_CONTROLS_SKINNING_PARAM parameter
+ *
+ * @param context
+ * @return value of STD_CONTROLS_SKINNING_PARAM parameter if present.
+ */
+ public static String getStandartControlSkinningParameter(FacesContext context) {
+ return getInitParameter(context, STD_CONTROLS_SKINNING_PARAM);
+ }
+
+ /**
+ * Method for determining STD_CONTROLS_SKINNING_CLASSES_PARAM parameter
+ *
+ * @param context
+ * @return value of STD_CONTROLS_SKINNING_CLASSES_PARAM parameter if present.
+ */
+ public static String getStandartControlSkinningClassesParameter(FacesContext context)
{
+ return getInitParameter(context, STD_CONTROLS_SKINNING_CLASSES_PARAM);
+ }
+
static int getInteger(FacesContext context, String[] paramNames, int defaulValue) {
String initParameter = getInitParameter(context, paramNames);
Modified:
root/framework/trunk/impl/src/main/java/org/ajax4jsf/resource/Java2Dresource.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/ajax4jsf/resource/Java2Dresource.java 2010-04-17
13:25:25 UTC (rev 16772)
+++
root/framework/trunk/impl/src/main/java/org/ajax4jsf/resource/Java2Dresource.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -21,10 +21,15 @@
package org.ajax4jsf.resource;
+import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.HtmlDimensions;
import org.ajax4jsf.util.NumericDataInputStream;
import org.ajax4jsf.util.NumericDataOutputStream;
import org.richfaces.resource.AbstractBaseResource;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+import javax.faces.application.ResourceHandler;
import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
import javax.imageio.ImageIO;
@@ -35,19 +40,25 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Map;
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.3 $ $Date: 2007/02/01 15:31:57 $
*/
public abstract class Java2Dresource extends AbstractBaseResource implements StateHolder
{
+ private static final String SKIN_MARKER = "Skin.";
private ImageType imageType;
public Java2Dresource(ImageType imageType) {
super();
this.imageType = imageType;
}
-
+
+ public void populateParameters(Map<String, String> parameters){
+
+ }
+
public static enum ImageType {
GIF("gif") {
@Override
@@ -225,4 +236,62 @@
public void setTransient(boolean newTransientValue) {
throw new UnsupportedOperationException();
}
+
+ protected String getValueParameter(FacesContext context, String name) {
+ SkinFactory skinFactory = SkinFactory.getInstance();
+
+ Skin skin = skinFactory.getSkin(context);
+ String value = (String) skin.getParameter(context, name);
+
+ if (value == null || value.length() == 0) {
+ skin = skinFactory.getDefaultSkin(context);
+ value = (String) skin.getParameter(context, name);
+ }
+
+ return value;
+ }
+
+ protected String encodeSkinParameter(String param){
+ if(param.startsWith(SKIN_MARKER)){
+ String name = param.substring(SKIN_MARKER.length());
+ return getValueParameter(FacesContext.getCurrentInstance(), name );
+ }
+ return param;
+ }
+
+ protected Integer getColorValueParameter(FacesContext context, String name, boolean
useDefault) {
+ Skin skin;
+ if (useDefault) {
+ skin = SkinFactory.getInstance().getDefaultSkin(context);
+ } else {
+ skin = SkinFactory.getInstance().getSkin(context);
+ }
+
+ return decodeColor((String) skin.getParameter(context, name));
+ }
+
+ protected Integer getHeight(FacesContext context, String heightParamName) {
+ SkinFactory skinFactory = SkinFactory.getInstance();
+ Skin skin = skinFactory.getSkin(context);
+
+ String height = (String) skin.getParameter(context, heightParamName);
+ if (height == null || height.length() == 0) {
+ skin = skinFactory.getDefaultSkin(context);
+ height = (String) skin.getParameter(context, heightParamName);
+ }
+
+ if (height != null && height.length() != 0) {
+ return Integer.valueOf(HtmlDimensions.decode(height).intValue());
+ } else {
+ return Integer.valueOf(16);
+ }
+ }
+
+ protected Integer decodeColor(String value) {
+ if (value != null && value.length() != 0) {
+ return Integer.valueOf(HtmlColor.decode(value).getRGB());
+ } else {
+ return null;
+ }
+ }
}
Added:
root/framework/trunk/impl/src/main/java/org/richfaces/context/PreRenderViewListener.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/context/PreRenderViewListener.java
(rev 0)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/context/PreRenderViewListener.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,168 @@
+package org.richfaces.context;
+
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.PreRenderViewEvent;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+
+import org.ajax4jsf.context.ContextInitParameters;
+import org.richfaces.log.RichfacesLogger;
+import org.slf4j.Logger;
+
+/**
+ * This class used for determining what standard skinning resources should be encoded.
+ * Implements SystemEventListener and reacts on PreRenderViewEvent
+ *
+ * @author amarkhel
+ * @since 4.0
+ */
+public class PreRenderViewListener implements SystemEventListener {
+
+ private static final String BASIC = "basic";
+
+ private static final String EXTENDED = "extended";
+
+ private static final String ENABLE = "enable";
+
+ private static final String _CLASSES_ECSS = "_classes.ecss";
+
+ private static final String ECSS = ".ecss";
+
+ private static final String _BOTH_ECSS = "_both.ecss";
+
+ private static final String HEAD = "head";
+
+ private static final String NAME_ATTRIBBUTE = "name";
+
+ private static final String STYLESHEET_RENDERER =
"javax.faces.resource.Stylesheet";
+
+ // private static final Logger LOG = RichfacesLogger.APPLICATION.getLogger();
+ private boolean useStdControlsSkinning;
+
+ private boolean useStdControlsSkinningClasses;
+
+ private boolean extendedSkinningAllowed;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.event.SystemEventListener#isListenerForSource(java.lang.Object)
+ */
+ public boolean isListenerForSource(Object source) {
+ return true;
+ }
+
+ private void setUseStdControlsSkinning(boolean stdControlsSkinning) {
+ this.useStdControlsSkinning = stdControlsSkinning;
+ }
+
+ private void setUseStdControlsSkinningClasses(boolean stdControlsSkinningClasses) {
+ this.useStdControlsSkinningClasses = stdControlsSkinningClasses;
+ }
+
+ private void setExtendedSkinningAllowed(boolean extendedSkinningAllowed) {
+ this.extendedSkinningAllowed = extendedSkinningAllowed;
+ }
+
+ private void initialize(FacesContext context) {
+ boolean extendedSkinningAllowed = true;
+ String skinningLevel = ContextInitParameters.getSkinningLevel(context);
+ if (skinningLevel != null && skinningLevel.length() > 0) {
+ if (BASIC.equals(skinningLevel)) {
+ extendedSkinningAllowed = false;
+ } else if (!EXTENDED.equals(skinningLevel)) {
+ throw new IllegalArgumentException("Value: " + skinningLevel +
" of "
+ + ContextInitParameters.CONTROL_SKINNING_LEVEL[0] + " init
parameter is invalid! Only " + EXTENDED
+ + ", " + BASIC + " can be used");
+ }
+ }
+
+ this.setExtendedSkinningAllowed(extendedSkinningAllowed);
+
+ boolean useStdControlsSkinning = false;
+
+ String stdControlsSkinning =
ContextInitParameters.getStandartControlSkinningParameter(context);
+ if (stdControlsSkinning != null) {
+ useStdControlsSkinning = ENABLE.equals(stdControlsSkinning);
+ }
+
+ this.setUseStdControlsSkinning(useStdControlsSkinning);
+
+ boolean useStdControlsSkinningClasses = true;
+
+ String stdControlsSkinningClasses =
ContextInitParameters.getStandartControlSkinningClassesParameter(context);
+ if (stdControlsSkinningClasses != null) {
+ useStdControlsSkinningClasses = ENABLE.equals(stdControlsSkinningClasses);
+ }
+
+ this.setUseStdControlsSkinningClasses(useStdControlsSkinningClasses);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
javax.faces.event.SystemEventListener#processEvent(javax.faces.event.SystemEvent)
+ */
+ public void processEvent(SystemEvent event) throws AbortProcessingException {
+
+ if (event instanceof PreRenderViewEvent) {
+ initialize(FacesContext.getCurrentInstance());
+ String resourceSuffix = null;
+
+ if (useStdControlsSkinning) {
+ if (useStdControlsSkinningClasses) {
+ resourceSuffix = _BOTH_ECSS;
+ } else {
+ resourceSuffix = ECSS;
+ }
+ } else {
+ if (useStdControlsSkinningClasses) {
+ resourceSuffix = _CLASSES_ECSS;
+ } else {
+ // no resources
+ }
+ }
+
+ if (resourceSuffix != null) {
+ addResource("richfaces.css/basic".concat(resourceSuffix));
+
+ if (extendedSkinningAllowed) {
+
addResource("richfaces.css/extended".concat(resourceSuffix));
+ }
+ }
+ }
+ }
+
+ private void addResource(String name) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ UIOutput output = new UIOutput();
+ output.setRendererType(STYLESHEET_RENDERER);
+ output.getAttributes().put(NAME_ATTRIBBUTE, name);
+ context.getViewRoot().addComponentResource(context, output, HEAD);
+ }
+
+}
Modified:
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2010-04-17
13:25:25 UTC (rev 16772)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -261,57 +261,9 @@
stream.writeByte((byte) this.gradientType.ordinal());
}
- private Integer decodeColor(String value) {
- if (value != null && value.length() != 0) {
- return Integer.valueOf(HtmlColor.decode(value).getRGB());
- } else {
- return null;
- }
- }
-
public boolean isCacheable() {
return true;
}
- protected String getValueParameter(FacesContext context, String name) {
- SkinFactory skinFactory = SkinFactory.getInstance();
-
- Skin skin = skinFactory.getSkin(context);
- String value = (String) skin.getParameter(context, name);
-
- if (value == null || value.length() == 0) {
- skin = skinFactory.getDefaultSkin(context);
- value = (String) skin.getParameter(context, name);
- }
-
- return value;
- }
-
- protected Integer getColorValueParameter(FacesContext context, String name, boolean
useDefault) {
- Skin skin;
- if (useDefault) {
- skin = SkinFactory.getInstance().getDefaultSkin(context);
- } else {
- skin = SkinFactory.getInstance().getSkin(context);
- }
-
- return decodeColor((String) skin.getParameter(context, name));
- }
-
- protected Integer getHeight(FacesContext context, String heightParamName) {
- SkinFactory skinFactory = SkinFactory.getInstance();
- Skin skin = skinFactory.getSkin(context);
-
- String height = (String) skin.getParameter(context, heightParamName);
- if (height == null || height.length() == 0) {
- skin = skinFactory.getDefaultSkin(context);
- height = (String) skin.getParameter(context, heightParamName);
- }
-
- if (height != null && height.length() != 0) {
- return Integer.valueOf(HtmlDimensions.decode(height).intValue());
- } else {
- return Integer.valueOf(16);
- }
- }
+
}
Modified:
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/CustomizeableGradient.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/CustomizeableGradient.java 2010-04-17
13:25:25 UTC (rev 16772)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/CustomizeableGradient.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -21,8 +21,18 @@
package org.richfaces.renderkit.html;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Rectangle2D;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
import org.ajax4jsf.resource.Java2Dresource;
-import org.ajax4jsf.util.HtmlColor;
import org.ajax4jsf.util.NumericDataInputStream;
import org.richfaces.renderkit.html.images.GradientAlignment;
import org.richfaces.renderkit.html.images.GradientType;
@@ -30,17 +40,16 @@
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
-import javax.faces.context.FacesContext;
-import java.awt.*;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
-
/**
* @author Nick Belaevski - nbelaevski(a)exadel.com
* created 02.02.2007
*/
public class CustomizeableGradient extends Java2Dresource {
+ private static final String BASE_COLOR = "baseColor";
+
+ private static final String GRADIENT_COLOR = "gradientColor";
+
protected Dimension dimension = new Dimension(20, 500);
protected Integer gradientColor;
@@ -58,7 +67,19 @@
gradientType = GradientType.getByParameter(gradientTypeString);
}
}
-
+
+ @Override
+ public void populateParameters(Map<String, String> parameters){
+ if(parameters.containsKey(GRADIENT_COLOR)){
+ String gradientColorValue =
encodeSkinParameter(parameters.get(GRADIENT_COLOR));
+ this.gradientColor = decodeColor(gradientColorValue);
+ }
+ if(parameters.containsKey(BASE_COLOR)){
+ String baseColorValue = encodeSkinParameter(parameters.get(BASE_COLOR));
+ this.baseColor = decodeColor(baseColorValue);
+ }
+ }
+
public Dimension getDimension() {
return dimension;
}
@@ -146,14 +167,6 @@
drawGradient(g2d, rect, secondLayer, gradientHeight / 2);
}
- private Integer decodeColor(String value) {
- if (value != null && value.length() != 0) {
- return Integer.valueOf(HtmlColor.decode(value).getRGB());
- } else {
- return null;
- }
- }
-
@Override
protected void readState(FacesContext context, NumericDataInputStream stream) {
super.readState(context, stream);
@@ -164,7 +177,7 @@
this.gradientAlignment = GradientAlignment.values()[stream.readByte()];
this.gradientType = GradientType.values()[stream.readByte()];
}
-
+ @Override
protected void writeState(FacesContext context,
org.ajax4jsf.util.NumericDataOutputStream stream) {
super.writeState(context, stream);
@@ -183,20 +196,6 @@
return true;
}
- protected String getValueParameter(FacesContext context, String name) {
- SkinFactory skinFactory = SkinFactory.getInstance();
-
- Skin skin = skinFactory.getSkin(context);
- String value = (String) skin.getParameter(context, name);
-
- if (value == null || value.length() == 0) {
- skin = skinFactory.getDefaultSkin(context);
- value = (String) skin.getParameter(context, name);
- }
-
- return value;
- }
-
public Integer getGradientColor() {
return gradientColor;
}
Added:
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java
(rev 0)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,123 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.util.Date;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.Java2Dresource;
+import org.ajax4jsf.resource.ResourceContext;
+import org.ajax4jsf.resource.Java2Dresource.ImageType;
+import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.NumericDataInputStream;
+import org.ajax4jsf.util.Zipper2;
+
+/**
+ * implementation of the default CANCEL icon renderer
+ * @author Anton Belevich
+ * @since 3.2.0
+ *
+ */
+public class CancelControlIcon extends Java2Dresource {
+
+ protected static final String ALTERNATE_COLOR = "#ED6161";
+ protected Integer iconColor;
+ protected Integer iconBorderColor;
+ private static final Dimension dimensions = new Dimension(11, 11);
+
+ public CancelControlIcon() {
+ super(ImageType.GIF);
+ }
+
+ @Override
+ public Dimension getDimension() {
+ return dimensions;
+ }
+
+ @Override
+ protected void readState(FacesContext context, NumericDataInputStream stream) {
+ super.readState(context, stream);
+
+ this.iconColor = stream.readIntColor();
+ this.iconBorderColor = stream.readIntColor();
+ }
+
+ protected void writeState(FacesContext context,
org.ajax4jsf.util.NumericDataOutputStream stream) {
+ super.writeState(context, stream);
+
+ stream.writeIntColor(this.iconColor);
+ stream.writeIntColor(this.iconBorderColor);
+ }
+
+ @Override
+ protected void paint(Graphics2D g2d, Dimension dimension) {
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
+// g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
+// g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_DEFAULT);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_DEFAULT);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_ENABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_DEFAULT);
+ Color iconColour = new Color(iconColor);
+ Color iconBorder = new Color(iconBorderColor);
+ g2d.setColor(iconColour);
+
+ Color altenateColor = HtmlColor.decode(ALTERNATE_COLOR);
+ GradientPaint gradient = new GradientPaint(2,3,altenateColor,3,9,iconColour);
+ g2d.setPaint(gradient);
+
+ // draw cross
+ g2d.drawLine(2, 3, 7, 8);
+ g2d.drawLine(3, 3, 7, 7);
+ g2d.drawLine(3, 2, 8, 7);
+
+ g2d.drawLine(2, 7, 7, 2);
+ g2d.drawLine(3, 7, 7, 3);
+ g2d.drawLine(3, 8, 8, 3);
+
+ //draw border
+ g2d.setColor(iconBorder);
+ g2d.drawLine(1, 3, 3, 5);
+ g2d.drawLine(3, 5, 1, 7);
+ g2d.drawLine(1, 7, 3, 9);
+ g2d.drawLine(3, 9, 5, 7);
+ g2d.drawLine(5, 7, 7, 9);
+ g2d.drawLine(7, 9, 9, 7);
+ g2d.drawLine(9, 7, 7, 5);
+ g2d.drawLine(7, 5, 9, 3);
+ g2d.drawLine(9, 3, 7, 1);
+ g2d.drawLine(7, 1, 5, 3);
+ g2d.drawLine(5, 3, 3, 1);
+ g2d.drawLine(3, 1, 1, 3);
+
+
+ }
+}
+
Added:
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java
(rev 0)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/ComboBoxButtonPressGradient.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,36 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.renderkit.html.images;
+
+import org.richfaces.renderkit.html.BaseGradient;
+import org.richfaces.skin.Skin;
+
+/**
+ * @author Anton Belevich
+ * @since 3.2.0
+ */
+public class ComboBoxButtonPressGradient extends BaseGradient{
+
+ public ComboBoxButtonPressGradient() {
+ super(7,15 , 9, Skin.HEADER_BACKGROUND_COLOR, "headerGradientColor");
+ }
+
+}
Added:
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/InputErrorIcon.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/InputErrorIcon.java
(rev 0)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/InputErrorIcon.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,52 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+
+import org.ajax4jsf.resource.Java2Dresource;
+import org.ajax4jsf.resource.ResourceContext;
+
+public class InputErrorIcon extends OneColorBasedResource {
+
+ public InputErrorIcon() {
+ super(6, 11, "warningColor");
+ }
+
+ /**
+ * @see Java2Dresource#paint(ResourceContext, Graphics2D)
+ */
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setColor(getBasicColor());
+ g2d.fillRect(3, 2, 2, 6);
+ g2d.fillRect(3, 9, 2, 2);
+ }
+
+ @Override
+ public Dimension getDimension() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added:
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java
(rev 0)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,61 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.Java2Dresource;
+import org.ajax4jsf.resource.ResourceContext;
+
+public abstract class OneColorBasedResource extends Java2Dresource {
+
+ private Dimension dimension;
+
+ private String basicColorParamName;
+
+ private Color basicColor;
+
+ public OneColorBasedResource(int width, int height, final String basicColorParamName)
{
+ super(ImageType.GIF);
+ this.basicColorParamName = basicColorParamName;
+ this.dimension = new Dimension(width, height);
+
+ }
+
+ /**
+ * @see Java2Dresource#isCacheable(ResourceContext)
+ */
+ public boolean isCacheable(ResourceContext ctx) {
+ return true;
+ }
+
+ /**
+ * Gets value of basicColor field.
+ * @return value of basicColor field
+ */
+ public Color getBasicColor() {
+ return basicColor;
+ }
+}
Added:
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java
(rev 0)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerButtonGradient.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,30 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import org.richfaces.renderkit.html.BaseGradient;
+
+public class SpinnerButtonGradient extends BaseGradient {
+ public SpinnerButtonGradient() {
+ super(30, 50, 20, "headerGradientColor", "headerBackgroundColor");
+ }
+}
Added:
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java
(rev 0)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/images/SpinnerFieldGradient.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,33 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import org.richfaces.renderkit.html.BaseGradient;
+
+public class SpinnerFieldGradient extends BaseGradient {
+
+ public SpinnerFieldGradient() {
+ super(30, 50, 12, "additionalBackgroundColor",
"controlBackgroundColor");
+ }
+
+
+}
Added: root/framework/trunk/impl/src/main/java/org/richfaces/resource/CSSCompiler.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/resource/CSSCompiler.java
(rev 0)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/resource/CSSCompiler.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,281 @@
+package org.richfaces.resource;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.application.Resource;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.util.ELUtils;
+import org.richfaces.log.RichfacesLogger;
+import org.slf4j.Logger;
+import org.w3c.css.sac.InputSource;
+import org.w3c.dom.css.CSSImportRule;
+import org.w3c.dom.css.CSSRule;
+import org.w3c.dom.css.CSSRuleList;
+import org.w3c.dom.css.CSSStyleDeclaration;
+import org.w3c.dom.css.CSSStyleRule;
+import org.w3c.dom.css.CSSStyleSheet;
+
+import com.steadystate.css.parser.CSSOMParser;
+
+public class CSSCompiler {
+
+ private static final Logger LOGGER = RichfacesLogger.RESOURCE.getLogger();
+ private static final String INVALID_RESOURCE_FORMAT_COLON_ERROR =
+ "Invalid resource format. Property ''{0}'' contains more
than one colon (:).";
+ private static final String INVALID_RESOURCE_FORMAT_NO_LIBRARY_NAME_ERROR =
+ "Invalid resource format. Property ''{0}'' cannot be parsed
to extract resource name and library name.";
+ private static final String INVALID_RESOURCE_FORMAT_ERROR =
+ "Invalid resource format. Property ''{0}'' cannot be
parsed.";
+ public static InputStream parse(Resource resource) throws IOException {
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ InputStream stream = new BufferedInputStream(
+ new ELEvaluatingInputStream(ctx,
+ resource,
+ resource.getInputStream()));
+ StringBuilder main = new StringBuilder();
+ try {
+ InputSource source = new InputSource(new InputStreamReader(stream));
+ CSSOMParser parser = new CSSOMParser();
+ // parse and create a stylesheet composition
+ CSSStyleSheet stylesheet = parser.parseStyleSheet(source, null,null);
+
+ // now iterate through the dom and inspect.
+
+ CSSRuleList ruleList = stylesheet.getCssRules();
+ for (int i = 0; i < ruleList.getLength(); i++) {
+ CSSRule rule = ruleList.item(i);
+ if(rule instanceof CSSImportRule){
+ main.append(rule.getCssText());
+ main.append("\r\n");
+ }else if (rule instanceof CSSStyleRule) {
+ CSSStyleRule styleRule = (CSSStyleRule) rule;
+ boolean needAppendSelector = false;
+ StringBuilder selector = new StringBuilder();
+ selector.append(styleRule.getSelectorText());
+ CSSStyleDeclaration styleDeclaration = styleRule.getStyle();
+ selector.append("{" + "\r\n");
+ for (int j = 0; j < styleDeclaration.getLength(); j++) {
+ String property = styleDeclaration.item(j);
+ String value = styleDeclaration.getPropertyCSSValue(property).getCssText();
+ if(value.startsWith("\"")){
+ //Remove quotas
+ value = value.substring(1, value.length()-1);
+ }
+ if(value != null && value.trim().length() > 0 &&
!value.equals("\"\"")){
+ //One of properties of selector is not empty
+ needAppendSelector = true;
+ selector.append("\t" + property + ":");
+ selector.append(value + ";" + "\r\n");
+ }
+ }
+ selector.append("}" + "\r\n");
+ if(needAppendSelector){
+ main.append(selector);
+ }
+ }// end of StyleRule instance test
+ } // end of ruleList loop
+
+ if (stream != null){
+ stream.close();
+ }
+ new ByteArrayInputStream(main.toString().getBytes());
+ return new ByteArrayInputStream(main.toString().getBytes("US-ASCII"));
+ }
+
+ catch (IOException ioe) {
+ LOGGER.warn("IO Error: " + ioe + "while evaluating dynamic CSS");
+ } catch (Exception e) {
+ LOGGER.warn("Error: " + e + "while evaluating dynamic CSS");
+ }
+ return null;
+ }
+
+ private static final class ELEvaluatingInputStream extends InputStream {
+
+ // Premature optimization is the root of all evil. Blah blah.
+ private List<Integer> buf = new ArrayList<Integer>(1024);
+ private boolean failedExpressionTest = false;
+ private boolean writingExpression = false;
+ private InputStream inner;
+ private FacesContext ctx;
+ private Resource info;
+
+ // ---------------------------------------------------- Constructors
+
+
+ public ELEvaluatingInputStream(FacesContext ctx,
+ Resource info,
+ InputStream inner) {
+
+ this.inner = inner;
+ this.info = info;
+ this.ctx = ctx;
+
+ }
+
+
+ // ------------------------------------------------ Methods from InputStream
+
+
+ @Override
+ public int read() throws IOException {
+ int i;
+ char c;
+
+ if (failedExpressionTest) {
+ i = nextRead;
+ nextRead = -1;
+ failedExpressionTest = false;
+ } else if (writingExpression) {
+ if (0 < buf.size()) {
+ i = buf.remove(0);
+ } else {
+ writingExpression = false;
+ i = inner.read();
+ }
+ } else {
+ // Read a character.
+ i = inner.read();
+ c = (char) i;
+ // If it *might* be an expression...
+ if (c == '#') {
+ // read another character.
+ i = inner.read();
+ c = (char) i;
+ // If it's '{', assume we have an expression.
+ if (c == '{') {
+ // read it into the buffer, and evaluate it into the
+ // same buffer.
+ readExpressionIntoBufferAndEvaluateIntoBuffer();
+ // set the flag so that we need to return content
+ // from the buffer.
+ writingExpression = true;
+ // Make sure to swallow the '{'.
+ i = this.read();
+ } else {
+ // It's not an expression, we need to return '#',
+ i = (int) '#';
+ // then return whatever we just read, on the
+ // *next* read;
+ nextRead = (int) c;
+ failedExpressionTest = true;
+ }
+ }
+ }
+
+ return i;
+ }
+
+
+ private int nextRead = -1;
+
+
+ private void readExpressionIntoBufferAndEvaluateIntoBuffer()
+ throws IOException {
+ int i;
+ char c;
+ do {
+ i = inner.read();
+ c = (char) i;
+ if (c == '}') {
+ evaluateExpressionIntoBuffer();
+ } else {
+ buf.add(i);
+ }
+ } while (c != '}' && i != -1);
+ }
+
+ /*
+ * At this point, we know that getBuf() returns a List<Integer>
+ * that contains the bytes of the expression.
+ * Turn it into a String, turn the String into a ValueExpression,
+ * evaluate it, store the toString() of it in
+ * expressionResult;
+ */
+ private void evaluateExpressionIntoBuffer() {
+ char chars[] = new char[buf.size()];
+ for (int i = 0, len = buf.size(); i < len; i++) {
+ chars[i] = (char) (int) buf.get(i);
+ }
+ String expressionBody = new String(chars);
+ int colon;
+ // If this expression contains a ":"
+ if (-1 != (colon = expressionBody.indexOf(":"))) {
+ // Make sure it contains only one ":"
+ if (!isPropertyValid(expressionBody)) {
+ String message =
MessageFormat.format(INVALID_RESOURCE_FORMAT_COLON_ERROR,
+ expressionBody);
+ throw new ELException(message);
+ }
+ String[] parts = split(expressionBody, ":");
+ if (null == parts[0] || null == parts[1]) {
+ String message =
MessageFormat.format(INVALID_RESOURCE_FORMAT_NO_LIBRARY_NAME_ERROR,
+ expressionBody);
+ throw new ELException(message);
+
+ }
+ try {
+ int mark = parts[0].indexOf("[") + 2;
+ char quoteMark = parts[0].charAt(mark - 1);
+ parts[0] = parts[0].substring(mark, colon);
+ if (parts[0].equals("this")) {
+ parts[0] = info.getLibraryName();
+ mark = parts[1].indexOf("]") - 1;
+ parts[1] = parts[1].substring(0, mark);
+ expressionBody = "resource[" + quoteMark + parts[0] +
+ ":" + parts[1] + quoteMark +
"]";
+ }
+ }
+ catch (Exception e) {
+ String message = MessageFormat.format(INVALID_RESOURCE_FORMAT_ERROR,
+ expressionBody);
+ throw new ELException(message);
+
+ }
+ }
+ ELContext elContext = ctx.getELContext();
+ ValueExpression ve =
+ ctx.getApplication().getExpressionFactory().
+ createValueExpression(elContext, "#{" + expressionBody
+
+ "}", String.class);
+ Object value = ve.getValue(elContext);
+ String expressionResult = ((value != null) ? value.toString() :
"");
+ buf.clear();
+ for (int i = 0, len = expressionResult.length(); i < len; i++) {
+ buf.add((int) expressionResult.charAt(i));
+ }
+ }
+
+
+ private String[] split(String expressionBody, String toSplit) {
+ return Pattern.compile(expressionBody).split(toSplit, 0);
+ }
+
+
+ @Override
+ public void close() throws IOException {
+ inner.close();
+ super.close();
+
+ }
+
+
+ private boolean isPropertyValid(String property) {
+ int idx = property.indexOf(':');
+ return (property.indexOf(':', idx + 1) == -1);
+ }
+
+ }
+}
Added:
root/framework/trunk/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java
(rev 0)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.faces.application.ProjectStage;
+import javax.faces.application.Resource;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.application.ServiceTracker;
+import org.richfaces.log.RichfacesLogger;
+import org.richfaces.skin.SkinFactory;
+import org.slf4j.Logger;
+/**
+ * @author amarkhel
+ * Class, that represented dynamic CSS resource.
+ *
+ */
+public class CompiledCSSResource extends AbstractBaseResource {
+
+ private static final String SKIN = "?skin=";
+ private static final String TEXT_CSS = "text/css";
+ private static final Logger LOGGER = RichfacesLogger.RESOURCE.getLogger();
+
+ public CompiledCSSResource(Resource resource){
+ this.resourceDelegate = resource;
+ }
+
+ private Resource resourceDelegate;
+
+ @Override
+ public InputStream getInputStream() {
+ InputStream stream = null;
+ try{
+ stream = CSSCompiler.parse(resourceDelegate);
+ }
+ catch(IOException ioe){
+ LOGGER.warn("IO Error: " + ioe + "while loading dynamic CSS");
+ }
+ return stream;
+ }
+
+ @Override
+ public String getContentType() {
+ return TEXT_CSS;
+ }
+
+ public Resource getResourceDelegate() {
+ return resourceDelegate;
+ }
+
+ public void setResourceDelegate(Resource resourceDelegate) {
+ this.resourceDelegate = resourceDelegate;
+ }
+
+ @Override
+ public String getResourceName() {
+ return resourceDelegate.getResourceName();
+ }
+
+ @Override
+ public String getRequestPath() {
+ StringBuilder b = new StringBuilder();
+ String path = resourceDelegate.getRequestPath();
+ b.append(path);
+ b.append(SKIN);
+ b.append(getSkinHashCode());
+ return b.toString();
+ }
+
+ private int getSkinHashCode() {
+ return ((SkinFactory)ServiceTracker.getService(FacesContext.getCurrentInstance(),
SkinFactory.class)).getSkin(FacesContext.getCurrentInstance()).hashCode();
+ }
+
+ @Override
+ public boolean userAgentNeedsUpdate(FacesContext context) {
+ if(context.isProjectStage(ProjectStage.Development)){
+ return true;
+ }
+ return super.userAgentNeedsUpdate(context);
+ }
+}
Modified:
root/framework/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-04-17
13:25:25 UTC (rev 16772)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -23,6 +23,8 @@
import org.ajax4jsf.cache.Cache;
import org.ajax4jsf.cache.CacheManager;
+import org.ajax4jsf.resource.Java2Dresource;
+import org.jboss.cache.util.BeanUtils;
import org.richfaces.context.AttributesContext;
import org.richfaces.context.SingletonsContext;
import org.richfaces.log.RichfacesLogger;
@@ -45,6 +47,7 @@
import java.net.URL;
import java.text.MessageFormat;
import java.util.Date;
+import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
@@ -238,7 +241,8 @@
}
if (isResourceExists(resourceName)) {
- resource = createHandlerDependentResource(resourceName);
+ Map<String, String> params =
Util.parseResourceParameters(resourceKey);
+ resource = createHandlerDependentResource(resourceName, params);
}
if (resource == null) {
@@ -423,9 +427,10 @@
* Should be called only if {@link #isResourceExists(String)} returns
<code>true</code>
*
* @param resourceName
+ * @param params
* @return
*/
- protected Resource createHandlerDependentResource(String resourceName) {
+ protected Resource createHandlerDependentResource(String resourceName, Map<String,
String> params) {
Resource resource = null;
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
@@ -436,7 +441,11 @@
if (Resource.class.isAssignableFrom(resourceClass)) {
resource = (Resource) resourceClass.newInstance();
resource.setResourceName(resourceName);
-
+ if(resource instanceof Java2Dresource){
+ Java2Dresource dynamicResource = (Java2Dresource)resource;
+ dynamicResource.populateParameters(params);
+ resource = dynamicResource;
+ }
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(MessageFormat.format("Successfully created
instance of {0} resource",
resourceName));
@@ -454,18 +463,29 @@
@Override
public Resource createResource(String resourceName, String libraryName, String
contentType) {
- Resource result;
-
+ Resource result = null;
+ Map<String, String> params = Util.parseResourceParameters(resourceName);
+ resourceName = extractParametersFromResourceName(resourceName);
if ((resourceName != null) && ((libraryName == null) ||
(libraryName.length() == 0))
&& isResourceExists(resourceName)) {
- result = createHandlerDependentResource(resourceName);
+ result = createHandlerDependentResource(resourceName, params);
} else {
- result = defaultHandler.createResource(resourceName, libraryName,
contentType);
+ result = defaultHandler.createResource(resourceName, libraryName, contentType);
+ if(resourceName.indexOf(".ecss") != -1){
+ result = new CompiledCSSResource(result);
+ }
}
return result;
}
+ private String extractParametersFromResourceName(String resourceName) {
+ if(!(resourceName.lastIndexOf("?") != -1)){
+ return resourceName;
+ }
+ return resourceName.substring(0, resourceName.lastIndexOf("?"));
+ }
+
@Override
public Resource createResource(String resourceName, String libraryName) {
return createResource(resourceName, libraryName, null);
@@ -479,7 +499,9 @@
@Override
public String getRendererTypeForResourceName(String resourceName) {
- // TODO add support for dynamic resources
+ if(resourceName.indexOf(".ecss") != -1){
+ return "javax.faces.resource.Stylesheet";
+ }
return defaultHandler.getRendererTypeForResourceName(resourceName);
}
Added:
root/framework/trunk/impl/src/main/java/org/richfaces/resource/Xcss2EcssConverter.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/resource/Xcss2EcssConverter.java
(rev 0)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/resource/Xcss2EcssConverter.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,256 @@
+package org.richfaces.resource;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.Attributes;
+import javax.xml.parsers.SAXParser;
+
+
+public class Xcss2EcssConverter {
+
+ public static void main(String[] args) {
+
+ // Create Handler
+ Handler handler = new Handler();
+
+ // Create the parser
+ CreateParser parser = new CreateParser(handler);
+
+ // Parse the XML file, handler generates the output
+ String string =
"E:/projs/richafces4/framework/trunk/impl/src/test/java/org/ajax4jsf/cache/extended.xcss";
+ parser.parse(string);
+ }
+
+}
+class Handler extends DefaultHandler {
+ private final String TEMPLATE = "template";
+ private final String SELECTOR = "selector";
+ private final String STYLE = "style";
+ private final String RESOURCE = "resource";
+ private final String ATTRIBBUTE = "attribute";
+ private final String VERBATIM = "verbatim";
+ private final String IMPORT = "importResource";
+ private StringBuilder ecssContent;
+ private boolean hasAttribbute = false;
+ private boolean verbatim = false;;
+
+ /**
+ * Receive notification of the start of an element.
+ * @param namespaceURI - The Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace processing is not being performed.
+ * @param localName - The local name (without prefix), or the empty string if
Namespace processing is not being performed.
+ * @param qName - The qualified name (with prefix), or the empty string if qualified
names are not available.
+ * @param atts - The attributes attached to the element. If there are no attributes,
it shall be an empty Attributes object.
+ * @throws SAXException - Any SAX exception, possibly wrapping another exception.
+ */
+ public void startElement(String namespaceURI, String localName, String qName,
Attributes atts)
+ throws SAXException {
+ if (TEMPLATE.equals(localName)){
+ ecssContent = new StringBuilder();
+ }
+ if (IMPORT.equals(localName)){
+ String src = atts.getValue("src");
+ ecssContent.append("@import url(#{resource['");
+ ecssContent.append(src);
+ ecssContent.append("']}\r\n");
+ }
+ if (VERBATIM.equals(localName)){
+ verbatim = true;
+ }
+ if (SELECTOR.equals(localName)){
+ String value = atts.getValue("name");
+ if(null != value){
+ ecssContent.append(value);
+ ecssContent.append("{\r\n");
+ }
+ }
+ if (STYLE.equals(localName)){
+ // Reset Order's values
+ String name = atts.getValue("name");
+ String skin = atts.getValue("skin");
+ String value = atts.getValue("value");
+ if(null != name){
+ if(skin != null){
+ ecssContent.append("\t");
+ ecssContent.append(name);
+ ecssContent.append(":");
+ ecssContent.append("'#{richSkin.");
+ ecssContent.append(skin);
+ ecssContent.append("}'");
+ }else if(value != null){
+ ecssContent.append("\t");
+ ecssContent.append(name);
+ ecssContent.append(":");
+ ecssContent.append(value);
+ }else{
+ ecssContent.append("\t");
+ ecssContent.append(name);
+ ecssContent.append(":");
+ }
+ }
+ }
+ if (RESOURCE.equals(localName)){
+ String value = atts.getValue("f:key");
+ if(null != value){
+ ecssContent.append("'url(#{resource['");
+ ecssContent.append(value);
+
+ }
+ }
+ if (ATTRIBBUTE.equals(localName)){
+ if(!hasAttribbute){
+ ecssContent.append("?");
+ hasAttribbute = true;
+ }
+ String name = atts.getValue("name");
+ String skin = atts.getValue("skin");
+ String value = atts.getValue("value");
+ if(null != name){
+ if(skin != null){
+ ecssContent.append(name);
+ ecssContent.append("=");
+ ecssContent.append("Skin.");
+ ecssContent.append(skin);
+ ecssContent.append("&");
+ }else if(value != null){
+ ecssContent.append(name);
+ ecssContent.append("=");
+ try {
+ ecssContent.append(URLDecoder.decode(value, "UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ ecssContent.append("&");
+ }else{
+ //ERROR
+ }
+ }
+ }
+ }
+
+ /**
+ * Receive notification of character data inside an element.
+ * @param ch - The characters.
+ * @param start - The start position in the character array.
+ * @param length - The number of characters to use from the character array.
+ * @throws SAXException - Any SAX exception, possibly wrapping another exception.
+ */
+ public void characters(char[] ch, int start, int length)
+ throws SAXException {
+ if ( verbatim ){
+ String strValue = new String(ch, start, length);
+ ecssContent.append(strValue);
+
+ }
+
+ }
+
+ /**
+ * Receive notification of the end of an element.
+ * @param namespaceURI - The Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace processing is not being performed.
+ * @param localName - The local name (without prefix), or the empty string if
Namespace processing is not being performed.
+ * @param qName - The qualified name (with prefix), or the empty string if qualified
names are not available.
+ * @throws SAXException - Any SAX exception, possibly wrapping another exception.
+ */
+ public void endElement(String namespaceURI, String localName, String qName)
+ throws SAXException {
+ if (TEMPLATE.equals(localName)){
+ System.out.println(ecssContent.toString().trim());
+ }
+ if (VERBATIM.equals(localName)){
+ verbatim = false;
+ }
+ if (SELECTOR.equals(localName)){
+ ecssContent.append("}\r\n");
+ }
+ if (STYLE.equals(localName)){
+ ecssContent.append(";\r\n");
+ }
+ if (RESOURCE.equals(localName)){
+ if(hasAttribbute){
+ ecssContent.setLength(ecssContent.length() -1);
+ }
+ ecssContent.append("']})'");
+ hasAttribbute = false;
+ }
+ if (ATTRIBBUTE.equals(localName)){
+ }
+ }
+
+ }
+class CreateParser {
+
+ private DefaultHandler handler;
+ private SAXParser saxParser;
+
+ /**
+ * Constructor
+ * @param handler - DefaultHandler for the SAX parser
+ */
+ public CreateParser(DefaultHandler handler) {
+ this.handler = handler;
+ create();
+ }
+
+ /**
+ * Create the SAX parser
+ */
+ private void create() {
+ try {
+ // Obtain a new instance of a SAXParserFactory.
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ // Specifies that the parser produced by this code will provide support for XML
namespaces.
+ factory.setNamespaceAware(true);
+ // Specifies that the parser produced by this code will validate documents as
they are parsed.
+ //factory.setValidating(true);
+ // Creates a new instance of a SAXParser using the currently configured factory
parameters.
+ saxParser = factory.newSAXParser();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ /**
+ * Parse a File
+ * @param file - File
+ */
+ public void parse(File file){
+ try{
+ saxParser.parse(file,handler);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ /**
+ * Parse a URI
+ * @param uri - String
+ */
+ public void parse(String uri){
+ try{
+ saxParser.parse(uri,handler);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ /**
+ * Parse a Stream
+ * @param stream - InputStream
+ */
+ public void parse(InputStream stream){
+ try{
+ saxParser.parse(stream,handler);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ }
+
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/util/Util.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/util/Util.java 2010-04-17
13:25:25 UTC (rev 16772)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/util/Util.java 2010-04-17
17:42:12 UTC (rev 16773)
@@ -42,6 +42,7 @@
package org.richfaces.util;
import org.ajax4jsf.Messages;
+import org.ajax4jsf.util.HtmlColor;
import org.ajax4jsf.util.base64.Codec;
import org.richfaces.log.RichfacesLogger;
import org.slf4j.Logger;
@@ -59,6 +60,7 @@
import java.io.OutputStream;
import java.io.StreamCorruptedException;
import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
@@ -67,7 +69,9 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.HashMap;
import java.util.Locale;
+import java.util.Map;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -79,6 +83,9 @@
* @since 4.0
*/
public final class Util {
+ private static final String EQUALS_SIGN = "=";
+ private static final String AND_SEPARATOR = "&";
+ private static final String QUESTION_SIGN = "?";
private static final String DATA_BYTES_SEPARATOR = "/DATB/";
private static final String DATA_SEPARATOR = "/DATA/";
@@ -346,6 +353,31 @@
return viewHandler.getResourceURL(context, resourcePath);
}
+ public static Map<String, String> parseResourceParameters(String
resourceName){
+ Map<String, String> params = new HashMap<String, String>();
+ if(!(resourceName.lastIndexOf(QUESTION_SIGN) != -1)){
+ return params;
+ }
+ resourceName = resourceName.substring(resourceName.lastIndexOf(QUESTION_SIGN) +
1);
+ try {
+ if (resourceName.trim().length() > 0) {
+ String query = resourceName;
+ String paramPairs[] = query.split(AND_SEPARATOR);
+ for(int i = 0; i < paramPairs.length ; i++){
+ String pair[] = paramPairs[i].split(EQUALS_SIGN);
+ String key = URLDecoder.decode(pair[0], "UTF-8").trim();
+ String value = URLDecoder.decode(pair[1], "UTF-8").trim();
+ if(key != null && value != null &&
key.trim().length() > 0 && value.trim().length() > 0){
+ params.put(key, value);
+ }
+ }
+ }
+ } catch (UnsupportedEncodingException e) {
+ RESOURCE_LOGGER.debug("Cannot parse resource parameters");
+ }
+ return params;
+ }
+
public static String decodeResourceURL(FacesContext context) {
ExternalContext externalContext = context.getExternalContext();
String resourceName = null;
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.Base2WayGradient.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.BaseGradient.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.CustomizeableGradient.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.GradientA.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.ButtonGradientImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.ButtonInverseGradientImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.HeaderGradientImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.HeaderInverseGradientImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.InputGradientImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.MenuGradientImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.MenuInverseGradientImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.TabGradientImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.gradientimages.TabInverseGradientImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.BaseControlBackgroundImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.ButtonBackgroundImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.ButtonDisabledBackgroundImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.GradientAlignment.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.GradientType.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.InputBackgroundImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.StandardButtonBgImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/org.richfaces.renderkit.html.images.StandardButtonPressedBgImage.resource.properties
===================================================================
Added:
root/framework/trunk/impl/src/main/resources/META-INF/prerenderview-listener.faces-config.xml
===================================================================
---
root/framework/trunk/impl/src/main/resources/META-INF/prerenderview-listener.faces-config.xml
(rev 0)
+++
root/framework/trunk/impl/src/main/resources/META-INF/prerenderview-listener.faces-config.xml 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
version="2.0">
+ <name>richfaces</name>
+ <application>
+ <system-event-listener>
+ <system-event-listener-class>org.richfaces.context.PreRenderViewListener</system-event-listener-class>
+ <system-event-class>javax.faces.event.PreRenderViewEvent</system-event-class>
+ </system-event-listener>
+ </application>
+
+</faces-config>
\ No newline at end of file
Modified: root/framework/trunk/pom.xml
===================================================================
--- root/framework/trunk/pom.xml 2010-04-17 13:25:25 UTC (rev 16772)
+++ root/framework/trunk/pom.xml 2010-04-17 17:42:12 UTC (rev 16773)
@@ -73,6 +73,11 @@
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>net.sourceforge.cssparser</groupId>
+ <artifactId>cssparser</artifactId>
+ <version>0.9.5</version>
+ </dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
Added:
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/basic.ecss
===================================================================
---
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/basic.ecss
(rev 0)
+++
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/basic.ecss 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,25 @@
+input, select, textarea, button, keygen, isindex, legend, a {
+ font-size : '#{richSkin.generalSizeFont}';
+ font-family : '#{richSkin.generalFamilyFont}';
+ color : '#{richSkin.controlTextColor}';
+}
+fieldset {
+ border-width: 1px;
+ border-style: solid;
+ padding: 10px;
+ border-color : '#{richSkin.panelBorderColor}';
+}
+hr {
+ border-width: 1px;
+ border-style: solid;
+ border-color : '#{richSkin.panelBorderColor}';
+}
+a {
+ color : '#{richSkin.generalLinkColor}';
+}
+a:hover {
+ color : '#{richSkin.hoverLinkColor}';
+}
+a:visited {
+ color : '#{richSkin.visitedLinkColor}';
+}
\ No newline at end of file
Added:
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/basic_both.ecss
===================================================================
---
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/basic_both.ecss
(rev 0)
+++
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/basic_both.ecss 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,2 @@
+@import url(#{resource['richfaces.css/basic.ecss']});
+@import url(#{resource['richfaces.css/basic_classes.ecss']});
\ No newline at end of file
Added:
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/basic_classes.ecss
===================================================================
---
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/basic_classes.ecss
(rev 0)
+++
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/basic_classes.ecss 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,349 @@
+.rich-container input, .rich-input, .rich-container select, .rich-select,
+.rich-container textarea, .rich-textarea, .rich-container button, .rich-button,
+.rich-container keygen, .rich-keygen,.rich-container isindex, .rich-isindex,
+.rich-container legend, .rich-legend,.rich-container a, .rich-link,
+.rich-container fieldset, .rich-fieldset,.rich-field, .rich-field-edit,
.rich-field-error,
+.rich-button, .rich-button-disabled, .rich-button-over, .rich-button-press {
+ font-size : '#{richSkin.generalSizeFont}';
+ font-family : '#{richSkin.generalFamilyFont}';
+ color : '#{richSkin.controlTextColor}';
+}
+
+.rich-container fieldset, .rich-fieldset {
+ border-width: 1px;
+ border-style: solid;
+ padding: 10px;
+}
+
+.rich-container hr, .rich-hr {
+ border-width: 1px;
+ border-style: solid;
+}
+
+.rich-container legend, .rich-legend {
+ font-weight : bold;
+}
+
+.rich-container form, .rich-form {
+ padding : 0px;
+ margin : 0px;
+}
+
+.rich-container fieldset, .rich-fieldset{
+ border-color : '#{richSkin.panelBorderColor}';
+}
+
+.rich-container hr, .rich-hr{
+ border-color : '#{richSkin.panelBorderColor}';
+}
+
+.rich-container a, .rich-link{
+ color: '#{richSkin.generalLinkColor}';
+}
+
+.rich-container a:hover, .rich-link:hover{
+ color : '#{richSkin.hoverLinkColor}';
+}
+
+.rich-container a:visited, .rich-link:visited{
+ color : '#{richSkin.visitedLinkColor}';
+}
+
+.rich-field, .rich-field-edit, .rich-field-error{
+ border-width: 1px;
+ border-style: inset;
+ border-color: '#{richSkin.panelBorderColor}';
+}
+
+.rich-field{
+ background-color : '#{richSkin.controlBackgroundColor}';
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.images.ButtonBackgroundImage']})';
+ background-repeat : no-repeat;
+ background-position : 1px 1px;
+}
+
+.rich-field-edit{
+ background-color : '#{richSkin.editBackgroundColor}';
+}
+
+.rich-field-error{
+ background-color : '#{richSkin.warningBackgroundColor}';
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.images.InputErrorIcon']})';
+ background-repeat : no-repeat;
+ background-position : center left;
+ padding-left : 7px;
+}
+
+.rich-button, .rich-button-disabled, .rich-button-over, .rich-button-press{
+ border-width : 1px;
+ border-style : solid;
+ border-color : '#{richSkin.panelBorderColor}';
+ background-color : '#{richSkin.trimColor}';
+ padding : 2px 10px 2px 10px;
+ text-align : center;
+ cursor : pointer;
+ background-repeat : repeat-x;
+ background-position : top left;
+}
+
+.rich-button{
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.images.StandardButtonBgImage']})';
+}
+
+.rich-button-disabled{
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.images.StandardButtonBgImage']})';
+}
+
+.rich-button-over{
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.images.StandardButtonBgImage']})';
+}
+
+.rich-button-press{
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.images.StandardButtonPressedBgImage']})';
+ background-position : bottom left;
+}
+
+ /*border color styles*/
+
+.rich-box-border-color-control-select{
+ border-color : '#{richSkin.selectControlColor}';
+}
+
+.rich-box-border-color-subborder{
+ border-color : '#{richSkin.subBorderColor}';
+}
+
+.rich-box-border-color-header{
+ border-color : '#{richSkin.headerBackgroundColor}';
+}
+
+.rich-box-border-color-general{
+ border-color : '#{richSkin.generalBackgroundColor}';
+}
+
+.rich-box-border-color-additional{
+ border-color : '#{richSkin.additionalBackgroundColor}';
+}
+
+.rich-box-border-color-panel{
+ border-color : '#{richSkin.panelBorderColor}';
+}
+
+.rich-box-border-color-tip{
+ border-color : '#{richSkin.tipBorderColor}';
+}
+
+.rich-box-border-color-table{
+ border-color : '#{richSkin.tableBorderColor}';
+}
+
+.rich-box-border-control-select, .rich-box-border-subborder, .rich-box-border-header,
+ .rich-box-border-general, .rich-box-border-additional, .rich-box-border-panel,
.rich-box-border-tip, .rich-box-border-table{
+ border-style : solid;
+ border-width : 1px;
+}
+
+.rich-box-border-control-select{
+ border-color : '#{richSkin.selectControlColor}';
+}
+
+.rich-box-border-subborder{
+ border-color : '#{richSkin.subBorderColor}';
+}
+
+.rich-box-border-header{
+ border-color : '#{richSkin.headerBackgroundColor}';
+}
+
+.rich-box-border-general{
+ border-color : '#{richSkin.generalBackgroundColor}';
+}
+
+.rich-box-border-additional{
+ border-color : '#{richSkin.additionalBackgroundColor}';
+}
+
+.rich-box-border-panel{
+ border-color : '#{richSkin.panelBorderColor}';
+}
+
+.rich-box-border-tip{
+ border-color : '#{richSkin.tipBorderColor}';
+}
+
+.rich-box-border-table{
+ border-color : '#{richSkin.tableBorderColor}';
+}
+
+ /*background color styles*/
+
+.rich-box-bgcolor-header{
+ background-color : '#{richSkin.headerBackgroundColor}';
+}
+
+.rich-box-bgcolor-general{
+ background-color : '#{richSkin.generalBackgroundColor}';
+}
+
+.rich-box-bgcolor-additional{
+ background-color : '#{richSkin.additionalBackgroundColor}';
+}
+
+.rich-box-bgcolor-panel{
+ background-color : '#{richSkin.panelBorderColor}';
+}
+
+.rich-box-bgcolor-tab{
+ background-color : '#{richSkin.tabBackgroundColor}';
+}
+
+.rich-box-bgcolor-trim{
+ background-color : '#{richSkin.trimColor}';
+}
+
+.rich-box-bgcolor-tip{
+ background-color : '#{richSkin.tipBackgroundColor}';
+}
+
+.rich-box-bgcolor-table{
+ background-color : '#{richSkin.tableBackgroundColor}';
+}
+
+.rich-box-bgcolor-table-footer{
+ background-color : '#{richSkin.tableFooterBackgroundColor}';
+}
+
+.rich-box-bgcolor-table-subfooter{
+ background-color : '#{richSkin.tableSubfooterBackgroundColor}';
+}
+
+.rich-box-bgcolor-editor{
+ background-color : '#{richSkin.editorBackgroundColor}';
+}
+
+.rich-box-bgcolor-edit{
+ background-color : '#{richSkin.editBackgroundColor}';
+}
+
+ /*text color styles*/
+
+.rich-text-color-header{
+ color : '#{richSkin.headerTextColor}';
+}
+
+.rich-text-color-general{
+ color : '#{richSkin.generalTextColor}';
+}
+
+.rich-text-color-tab-disabled{
+ color : '#{richSkin.tabDisabledTextColor}';
+}
+
+.rich-text-color-select{
+ color : '#{richSkin.selectControlColor}';
+}
+
+.rich-text-color-link-general{
+ color : '#{richSkin.generalLinkColor}';
+}
+
+.rich-text-color-link-hover{
+ color : '#{richSkin.hoverLinkColor}';
+}
+
+.rich-text-color-link-visited{
+ color : '#{richSkin.visitedLinkColor}';
+}
+
+ /*font size styles*/
+
+.rich-font-size-general{
+ font-size : '#{richSkin.generalSizeFont}';
+}
+
+.rich-font-size-header{
+ font-size : '#{richSkin.headerSizeFont}';
+}
+
+ /*font family styles*/
+
+.rich-font-family-general{
+ font-family : '#{richSkin.generalFamilyFont}';
+}
+
+.rich-font-family-header{
+ font-family : '#{richSkin.headerFamilyFont}';
+}
+
+ /* text styles */
+
+.rich-text-general{
+ font-size : '#{richSkin.generalSizeFont}';
+ font-family : '#{richSkin.generalFamilyFont}';
+ color : '#{richSkin.generalTextColor}';
+}
+
+.rich-text-header{
+ font-size : '#{richSkin.generalSizeFont}';
+ font-family : '#{richSkin.headerFamilyFont}';
+ color : '#{richSkin.headerTextColor}';
+}
+
+.rich-text-tab-disabled{
+ font-size : '#{richSkin.generalSizeFont}';
+ font-family : '#{richSkin.generalFamilyFont}';
+ color : '#{richSkin.tabDisabledTextColor}';
+}
+
+.rich-text-control-select{
+ font-size : '#{richSkin.generalSizeFont}';
+ font-family : '#{richSkin.headerFamilyFont};
+ color : '#{richSkin.selectControlColor}';
+}
+
+ /*gradient styles*/
+
+.rich-gradient-header-inverse{
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.gradientimages.HeaderInverseGradientImage']})';
+ background-repeat : repeat-x;
+}
+
+.rich-gradient-header{
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.gradientimages.HeaderGradientImage']})';
+ background-repeat : repeat-x;
+}
+
+.rich-gradient-tab{
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.gradientimages.TabGradientImage']})';
+ background-repeat : repeat-x;
+}
+
+.rich-gradient-tab-inverse{
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.gradientimages.TabInverseGradientImage']})';
+ background-repeat : repeat-x;
+}
+
+.rich-gradient-input{
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.gradientimages.InputGradientImage']})';
+ background-repeat : repeat-x;
+}
+
+.rich-gradient-menu-inverse{
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.gradientimages.MenuInverseGradientImage']})';
+ background-repeat : repeat-x;
+}
+
+.rich-gradient-menu{
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.gradientimages.MenuGradientImage']})';
+ background-repeat : repeat-x;
+}
+
+.rich-gradient-button-inverse{
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.gradientimages.ButtonInverseGradientImage']})';
+ background-repeat : repeat-x;
+}
+
+.rich-gradient-button{
+ background-image :
'url(#{resource['org.richfaces.renderkit.html.gradientimages.ButtonGradientImage']})';
+ background-repeat : repeat-x;
+}
\ No newline at end of file
Added:
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/extended.ecss
===================================================================
---
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/extended.ecss
(rev 0)
+++
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/extended.ecss 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,86 @@
+input, select, textarea, button, keygen, isindex{
+ border-width:1px;
+ border-color:'#{richSkin.panelBorderColor}';
+ color:'#{richSkin.controlTextColor}';
+}
+
+
+ *|button {
+ border-width: 1px;
+ background-repeat : repeat-x;
+ background-position : top left;
+ }
+
+ button[type="button"], button[type="reset"],
button[type="submit"], input[type="reset"],
input[type="submit"], input[type="button"] {
+ border-width: 1px;
+ background-repeat : repeat-x;
+ background-position : top left;
+ }
+
+
+ *|button{
+ border-color:'#{richSkin.panelBorderColor}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ color:'#{richSkin.headerTextColor}';
+ background-color:'#{richSkin.headerBackgroundColor}';
+ background-image:'url(#{resource['org.richfaces.renderkit.html.images.ButtonBackgroundImage']})';
+}
+button[type="button"], button[type="reset"],
button[type="submit"], input[type="reset"],
input[type="submit"], input[type="button"]{
+ border-color:'#{richSkin.panelBorderColor}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ color:'#{richSkin.headerTextColor}';
+ background-color:'#{richSkin.headerBackgroundColor}';
+ background-image:'url(#{resource['org.richfaces.renderkit.html.images.ButtonBackgroundImage']})';
+}
+*|button[disabled]{
+ color:'#{richSkin.tabDisabledTextColor}';
+ border-color:'#{richSkin.tableFooterBackgroundColor}';
+ background-color:'#{richSkin.tableFooterBackgroundColor}';
+ background-image:'url(#{resource['org.richfaces.renderkit.html.images.ButtonDisabledBackgroundImage']})';
+}
+button[type="button"][disabled], button[type="reset"][disabled],
button[type="submit"][disabled], input[type="reset"][disabled],
input[type="submit"][disabled], input[type="button"][disabled]{
+ color:'#{richSkin.tabDisabledTextColor}';
+ border-color:'#{richSkin.tableFooterBackgroundColor}';
+ background-color:'#{richSkin.tableFooterBackgroundColor}';
+ background-image:'url(#{resource['org.richfaces.renderkit.html.images.ButtonDisabledBackgroundImage']})';
+}
+
+
+ *|textarea {
+ border-width: 1px;
+ border-style : inset;
+ background-repeat : no-repeat;
+ background-position : 1px 1px;
+ }
+
+ textarea[type="textarea"], input[type="text"],
input[type="password"], select {
+ border-width: 1px;
+ border-style : inset;
+ background-repeat : no-repeat;
+ background-position : 1px 1px;
+ }
+
+ *|textarea{
+ border-color:'#{richSkin.panelBorderColor}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ color:'#{richSkin.controlTextColor}';
+ background-color:'#{richSkin.controlBackgroundColor}';
+ background-image:'url(#{resource['org.richfaces.renderkit.html.images.InputBackgroundImage']})';
+}
+textarea[type="textarea"], input[type="text"],
input[type="password"], select{
+ border-color:'#{richSkin.panelBorderColor}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ color:'#{richSkin.controlTextColor}';
+ background-color:'#{richSkin.controlBackgroundColor}';
+ background-image:'url(#{resource['org.richfaces.renderkit.html.images.InputBackgroundImage']})';
+}
+*|textarea[disabled], *|select[disabled]{
+ color:'#{richSkin.panelBorderColor}';
+}
+textarea[type="textarea"][disabled], input[type="text"][disabled],
input[type="password"][disabled], select[disabled]{
+ color:'#{richSkin.panelBorderColor}';
+}
\ No newline at end of file
Added:
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/extended_both.ecss
===================================================================
---
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/extended_both.ecss
(rev 0)
+++
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/extended_both.ecss 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,2 @@
+@import url(#{resource['richfaces.css/extended.ecss']});
+@import url(#{resource['richfaces.css/extended_classes.ecss']});
\ No newline at end of file
Added:
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/extended_classes.ecss
===================================================================
---
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/extended_classes.ecss
(rev 0)
+++
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/extended_classes.ecss 2010-04-17
17:42:12 UTC (rev 16773)
@@ -0,0 +1,96 @@
+.rich-container input, .rich-input, .rich-container select, .rich-select,
.rich-container textarea, .rich-textarea, .rich-container button, .rich-button,
.rich-container keygen, .rich-keygen, .rich-container isindex, .rich-isindex{
+ border-width:1px;
+ border-color:'#{richSkin.panelBorderColor}';
+ color:'#{richSkin.controlTextColor}';
+}
+
+
+ .rich-container *|button, .rich-button {
+ border-width: 1px;
+ background-repeat : repeat-x;
+ background-position : top left;
+ }
+
+ .rich-button,
+ .rich-container button[type="button"], .rich-button-button,
+ .rich-container button[type="reset"], .rich-button-reset,
+ .rich-container button[type="submit"], .rich-button-submit,
+ .rich-container input[type="reset"], .rich-input-reset,
+ .rich-container input[type="submit"], .rich-input-submit,
+ .rich-container input[type="button"], .rich-input-button {
+ border-width: 1px;
+ background-repeat : repeat-x;
+ background-position : top left;
+ }
+
+
+ .rich-container *|button, .rich-button{
+ border-color:'#{richSkin.panelBorderColor}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ color:'#{richSkin.headerTextColor}';
+ background-color:'#{richSkin.headerBackgroundColor}';
+ background-image:'url(#{resource['org.richfaces.renderkit.html.images.ButtonBackgroundImage']})';
+}
+ .rich-button, .rich-container button[type="button"], .rich-button-button,
.rich-container button[type="reset"], .rich-button-reset, .rich-container
button[type="submit"], .rich-button-submit, .rich-container
input[type="reset"], .rich-input-reset, .rich-container
input[type="submit"], .rich-input-submit, .rich-container
input[type="button"], .rich-input-button {
+ border-color:'#{richSkin.panelBorderColor}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ color:'#{richSkin.headerTextColor}';
+ background-color:'#{richSkin.headerBackgroundColor}';
+ background-image:'url(#{resource['org.richfaces.renderkit.html.images.ButtonBackgroundImage']})';
+}
+.rich-container *|button[disabled]{
+ color:'#{richSkin.tabDisabledTextColor}';
+ background-color:'#{richSkin.tableFooterBackgroundColor}';
+ border-color:'#{richSkin.tableFooterBackgroundColor}';
+ background-image:'url(#{resource['org.richfaces.renderkit.html.images.ButtonDisabledBackgroundImage']})';
+}
+.rich-button-disabled, .rich-container button[type="button"][disabled],
.rich-button-button-disabled, .rich-container button[type="reset"][disabled],
.rich-button-reset-disabled, .rich-container button[type="submit"][disabled],
.rich-button-submit-disabled, .rich-container input[type="reset"][disabled],
.rich-input-reset-disabled, .rich-container input[type="submit"][disabled],
.rich-input-submit-disabled, .rich-container input[type="button"][disabled],
.rich-input-button-disabled{
+ color:'#{richSkin.tabDisabledTextColor}';
+ background-color:'#{richSkin.tableFooterBackgroundColor}';
+ border-color:'#{richSkin.tableFooterBackgroundColor}';
+ background-image:'url(#{resource['org.richfaces.renderkit.html.images.ButtonDisabledBackgroundImage']})';
+}
+
+
+ .rich-container *|textarea {
+ border-width: 1px;
+ border-style : inset;
+ background-repeat : no-repeat;
+ background-position : 1px 1px;
+ }
+
+ .rich-textarea,
+ .rich-container textarea[type="textarea"], .rich-textarea-textarea,
+ .rich-container input[type="text"], .rich-input-text,
+ .rich-container input[type="password"], .rich-input-password,
+ .rich-container select, .rich-select {
+ border-width: 1px;
+ border-style : inset;
+ background-repeat : no-repeat;
+ background-position : 1px 1px;
+ }
+
+ .rich-container *|textarea{
+ border-color:'#{richSkin.panelBorderColor}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ color:'#{richSkin.controlTextColor}';
+ background-color:'#{richSkin.controlBackgroundColor}';
+ background-image:'url(#{resource['org.richfaces.renderkit.html.images.InputBackgroundImage']})';
+}
+.rich-textarea, .rich-container textarea[type="textarea"],
.rich-textarea-textarea, .rich-container input[type="text"], .rich-input-text,
.rich-container input[type="password"], .rich-input-password,
.rich-container select, .rich-select{
+ border-color:'#{richSkin.panelBorderColor}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ color:'#{richSkin.controlTextColor}';
+ background-color:'#{richSkin.controlBackgroundColor}';
+ background-image:'url(#{resource['org.richfaces.renderkit.html.images.InputBackgroundImage']})';
+}
+.rich-container *|textarea[disabled], .rich-container *|select[disabled]{
+ color:'#{richSkin.panelBorderColor}';
+}
+.rich-textarea-disabled, .rich-container textarea[type="textarea"][disabled],
.rich-textarea-textarea-disabled, .rich-container
input[type="text"][disabled], .rich-input-text-disabled, .rich-container
input[type="password"][disabled], .rich-input-password-disabled,
.rich-container select[disabled], .rich-select-disabled{
+ color:'#{richSkin.panelBorderColor}';
+}
\ No newline at end of file