Author: vmolotkov
Date: 2007-11-13 13:04:52 -0500 (Tue, 13 Nov 2007)
New Revision: 3959
Modified:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss
Log:
disabled buttons was added
Modified:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
===================================================================
---
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-13
16:41:29 UTC (rev 3958)
+++
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-13
18:04:52 UTC (rev 3959)
@@ -71,6 +71,18 @@
private final static String ATTRIBUTE_CAPTION_LABEL = "captionLabel";
+ private final static String ATTRIBUTE_CLASS_TOP_CONTROL = "topControlClass";
+
+ private final static String ATTRIBUTE_CLASS_BOTTOM_CONTROL =
"bottomControlClass";
+
+ private final static String ATTRIBUTE_CLASS_DOWN_CONTROL =
"downControlClass";
+
+ private final static String ATTRIBUTE_CLASS_UP_CONTROL = "upControlClass";
+
+ private final static String ATTRIBUTE_CLASS_DISABLED_CONTROL =
"disabledControlClass";
+
+ private final static String STYLE_SKIN_CONTROL_BUTTON = "ol_button_control";
+
private final static String DIS_CONTROL_ID_PREFIX = "dis";
private final static String CONTROL_ID_UP = "up";
@@ -96,18 +108,28 @@
private String customEvent;
+ private String styleFromAttribute;
+
+ private String buttonStyle;
+
+ private boolean enable;
+
public abstract boolean isRendered(FacesContext context, UIOrderingList list);
public ControlsHelper(String name, String text, String imageURI,
- String facetName, String styleClassName, String idSuffix, String customEvent) {
+ String facetName, String styleClassName, String styleFromAttribute, String
buttonStyle,
+ String idSuffix, String customEvent, boolean isEnable) {
super();
this.name = name;
this.text = text;
this.imageURI = imageURI;
this.facetName = facetName;
this.styleClassName = styleClassName;
+ this.styleFromAttribute = styleFromAttribute;
this.idSuffix = idSuffix;
this.customEvent = customEvent;
+ this.buttonStyle = buttonStyle;
+ this.enable = isEnable;
}
public String getName() {
@@ -133,11 +155,28 @@
public String getIdSuffix() {
return idSuffix;
}
+
+ public String getCustomEvent() {
+ return customEvent;
+ }
+
+ public String getStyleFromAttribute() {
+ return styleFromAttribute;
+ }
+
+ public String getButtonStyle() {
+ return buttonStyle;
+ }
+
+ public boolean isEnable() {
+ return enable;
+ }
};
protected static final ControlsHelper[] HELPERS = new ControlsHelper[] {
new ControlsHelper("top", "↟",
OrderingListIconTop.class.getName(), FACET_TOP,
- "rich-ordering-control-top", CONTROL_ID_TOP, ATTRIBUTE_CE_ONTOPCLICK) {
+ " rich-ordering-control-top", ATTRIBUTE_CLASS_TOP_CONTROL,
"ol_control_bn_top",
+ CONTROL_ID_TOP, ATTRIBUTE_CE_ONTOPCLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isFastOrderControlsVisible();
@@ -145,7 +184,8 @@
},
new ControlsHelper("disabledTop", "↟",
OrderingListIconTopDisabled.class.getName(), FACET_DIS_TOP,
- "rich-ordering-control-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_TOP), null) {
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL,
"ol_control_dbn_top",
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_TOP), null, false) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isFastOrderControlsVisible();
@@ -153,7 +193,8 @@
},
new ControlsHelper("up", "↑",
OrderingListIconUp.class.getName(), FACET_UP,
- "rich-ordering-control-up", CONTROL_ID_UP, ATTRIBUTE_CE_ONUPCLICK) {
+ " rich-ordering-control-up", ATTRIBUTE_CLASS_UP_CONTROL,
"ol_control_bn_up",
+ CONTROL_ID_UP, ATTRIBUTE_CE_ONUPCLICK ,true) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isOrderControlsVisible();
@@ -161,7 +202,8 @@
},
new ControlsHelper("disabledUp", "↑",
OrderingListIconUpDisabled.class.getName(), FACET_DIS_UP,
- "rich-ordering-control-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_UP), null) {
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL,
"ol_control_dbn_up",
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_UP), null, false) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isOrderControlsVisible();
@@ -169,7 +211,8 @@
},
new ControlsHelper("down", "↓",
OrderingListIconDown.class.getName(), FACET_DOWN,
- "rich-ordering-control-down", CONTROL_ID_DOWN, ATTRIBUTE_CE_ONDOWNCLICK) {
+ " rich-ordering-control-down", ATTRIBUTE_CLASS_DOWN_CONTROL,
"ol_control_bn_down",
+ CONTROL_ID_DOWN, ATTRIBUTE_CE_ONDOWNCLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isFastOrderControlsVisible();
@@ -177,23 +220,26 @@
},
new ControlsHelper("disabledDown", "↓",
OrderingListIconDownDisabled.class.getName(), FACET_DIS_DOWN,
- "rich-ordering-control-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_DOWN), null) {
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL,
"ol_control_dbn_down",
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_DOWN), null, false) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isFastOrderControlsVisible();
}
},
- new ControlsHelper("botton", "↡",
OrderingListIconBottom.class.getName(), FACET_BOTTOM,
- "rich-ordering-control-bottom", CONTROL_ID_BOTTOM,
ATTRIBUTE_CE_ONBOTTOMCLICK) {
+ new ControlsHelper("bottom", "↡",
OrderingListIconBottom.class.getName(), FACET_BOTTOM,
+ " rich-ordering-control-bottom", ATTRIBUTE_CLASS_BOTTOM_CONTROL,
"ol_control_bn_bottom",
+ CONTROL_ID_BOTTOM, ATTRIBUTE_CE_ONBOTTOMCLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isOrderControlsVisible();
}
},
- new ControlsHelper("disabledBotton", "↡",
OrderingListIconBottomDisabled.class.getName(), FACET_DIS_BOTTOM,
- "rich-ordering-control-disabled",
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_BOTTOM), null) {
+ new ControlsHelper("disabledBottom", "↡",
OrderingListIconBottomDisabled.class.getName(), FACET_DIS_BOTTOM,
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL,
"ol_control_dbn_bottom",
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_BOTTOM), null, false) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isOrderControlsVisible();
@@ -275,7 +321,11 @@
if (helper.customEvent != null) {
customEvent = (String) attributes.get(helper.customEvent);
}
-
+ String styleFromAttribute = (String) attributes.get(helper.styleFromAttribute);
+ String currentStyle = helper.getStyleClassName();
+ if (styleFromAttribute != null) {
+ currentStyle = styleFromAttribute.concat(currentStyle);
+ }
String htmlElem = null;
if (CONTROL_TYPE_BUTTON.equals(controlType)) {
isButton = true;
@@ -296,7 +346,6 @@
if (htmlElem != null) {
writer.startElement(htmlElem, orderingList);
writer.writeAttribute(HTML.id_ATTRIBUTE, clientId + helper.getIdSuffix(), null);
- writer.writeAttribute(HTML.class_ATTRIBUTE, helper.getStyleClassName(), null);
if (customEvent != null) {
writer.writeAttribute(HTML.onclick_ATTRIBUTE, customEvent, null);
}
@@ -307,10 +356,14 @@
} else {
if (isButton) {
writer.writeAttribute("style", "font-size: 1.5em;", null);
- writer.write(helper.getText());
+ currentStyle = helper.buttonStyle.concat(currentStyle);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
+ if (!helper.enable) {
+ writer.writeAttribute(HTML.DISABLED_ATTR, "true", null);
+ }
} else {
+ writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
writer.startElement(HTML.IMG_ELEMENT, orderingList);
-
writer.writeAttribute("border", "0", null);
writer.writeAttribute("alt", helper.getFacetName(), null);
writer.writeAttribute("src",
getResource(helper.getImageURI()).getUri(context, null), null);
Modified:
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss
===================================================================
---
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2007-11-13
16:41:29 UTC (rev 3958)
+++
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2007-11-13
18:04:52 UTC (rev 3959)
@@ -140,43 +140,71 @@
<u:style name="color" skin="generalTextColor"/>
<u:style name="font-size" skin="generalSizeFont"/>
<u:style name="font-family" skin="generalFamilyFont"/>
+ <u:style name="width" value="16px"/>
+ <u:style name="height" value="16px"/>
+ <u:style name="border" value="0"/>
</u:selector>
<u:selector name=".ol_control_bn_up">
<u:style name="background-image">
<f:resource f:key="org.richfaces.renderkit.html.images.OrderingListIconUp"
/>
</u:style>
+ <u:style name="width" value="18px"/>
+ <u:style name="height" value="18px"/>
+ <u:style name="border" value="1"/>
</u:selector>
<u:selector name=".ol_control_bn_down">
+ <u:style name="width" value="18px"/>
+ <u:style name="height" value="18px"/>
+ <u:style name="border" value="1"/>
<u:style name="background-image">
<f:resource
f:key="org.richfaces.renderkit.html.images.OrderingListIconDown" />
</u:style>
</u:selector>
<u:selector name=".ol_control_bn_top">
+ <u:style name="width" value="18px"/>
+ <u:style name="height" value="18px"/>
+ <u:style name="border" value="1"/>
<u:style name="background-image">
<f:resource
f:key="org.richfaces.renderkit.html.images.OrderingListIconTop" />
</u:style>
</u:selector>
<u:selector name=".ol_control_bn_bottom">
+ <u:style name="width" value="18px"/>
+ <u:style name="height" value="18px"/>
+ <u:style name="border" value="1"/>
<u:style name="background-image">
<f:resource
f:key="org.richfaces.renderkit.html.images.OrderingListIconBottom" />
</u:style>
</u:selector>
<u:selector name=".ol_control_dbn_up">
+ <u:style name="width" value="18px"/>
+ <u:style name="height" value="18px"/>
+ <u:style name="border" value="1"/>
+ <u:style name="disabled" value="true"/>
<u:style name="background-image">
<f:resource
f:key="org.richfaces.renderkit.html.images.OrderingListIconUpDisabled" />
</u:style>
</u:selector>
<u:selector name=".ol_control_dbn_down">
+ <u:style name="width" value="18px"/>
+ <u:style name="height" value="18px"/>
+ <u:style name="border" value="1"/>
<u:style name="background-image">
<f:resource
f:key="org.richfaces.renderkit.html.images.OrderingListIconDownDisabled" />
</u:style>
</u:selector>
<u:selector name=".ol_control_dbn_top">
+ <u:style name="width" value="18px"/>
+ <u:style name="height" value="18px"/>
+ <u:style name="border" value="1"/>
<u:style name="background-image">
<f:resource
f:key="org.richfaces.renderkit.html.images.OrderingListIconTopDisabled" />
</u:style>
</u:selector>
<u:selector name=".ol_control_dbn_bottom">
+ <u:style name="width" value="18px"/>
+ <u:style name="height" value="18px"/>
+ <u:style name="border" value="1"/>
<u:style name="background-image">
<f:resource
f:key="org.richfaces.renderkit.html.images.OrderingListIconBottomDisabled"
/>
</u:style>