Author: mvitenkov
Date: 2009-04-06 08:22:40 -0400 (Mon, 06 Apr 2009)
New Revision: 13389
Added:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/colorPicker/ColorPickerConverter.java
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/ColorPicker.xhtml
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/ColorPickerProperty.xhtml
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/ColorPickerStraightforward.xhtml
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/images/
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/images/colorPicker_ico.png
Modified:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/colorPicker/ColorPicker.java
trunk/test-applications/seamApp/web/src/main/webapp/WEB-INF/faces-config.xml
Log:
Modified:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/colorPicker/ColorPicker.java
===================================================================
---
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/colorPicker/ColorPicker.java 2009-04-06
12:15:57 UTC (rev 13388)
+++
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/colorPicker/ColorPicker.java 2009-04-06
12:22:40 UTC (rev 13389)
@@ -22,23 +22,33 @@
public class ColorPicker implements Validator, Converter {
private HtmlColorPicker htmlColorPicker;
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;
@@ -47,8 +57,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){
@@ -76,9 +88,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!"));
}
@@ -96,8 +109,16 @@
if (value.toString().indexOf("100") != -1)
throw new ConverterException(new FacesMessage("Test converter(getAsString): 100
is restricted!"));
return value.toString();
- }
+ }
+ public HtmlColorPicker getHtmlColorPicker() {
+ return htmlColorPicker;
+ }
+
+ public void setHtmlColorPicker(HtmlColorPicker htmlColorPicker) {
+ this.htmlColorPicker = htmlColorPicker;
+ }
+
public String getColorMode() {
return colorMode;
}
@@ -112,16 +133,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;
}
@@ -194,12 +207,19 @@
this.bindLabel = bindLabel;
}
- public HtmlColorPicker getHtmlColorPicker() {
- return htmlColorPicker;
+ public boolean isFacets() {
+ return facets;
}
- public void setHtmlColorPicker(HtmlColorPicker htmlColorPicker) {
- this.htmlColorPicker = htmlColorPicker;
+ public void setFacets(boolean facets) {
+ this.facets = facets;
}
-}
+ public String getFacetsValue() {
+ return facetsValue;
+ }
+
+ public void setFacetsValue(String facetsValue) {
+ this.facetsValue = facetsValue;
+ }
+}
\ No newline at end of file
Added:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/colorPicker/ColorPickerConverter.java
===================================================================
---
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/colorPicker/ColorPickerConverter.java
(rev 0)
+++
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/colorPicker/ColorPickerConverter.java 2009-04-06
12:22:40 UTC (rev 13389)
@@ -0,0 +1,31 @@
+package org.richfaces.helloworld.domain.colorPicker;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+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 if (value == null) {
+ value = new String();
+ String str = value.toString();
+ return str;
+ } else
+ throw new ConverterException(
+ "Error in custom converted colorPicker.ColorPickerConverter.java");
+ }
+}
\ No newline at end of file
Added: trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/ColorPicker.xhtml
===================================================================
--- trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/ColorPicker.xhtml
(rev 0)
+++
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/ColorPicker.xhtml 2009-04-06
12:22:40 UTC (rev 13389)
@@ -0,0 +1,46 @@
+<f:subview
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:rich="http://richfaces.org/rich" id="calendarSubviewID">
+ <rich:colorPicker binding="#{colorPicker.htmlColorPicker}"
+ colorMode="#{colorPicker.colorMode}"
converter="colorPickerConverter"
+ converterMessage="#{colorPicker.converterMessage}"
+ 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 and colorPicker.facets}"
+ showEvent="#{colorPicker.showEvent}"
+ validator="#{colorPicker.validate}"
+ validatorMessage="#{colorPicker.validatorMessage}"
+ 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
Added:
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/ColorPickerProperty.xhtml
===================================================================
---
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/ColorPickerProperty.xhtml
(rev 0)
+++
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/ColorPickerProperty.xhtml 2009-04-06
12:22:40 UTC (rev 13389)
@@ -0,0 +1,68 @@
+<f:subview
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:rich="http://richfaces.org/rich"
id="calendarPropertySubviewID">
+ <h:commandButton value="add test"
+ action="#{colorPicker.addColorPicker}"></h:commandButton>
+ <h:panelGrid columns="2">
+ <h:outputText value="colorMode" />
+ <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}">
+ </h:inputText>
+
+ <h:outputText value="flat" />
+ <h:selectBooleanCheckbox value="#{colorPicker.flat}">
+ </h:selectBooleanCheckbox>
+
+ <h:outputText value="immediate" />
+ <h:selectBooleanCheckbox value="#{colorPicker.immediate}">
+ </h:selectBooleanCheckbox>
+
+ <h:outputText value="localValueSet" />
+ <h:selectBooleanCheckbox value="#{colorPicker.localValueSet}">
+ </h:selectBooleanCheckbox>
+
+ <h:outputText value="rendered" />
+ <h:selectBooleanCheckbox value="#{colorPicker.rendered}">
+ </h:selectBooleanCheckbox>
+
+ <h:outputText value="required" />
+ <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}">
+ </h:inputText>
+
+ <h:outputText value="valid" />
+ <h:selectBooleanCheckbox value="#{colorPicker.valid}">
+ </h:selectBooleanCheckbox>
+
+ <h:outputText value="validatorMessage: "></h:outputText>
+ <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
Added:
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/ColorPickerStraightforward.xhtml
===================================================================
---
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/ColorPickerStraightforward.xhtml
(rev 0)
+++
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/ColorPickerStraightforward.xhtml 2009-04-06
12:22:40 UTC (rev 13389)
@@ -0,0 +1,8 @@
+<f:subview
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:rich="http://richfaces.org/rich"
+ id="calendarStraightforwardSubviewID">
+
+</f:subview>
\ No newline at end of file
Added:
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/images/colorPicker_ico.png
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seamApp/web/src/main/webapp/ColorPicker/images/colorPicker_ico.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/test-applications/seamApp/web/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/test-applications/seamApp/web/src/main/webapp/WEB-INF/faces-config.xml 2009-04-06
12:15:57 UTC (rev 13388)
+++
trunk/test-applications/seamApp/web/src/main/webapp/WEB-INF/faces-config.xml 2009-04-06
12:22:40 UTC (rev 13389)
@@ -22,7 +22,9 @@
</converter>
<converter>
<converter-id>colorPickerConverter</converter-id>
- <converter-class>org.richfaces.helloworld.domain.colorPicker.ColorPicker</converter-class>
+ <converter-class>
+ org.richfaces.helloworld.domain.colorPicker.ColorPickerConverter
+ </converter-class>
</converter>
<validator>
<validator-id>CalendarValidator</validator-id>