Author: sergeyhalipov
Date: 2008-04-29 10:29:20 -0400 (Tue, 29 Apr 2008)
New Revision: 8316
Modified:
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java
Log:
http://jira.jboss.com/jira/browse/RF-3272
Modified:
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java
===================================================================
---
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java 2008-04-29
14:28:07 UTC (rev 8315)
+++
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java 2008-04-29
14:29:20 UTC (rev 8316)
@@ -102,41 +102,34 @@
UIComponent component){
String source = "";
- String color = "";
- Skin skin = getSkin(context);
-
- if (isTopLevel){
- color = (String) skin.getParameter(context,"panelmenu.headerBulletColor");
- } else {
- color = (String) skin.getParameter(context,"panelmenu.itemBulletColor");
- }
+
+ Boolean topLevel = new Boolean(isTopLevel);
+
if(iconType != null && !iconType.equals("none")){
if (iconType.equals("custom") || "".equals(iconType)){
- source = getResource(PanelMenuIconSpacer.class.getName()).getUri(context, color);
+ source = getResource(PanelMenuIconSpacer.class.getName()).getUri(context, topLevel);
} else if (iconType.equals("spacer")){
- source = getResource(PanelMenuIconSpacer.class.getName()).getUri(context, color);
+ source = getResource(PanelMenuIconSpacer.class.getName()).getUri(context, topLevel);
} else if (iconType.equals("triangle")) {
- source = getResource(PanelMenuIconTriangle.class.getName()).getUri(context, color);
+ source = getResource(PanelMenuIconTriangle.class.getName()).getUri(context,
topLevel);
} else if (iconType.equals("triangleLeft")) {
- source = getResource(PanelMenuIconTriangleLeft.class.getName()).getUri(context,
color);
+ source = getResource(PanelMenuIconTriangleLeft.class.getName()).getUri(context,
topLevel);
} else if (iconType.equals("triangleDown")) {
- source = getResource(PanelMenuIconTriangleDown.class.getName()).getUri(context,
color);
+ source = getResource(PanelMenuIconTriangleDown.class.getName()).getUri(context,
topLevel);
} else if (iconType.equals("triangleUp")) {
- source = getResource(PanelMenuIconTriangleUp.class.getName()).getUri(context,
color);
+ source = getResource(PanelMenuIconTriangleUp.class.getName()).getUri(context,
topLevel);
} else if (iconType.equals("chevron")) {
- source = getResource(PanelMenuIconChevron.class.getName()).getUri(context, color);
+ source = getResource(PanelMenuIconChevron.class.getName()).getUri(context,
topLevel);
} else if (iconType.equals("chevronLeft")) {
- source = getResource(PanelMenuIconChevronLeft.class.getName()).getUri(context,
color);
+ source = getResource(PanelMenuIconChevronLeft.class.getName()).getUri(context,
topLevel);
} else if (iconType.equals("chevronUp")) {
- source = getResource(PanelMenuIconChevronUp.class.getName()).getUri(context, color);
+ source = getResource(PanelMenuIconChevronUp.class.getName()).getUri(context,
topLevel);
} else if (iconType.equals("chevronDown")) {
- source = getResource(PanelMenuIconChevronDown.class.getName()).getUri(context,
color);
-// } else if (iconType.equals("square")) {
-// source = getResource(PanelMenuIconSquare.class.getName()).getUri(context, color);
+ source = getResource(PanelMenuIconChevronDown.class.getName()).getUri(context,
topLevel);
} else if (iconType.equals("disc")) {
- source = getResource(PanelMenuIconDisc.class.getName()).getUri(context, color);
+ source = getResource(PanelMenuIconDisc.class.getName()).getUri(context, topLevel);
} else if (iconType.equals("grid")) {
- source = getResource(PanelMenuIconGrid.class.getName()).getUri(context, color);
+ source = getResource(PanelMenuIconGrid.class.getName()).getUri(context, topLevel);
} else {
//TODO by nick - dima - TemplateContext is deprecated and shouldn't be used
source = (String)getUtils().encodeResourceURL(new
TemplateContext(this,context,component),iconType);
Modified:
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java
===================================================================
---
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java 2008-04-29
14:28:07 UTC (rev 8315)
+++
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java 2008-04-29
14:29:20 UTC (rev 8316)
@@ -43,6 +43,8 @@
*
*/
public abstract class PanelMenuIconBasic extends Java2Dresource {
+ private static final String TOP_BULLET_COLOR = "headerTextColor";
+ private static final String ORDINAL_BULLET_COLOR = "headerBackgroundColor";
public PanelMenuIconBasic() {
setRenderer(new GifRenderer());
@@ -93,22 +95,23 @@
byte[] ret = new byte[3];
Color color = null;
+ String skinParameter = ORDINAL_BULLET_COLOR;
- if (data!=null){
- color = HtmlColor.decode(data.toString());
- } else {
- String skinParameter = "headerTextColor";
- String headerTextColor = (String) skin.getParameter(context, skinParameter);
- if (null == headerTextColor || "".equals(headerTextColor))
- headerTextColor = (String) defaultSkin.getParameter(context, skinParameter);
-
- if(headerTextColor == null) {
- return null;
+ if (data != null) {
+ if (((Boolean)data).booleanValue()) {
+ skinParameter = TOP_BULLET_COLOR;
}
-
- color = HtmlColor.decode(headerTextColor);
}
+ String headerTextColor = (String) skin.getParameter(context, skinParameter);
+ if (null == headerTextColor || "".equals(headerTextColor))
+ headerTextColor = (String) defaultSkin.getParameter(context, skinParameter);
+ if(headerTextColor == null) {
+ return null;
+ }
+
+ color = HtmlColor.decode(headerTextColor);
+
new Zipper2(ret).addColor(color);
return ret;