Author: Alex.Kolonitsky
Date: 2010-10-01 05:13:43 -0400 (Fri, 01 Oct 2010)
New Revision: 19400
Added:
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/TabHeaderGradient.java
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/TopTabHeaderGradient.java
trunk/examples/output-demo/src/main/java/org/richfaces/SkinBean.java
Modified:
trunk/core/api/src/main/java/org/richfaces/skin/Skin.java
trunk/examples/output-demo/src/main/webapp/WEB-INF/web.xml
trunk/examples/output-demo/src/main/webapp/templates/template.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tabPanel.ecss
Log:
RF-8779 TabPanel: skinning component
Modified: trunk/core/api/src/main/java/org/richfaces/skin/Skin.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/skin/Skin.java 2010-10-01 08:36:30 UTC (rev
19399)
+++ trunk/core/api/src/main/java/org/richfaces/skin/Skin.java 2010-10-01 09:13:43 UTC (rev
19400)
@@ -252,6 +252,8 @@
*/
public static final String TAB_WEIGHT_FONT = "tabWeightFont";
+ public static final String TAB_BACKGROUND_COLOR = "tabBackgroundColor";
+
public static final String TRIM_COLOR = "trimColor";
/**
Added:
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/TabHeaderGradient.java
===================================================================
---
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/TabHeaderGradient.java
(rev 0)
+++
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/TabHeaderGradient.java 2010-10-01
09:13:43 UTC (rev 19400)
@@ -0,0 +1,41 @@
+/**
+ * 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;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author akolonitsky
+ * @since Sep 30, 2010
+ */
+public class TabHeaderGradient extends BaseGradient {
+
+ @Override
+ protected void initializeProperties(FacesContext context, Skin skin) {
+ super.initializeProperties(context, skin);
+ setBaseColorParam(Skin.GENERAL_BACKGROUND_COLOR);
+ setGradientColorParam(Skin.TAB_BACKGROUND_COLOR);
+ }
+}
Added:
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/TopTabHeaderGradient.java
===================================================================
---
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/TopTabHeaderGradient.java
(rev 0)
+++
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/TopTabHeaderGradient.java 2010-10-01
09:13:43 UTC (rev 19400)
@@ -0,0 +1,41 @@
+/**
+ * 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;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author akolonitsky
+ * @since Sep 30, 2010
+ */
+public class TopTabHeaderGradient extends BaseGradient {
+
+ @Override
+ protected void initializeProperties(FacesContext context, Skin skin) {
+ super.initializeProperties(context, skin);
+ setBaseColorParam(Skin.TAB_BACKGROUND_COLOR);
+ setGradientColorParam(Skin.GENERAL_BACKGROUND_COLOR);
+ }
+}
Added: trunk/examples/output-demo/src/main/java/org/richfaces/SkinBean.java
===================================================================
--- trunk/examples/output-demo/src/main/java/org/richfaces/SkinBean.java
(rev 0)
+++ trunk/examples/output-demo/src/main/java/org/richfaces/SkinBean.java 2010-10-01
09:13:43 UTC (rev 19400)
@@ -0,0 +1,61 @@
+package org.richfaces;
+
+import java.io.Serializable;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.faces.model.SelectItem;
+
+@SessionScoped
+@ManagedBean(name = "skinBean")
+public class SkinBean implements Serializable {
+
+ private static final long serialVersionUID = 2744605279708632184L;
+
+ private SelectItem[] skinSetItems = {
+ new SelectItem("blueSky"),
+ new SelectItem("classic"),
+ new SelectItem("deepMarine"),
+ new SelectItem("DEFAULT"),
+ new SelectItem("emeraldTown"),
+ new SelectItem("japanCherry"),
+ new SelectItem("NULL"),
+ new SelectItem("plain"),
+ new SelectItem("ruby"),
+ new SelectItem("wine")
+ };
+
+ private String skin = "classic";
+
+ private boolean enableElementsSkinning = true;
+
+ private boolean enableClassesSkinning = false;
+
+ public String getSkin() {
+ return skin;
+ }
+
+ public void setSkin(String skin) {
+ this.skin = skin;
+ }
+
+ public boolean isEnableElementsSkinning() {
+ return enableElementsSkinning;
+ }
+
+ public void setEnableElementsSkinning(boolean enableElementsSkinning) {
+ this.enableElementsSkinning = enableElementsSkinning;
+ }
+
+ public boolean isEnableClassesSkinning() {
+ return enableClassesSkinning;
+ }
+
+ public void setEnableClassesSkinning(boolean enableClassesSkinning) {
+ this.enableClassesSkinning = enableClassesSkinning;
+ }
+
+ public SelectItem[] getSkinSetItems() {
+ return skinSetItems;
+ }
+}
Modified: trunk/examples/output-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/WEB-INF/web.xml 2010-10-01 08:36:30 UTC
(rev 19399)
+++ trunk/examples/output-demo/src/main/webapp/WEB-INF/web.xml 2010-10-01 09:13:43 UTC
(rev 19400)
@@ -5,7 +5,22 @@
version="2.5">
<display-name>Sample RichFaces 4 Application</display-name>
+
<context-param>
+ <param-name>org.richfaces.skin</param-name>
+ <param-value>#{skinBean.skin}</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.enableControlSkinning</param-name>
+ <param-value>#{skinBean.enableElementsSkinning}</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.enableControlSkinningClasses</param-name>
+ <param-value>#{skinBean.enableClassesSkinning}</param-value>
+ </context-param>
+
+
+ <context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
Modified: trunk/examples/output-demo/src/main/webapp/templates/template.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-10-01
08:36:30 UTC (rev 19399)
+++ trunk/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-10-01
09:13:43 UTC (rev 19400)
@@ -16,6 +16,19 @@
<ui:insert name="scripts" ></ui:insert>
+
+ <h:form>
+ <h:commandButton value="Classic">
+ <f:setPropertyActionListener target="#{skinBean.skin}"
value="classic"/>
+ </h:commandButton>
+ <h:commandButton value="BlueSky">
+ <f:setPropertyActionListener target="#{skinBean.skin}"
value="blueSky"/>
+ </h:commandButton>
+ <h:commandButton value="DeepMarine">
+ <f:setPropertyActionListener target="#{skinBean.skin}"
value="deepMarine"/>
+ </h:commandButton>
+ </h:form>
+
<table width="100%">
<thead>
<tr>
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java 2010-10-01
08:36:30 UTC (rev 19399)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTabPanel.java 2010-10-01
09:13:43 UTC (rev 19400)
@@ -43,6 +43,12 @@
return COMPONENT_FAMILY;
}
-
-
+ @Override
+ public String getActiveItem() {
+ String res = super.getActiveItem();
+ if (res == null) {
+ res = getFirstItem().getName();
+ }
+ return res;
+ }
}
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tabPanel.ecss
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tabPanel.ecss 2010-10-01
08:36:30 UTC (rev 19399)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tabPanel.ecss 2010-10-01
09:13:43 UTC (rev 19400)
@@ -1,11 +1,10 @@
.rf-tb-hdr {
- white-space: nowrap;
- border: "1px solid #{richSkin.panelBorderColor}";
+ white-space: nowrap;
+ border: "1px solid #{richSkin.panelBorderColor}";
cursor : pointer;
padding : 0px 5px 3px 5px;
vertical-align : top;
- /*gradient - from generalBackgroundColor to tabBackgroundColor*/
- background-image:
"url(#{resource['org.richfaces.images:tabBg.png']})";
+ background-image:
"url(#{resource['org.richfaces.renderkit.html.images.TabHeaderGradient']})";
background-position: top;
background-repeat: repeat-x;
background-color: "#{richSkin.tabBackgroundColor}";
@@ -17,7 +16,7 @@
border-bottom: 0px;
font-weight: bold;
vertical-align: top;
- background-image:
"url(#{resource['org.richfaces.images:actTabBg.png']})";
+ background-image:
"url(#{resource['org.richfaces.renderkit.html.images.TopTabHeaderGradient']})";
background-position: top;
background-repeat: repeat-x;
background-color: "#{richSkin.additionalBackgroundColor}";
@@ -28,11 +27,15 @@
}
.rf-tb-hdr-dis {
- color: "#{richSkin.tabDisabledTextColor}";
- cursor: default;
+ color: "#{richSkin.tabDisabledTextColor}";
+ cursor: default;
}
.rf-tb-hdr-tabline-vis {
+ background:url("tabline_bg.gif") repeat-x scroll center top #EEF4FB;
+ border-color:#A6A6A6 #A6A6A6 -moz-use-text-color;
+ border-style:solid solid none;
+ border-width:1px 1px 0;
padding-top: 2px;
overflow: hidden;
height: 25px;
@@ -40,7 +43,7 @@
position: relative;
}
-.rf-tb-hdr_tabs {
+.rf-tb-hdr-tabs {
border: 0px;
width: 100%;
height: 100%;
@@ -65,7 +68,7 @@
}
.rf-tb-hdr-scrl_l {
- background: "url(#{resource['org.richfaces.images:actTabBg.png']}) top
repeat-x #{richSkin.additionalBackgroundColor}";
+ background:
"url(#{resource['org.richfaces.renderkit.html.images.TopTabHeaderGradient']})
top repeat-x #{richSkin.additionalBackgroundColor}";
position: absolute;
top: 1px;
left: 1px;
@@ -80,7 +83,7 @@
}
.rf-tb-hdr-scrl_r {
- background: "url(#{resource['org.richfaces.images:actTabBg.png']}) top
repeat-x #{richSkin.additionalBackgroundColor}";
+ background:
"url(#{resource['org.richfaces.renderkit.html.images.TopTabHeaderGradient']})
top repeat-x #{richSkin.additionalBackgroundColor}";
position: absolute;
top: 1px;
right: 17px;
@@ -95,7 +98,7 @@
}
.rf-tb-hdr-tablst {
- background: "url(#{resource['org.richfaces.images:actTabBg.png']}) top
repeat-x #{richSkin.additionalBackgroundColor}";
+ background:
"url(#{resource['org.richfaces.renderkit.html.images.TopTabHeaderGradient']})
top repeat-x #{richSkin.additionalBackgroundColor}";
position: absolute;
top: 1px;
right: 1px;