Author: tkuprevich
Date: 2009-04-02 07:05:10 -0400 (Thu, 02 Apr 2009)
New Revision: 13357
Added:
trunk/test-applications/facelets/src/main/java/colorPicker/ColorPickerConverter.java
Modified:
trunk/test-applications/facelets/src/main/java/colorPicker/ColorPicker.java
trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPicker.xhtml
trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPickerProperty.xhtml
trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Converter.xml
Log:
Modified: trunk/test-applications/facelets/src/main/java/colorPicker/ColorPicker.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/colorPicker/ColorPicker.java 2009-04-02
11:04:33 UTC (rev 13356)
+++ trunk/test-applications/facelets/src/main/java/colorPicker/ColorPicker.java 2009-04-02
11:05:10 UTC (rev 13357)
@@ -17,23 +17,33 @@
public class ColorPicker implements Validator, Converter {
private HtmlColorPicker component;
private String colorMode;// hex, rgb
- private String converterMessage;
- private boolean disabled;
+ private String converterMessage;
private boolean flat;
private boolean immediate;
private boolean localValueSet;
private boolean rendered;
+ private boolean facets;
private boolean required;
private String requiredMessage;
private boolean valid;
private String validatorMessage;
private String value;
+ private String facetsValue;
private String bindLabel;
+ private String showEvent;
+ public String getShowEvent() {
+ return showEvent;
+ }
+
+ public void setShowEvent(String showEvent) {
+ this.showEvent = showEvent;
+ }
+
public ColorPicker() {
+ facets = false;
colorMode = "rgb";
- converterMessage = "custom converter message";
- disabled = false;
+ converterMessage = "custom converter message";
flat = false;
immediate = false;
localValueSet = true;
@@ -42,8 +52,10 @@
requiredMessage = "custom required message";
valid = true;
validatorMessage = "custom validator message";
- value = "rgb(255, 250, 240)";
+ value = new String();
+ facetsValue = new String();
bindLabel = "Click Binding";
+ showEvent = "onclick";
}
public void checkBinding(ActionEvent e){
@@ -71,9 +83,10 @@
public void validate(FacesContext context, UIComponent component,
Object value) throws ValidatorException {
+ System.out.println("<<<Color Picker Validator Works>>>");
String str = value.toString();
if (str.startsWith("rgb")) {
- if (str.indexOf("100") != -1)
+ if (str.indexOf("56") != -1)
throw new ValidatorException(new FacesMessage(
"Test validator: 100 is restricted!"));
}
@@ -115,16 +128,8 @@
public void setConverterMessage(String converterMessage) {
this.converterMessage = converterMessage;
- }
+ }
- public boolean isDisabled() {
- return disabled;
- }
-
- public void setDisabled(boolean disabled) {
- this.disabled = disabled;
- }
-
public boolean isFlat() {
return flat;
}
@@ -197,4 +202,21 @@
this.bindLabel = bindLabel;
}
+ public boolean isFacets() {
+ return facets;
+ }
+
+ public void setFacets(boolean facets) {
+ this.facets = facets;
+ }
+
+ public String getFacetsValue() {
+ return facetsValue;
+ }
+
+ public void setFacetsValue(String facetsValue) {
+ this.facetsValue = facetsValue;
+ }
+
+
}
Added:
trunk/test-applications/facelets/src/main/java/colorPicker/ColorPickerConverter.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/colorPicker/ColorPickerConverter.java
(rev 0)
+++
trunk/test-applications/facelets/src/main/java/colorPicker/ColorPickerConverter.java 2009-04-02
11:05:10 UTC (rev 13357)
@@ -0,0 +1,30 @@
+package colorPicker;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.swing.tree.TreeNode;
+import util.data.*;
+
+public class ColorPickerConverter implements Converter {
+
+ public Object getAsObject(FacesContext context, UIComponent component,
+ String value) {
+ System.out.println("<<<ColorPicker Converter getAsObject()
Called>>>");
+ String str = value.toString();
+ return str;
+ }
+
+ public String getAsString(FacesContext context, UIComponent component,
+ Object value) {
+ System.out.println("<<<ColorPicker Converter getAsString()
Called>>>");
+ if (value instanceof String) {
+ String str = value.toString();
+ return str;
+ } else
+ throw new ConverterException(
+ "Test Application: Error in custom converted
colorPicker.ColorPickerConverter.java");
+ }
+
+}
Modified: trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPicker.xhtml
===================================================================
---
trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPicker.xhtml 2009-04-02
11:04:33 UTC (rev 13356)
+++
trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPicker.xhtml 2009-04-02
11:05:10 UTC (rev 13357)
@@ -4,22 +4,43 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich" id="calendarSubviewID">
<rich:colorPicker binding="#{colorPicker.component}"
- colorMode="hex" converter="colorPickerConverter"
+ colorMode="#{colorPicker.colorMode}"
converter="colorPickerConverter"
converterMessage="#{colorPicker.converterMessage}"
- flat="#{colorPicker.flat}"
- id="colorPickerID" immediate="#{colorPicker.immediate}"
- localValueSet="#{colorPicker.localValueSet}"
+ flat="#{colorPicker.flat}" id="colorPickerID"
+ immediate="#{colorPicker.immediate}" onclick="#{event.onclick}"
+ ondblclick="#{event.ondblclick}" onkeydown="#{event.onkeydown}"
+ onkeypress="#{event.onkeypress}" onkeyup="#{event.onkeyup}"
+ onmousedown="#{event.onmousedown}"
onmousemove="#{event.onmousemove}"
+ onmouseout="#{event.onmouseout}"
onmouseover="#{event.onmouseover}"
+ onmouseup="#{event.onmouseup}"
+ rendered="#{colorPicker.rendered and !colorPicker.facets}"
+ showEvent="#{colorPicker.showEvent}"
+ validator="#{colorPicker.validate}"
+ validatorMessage="#{colorPicker.validatorMessage}"
+ value="#{colorPicker.value}"
+ valueChangeListener="#{colorPicker.changeValue}">
+ </rich:colorPicker>
+
+ <rich:colorPicker colorMode="#{colorPicker.colorMode}"
+ flat="#{colorPicker.flat}" id="colorPickerIDFacets"
onclick="#{event.onclick}" ondblclick="#{event.ondblclick}"
onkeydown="#{event.onkeydown}" onkeypress="#{event.onkeypress}"
onkeyup="#{event.onkeyup}" onmousedown="#{event.onmousedown}"
onmousemove="#{event.onmousemove}"
onmouseout="#{event.onmouseout}"
onmouseover="#{event.onmouseover}" onmouseup="#{event.onmouseup}"
- rendered="#{colorPicker.rendered}"
required="#{colorPicker.required}"
- requiredMessage="#{colorPicker.requiredMessage}"
- showEvent="onmouseover" valid="#{colorPicker.valid}"
+ rendered="#{colorPicker.rendered and colorPicker.facets}"
+ showEvent="#{colorPicker.showEvent}"
validator="#{colorPicker.validate}"
validatorMessage="#{colorPicker.validatorMessage}"
- value="#ffffff"
+ value="#{colorPicker.facetsValue}"
valueChangeListener="#{colorPicker.changeValue}">
+ <f:facet name="icon">
+ <h:graphicImage value="/ColorPicker/images/colorPicker_ico.png"
+ width="18px" height="18px"></h:graphicImage>
+ </f:facet>
+ <f:facet name="arrows">
+ <h:graphicImage value="/ColorPicker/images/colorPicker_ico.png"
+ width="30px" height="5px"></h:graphicImage>
+ </f:facet>
</rich:colorPicker>
</f:subview>
\ No newline at end of file
Modified:
trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPickerProperty.xhtml
===================================================================
---
trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPickerProperty.xhtml 2009-04-02
11:04:33 UTC (rev 13356)
+++
trunk/test-applications/facelets/src/main/webapp/ColorPicker/ColorPickerProperty.xhtml 2009-04-02
11:05:10 UTC (rev 13357)
@@ -7,57 +7,62 @@
action="#{colorPicker.addColorPicker}"></h:commandButton>
<h:panelGrid columns="2">
<h:outputText value="colorMode" />
- <h:selectOneRadio value="#{colorPicker.colorMode}"
- onchange="submit">
+ <h:selectOneRadio value="#{colorPicker.colorMode}">
<f:selectItem itemLabel="rgb" itemValue="rgb" />
<f:selectItem itemLabel="hex" itemValue="hex" />
</h:selectOneRadio>
+ <h:outputText value="showEvent: "></h:outputText>
+ <h:inputText value="#{colorPicker.showEvent}">
+ </h:inputText>
+
<h:outputText value="converterMessage: "></h:outputText>
- <h:inputText value="#{colorPicker.converterMessage}"
- onchange="submit"></h:inputText>
+ <h:inputText value="#{colorPicker.converterMessage}">
+ </h:inputText>
- <h:outputText value="disabled" />
- <h:selectBooleanCheckbox value="#{colorPicker.disabled}"
- onclick="submit" />
-
<h:outputText value="flat" />
- <h:selectBooleanCheckbox value="#{colorPicker.flat}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.flat}">
+ </h:selectBooleanCheckbox>
<h:outputText value="immediate" />
- <h:selectBooleanCheckbox value="#{colorPicker.immediate}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.immediate}">
+ </h:selectBooleanCheckbox>
<h:outputText value="localValueSet" />
- <h:selectBooleanCheckbox value="#{colorPicker.localValueSet}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.localValueSet}">
+ </h:selectBooleanCheckbox>
<h:outputText value="rendered" />
- <h:selectBooleanCheckbox value="#{colorPicker.rendered}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.rendered}">
+ </h:selectBooleanCheckbox>
<h:outputText value="required" />
- <h:selectBooleanCheckbox value="#{colorPicker.required}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.required}">
+ </h:selectBooleanCheckbox>
+ <h:outputText value="facets" />
+ <h:selectBooleanCheckbox value="#{colorPicker.facets}">
+ </h:selectBooleanCheckbox>
+
<h:outputText value="requiredMessage: "></h:outputText>
- <h:inputText value="#{colorPicker.requiredMessage}"
- onchange="submit"></h:inputText>
+ <h:inputText value="#{colorPicker.requiredMessage}">
+ </h:inputText>
<h:outputText value="valid" />
- <h:selectBooleanCheckbox value="#{colorPicker.valid}"
- onclick="submit" />
+ <h:selectBooleanCheckbox value="#{colorPicker.valid}">
+ </h:selectBooleanCheckbox>
<h:outputText value="validatorMessage: "></h:outputText>
- <h:inputText value="#{colorPicker.validatorMessage}"
- onchange="submit;"></h:inputText>
+ <h:inputText value="#{colorPicker.validatorMessage}">
+ </h:inputText>
<h:commandButton actionListener="#{colorPicker.checkBinding}"
value="Binding">
<a4j:support event="onclick"
reRender="bindLabelID"></a4j:support>
</h:commandButton>
<h:outputText value="#{colorPicker.bindLabel}" id="bindLabelID"
/>
-
+
</h:panelGrid>
+
+
</f:subview>
\ No newline at end of file
Modified:
trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Converter.xml
===================================================================
---
trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Converter.xml 2009-04-02
11:04:33 UTC (rev 13356)
+++
trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-Converter.xml 2009-04-02
11:05:10 UTC (rev 13357)
@@ -2,20 +2,28 @@
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces
Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
- <converter>
- <converter-id>listShuttleConverter</converter-id>
- <converter-class>util.converter.ListShuttleConverter</converter-class>
- </converter>
- <converter>
- <converter-id>orderingListConverter</converter-id>
- <converter-class>util.converter.OrderingListConverter</converter-class>
- </converter>
- <converter>
- <converter-id>inplaceInputConverter</converter-id>
- <converter-class>util.converter.InplaceInputConverter</converter-class>
- </converter>
- <converter>
- <converter-id>colorPickerConverter</converter-id>
- <converter-class>colorPicker.ColorPicker</converter-class>
- </converter>
+ <converter>
+ <converter-id>listShuttleConverter</converter-id>
+ <converter-class>
+ util.converter.ListShuttleConverter
+ </converter-class>
+ </converter>
+ <converter>
+ <converter-id>orderingListConverter</converter-id>
+ <converter-class>
+ util.converter.OrderingListConverter
+ </converter-class>
+ </converter>
+ <converter>
+ <converter-id>inplaceInputConverter</converter-id>
+ <converter-class>
+ util.converter.InplaceInputConverter
+ </converter-class>
+ </converter>
+ <converter>
+ <converter-id>colorPickerConverter</converter-id>
+ <converter-class>
+ colorPicker.ColorPickerConverter
+ </converter-class>
+ </converter>
</faces-config>