Author: mvitenkov
Date: 2009-03-17 11:26:00 -0400 (Tue, 17 Mar 2009)
New Revision: 12982
Added:
trunk/test-applications/jsp/src/main/java/colorPicker/
trunk/test-applications/jsp/src/main/java/colorPicker/ColorPicker.java
trunk/test-applications/jsp/src/main/webapp/ColorPicker/
trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPicker.jsp
trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPickerProperty.jsp
trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPickerStraightforward.jsp
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-ColorPicker.xml
Modified:
trunk/test-applications/jsp/src/main/java/rich/RichBean.java
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Converter.xml
trunk/test-applications/jsp/src/main/webapp/WEB-INF/web.xml
Log:
Add colorPicker to jsp test application
Added: trunk/test-applications/jsp/src/main/java/colorPicker/ColorPicker.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/colorPicker/ColorPicker.java
(rev 0)
+++ trunk/test-applications/jsp/src/main/java/colorPicker/ColorPicker.java 2009-03-17
15:26:00 UTC (rev 12982)
@@ -0,0 +1,200 @@
+package colorPicker;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+import org.richfaces.component.html.HtmlColorPicker;
+
+import util.componentInfo.ComponentInfo;
+
+public class ColorPicker implements Validator, Converter {
+ private HtmlColorPicker component;
+ private String colorMode;// hex, rgb
+ private String converterMessage;
+ private boolean disabled;
+ private boolean flat;
+ private boolean immediate;
+ private boolean localValueSet;
+ private boolean rendered;
+ private boolean required;
+ private String requiredMessage;
+ private boolean valid;
+ private String validatorMessage;
+ private String value;
+ private String bindLabel;
+
+ public ColorPicker() {
+ colorMode = "hex";
+ converterMessage = "custom converter message";
+ disabled = false;
+ flat = false;
+ immediate = false;
+ localValueSet = true;
+ rendered = true;
+ required = false;
+ requiredMessage = "custom required message";
+ valid = true;
+ validatorMessage = "custom validator message";
+ value = "rgb(255, 250, 240)";
+ bindLabel = "Click Binding";
+ }
+
+ public void checkBinding(ActionEvent e){
+ FacesContext context = FacesContext.getCurrentInstance();
+ bindLabel = component.getClientId(context);
+ }
+
+ public void changeValue(ValueChangeEvent e) {
+ System.out.println("old value:" + e.getOldValue() + " new value:"
+ + e.getNewValue());
+ }
+
+ public void addColorPicker() {
+ ComponentInfo info = ComponentInfo.getInstance();
+ info.addField(component);
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void validate(FacesContext context, UIComponent component,
+ Object value) throws ValidatorException {
+ String str = value.toString();
+ if (str.startsWith("rgb")) {
+ if (str.indexOf("100") != -1)
+ throw new ValidatorException(new FacesMessage(
+ "Test validator: 100 is restricted!"));
+ }
+ }
+
+ public Object getAsObject(FacesContext context, UIComponent component,
+ String value) throws ConverterException {
+ if (value.indexOf("100") != -1)
+ throw new ConverterException(new FacesMessage("Test converter(getAsObject): 100
is restricted!"));
+ return new String(value + " converted");
+ }
+
+ public String getAsString(FacesContext context, UIComponent component,
+ Object value) throws ConverterException {
+ if (value.toString().indexOf("100") != -1)
+ throw new ConverterException(new FacesMessage("Test converter(getAsString): 100
is restricted!"));
+ return value.toString();
+ }
+
+ public HtmlColorPicker getComponent() {
+ return component;
+ }
+
+ public void setComponent(HtmlColorPicker component) {
+ this.component = component;
+ }
+
+ public String getColorMode() {
+ return colorMode;
+ }
+
+ public void setColorMode(String colorMode) {
+ this.colorMode = colorMode;
+ }
+
+ public String getConverterMessage() {
+ return converterMessage;
+ }
+
+ 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;
+ }
+
+ public void setFlat(boolean flat) {
+ this.flat = flat;
+ }
+
+ public boolean isImmediate() {
+ return immediate;
+ }
+
+ public void setImmediate(boolean immediate) {
+ this.immediate = immediate;
+ }
+
+ public boolean isLocalValueSet() {
+ return localValueSet;
+ }
+
+ public void setLocalValueSet(boolean localValueSet) {
+ this.localValueSet = localValueSet;
+ }
+
+ public boolean isRendered() {
+ return rendered;
+ }
+
+ public void setRendered(boolean rendered) {
+ this.rendered = rendered;
+ }
+
+ public boolean isRequired() {
+ return required;
+ }
+
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+ public String getRequiredMessage() {
+ return requiredMessage;
+ }
+
+ public void setRequiredMessage(String requiredMessage) {
+ this.requiredMessage = requiredMessage;
+ }
+
+ public boolean isValid() {
+ return valid;
+ }
+
+ public void setValid(boolean valid) {
+ this.valid = valid;
+ }
+
+ public String getValidatorMessage() {
+ return validatorMessage;
+ }
+
+ public void setValidatorMessage(String validatorMessage) {
+ this.validatorMessage = validatorMessage;
+ }
+
+ public String getBindLabel() {
+ return bindLabel;
+ }
+
+ public void setBindLabel(String bindLabel) {
+ this.bindLabel = bindLabel;
+ }
+
+}
Modified: trunk/test-applications/jsp/src/main/java/rich/RichBean.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/rich/RichBean.java 2009-03-17 15:18:12 UTC
(rev 12981)
+++ trunk/test-applications/jsp/src/main/java/rich/RichBean.java 2009-03-17 15:26:00 UTC
(rev 12982)
@@ -26,6 +26,7 @@
// map.add( value, add( pages_path/name_pages, array<boolean>(Property,
Straightforward) );
map.add("Blank", add("/pages/Blank/Blank", new boolean [] {true,
true, true}));
map.add("Calendar", add("/Calendar/Calendar", new boolean [] {true,
true, true}));
+ map.add("ColorPicker", add("/ColorPicker/ColorPicker", new boolean
[] {false, true, false}));
map.add("DataFilterSlider",
add("/DataFilterSlider/DataFilterSlider", new boolean [] {true, true, false}));
map.add("DataScroller", add("/DataScroller/DataScroller", new
boolean [] {true, true, true}));
map.add("DataTable", add("/DataTable/DataTable", new boolean []
{true, true, true}));
@@ -75,8 +76,8 @@
map.add("ExtendedDataTable",
add("/ExtendedDataTable/ExtendedDataTable", new boolean [] {false, true,
false}));
map.add("Editor", add("/Editor/Editor", new boolean [] {true, true,
false}));
map.add("tTree", add("/tTree/tTree", new boolean [] {true, true,
true}));
- map.add("Queue", add("/Queue/Queue", new boolean [] {false, true,
true}));
- Iterator<String> iterator = map.getSet().iterator();
+ map.add("Queue", add("/Queue/Queue", new boolean [] {false, true,
true}));
+ Iterator<String> iterator = map.getSet().iterator();
while(iterator.hasNext()){
list.add(new SelectItem(iterator.next()));
}
Added: trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPicker.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPicker.jsp
(rev 0)
+++ trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPicker.jsp 2009-03-17
15:26:00 UTC (rev 12982)
@@ -0,0 +1,26 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib
uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib
uri="http://richfaces.org/rich" prefix="rich"%>
+
+<f:subview id="colorPickerSubviewID">
+ <rich:colorPicker binding="#{colorPicker.component}"
+ colorMode="hex" converter="colorPickerConverter"
+ converterMessage="#{colorPicker.converterMessage}"
+ disabled="#{colorPicker.disabled}" flat="#{colorPicker.flat}"
+ id="colorPickerID" immediate="#{colorPicker.immediate}"
+ localValueSet="#{colorPicker.localValueSet}"
+ 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}"
+ validator="#{colorPicker.validate}"
+ validatorMessage="#{colorPicker.validatorMessage}"
+ value="#{colorPicker.value}"
+ valueChangeListener="#{colorPicker.changeValue}">
+ </rich:colorPicker>
+</f:subview>
Added: trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPickerProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPickerProperty.jsp
(rev 0)
+++
trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPickerProperty.jsp 2009-03-17
15:26:00 UTC (rev 12982)
@@ -0,0 +1,64 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib
uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib
uri="http://richfaces.org/rich" prefix="rich"%>
+
+<f:subview id="colorPickerPropertySubviewID">
+ <h:commandButton value="add test"
+ action="#{colorPicker.addColorPicker}"></h:commandButton>
+ <h:panelGrid columns="2">
+ <h:outputText value="colorMode" />
+ <h:selectOneRadio value="#{colorPicker.colorMode}"
+ onchange="submit">
+ <f:selectItem itemLabel="rgb" itemValue="rgb" />
+ <f:selectItem itemLabel="hex" itemValue="hex" />
+ </h:selectOneRadio>
+
+ <h:outputText value="converterMessage: "></h:outputText>
+ <h:inputText value="#{colorPicker.converterMessage}"
+ onchange="submit();"></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:outputText value="immediate" />
+ <h:selectBooleanCheckbox value="#{colorPicker.immediate}"
+ onclick="submit();" />
+
+ <h:outputText value="localValueSet" />
+ <h:selectBooleanCheckbox value="#{colorPicker.localValueSet}"
+ onclick="submit();" />
+
+ <h:outputText value="rendered" />
+ <h:selectBooleanCheckbox value="#{colorPicker.rendered}"
+ onclick="submit();" />
+
+ <h:outputText value="required" />
+ <h:selectBooleanCheckbox value="#{colorPicker.required}"
+ onclick="submit();" />
+
+ <h:outputText value="requiredMessage: "></h:outputText>
+ <h:inputText value="#{colorPicker.requiredMessage}"
+ onchange="submit();"></h:inputText>
+
+ <h:outputText value="valid" />
+ <h:selectBooleanCheckbox value="#{colorPicker.valid}"
+ onclick="submit();" />
+
+ <h:outputText value="validatorMessage: "></h:outputText>
+ <h:inputText value="#{colorPicker.validatorMessage}"
+ onchange="submit();"></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/jsp/src/main/webapp/ColorPicker/ColorPickerStraightforward.jsp
===================================================================
---
trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPickerStraightforward.jsp
(rev 0)
+++
trunk/test-applications/jsp/src/main/webapp/ColorPicker/ColorPickerStraightforward.jsp 2009-03-17
15:26:00 UTC (rev 12982)
@@ -0,0 +1,8 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib
uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib
uri="http://richfaces.org/rich" prefix="rich"%>
+
+<f:subview id="colorPickerStraightforwardSubviewID">
+<div>ColorPicker straightforward...</div>
+</f:subview>
\ No newline at end of file
Added: trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-ColorPicker.xml
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-ColorPicker.xml
(rev 0)
+++
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-ColorPicker.xml 2009-03-17
15:26:00 UTC (rev 12982)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!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>
+ <managed-bean>
+ <managed-bean-name>colorPicker</managed-bean-name>
+ <managed-bean-class>colorPicker.ColorPicker</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+</faces-config>
\ No newline at end of file
Modified: trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Converter.xml
===================================================================
---
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Converter.xml 2009-03-17
15:18:12 UTC (rev 12981)
+++
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-Converter.xml 2009-03-17
15:26:00 UTC (rev 12982)
@@ -32,4 +32,8 @@
<converter-id>dateValueConverter</converter-id>
<converter-class>util.converter.DateValueConverter</converter-class>
</converter>
+ <converter>
+ <converter-id>colorPickerConverter</converter-id>
+ <converter-class>colorPicker.ColorPicker</converter-class>
+ </converter>
</faces-config>
Modified: trunk/test-applications/jsp/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/WEB-INF/web.xml 2009-03-17 15:18:12 UTC
(rev 12981)
+++ trunk/test-applications/jsp/src/main/webapp/WEB-INF/web.xml 2009-03-17 15:26:00 UTC
(rev 12982)
@@ -22,14 +22,12 @@
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING_LEVEL</param-name>
<param-value>extended</param-value>
- </context-param>
-
+ </context-param>
+
<context-param>
- <param-name>
- org.richfaces.CONTROL_SKINNING_CLASSES_LEVEL
- </param-name>
- <param-value>extended</param-value>
- </context-param>
+ <param-name>org.ajax4jsf.handleViewExpiredOnClient</param-name>
+ <param-value>true</param-value>
+ </context-param>
<context-param>
<description>
@@ -198,7 +196,7 @@
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>
- /WEB-INF/faces-config-tTree.xml,/WEB-INF/faces-config-Queue.xml,/WEB-INF/faces-config-Editor.xml,/WEB-INF/faces-config-ExtendedDataTable.xml,/WEB-INF/faces-config-DataGrid.xml,/WEB-INF/faces-config-Validator.xml,/WEB-INF/faces-config-ComponentInfo.xml,/WEB-INF/faces-config-HotKey.xml,/WEB-INF/faces-config-DataTable.xml,/WEB-INF/faces-config-SimpleTogglePanel.xml,/WEB-INF/faces-config-Panel.xml,/WEB-INF/faces-config-PanelBar.xml,/WEB-INF/faces-config-TabPanel.xml,/WEB-INF/faces-config-TogglePanel.xml,/WEB-INF/faces-config-Paint2D.xml,/WEB-INF/faces-config-InputNumberSlider.xml,/WEB-INF/faces-config-InputNumberSpinner.xml,/WEB-INF/faces-config-DDMenu.xml,/WEB-INF/faces-config-Tree.xml,/WEB-INF/faces-config-PanelMenu.xml,/WEB-INF/faces-config-Icon.xml,/WEB-INF/faces-config-ModalPanel.xml,/WEB-INF/faces-config-tooltip.xml,/WEB-INF/faces-config-Skin.xml,/WEB-INF/faces-config-Calendar.xml,/WEB-INF/faces-config-Gmap.xml,/WEB-INF/faces-config-DataFilterSlider.xml,/WEB-INF/faces-!
config-Separator.xml,/WEB-INF/faces-config-Spacer.xml,/WEB-INF/faces-config-ToolBar.xml,/WEB-INF/faces-config-DataScroller.xml,/WEB-INF/faces-config-SuggestionBox.xml,/WEB-INF/faces-config-Message.xml,/WEB-INF/faces-config-VirtualEarth.xml,/WEB-INF/faces-config-Effect.xml,/WEB-INF/faces-config-Insert.xml,/WEB-INF/faces-config-RichBean.xml,/WEB-INF/faces-config-RichTest.xml,/WEB-INF/faces-config-ScrollableDataTable.xml,/WEB-INF/faces-config-jQuery.xml,/WEB-INF/faces-config-DragAndDrop.xml,/WEB-INF/faces-config-OrderingList.xml,/WEB-INF/faces-config-DataOrderedList.xml,/WEB-INF/faces-config-DataDefinitionList.xml,/WEB-INF/faces-config-ContextMenu.xml,/WEB-INF/faces-config-ListShuttle.xml,/WEB-INF/faces-config-Converter.xml,/WEB-INF/faces-config-ComponentControl.xml,/WEB-INF/faces-config-Columns.xml,/WEB-INF/faces-config-PickList.xml,/WEB-INF/faces-config-Combobox.xml,/WEB-INF/faces-config-PTComponent.xml,/WEB-INF/faces-config-Event.xml,/WEB-INF/faces-config-ProgressBar.xml,/W!
EB-INF/faces-config-Options.xml,/WEB-INF/faces-config-SortingAndFilter
ing.xml,/WEB-INF/faces-config-Style.xml,/WEB-INF/faces-config-FileUpload.xml,/WEB-INF/faces-config-InplaceSelect.xml,/WEB-INF/faces-config-InplaceInput.xml,/WEB-INF/faces-config-Skinning.xml,/WEB-INF/faces-config-Custom.xml
+ /WEB-INF/faces-config-ColorPicker.xml,/WEB-INF/faces-config-tTree.xml,/WEB-INF/faces-config-Queue.xml,/WEB-INF/faces-config-Editor.xml,/WEB-INF/faces-config-ExtendedDataTable.xml,/WEB-INF/faces-config-DataGrid.xml,/WEB-INF/faces-config-Validator.xml,/WEB-INF/faces-config-ComponentInfo.xml,/WEB-INF/faces-config-HotKey.xml,/WEB-INF/faces-config-DataTable.xml,/WEB-INF/faces-config-SimpleTogglePanel.xml,/WEB-INF/faces-config-Panel.xml,/WEB-INF/faces-config-PanelBar.xml,/WEB-INF/faces-config-TabPanel.xml,/WEB-INF/faces-config-TogglePanel.xml,/WEB-INF/faces-config-Paint2D.xml,/WEB-INF/faces-config-InputNumberSlider.xml,/WEB-INF/faces-config-InputNumberSpinner.xml,/WEB-INF/faces-config-DDMenu.xml,/WEB-INF/faces-config-Tree.xml,/WEB-INF/faces-config-PanelMenu.xml,/WEB-INF/faces-config-Icon.xml,/WEB-INF/faces-config-ModalPanel.xml,/WEB-INF/faces-config-tooltip.xml,/WEB-INF/faces-config-Skin.xml,/WEB-INF/faces-config-Calendar.xml,/WEB-INF/faces-config-Gmap.xml,/WEB-INF/faces-confi!
g-DataFilterSlider.xml,/WEB-INF/faces-config-Separator.xml,/WEB-INF/faces-config-Spacer.xml,/WEB-INF/faces-config-ToolBar.xml,/WEB-INF/faces-config-DataScroller.xml,/WEB-INF/faces-config-SuggestionBox.xml,/WEB-INF/faces-config-Message.xml,/WEB-INF/faces-config-VirtualEarth.xml,/WEB-INF/faces-config-Effect.xml,/WEB-INF/faces-config-Insert.xml,/WEB-INF/faces-config-RichBean.xml,/WEB-INF/faces-config-RichTest.xml,/WEB-INF/faces-config-ScrollableDataTable.xml,/WEB-INF/faces-config-jQuery.xml,/WEB-INF/faces-config-DragAndDrop.xml,/WEB-INF/faces-config-OrderingList.xml,/WEB-INF/faces-config-DataOrderedList.xml,/WEB-INF/faces-config-DataDefinitionList.xml,/WEB-INF/faces-config-ContextMenu.xml,/WEB-INF/faces-config-ListShuttle.xml,/WEB-INF/faces-config-Converter.xml,/WEB-INF/faces-config-ComponentControl.xml,/WEB-INF/faces-config-Columns.xml,/WEB-INF/faces-config-PickList.xml,/WEB-INF/faces-config-Combobox.xml,/WEB-INF/faces-config-PTComponent.xml,/WEB-INF/faces-config-Event.xml,/W!
EB-INF/faces-config-ProgressBar.xml,/WEB-INF/faces-config-Options.xml,
/WEB-INF/faces-config-SortingAndFiltering.xml,/WEB-INF/faces-config-Style.xml,/WEB-INF/faces-config-FileUpload.xml,/WEB-INF/faces-config-InplaceSelect.xml,/WEB-INF/faces-config-InplaceInput.xml,/WEB-INF/faces-config-Skinning.xml,/WEB-INF/faces-config-Custom.xml
</param-value>
</context-param>
@@ -273,7 +271,7 @@
</filter-mapping>
<session-config>
- <session-timeout>600</session-timeout>
+ <session-timeout>500</session-timeout>
</session-config>
<!-- Listener, to allow Jetty serving MyFaces apps -->