Author: nbelaevski
Date: 2010-10-27 11:23:56 -0400 (Wed, 27 Oct 2010)
New Revision: 19691
Added:
branches/RF-7817/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/ClientSelectItem.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/PopupConstants.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ArrowBase.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowBase.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowBottom.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowTop.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerDisabledArrowBottom.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerDisabledArrowTop.java
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputBase.js
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.ecss
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.ecss
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/selectList.js
branches/RF-7817/ui/input/ui/src/main/templates/inplaceSelect.template.xml
branches/RF-7817/ui/input/ui/src/main/templates/inputnumberspinner.template.xml
branches/RF-7817/ui/input/ui/src/main/templates/select.template.xml
Removed:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
Modified:
branches/RF-7817/ui/input/
branches/RF-7817/ui/input/api/pom.xml
branches/RF-7817/ui/input/api/src/main/java/org/richfaces/component/InplaceState.java
branches/RF-7817/ui/input/ui/pom.xml
branches/RF-7817/ui/input/ui/src/main/config/faces-config.xml
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SliderArrowBase.java
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.ecss
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.ecss
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
branches/RF-7817/ui/input/ui/src/main/templates/autocomplete.template.xml
branches/RF-7817/ui/input/ui/src/main/templates/inplaceInput.template.xml
branches/RF-7817/ui/input/ui/src/main/templates/input.template.inc
branches/RF-7817/ui/input/ui/src/main/templates/inputnumberslider.template.xml
branches/RF-7817/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java
Log:
Merged revisions
19156-19157,19159-19160,19176,19186-19187,19190,19194,19196,19199,19203-19204,19231-19234,19248-19249,19255-19256,19258-19262,19276,19279-19281,19283,19285,19291-19299,19307,19312,19315,19318-19319,19325,19341-19342,19345-19351,19353-19355,19358-19359,19364,19367-19369,19371,19374-19377,19379-19385,19387,19393-19394,19400,19402-19404,19418-19422,19426,19430-19431,19434-19441,19443-19444,19446,19468,19470,19477,19491,19498-19499,19501,19504,19506-19507,19517-19519,19525,19542-19543,19548,19550,19555,19557,19560-19561,19565-19566,19571-19573,19582-19585,19592-19593,19599,19601-19602,19613,19646,19657-19659,19665,19671-19674
via svnmerge from
https://svn.jboss.org/repos/richfaces/trunk
Property changes on: branches/RF-7817/ui/input
___________________________________________________________________
Name: svn:ignore
+ target
.settings
.project
.classpath
.clover
.externalToolBuilders
Modified: branches/RF-7817/ui/input/api/pom.xml
===================================================================
--- branches/RF-7817/ui/input/api/pom.xml 2010-10-27 15:07:36 UTC (rev 19690)
+++ branches/RF-7817/ui/input/api/pom.xml 2010-10-27 15:23:56 UTC (rev 19691)
@@ -34,6 +34,14 @@
<name>Richfaces UI Components: Input API</name>
<packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencies>
<!-- runtime -->
<dependency>
Copied:
branches/RF-7817/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java
(from rev 19674,
trunk/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java)
===================================================================
---
branches/RF-7817/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java
(rev 0)
+++
branches/RF-7817/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+
+/**
+ * @author Anton Belevich
+ *
+ */
+public interface InplaceComponent {
+
+ public String getDefaultLabel();
+
+ public String getEditEvent();
+
+ public boolean isShowControls();
+
+ public boolean isSaveOnBlur();
+
+ public InplaceState getState();
+
+ public String getReadyStateCss();
+
+ public String getEditStateCss();
+
+ public String getChangedStateCss();
+
+ public String getDisableStateCss();
+
+ public String getEditCss();
+
+ public String getNoneCss();
+
+}
Modified:
branches/RF-7817/ui/input/api/src/main/java/org/richfaces/component/InplaceState.java
===================================================================
---
branches/RF-7817/ui/input/api/src/main/java/org/richfaces/component/InplaceState.java 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/api/src/main/java/org/richfaces/component/InplaceState.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -19,10 +19,18 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
+
package org.richfaces.component;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
public enum InplaceState {
ready,
edit,
- changed
+ changed,
+ disable
}
Modified: branches/RF-7817/ui/input/ui/pom.xml
===================================================================
--- branches/RF-7817/ui/input/ui/pom.xml 2010-10-27 15:07:36 UTC (rev 19690)
+++ branches/RF-7817/ui/input/ui/pom.xml 2010-10-27 15:23:56 UTC (rev 19691)
@@ -40,6 +40,9 @@
<groupId>org.richfaces.cdk</groupId>
<artifactId>maven-cdk-plugin</artifactId>
</plugin>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
</plugins>
</build>
Modified: branches/RF-7817/ui/input/ui/src/main/config/faces-config.xml
===================================================================
--- branches/RF-7817/ui/input/ui/src/main/config/faces-config.xml 2010-10-27 15:07:36 UTC
(rev 19690)
+++ branches/RF-7817/ui/input/ui/src/main/config/faces-config.xml 2010-10-27 15:23:56 UTC
(rev 19691)
@@ -151,6 +151,14 @@
</property-extension>
</property>
<property>
+ <property-name>onchange</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name default="true">change</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
<property-name>showArrows</property-name>
<property-class>boolean</property-class>
<default-value>false</default-value>
@@ -237,6 +245,304 @@
</cdk:tag>
</component-extension>
</component>
+ <component>
+ <component-type>org.richfaces.InputNumberSpinner</component-type>
+ <component-class>org.richfaces.component.html.HtmlInputNumberSpinner</component-class>
+ <property>
+ <property-name>accesskey</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>disabled</property-name>
+ <property-class>boolean</property-class>
+ <default-value>false</default-value>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>cycled</property-name>
+ <property-class>boolean</property-class>
+ <default-value>true</default-value>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>enableManualInput</property-name>
+ <property-class>boolean</property-class>
+ <default-value>true</default-value>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>inputClass</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>inputSize</property-name>
+ <property-class>int</property-class>
+ <default-value>10</default-value>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>maxValue</property-name>
+ <property-class>java.lang.String</property-class>
+ <default-value>"100"</default-value>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>minValue</property-name>
+ <property-class>java.lang.String</property-class>
+ <default-value>"0"</default-value>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>minValue</property-name>
+ <property-class>java.lang.String</property-class>
+ <default-value>"0"</default-value>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>onblur</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>blur</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>onchange</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name default="true">change</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>onclick</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>click</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>ondblclick</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>dblclick</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>ondownclick</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>downclick</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>onfocus</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>focus</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>oninputclick</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>inputclick</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>oninputdblclick</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>inputdblclick</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>oninputkeydown</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>inputkeydown</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>oninputkeypress</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>inputkeypress</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>oninputkeyup</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>inputkeyup</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>oninputmousedown</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>inputmousedown</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>oninputmousemove</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>inputmousemove</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>oninputmouseout</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>inputmouseout</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>oninputmouseover</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>inputmouseover</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>oninputmouseup</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>inputmouseup</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>onmousedown</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>mousedown</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>onmousemove</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>mousemove</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>onmouseout</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>mouseout</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>onmouseover</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>mouseover</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>onmouseup</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>mouseup</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>onselect</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>select</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>onupclick</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:event-name>upclick</cdk:event-name>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>step</property-name>
+ <property-class>java.lang.String</property-class>
+ <default-value>"1"</default-value>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>style</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>styleClass</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ </property-extension>
+ </property>
+ <property>
+ <property-name>tabindex</property-name>
+ <property-class>int</property-class>
+ <default-value>Integer.MIN_VALUE</default-value>
+ <property-extension>
+ <cdk:generate>true</cdk:generate>
+ </property-extension>
+ </property>
+ <component-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:base-class>javax.faces.component.UIInput</cdk:base-class>
+ <cdk:component-family>javax.faces.Input</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.InputNumberSpinnerRenderer</cdk:renderer-type>
+ <cdk:tag>
+ <cdk:tag-name>inputNumberSpinner</cdk:tag-name>
+ <cdk:tag-type>Facelets</cdk:tag-type>
+ </cdk:tag>
+ </component-extension>
+ </component>
<faces-config-extension>
<cdk:taglib>
<cdk:shortName>input</cdk:shortName>
Modified:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -82,7 +82,7 @@
@Attribute
public abstract String getFilterFunction();
- @Attribute(defaultValue = "rf-au-select")
+ @Attribute(defaultValue = "rf-au-sel")
public abstract String getSelectedItemClass();
@Attribute
@@ -177,13 +177,10 @@
@Attribute(events = @EventName("focus"))
public abstract String getOnfocus();
+
+ @Attribute(events = @EventName("selectitem"))
+ public abstract String getOnselectitem();
- @Attribute(events = @EventName("listblur"))
- public abstract String getOnlistblur();
-
- @Attribute(events = @EventName("listfocus"))
- public abstract String getOnlistfocus();
-
@Attribute(events = @EventName("begin"))
public abstract String getOnbegin();
Modified:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -40,7 +40,7 @@
renderer = @JsfRenderer(type = "org.richfaces.InplaceInputRenderer"),
tag = @Tag(name="inplaceInput")
)
-public abstract class AbstractInplaceInput extends UIInput {
+public abstract class AbstractInplaceInput extends UIInput implements InplaceComponent {
public static final String COMPONENT_TYPE = "org.richfaces.InplaceInput";
@@ -49,6 +49,9 @@
@Attribute
public abstract String getDefaultLabel();
+ @Attribute(defaultValue="true")
+ public abstract boolean isSaveOnBlur();
+
@Attribute(defaultValue="InplaceState.ready")
public abstract InplaceState getState();
@@ -64,6 +67,24 @@
@Attribute
public abstract String getTabIndex();
+ @Attribute
+ public abstract String getReadyStateCss();
+
+ @Attribute
+ public abstract String getEditStateCss();
+
+ @Attribute
+ public abstract String getChangedStateCss();
+
+ @Attribute
+ public abstract String getDisableStateCss();
+
+ @Attribute
+ public abstract String getEditCss();
+
+ @Attribute
+ public abstract String getNoneCss();
+
@Attribute(events=@EventName("blur"))
public abstract String getOnblur();
@@ -100,47 +121,47 @@
@Attribute(events=@EventName("mouseup"))
public abstract String getOnmouseup();
- @Attribute(events=@EventName("inputClick"))
- public abstract String getOnInputClick();
+ @Attribute(events=@EventName("inputclick"))
+ public abstract String getOninputclick();
- @Attribute(events=@EventName("inputDblclick"))
- public abstract String getOnInputDblclick();
+ @Attribute(events=@EventName("inputdblclick"))
+ public abstract String getOninputdblclick();
- @Attribute(events=@EventName("inputMousedown"))
- public abstract String getOnInputMousedown();
+ @Attribute(events=@EventName("inputmousedown"))
+ public abstract String getOninputmousedown();
- @Attribute(events=@EventName("inputMousemove"))
- public abstract String getOnInputMousemove();
+ @Attribute(events=@EventName("inputmousemove"))
+ public abstract String getOninputmousemove();
- @Attribute(events=@EventName("inputMouseout"))
- public abstract String getOnInputMouseout();
+ @Attribute(events=@EventName("inputmouseout"))
+ public abstract String getOninputmouseout();
- @Attribute(events=@EventName("inputMouseover"))
- public abstract String getOnInputMouseover();
+ @Attribute(events=@EventName("inputmouseover"))
+ public abstract String getOninputmouseover();
- @Attribute(events=@EventName("inputMouseup"))
- public abstract String getOnInputMouseup();
+ @Attribute(events=@EventName("inputmouseup"))
+ public abstract String getOninputmouseup();
- @Attribute(events=@EventName("inputKeydown"))
- public abstract String getOnInputKeydown();
+ @Attribute(events=@EventName("inputkeydown"))
+ public abstract String getOninputkeydown();
- @Attribute(events=@EventName("inputKeypress"))
- public abstract String getOnInputKeypress();
+ @Attribute(events=@EventName("inputkeypress"))
+ public abstract String getOninputkeypress();
- @Attribute(events=@EventName("oninputKeyup"))
- public abstract String getOnInputKeypup();
+ @Attribute(events=@EventName("inputkeyup"))
+ public abstract String getOninputkeypup();
- @Attribute(events=@EventName("inputFocus"))
- public abstract String getOnInputFocus();
+ @Attribute(events=@EventName("inputfocus"))
+ public abstract String getOninputfocus();
- @Attribute(events=@EventName("inputBlur"))
- public abstract String getOnInputBlur();
+ @Attribute(events=@EventName("inputblur"))
+ public abstract String getOninputblur();
- @Attribute(events=@EventName("select"))
- public abstract String getOnselect();
+ @Attribute(events=@EventName("inputselect"))
+ public abstract String getOninputselect();
- @Attribute(events=@EventName("change"))
- public abstract String getOnchange();
+ @Attribute(events=@EventName("inputchange"))
+ public abstract String getOninputchange();
//TODO: what is default event?, add onViewActivated, onEditActivated events support
}
Copied:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
(from rev 19674,
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+@JsfComponent(
+ type = AbstractInplaceSelect.COMPONENT_TYPE,
+ family = AbstractInplaceSelect.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIInplaceSelect",
+ renderer = @JsfRenderer(type = "org.richfaces.InplaceSelectRenderer"),
+ tag = @Tag(name="inplaceSelect")
+)
+public abstract class AbstractInplaceSelect extends AbstractSelect implements
InplaceComponent {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.InplaceSelect";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.Select";
+
+ @Attribute(defaultValue="InplaceState.ready")
+ public abstract InplaceState getState();
+
+ @Attribute(defaultValue="false")
+ public abstract boolean isOpenOnEdit();
+
+ @Attribute(defaultValue="true")
+ public abstract boolean isSaveOnBlur();
+
+ @Attribute(defaultValue="false")
+ public abstract boolean isShowControls();
+
+ @Override
+ @Attribute
+ public abstract String getItemCss();
+
+ @Override
+ @Attribute
+ public abstract String getSelectItemCss();
+
+ @Override
+ @Attribute
+ public abstract String getListCss();
+
+
+ @Attribute(defaultValue="click")
+ public abstract String getEditEvent();
+
+ @Attribute(events=@EventName("inputclick"))
+ public abstract String getOninputclick();
+
+ @Attribute(events=@EventName("inputdblclick"))
+ public abstract String getOninputdblclick();
+
+ @Attribute(events=@EventName("inputmousedown"))
+ public abstract String getOninputmousedown();
+
+ @Attribute(events=@EventName("inputmousemove"))
+ public abstract String getOninputmousemove();
+
+ @Attribute(events=@EventName("inputmouseout"))
+ public abstract String getOninputmouseout();
+
+ @Attribute(events=@EventName("inputmouseover"))
+ public abstract String getOninputmouseover();
+
+ @Attribute(events=@EventName("inputmouseup"))
+ public abstract String getOninputmouseup();
+
+ @Attribute(events=@EventName("inputkeydown"))
+ public abstract String getOninputkeydown();
+
+ @Attribute(events=@EventName("inputkeypress"))
+ public abstract String getOninputkeypress();
+
+ @Attribute(events=@EventName("inputkeyup"))
+ public abstract String getOninputkeypup();
+
+ @Attribute(events=@EventName("inputfocus"))
+ public abstract String getOninputfocus();
+
+ @Attribute(events=@EventName("inputblur"))
+ public abstract String getOninputblur();
+
+ @Attribute(events=@EventName("inputselect"))
+ public abstract String getOninputselect();
+
+ @Attribute(events=@EventName("inputchange"))
+ public abstract String getOnchange();
+
+}
Copied:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
(from rev 19674,
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/component/AbstractSelect.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UISelectOne;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+
+/**
+ * @author abelevich
+ *
+ */
+@JsfComponent(
+ type = AbstractSelect.COMPONENT_TYPE,
+ family = AbstractSelect.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UISelect",
+ renderer = @JsfRenderer(type = "org.richfaces.SelectRenderer"),
+ tag = @Tag(name="select")
+)
+public abstract class AbstractSelect extends UISelectOne {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Select";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.Select";
+
+ @Attribute(defaultValue="250px")
+ public abstract String getListWidth();
+
+ @Attribute(defaultValue="100px")
+ public abstract String getListHeight();
+
+ @Attribute(defaultValue="true")
+ public abstract boolean isShowButton();
+
+ @Attribute(defaultValue="false")
+ public abstract boolean isEnableManualInput();
+
+ @Attribute(defaultValue="true")
+ public abstract boolean isSelectFirst();
+
+ @Attribute
+ public abstract String getDefaultLabel();
+
+ @Attribute
+ public abstract String getItemCss();
+
+ @Attribute
+ public abstract String getSelectItemCss();
+
+ @Attribute
+ public abstract String getListCss();
+
+ @Attribute(events=@EventName("blur"))
+ public abstract String getOnblur();
+
+ @Attribute(events=@EventName("click"))
+ public abstract String getOnclick();
+
+ @Attribute(events=@EventName("dblclick"))
+ public abstract String getOndblclick();
+
+ @Attribute(events=@EventName("focus"))
+ public abstract String getOnfocus();
+
+ @Attribute(events=@EventName("keydown"))
+ public abstract String getOnkeydown();
+
+ @Attribute(events=@EventName("keypress"))
+ public abstract String getOnkeypress();
+
+ @Attribute(events=@EventName("keyup"))
+ public abstract String getOnkeypup();
+
+ @Attribute(events=@EventName("mousedown"))
+ public abstract String getOnmousedown();
+
+ @Attribute(events=@EventName("mousemove"))
+ public abstract String getOnmousemove();
+
+ @Attribute(events=@EventName("mouseout"))
+ public abstract String getOnmouseout();
+
+ @Attribute(events=@EventName("mouseover"))
+ public abstract String getOnmouseover();
+
+ @Attribute(events=@EventName("mouseup"))
+ public abstract String getOnmouseup();
+
+ @Attribute(events=@EventName("listclick"))
+ public abstract String getOnlistclick();
+
+ @Attribute(events=@EventName("listdblclick"))
+ public abstract String getOnlistdblclick();
+
+ @Attribute(events=@EventName("listmousedown"))
+ public abstract String getOnlistmousedown();
+
+ @Attribute(events=@EventName("listmouseup"))
+ public abstract String getOnlistmouseup();
+
+ @Attribute(events=@EventName("listmouseover"))
+ public abstract String getOnlistmouseover();
+
+ @Attribute(events=@EventName("listmousemove"))
+ public abstract String getOnlistmousemove();
+
+ @Attribute(events=@EventName("listmouseout"))
+ public abstract String getOnlistmouseout();
+
+ @Attribute(events=@EventName("listkeypress"))
+ public abstract String getOnlistkeypress();
+
+ @Attribute(events=@EventName("listkeydown"))
+ public abstract String getOnlistkeydown();
+
+ @Attribute(events=@EventName("listkeyup"))
+ public abstract String getOnlistkeyup();
+
+ @Attribute(events=@EventName("select"))
+ public abstract String getOnselect();
+
+ @Attribute(events=@EventName("change"))
+ public abstract String getOnchange();
+
+}
Modified:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteDivLayoutStrategy.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -52,7 +52,7 @@
}
public void encodeItemBegin(FacesContext facesContext, UIComponent component) throws
IOException {
- ResponseWriter writer = facesContext.getResponseWriter();
+ ResponseWriter writer = facesContext.getResponseWriter();
writer.startElement(HtmlConstants.DIV_ELEM, component);
}
@@ -61,4 +61,15 @@
writer.endElement(HtmlConstants.DIV_ELEM);
}
+ public void encodeItem(FacesContext facesContext, UIComponent component) throws
IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ encodeItemBegin(facesContext, component);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-au-opt rf-au-fnt
rf-au-inp", null);
+ for (UIComponent child : component.getChildren()) {
+ child.encodeAll(facesContext);
+ }
+ encodeItemEnd(facesContext, component);
+
+ }
+
}
Modified:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteEncodeStrategy.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -15,6 +15,8 @@
void encodeItemBegin(FacesContext facesContext, UIComponent component) throws
IOException ;
void encodeItemEnd(FacesContext facesContext, UIComponent component) throws
IOException ;
+
+ void encodeItem(FacesContext facesContext, UIComponent component) throws IOException
;
void encodeFakeItem(FacesContext facesContext, UIComponent component) throws
IOException ;
Modified:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteListLayoutStrategy.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -31,7 +31,7 @@
}
public void encodeItemBegin(FacesContext facesContext, UIComponent component) throws
IOException {
- ResponseWriter writer = facesContext.getResponseWriter();
+ ResponseWriter writer = facesContext.getResponseWriter();
writer.startElement(HtmlConstants.LI_ELEMENT, component);
}
@@ -39,5 +39,16 @@
ResponseWriter writer = facesContext.getResponseWriter();
writer.endElement(HtmlConstants.LI_ELEMENT);
}
+
+ public void encodeItem(FacesContext facesContext, UIComponent component) throws
IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ encodeItemBegin(facesContext, component);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-au-opt rf-au-fnt
rf-au-inp", null);
+ for (UIComponent child : component.getChildren()) {
+ child.encodeAll(facesContext);
+ }
+ encodeItemEnd(facesContext, component);
+
+ }
}
Modified:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -24,7 +24,6 @@
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -47,23 +46,20 @@
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunctionDefinition;
-import org.ajax4jsf.javascript.ScriptUtils;
import org.richfaces.component.AbstractAutocomplete;
import org.richfaces.component.AutocompleteLayout;
import org.richfaces.component.MetaComponentResolver;
import org.richfaces.component.util.InputUtils;
-import org.richfaces.renderkit.util.RendererUtils;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterators;
/**
* @author Nick Belaevski
- *
*/
-@ResourceDependencies({
+@ResourceDependencies({
@ResourceDependency(library = "org.richfaces", name =
"ajax.reslib"),
- @ResourceDependency(library = "org.richfaces", name =
"base-component.reslib"),
+ @ResourceDependency(library = "org.richfaces", name =
"base-component.reslib"),
@ResourceDependency(name = "jquery.position.js"), @ResourceDependency(name
= "richfaces-event.js"),
@ResourceDependency(name = "richfaces-selection.js"),
@ResourceDependency(library = "org.richfaces", name =
"AutocompleteBase.js"),
@@ -75,52 +71,19 @@
public JSFunctionDefinition getClientFilterFunction(UIComponent component) {
AbstractAutocomplete autocomplete = (AbstractAutocomplete) component;
- String clientFilter =
(String)autocomplete.getAttributes().get("clientFilter");
+ String clientFilter = (String)
autocomplete.getAttributes().get("clientFilter");
if (clientFilter != null && clientFilter.length() != 0) {
JSFunctionDefinition clientFilterFunction = new
JSFunctionDefinition("subString");
clientFilterFunction.addParameter("value");
clientFilterFunction.addToBody(clientFilter);
return clientFilterFunction;
}
-
+
return null;
}
- public String getScriptOptions(UIComponent component) {
- Map<String, Object> attributes = component.getAttributes();
- Map<String, Object> options = new HashMap<String, Object>();
- RendererUtils utils = getUtils();
- utils.addToScriptHash(options, "buttonId", component.getClientId() +
"Button");
- utils.addToScriptHash(options, "selectedItemClass",
attributes.get("selectedItemClass"));
- utils.addToScriptHash(options, "minChars",
attributes.get("minChars"), "1");
- utils.addToScriptHash(options, "filterFunction",
attributes.get("filterFunction"));
- utils.addToScriptHash(options, "autofill",
attributes.get("autofill"), "true");
- utils.addToScriptHash(options, "disabled",
attributes.get("disabled"), "false");
- utils.addToScriptHash(options, "selectFirst",
attributes.get("selectFirst"), "true");
- utils.addToScriptHash(options, "tokens",
attributes.get("tokens"));
- utils.addToScriptHash(options, "onbegin",
attributes.get("onbegin"));
- utils.addToScriptHash(options, "oncomplete",
attributes.get("oncomplete"));
- utils.addToScriptHash(options, "onerror",
attributes.get("onerror"));
- utils.addToScriptHash(options, "onbeforedomupdate",
attributes.get("onbeforedomupdate"));
- utils.addToScriptHash(options, "onchange",
attributes.get("onchange"));
- utils.addToScriptHash(options, "filterFunction",
getClientFilterFunction(component));
- String mode = (String)attributes.get("mode");
- if (mode != null) {
- if (mode.equals("ajax")){
- utils.addToScriptHash(options, "isCachedAjax", false,
"true");
- } else if (mode.equals("client") ||
mode.equals("lazyClient")) {
- utils.addToScriptHash(options, "ajaxMode", false,
"true");
- if (mode.equals("lazyClient")) {
- utils.addToScriptHash(options, "lazyClientMode", true,
"false");
- }
- }
- }
- StringBuilder builder = new StringBuilder();
- builder.append(ScriptUtils.toScript(options));
- return builder.toString();
- }
-
// TODO nick - handle parameter
+
@SuppressWarnings("unchecked")
private DataModel<Object> getItems(FacesContext facesContext,
AbstractAutocomplete component) {
Object itemsObject = null;
@@ -132,16 +95,16 @@
try {
// String value = getInputValue(facesContext, component);
- itemsObject = autocompleteMethod.invoke(facesContext.getELContext(), new
Object[] { facesContext,
- component, value });
+ itemsObject = autocompleteMethod.invoke(facesContext.getELContext(), new
Object[]{facesContext,
+ component, value});
} catch (ELException e) {
try {
autocompleteMethod = facesContext
.getApplication()
.getExpressionFactory()
.createMethodExpression(facesContext.getELContext(),
autocompleteMethod.getExpressionString(),
- Void.class, new Class[] { String.class });
- itemsObject = autocompleteMethod.invoke(facesContext.getELContext(),
new Object[] { value });
+ Void.class, new Class[]{String.class});
+ itemsObject = autocompleteMethod.invoke(facesContext.getELContext(),
new Object[]{value});
} catch (ELException ee) {
ee.printStackTrace();
}
@@ -214,10 +177,10 @@
// TODO use converter
if (comboBox.getItemConverter() != null) {
fetchValues.add(comboBox.getItemConverter().getAsString(facesContext,
component, nextItem));
- } else{
+ } else {
fetchValues.add(nextItem);
- }
-
+ }
+
}
}
@@ -233,7 +196,7 @@
protected void encodeItemsContainer(FacesContext facesContext, UIComponent component)
throws IOException {
AutocompleteEncodeStrategy strategy = getStrategy(component);
Object mode = component.getAttributes().get("mode");
- if (mode!= null && mode.equals("client")) {
+ if (mode != null && mode.equals("client")) {
List<Object> fetchValues = new ArrayList<Object>();
this.encodeItems(facesContext, component, fetchValues);
} else {
@@ -244,18 +207,15 @@
}
}
- public void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox,
Object item, AutocompleteEncodeStrategy strategy) throws IOException {
- strategy.encodeItemBegin(facesContext, comboBox);
- ResponseWriter writer = facesContext.getResponseWriter();
-
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-au-option
rf-au-font rf-au-input", null);
-
+ public void encodeItem(FacesContext facesContext, AbstractAutocomplete comboBox,
Object item,
+ AutocompleteEncodeStrategy strategy) throws IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
if (comboBox.getChildCount() > 0) {
- for (UIComponent child : comboBox.getChildren()) {
- child.encodeAll(facesContext);
- }
+ strategy.encodeItem(facesContext, comboBox);
} else {
if (item != null) {
+ strategy.encodeItemBegin(facesContext, comboBox);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-au-opt
rf-au-fnt rf-au-inp", null);
// TODO nick - use converter
String value = null;
if (comboBox.getItemConverter() != null) {
@@ -265,11 +225,12 @@
writer.writeText(value, null);
}
writer.writeText(item, null);
+ strategy.encodeItemEnd(facesContext, comboBox);
}
}
- strategy.encodeItemEnd(facesContext, comboBox);
+
}
-
+
private AutocompleteEncodeStrategy getStrategy(UIComponent component) {
AbstractAutocomplete comboBox = (AbstractAutocomplete) component;
if (comboBox.getLayout() != null) {
@@ -288,21 +249,21 @@
@Override
protected void doDecode(FacesContext context, UIComponent component) {
- AbstractAutocomplete autocomplete = (AbstractAutocomplete)component;
- if (InputUtils.isDisabled(autocomplete)) {
+ AbstractAutocomplete autocomplete = (AbstractAutocomplete) component;
+ if (InputUtils.isDisabled(autocomplete)) {
return;
}
Map<String, String> requestParameters =
context.getExternalContext().getRequestParameterMap();
Object value = requestParameters.get(component.getClientId(context) +
"Value");
if (value != null) {
- if(autocomplete.getConverter() != null){
+ if (autocomplete.getConverter() != null) {
value = autocomplete.getConverter().getAsObject(context, component,
value.toString());
}
autocomplete.setSubmittedValue(value);
}
super.doDecode(context, component);
-
+
if (requestParameters.get(component.getClientId(context) + ".ajax") !=
null) {
PartialViewContext pvc = context.getPartialViewContext();
pvc.getRenderIds().add(
Modified:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteTableLayoutStrategy.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -2,6 +2,7 @@
import java.io.IOException;
+import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
@@ -34,15 +35,38 @@
}
public void encodeItemBegin(FacesContext facesContext, UIComponent component) throws
IOException {
- ResponseWriter writer = facesContext.getResponseWriter();
+ ResponseWriter writer = facesContext.getResponseWriter();
writer.startElement(HtmlConstants.TR_ELEMENT, component);
writer.startElement(HtmlConstants.TD_ELEM, component);
}
+ private void encodeItemChildBegin(FacesContext facesContext, UIComponent component)
throws IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.startElement(HtmlConstants.TD_ELEM, component);
+ }
+
+ private void encodeItemChildEnd(FacesContext facesContext, UIComponent component)
throws IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.endElement(HtmlConstants.TD_ELEM);
+ }
+
public void encodeItemEnd(FacesContext facesContext, UIComponent component) throws
IOException {
ResponseWriter writer = facesContext.getResponseWriter();
writer.endElement(HtmlConstants.TD_ELEM);
writer.endElement(HtmlConstants.TR_ELEMENT);
}
+ public void encodeItem(FacesContext facesContext, UIComponent component) throws
IOException {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.startElement(HtmlConstants.TR_ELEMENT, component);
+ for (UIComponent child : component.getChildren()) {
+ if (child instanceof UIColumn) {
+ encodeItemChildBegin(facesContext, component);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-au-opt
rf-au-fnt rf-au-inp", null);
+ child.encodeAll(facesContext);
+ encodeItemChildEnd(facesContext, component);
+ }
+ }
+ writer.endElement(HtmlConstants.TR_ELEMENT);
+ }
}
Copied:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/ClientSelectItem.java
(from rev 19674,
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/ClientSelectItem.java)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/ClientSelectItem.java
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/ClientSelectItem.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit;
+
+import org.ajax4jsf.javascript.ScriptString;
+import org.ajax4jsf.javascript.ScriptUtils;
+
+public final class ClientSelectItem implements ScriptString {
+
+ private String clientId;
+ private String label;
+ private String convertedValue;
+
+ public ClientSelectItem(String convertedValue, String label) {
+ this(convertedValue, label, null);
+ }
+
+ public ClientSelectItem(String convertedValue, String label,
+ String clientId) {
+ super();
+ this.convertedValue = convertedValue;
+ this.label = label;
+ this.clientId = clientId;
+ }
+
+ public String getClientId() {
+ return clientId;
+ }
+
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public String getConvertedValue() {
+ return convertedValue;
+ }
+
+ public void appendScript(StringBuffer functionString) {
+ functionString.append(this.toScript());
+ }
+
+ public String toScript() {
+ return "{ 'id' : " + ScriptUtils.toScript(clientId)
+ + " , 'label' : " + ScriptUtils.toScript(label)
+ + ", 'value' : " +
ScriptUtils.toScript(convertedValue)
+ + "}";
+ }
+}
Deleted:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -1,195 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.faces.application.Resource;
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.application.ResourceHandler;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.javascript.JSFunction;
-import org.richfaces.component.AbstractInplaceInput;
-import org.richfaces.component.InplaceState;
-import org.richfaces.component.util.HtmlUtil;
-
-/**
- * @author Anton Belevich
- *
- */
-@ResourceDependencies({
- @ResourceDependency(library = "javax.faces", name = "jsf.js"),
- @ResourceDependency(library = "org.richfaces", name =
"base-component.reslib"),
- @ResourceDependency(name = "richfaces-event.js"),
- @ResourceDependency(library="org.richfaces", name =
"inplaceInput.js"),
- @ResourceDependency(library="org.richfaces", name =
"inplaceInput.ecss") })
-public class InplaceInputBaseRenderer extends InputRendererBase {
-
- public static final String OPTIONS_EDIT_EVENT = "editEvent";
-
- public static final String OPTIONS_EDIT_CONTAINER = "editContainer";
-
- public static final String OPTIONS_INPUT = "input";
-
- public static final String OPTIONS_FOCUS = "focusElement";
-
- public static final String OPTIONS_BUTTON_OK = "okbtn";
-
- public static final String OPTIONS_LABEL = "label";
-
- public static final String OPTIONS_DEFAULT_LABEL = "defaultLabel";
-
- public static final String OPTIONS_BUTTON_CANCEL = "cancelbtn";
-
- public static final String OPTIONS_SHOWCONTROLS = "showControls";
-
- public static final String OPTIONS_NONE_CSS = "noneCss";
-
- public static final String OPTIONS_CHANGED_CSS = "changedCss";
-
- public static final String OPTIONS_INITIAL_VALUE = "initialValue";
-
- private static final String READY_STATE_CSS = "rf-ii-d-s";
-
- private static final String EDIT_STATE_CSS = "rf-ii-e-s";
-
- private static final String CHANGED_STATE_CSS = "rf-ii-c-s";
-
- private static final String NONE_CSS = "rf-ii-none";
-
- private static final Map<String, ComponentAttribute>
INPLACEINPUT_HANDLER_ATTRIBUTES = Collections
- .unmodifiableMap(ComponentAttribute.createMap(
- new
ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE).setEventNames("inputClick").
- setComponentAttributeName("onInputClick"),
- new
ComponentAttribute(HtmlConstants.ONDBLCLICK_ATTRIBUTE).setEventNames("inputDblclick").
- setComponentAttributeName("onInputDblclick"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEDOWN_ATTRIBUTE).setEventNames("inputMousedown").
- setComponentAttributeName("onInputMousedown"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEUP_ATTRIBUTE).setEventNames("inputMouseup").
- setComponentAttributeName("onInputMouseup"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEOVER_ATTRIBUTE).setEventNames("inputMouseover").
- setComponentAttributeName("onInputMouseover"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEMOVE_ATTRIBUTE).setEventNames("inputMousemove").
- setComponentAttributeName("onInputMousemove"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEOUT_ATTRIBUTE).setEventNames("inputMouseout").
- setComponentAttributeName("onInputMouseout"),
- new
ComponentAttribute(HtmlConstants.ONKEYPRESS_ATTRIBUTE).setEventNames("inputKeypress").
- setComponentAttributeName("onInputKeypress"),
- new
ComponentAttribute(HtmlConstants.ONKEYDOWN_ATTRIBUTE).setEventNames("inputKeydown").
- setComponentAttributeName("onInputKeydown"),
- new
ComponentAttribute(HtmlConstants.ONKEYUP_ATTRIBUTE).setEventNames("inputKeyup").
- setComponentAttributeName("onInputKeyup"),
- new
ComponentAttribute(HtmlConstants.ONBLUR_ATTRIBUTE).setEventNames("inputBlur").
- setComponentAttributeName("onInputBlur"),
- new
ComponentAttribute(HtmlConstants.ONFOCUS_ATTRIBUTE).setEventNames("inputFocus").
- setComponentAttributeName("onInputFocus"),
- new
ComponentAttribute(HtmlConstants.ONCHANGE_ATTRIBUTE).setEventNames("change").
- setComponentAttributeName("onchange"),
- new
ComponentAttribute(HtmlConstants.ONSELECT_ATTRIBUTE).setEventNames("select").
- setComponentAttributeName("onselect")
- ));
-
- protected void renderInputHandlers(FacesContext facesContext, UIComponent component)
throws IOException {
- RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component,
INPLACEINPUT_HANDLER_ATTRIBUTES);
- }
-
- public InplaceState getInplaceState(UIComponent component) {
- return ((AbstractInplaceInput) component).getState();
- }
-
- public String getValue(FacesContext facesContext, UIComponent component) throws
IOException {
- AbstractInplaceInput inplaceInput = (AbstractInplaceInput)component;
- String value = getInputValue(facesContext, inplaceInput);
- if(value == null || "".equals(value)) {
- value = inplaceInput.getDefaultLabel();
- }
- return value;
- }
-
- public String getResourcePath(FacesContext context, String resourceName) {
- if (resourceName != null) {
- ResourceHandler resourceHandler =
context.getApplication().getResourceHandler();
- Resource resource = resourceHandler.createResource(resourceName);
- return resource.getRequestPath();
- }
- return null;
- }
-
- public String getReadyStyleClass(UIComponent component, InplaceState inplaceState) {
- return (InplaceState.changed != inplaceState) ? READY_STATE_CSS :
HtmlUtil.concatClasses(READY_STATE_CSS, CHANGED_STATE_CSS);
- }
-
- public String getEditStyleClass(UIComponent component, InplaceState inplaceState) {
- return (InplaceState.edit != inplaceState)?
HtmlUtil.concatClasses(EDIT_STATE_CSS, NONE_CSS) : EDIT_STATE_CSS;
- }
- public String getReadyClientId(FacesContext facesContext, UIComponent component,
InplaceState inplaceState) {
- String clientId = component.getClientId(facesContext);
- return getId(clientId, InplaceState.ready, inplaceState);
- }
-
- public String getChangedClientId(FacesContext facesContext, UIComponent component,
InplaceState inplaceState) {
- String clientId = component.getClientId(facesContext);
- return getId(clientId, InplaceState.changed, inplaceState);
- }
-
- private String getId(String clientId, InplaceState expect, InplaceState current) {
- String result = clientId;
- if (expect != current) {
- result = clientId + ":" + expect;
- }
- return result;
- }
-
- public void buildScript(ResponseWriter writer, FacesContext facesContext, UIComponent
component) throws IOException {
- AbstractInplaceInput inplaceInput = (AbstractInplaceInput)component;
- JSFunction function = new JSFunction("new RichFaces.ui.InplaceInput");
- function.addParameter(inplaceInput.getClientId(facesContext));
-
- String clientId = inplaceInput.getClientId(facesContext);
- Map<String, Object> options = new HashMap<String, Object>();
- options.put(OPTIONS_EDIT_EVENT, inplaceInput.getEditEvent());
- options.put(OPTIONS_NONE_CSS, NONE_CSS);
- options.put(OPTIONS_CHANGED_CSS, CHANGED_STATE_CSS);
- options.put(OPTIONS_EDIT_CONTAINER, clientId + ":edit");
- options.put(OPTIONS_INPUT, clientId + ":input");
- options.put(OPTIONS_LABEL, clientId + ":label");
- options.put(OPTIONS_FOCUS, clientId + ":focus");
- options.put(OPTIONS_DEFAULT_LABEL, inplaceInput.getDefaultLabel());
-
- boolean showControls = inplaceInput.isShowControls();
- options.put(OPTIONS_SHOWCONTROLS, showControls);
- if(showControls) {
- options.put(OPTIONS_BUTTON_OK, clientId + ":okbtn");
- options.put(OPTIONS_BUTTON_CANCEL, clientId + ":cancelbtn");
- }
- function.addParameter(options);
-
- writer.write(function.toString());
- }
-}
Copied:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
(from rev 19674,
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,295 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.application.ResourceHandler;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.javascript.JSFunction;
+import org.richfaces.component.InplaceComponent;
+import org.richfaces.component.InplaceState;
+import org.richfaces.component.util.HtmlUtil;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+@ResourceDependencies({
+ @ResourceDependency(library = "javax.faces", name =
"jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"inputBase.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"inplaceBase.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"inplaceInput.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"inplaceInput.ecss") })
+public class InplaceInputRendererBase extends InputRendererBase {
+
+ public static final String OPTIONS_EDIT_EVENT = "editEvent";
+
+ public static final String OPTIONS_STATE = "state";
+
+ public static final String OPTIONS_EDIT_CONTAINER = "editContainer";
+
+ public static final String OPTIONS_INPUT = "input";
+
+ public static final String OPTIONS_FOCUS = "focusElement";
+
+ public static final String OPTIONS_BUTTON_OK = "okbtn";
+
+ public static final String OPTIONS_LABEL = "label";
+
+ public static final String OPTIONS_DEFAULT_LABEL = "defaultLabel";
+
+ public static final String OPTIONS_BUTTON_CANCEL = "cancelbtn";
+
+ public static final String OPTIONS_SHOWCONTROLS = "showControls";
+
+ public static final String OPTIONS_NONE_CSS = "noneCss";
+
+ public static final String OPTIONS_CHANGED_CSS = "changedCss";
+
+ public static final String OPTIONS_EDIT_CSS = "editCss";
+
+ public static final String OPTIONS_INITIAL_VALUE = "initialValue";
+
+ public static final String OPTIONS_SAVE_ON_BLUR = "saveOnBlur";
+
+
+
+
+ //TODO: anton - move to RenderUtils (we use the same in the calendar base renderer) ?
+ protected static final Map<String, ComponentAttribute>
INPLACE_INPUT_HANDLER_ATTRIBUTES = Collections
+ .unmodifiableMap(ComponentAttribute.createMap(
+ new ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE)
+ .setEventNames("inputclick")
+ .setComponentAttributeName("oninputclick"),
+ new ComponentAttribute(HtmlConstants.ONDBLCLICK_ATTRIBUTE)
+ .setEventNames("inputdblclick")
+ .setComponentAttributeName("oninputdblclick"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEDOWN_ATTRIBUTE)
+ .setEventNames("inputmousedown")
+ .setComponentAttributeName("oninputmousedown"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEUP_ATTRIBUTE)
+ .setEventNames("inputmouseup")
+ .setComponentAttributeName("oninputmouseup"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEOVER_ATTRIBUTE)
+ .setEventNames("inputmouseover")
+ .setComponentAttributeName("oninputmouseover"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEMOVE_ATTRIBUTE)
+ .setEventNames("inputmousemove")
+ .setComponentAttributeName("oninputmousemove"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEOUT_ATTRIBUTE)
+ .setEventNames("inputmouseout")
+ .setComponentAttributeName("oninputmouseout"),
+ new ComponentAttribute(HtmlConstants.ONKEYPRESS_ATTRIBUTE)
+ .setEventNames("inputkeypress")
+ .setComponentAttributeName("oninputkeypress"),
+ new ComponentAttribute(HtmlConstants.ONKEYDOWN_ATTRIBUTE)
+ .setEventNames("inputkeydown")
+ .setComponentAttributeName("oninputkeydown"),
+ new ComponentAttribute(HtmlConstants.ONKEYUP_ATTRIBUTE)
+ .setEventNames("inputkeyup")
+ .setComponentAttributeName("oninputkeyup"),
+ new ComponentAttribute(HtmlConstants.ONBLUR_ATTRIBUTE)
+ .setEventNames("inputblur")
+ .setComponentAttributeName("oninputblur"),
+ new ComponentAttribute(HtmlConstants.ONFOCUS_ATTRIBUTE)
+ .setEventNames("inputfocus")
+ .setComponentAttributeName("oninputfocus"),
+ new ComponentAttribute(HtmlConstants.ONCHANGE_ATTRIBUTE)
+
.setEventNames("inputchange").setComponentAttributeName(
+ "oninputchange"),
+ new ComponentAttribute(HtmlConstants.ONSELECT_ATTRIBUTE)
+
.setEventNames("inputselect").setComponentAttributeName(
+ "oninputselect")));
+
+ public void renderInputHandlers(FacesContext facesContext,
+ UIComponent component) throws IOException {
+ RenderKitUtils.renderPassThroughAttributesOptimized(facesContext,
+ component, INPLACE_INPUT_HANDLER_ATTRIBUTES);
+ }
+
+ public InplaceState getInplaceState(UIComponent component) {
+ return ((InplaceComponent) component).getState();
+ }
+
+ public String getValue(FacesContext facesContext, UIComponent component) throws
IOException {
+ String value = getInputValue(facesContext, component);
+ if (!isDisable(getInplaceState(component)) && (value == null ||
"".equals(value)) ) {
+ value = ((InplaceComponent) component).getDefaultLabel();
+ }
+ return value;
+ }
+
+ public String getResourcePath(FacesContext context, String resourceName) {
+ if (resourceName != null) {
+ ResourceHandler resourceHandler = context.getApplication()
+ .getResourceHandler();
+ Resource resource = resourceHandler.createResource(resourceName);
+ return resource.getRequestPath();
+ }
+ return null;
+ }
+
+ public String getStateStyleClass(UIComponent component, InplaceState inplaceState) {
+ InplaceComponent inplaceComponent = (InplaceComponent)component;
+ String style = getReadyStateCss(inplaceComponent);
+ switch (inplaceState) {
+ case edit:
+ style = HtmlUtil.concatClasses(style,
getEditStateCss(inplaceComponent));
+ break;
+
+ case changed:
+ style = HtmlUtil.concatClasses(style,
getChangedStateCss(inplaceComponent));
+ break;
+
+ case disable:
+ style = getDisableStateCss(inplaceComponent);
+ break;
+
+ default:
+ break;
+ }
+
+ return style;
+ }
+
+ public boolean isDisable(InplaceState currentState) {
+ return (InplaceState.disable == currentState);
+ }
+
+ public String getEditStyleClass(UIComponent component, InplaceState inplaceState) {
+ InplaceComponent inplaceComponent = (InplaceComponent)component;
+ return (InplaceState.edit != inplaceState) ?
HtmlUtil.concatClasses(getEditCss(inplaceComponent), getNoneCss(inplaceComponent)) :
getEditCss(inplaceComponent);
+ }
+
+ public void buildScript(ResponseWriter writer, FacesContext facesContext,
+ UIComponent component, Object additional) throws IOException {
+ if (!(component instanceof InplaceComponent)) {
+ return;
+ }
+
+ String scriptName = getScriptName();
+ JSFunction function = new JSFunction(scriptName);
+ String clientId = component.getClientId(facesContext);
+ Map<String, Object> options = createInplaceComponentOptions(clientId,
+ (InplaceComponent) component);
+ addToOptions(facesContext, component, options, additional);
+ function.addParameter(clientId);
+ function.addParameter(options);
+ writer.write(function.toString());
+ }
+
+ protected String getScriptName() {
+ return "new RichFaces.ui.InplaceInput";
+ }
+
+ private Map<String, Object> createInplaceComponentOptions(String clientId,
+ InplaceComponent inplaceComponent) {
+ Map<String, Object> options = new HashMap<String, Object>();
+
+ if(!"click".equals(inplaceComponent.getEditEvent())){
+ options.put(OPTIONS_EDIT_EVENT, inplaceComponent.getEditEvent());
+ }
+
+ if(!(InplaceState.ready == inplaceComponent.getState())) {
+ options.put(OPTIONS_STATE, inplaceComponent.getState());
+ }
+
+ String css = inplaceComponent.getNoneCss();
+ if(css != null && css.trim().length() > 0) {
+ options.put(OPTIONS_NONE_CSS, getNoneCss(inplaceComponent));
+ }
+
+ css = inplaceComponent.getChangedStateCss();
+ if(css != null && css.trim().length() > 0) {
+ options.put(OPTIONS_CHANGED_CSS, getChangedStateCss(inplaceComponent));
+ }
+
+ css = inplaceComponent.getEditStateCss();
+ if(css != null && css.trim().length() > 0) {
+ options.put(OPTIONS_EDIT_CSS, getEditStateCss(inplaceComponent));
+ }
+
+ String label = inplaceComponent.getDefaultLabel();
+ if(label != null && label.trim().length() > 0) {
+ options.put(OPTIONS_DEFAULT_LABEL, inplaceComponent.getDefaultLabel());
+ }
+
+ if(!inplaceComponent.isSaveOnBlur()) {
+ options.put(OPTIONS_SAVE_ON_BLUR, inplaceComponent.isSaveOnBlur());
+ }
+
+ if(inplaceComponent.isShowControls()) {
+ options.put(OPTIONS_SHOWCONTROLS, inplaceComponent.isShowControls());
+ }
+
+ return options;
+ }
+
+ public void addToOptions(FacesContext facesContext, UIComponent component,
+ Map<String, Object> options, Object additional) {
+ // override this method if you need additional options
+ }
+
+ public String getReadyStateCss(InplaceComponent component) {
+ String css = component.getReadyStateCss();
+ return HtmlUtil.concatClasses("rf-ii-d-s", css);
+ }
+
+ public String getEditStateCss(InplaceComponent component) {
+ String css = component.getEditStateCss();
+ return HtmlUtil.concatClasses("rf-ii-e-s", css);
+ }
+
+ public String getChangedStateCss(InplaceComponent component) {
+ String css = component.getChangedStateCss();
+ return HtmlUtil.concatClasses("rf-ii-c-s", css);
+ }
+
+ public String getDisableStateCss(InplaceComponent component) {
+ String css = component.getDisableStateCss();
+ return HtmlUtil.concatClasses("rf-ii-dis-s", css);
+ }
+
+ public String getEditCss(InplaceComponent component) {
+ String css = component.getEditCss();
+ return HtmlUtil.concatClasses("rf-ii-edit", css);
+ }
+
+ public String getNoneCss(InplaceComponent component) {
+ String css = component.getNoneCss();
+ return HtmlUtil.concatClasses("rf-ii-none", css);
+ }
+}
Copied:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
(from rev 19674,
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectRendererBase.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.AbstractInplaceSelect;
+import org.richfaces.component.AbstractSelect;
+import org.richfaces.component.InplaceComponent;
+import org.richfaces.component.util.HtmlUtil;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+@ResourceDependencies({
+ @ResourceDependency(library = "javax.faces", name =
"jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "jquery.position.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(name = "richfaces-selection.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"inputBase.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"inplaceBase.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"popup.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"popupList.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"inplaceInput.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"inplaceSelect.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"inplaceSelect.ecss") })
+public class InplaceSelectRendererBase extends InplaceInputRendererBase {
+
+ public static final String OPTIONS_VISIBLE = "visible";
+
+ public static final String ITEM_CSS = "rf-is-opt";
+
+ public static final String SELECT_ITEM_CSS = "rf-is-sel";
+
+ public static final String LIST_CSS = "rf-is-lst-cord";
+
+
+ @Override
+ protected String getScriptName() {
+ return "new RichFaces.ui.InplaceSelect";
+ }
+
+ public List<ClientSelectItem> getConvertedSelectItems(FacesContext
facesContext, UIComponent component) {
+ return SelectHelper.getConvertedSelectItems(facesContext, component);
+ }
+
+ public void encodeItems(FacesContext facesContext, UIComponent component,
List<ClientSelectItem> clientSelectItems) throws IOException {
+ SelectHelper.encodeItems(facesContext, component, clientSelectItems,
HtmlConstants.SPAN_ELEM, ITEM_CSS);
+ }
+
+ public void renderListHandlers(FacesContext facesContext, UIComponent component)
throws IOException {
+ RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component,
SelectHelper.SELECT_LIST_HANDLER_ATTRIBUTES);
+ }
+
+ @Override
+ public void renderInputHandlers(FacesContext facesContext, UIComponent component)
throws IOException {
+ RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component,
INPLACE_INPUT_HANDLER_ATTRIBUTES);
+ }
+
+ public String getSelectInputLabel(FacesContext facesContext, UIComponent component)
{
+ return SelectHelper.getSelectInputLabel(facesContext, component);
+ }
+
+ @Override
+ public void addToOptions(FacesContext facesContext, UIComponent component,
Map<String, Object> options, Object additional) {
+ AbstractSelect abstractSelect = (AbstractSelect)component;
+ SelectHelper.addSelectCssToOptions(abstractSelect, options, new String[]
{ITEM_CSS, SELECT_ITEM_CSS, LIST_CSS});
+ boolean openOnEdit =
(Boolean)component.getAttributes().get("openOnEdit");
+ if(openOnEdit) {
+ options.put(OPTIONS_VISIBLE, openOnEdit);
+ }
+ options.put(SelectHelper.OPTIONS_LIST_ITEMS, additional);
+ }
+
+ public String getSelectLabel(FacesContext facesContext, UIComponent component) {
+ AbstractInplaceSelect select = (AbstractInplaceSelect) component;
+ String label = getSelectInputLabel(facesContext, select);
+ if (!isDisable(getInplaceState(component)) && (label == null)) {
+ label = select.getDefaultLabel();
+ }
+ return label;
+ }
+
+ public String getReadyStateCss(InplaceComponent component) {
+ String css = component.getReadyStateCss();
+ return HtmlUtil.concatClasses("rf-is-d-s", css);
+ }
+
+ public String getEditStateCss(InplaceComponent component) {
+ String css = component.getEditStateCss();
+ return HtmlUtil.concatClasses("rf-is-e-s", css);
+ }
+
+ public String getChangedStateCss(InplaceComponent component) {
+ String css = component.getChangedStateCss();
+ return HtmlUtil.concatClasses("rf-is-c-s", css);
+ }
+
+ public String getDisableStateCss(InplaceComponent component) {
+ String css = component.getDisableStateCss();
+ return HtmlUtil.concatClasses("rf-is-dis-s", css);
+ }
+
+ public String getEditCss(InplaceComponent component) {
+ String css = component.getEditCss();
+ return HtmlUtil.concatClasses("rf-is-edit", css);
+ }
+
+ public String getNoneCss(InplaceComponent component) {
+ String css = component.getNoneCss();
+ return HtmlUtil.concatClasses("rf-is-none", css);
+ }
+}
Modified:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -1,22 +1,23 @@
-/**
- * License Agreement.
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * JBoss RichFaces - Ajax4jsf Component Library
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
package org.richfaces.renderkit;
@@ -35,13 +36,10 @@
* created 23.01.2007
*/
public class InputRendererBase extends AjaxComponentRendererBase {
- protected Class getComponentClass() {
- return UIInput.class;
- }
protected void doDecode(FacesContext context, UIComponent component) {
String clientId = component.getClientId(context);
- Map requestParameterMap = context.getExternalContext().getRequestParameterMap();
+ Map<String, String> requestParameterMap =
context.getExternalContext().getRequestParameterMap();
String newValue = (String) requestParameterMap.get(clientId);
if (null != newValue) {
Copied:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/PopupConstants.java
(from rev 19674,
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/PopupConstants.java)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/PopupConstants.java
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/PopupConstants.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit;
+
+/**
+ * @author abelevich
+ *
+ */
+public interface PopupConstants {
+
+ public static final String OPTIONS_ITEM_CLASS = "itemCss";
+
+ public static final String OPTIONS_SELECT_ITEM_CLASS = "selectItemCss";
+
+ public static final String OPTIONS_LIST_CLASS = "listCss";
+
+ public static final String OPTIONS_LIST_CORD = "list";
+}
Copied:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java (from
rev 19674, trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java)
===================================================================
--- branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectHelper.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.model.SelectItem;
+
+import org.richfaces.component.AbstractSelect;
+import org.richfaces.component.util.HtmlUtil;
+import org.richfaces.component.util.InputUtils;
+import org.richfaces.component.util.SelectUtils;
+
+/**
+ * @author abelevich
+ *
+ */
+public final class SelectHelper {
+
+ public static final String OPTIONS_SHOWCONTROL = "showControl";
+
+ public static final String OPTIONS_LIST_ITEMS = "items";
+
+ public static final String OPTIONS_ENABLE_MANUAL_INPUT =
"enableManualInput";
+
+ public static final String OPTIONS_LIST_SELECT_FIRST = "selectFirst";
+
+ public static final String OPTIONS_INPUT_DEFAULT_LABEL = "defaultLabel";
+
+ public static final Map<String, ComponentAttribute>
SELECT_LIST_HANDLER_ATTRIBUTES = Collections
+ .unmodifiableMap(ComponentAttribute.createMap(
+ new ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE)
+ .setEventNames("listclick")
+ .setComponentAttributeName("onlistclick"),
+ new ComponentAttribute(HtmlConstants.ONDBLCLICK_ATTRIBUTE)
+ .setEventNames("listdblclick")
+ .setComponentAttributeName("onlistdblclick"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEDOWN_ATTRIBUTE)
+ .setEventNames("listmousedown")
+ .setComponentAttributeName("onlistmousedown"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEUP_ATTRIBUTE)
+ .setEventNames("listmouseup")
+ .setComponentAttributeName("onlistmouseup"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEOVER_ATTRIBUTE)
+ .setEventNames("listmouseover")
+ .setComponentAttributeName("onlistmouseover"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEMOVE_ATTRIBUTE)
+ .setEventNames("listmousemove")
+ .setComponentAttributeName("onlistmousemove"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEOUT_ATTRIBUTE)
+ .setEventNames("listmouseout")
+ .setComponentAttributeName("onlistmouseout"),
+ new ComponentAttribute(HtmlConstants.ONKEYPRESS_ATTRIBUTE)
+ .setEventNames("listkeypress")
+ .setComponentAttributeName("onlistkeypress"),
+ new ComponentAttribute(HtmlConstants.ONKEYDOWN_ATTRIBUTE)
+ .setEventNames("listkeydown")
+ .setComponentAttributeName("onlistkeydown"),
+ new ComponentAttribute(HtmlConstants.ONKEYUP_ATTRIBUTE)
+ .setEventNames("listkeyup")
+ .setComponentAttributeName("onlistkeyup")
+ ));
+
+ private SelectHelper() {
+ }
+
+ public static List<ClientSelectItem> getConvertedSelectItems(FacesContext
facesContext, UIComponent component) {
+ AbstractSelect select = (AbstractSelect) component;
+ List<SelectItem> selectItems = SelectUtils.getSelectItems(facesContext,
select);
+ List<ClientSelectItem> clientSelectItems = new
ArrayList<ClientSelectItem>();
+
+ for (SelectItem selectItem : selectItems) {
+ String convertedStringValue =
InputUtils.getConvertedStringValue(facesContext, select, selectItem.getValue());
+ String label = selectItem.getLabel();
+ clientSelectItems.add(new ClientSelectItem(convertedStringValue,label));
+ }
+ return clientSelectItems;
+ }
+
+ public static void encodeItems(FacesContext facesContext, UIComponent component,
+ List<ClientSelectItem> clientSelectItems, String itemHtmlElement,
String defaultItemCss) throws IOException {
+ AbstractSelect select = (AbstractSelect) component;
+ if (clientSelectItems != null && !clientSelectItems.isEmpty()) {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ String clientId = component.getClientId(facesContext);
+ int i = 0;
+ for (ClientSelectItem clientSelectItem : clientSelectItems) {
+ String itemClientId = clientId + "Item" + (i++);
+ clientSelectItem.setClientId(itemClientId);
+
+ writer.startElement(itemHtmlElement, select);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, itemClientId,
+ null);
+
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
HtmlUtil.concatClasses(defaultItemCss, select.getItemCss()), null);
+
+ String label = clientSelectItem.getLabel();
+ if (label != null && label.trim().length() > 0) {
+ writer.writeText(label, null);
+ } else {
+ writer.write("\u00a0");
+ }
+ writer.endElement(itemHtmlElement);
+ }
+ }
+ }
+
+ public static String getSelectInputLabel(FacesContext facesContext, UIComponent
component) {
+ AbstractSelect select = (AbstractSelect) component;
+ Object value = select.getSubmittedValue();
+ String label = null;
+ if (value == null) {
+ value = select.getValue();
+ if (value != null) {
+ List<SelectItem> items = SelectUtils.getSelectItems(
+ facesContext, component);
+ for (SelectItem item : items) {
+ if (value.equals(item.getValue())) {
+ label = item.getLabel();
+ }
+ }
+ }
+ }
+
+ return label;
+ }
+
+ public static void addSelectCssToOptions(AbstractSelect abstractSelect,
Map<String, Object> options, String [] defaultCss) {
+ String itemCss = abstractSelect.getItemCss();
+ if(itemCss != null && itemCss.trim().length() > 0) {
+ options.put(PopupConstants.OPTIONS_ITEM_CLASS,
HtmlUtil.concatClasses(defaultCss[0], itemCss));
+ }
+
+ String selectItemCss = abstractSelect.getSelectItemCss();
+ if(selectItemCss != null && selectItemCss.trim().length() > 0) {
+ options.put(PopupConstants.OPTIONS_SELECT_ITEM_CLASS,
HtmlUtil.concatClasses(defaultCss[1], selectItemCss));
+ }
+
+ String listCss = abstractSelect.getListCss();
+ if(listCss != null && listCss.trim().length() > 0) {
+ options.put(PopupConstants.OPTIONS_LIST_CLASS,
HtmlUtil.concatClasses(defaultCss[2], listCss));
+ }
+ }
+}
Copied:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java
(from rev 19674,
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/SelectRendererBase.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.javascript.JSFunction;
+import org.richfaces.component.AbstractSelect;
+
+/**
+ * @author abelevich
+ *
+ */
+@ResourceDependencies({ @ResourceDependency(library = "javax.faces", name =
"jsf.js"),
+ @ResourceDependency(name = "jquery.js"), @ResourceDependency(name =
"jquery.position.js"),
+ @ResourceDependency(name = "richfaces.js"), @ResourceDependency(name =
"jquery.position.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(name = "richfaces-selection.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"inputBase.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"popup.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"popupList.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"selectList.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"select.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"select.ecss") })
+public class SelectRendererBase extends InputRendererBase {
+
+ public static final String ITEM_CSS = "rf-sel-opt";
+
+ public static final String SELECT_ITEM_CSS = "rf-sel-sel";
+
+ public static final String LIST_CSS = "rf-sel-lst-cord";
+
+
+ public void renderListHandlers(FacesContext facesContext, UIComponent component)
throws IOException {
+ RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component,
SelectHelper.SELECT_LIST_HANDLER_ATTRIBUTES);
+ }
+
+ public List<ClientSelectItem> getConvertedSelectItems(FacesContext
facesContext, UIComponent component) {
+ return SelectHelper.getConvertedSelectItems(facesContext, component);
+ }
+
+ public String getSelectInputLabel(FacesContext facesContext, UIComponent component)
{
+ return SelectHelper.getSelectInputLabel(facesContext, component);
+ }
+
+ public String getSelectLabel(FacesContext facesContext, UIComponent component) {
+ AbstractSelect select = (AbstractSelect) component;
+ String label = getSelectInputLabel(facesContext, select);
+ if (label == null || "".equals(label.trim())) {
+ label = select.getDefaultLabel();
+ }
+ return label;
+ }
+
+ public void encodeItems(FacesContext facesContext, UIComponent component,
List<ClientSelectItem> clientSelectItems)
+ throws IOException {
+ SelectHelper.encodeItems(facesContext, component, clientSelectItems,
HtmlConstants.DIV_ELEM, ITEM_CSS);
+ }
+
+ public void buildScript(ResponseWriter writer, FacesContext facesContext, UIComponent
component, List<ClientSelectItem> selectItems) throws IOException {
+ if (!(component instanceof AbstractSelect)) {
+ return;
+ }
+
+ AbstractSelect abstractSelect = (AbstractSelect)component;
+ String scriptName = getScriptName();
+ JSFunction function = new JSFunction(scriptName);
+
+ String clientId = abstractSelect.getClientId(facesContext);
+ Map<String, Object> options = new HashMap<String, Object>();
+ options.put(SelectHelper.OPTIONS_LIST_ITEMS, selectItems);
+
+ if(!abstractSelect.isShowButton()) {
+ options.put(SelectHelper.OPTIONS_SHOWCONTROL,
abstractSelect.isShowButton());
+ }
+
+ String defaultLabel = abstractSelect.getDefaultLabel();
+ if( defaultLabel != null && defaultLabel.trim().length() > 0) {
+ options.put(SelectHelper.OPTIONS_INPUT_DEFAULT_LABEL, defaultLabel);
+ }
+
+ if(abstractSelect.isEnableManualInput()) {
+ options.put(SelectHelper.OPTIONS_ENABLE_MANUAL_INPUT,
abstractSelect.isEnableManualInput());
+ }
+
+ if(!abstractSelect.isSelectFirst()) {
+ options.put(SelectHelper.OPTIONS_LIST_SELECT_FIRST,
abstractSelect.isSelectFirst());
+ }
+
+ SelectHelper.addSelectCssToOptions(abstractSelect, options, new String[]
{ITEM_CSS, SELECT_ITEM_CSS, LIST_CSS});
+
+ function.addParameter(clientId);
+ function.addParameter(options);
+
+ writer.write(function.toString());
+ }
+
+ protected String getScriptName() {
+ return "new RichFaces.ui.Select";
+ }
+}
Copied:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ArrowBase.java
(from rev 19674,
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ArrowBase.java)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ArrowBase.java
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ArrowBase.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Date;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.resource.DynamicResource;
+import org.richfaces.resource.ImageType;
+import org.richfaces.resource.Java2DUserResource;
+import org.richfaces.resource.StateHolderResource;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+@DynamicResource
+public abstract class ArrowBase implements Java2DUserResource, StateHolderResource {
+
+ private int color;
+ private String colorName = Skin.GENERAL_TEXT_COLOR;
+
+ private void initialize() {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Skin skin = SkinFactory.getInstance(context).getSkin(context);
+ this.color = skin.getColorParameter(context, colorName);
+ }
+
+ protected final void setColorName(String colorName) {
+ this.colorName = colorName;
+ }
+
+ public abstract Dimension getDimension();
+
+ public void paint(Graphics2D graphics2d, Dimension dimension) {
+ graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+ graphics2d.setColor(new Color(color));
+ }
+
+ public void writeState(FacesContext context, DataOutput dataOutput) throws
IOException {
+ initialize();
+ dataOutput.writeInt(this.color);
+ }
+
+ public void readState(FacesContext context, DataInput dataInput) throws IOException
{
+ this.color = dataInput.readInt();
+ }
+
+ public Map<String, String> getResponseHeaders() {
+ return null;
+ }
+
+ public Date getLastModified() {
+ return null;
+ }
+
+ public ImageType getImageType() {
+ return ImageType.PNG;
+ }
+
+ public boolean isTransient() {
+ return false;
+ }
+
+}
Modified:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SliderArrowBase.java
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SliderArrowBase.java 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SliderArrowBase.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -22,77 +22,18 @@
package org.richfaces.renderkit.html.images;
-import java.awt.Color;
import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Date;
-import java.util.Map;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.resource.DynamicResource;
-import org.richfaces.resource.ImageType;
-import org.richfaces.resource.Java2DUserResource;
-import org.richfaces.resource.StateHolderResource;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-
/**
* @author Konstantin Mishin
*
*/
-@DynamicResource
-public abstract class SliderArrowBase implements Java2DUserResource, StateHolderResource
{
+public abstract class SliderArrowBase extends ArrowBase {
private Dimension dimension = new Dimension(7, 7);
- private int color;
- private String colorName = Skin.GENERAL_TEXT_COLOR;
- private void initialize() {
- FacesContext context = FacesContext.getCurrentInstance();
- Skin skin = SkinFactory.getInstance(context).getSkin(context);
- this.color = skin.getColorParameter(context, colorName);
- }
-
- protected final void setColorName(String colorName) {
- this.colorName = colorName;
- }
-
+ @Override
public Dimension getDimension() {
return dimension;
}
- public void paint(Graphics2D graphics2d, Dimension dimension) {
- graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
- graphics2d.setColor(new Color(color));
- }
-
- public void writeState(FacesContext context, DataOutput dataOutput) throws
IOException {
- initialize();
- dataOutput.writeInt(this.color);
- }
-
- public void readState(FacesContext context, DataInput dataInput) throws IOException
{
- this.color = dataInput.readInt();
- }
-
- public Map<String, String> getResponseHeaders() {
- return null;
- }
-
- public Date getLastModified() {
- return null;
- }
-
- public ImageType getImageType() {
- return ImageType.PNG;
- }
-
- public boolean isTransient() {
- return false;
- }
-
}
Copied:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowBase.java
(from rev 19674,
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowBase.java)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowBase.java
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowBase.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Dimension;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public abstract class SpinnerArrowBase extends ArrowBase {
+
+ private Dimension dimension = new Dimension(5, 3);
+
+ @Override
+ public Dimension getDimension() {
+ return dimension;
+ }
+}
Copied:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowBottom.java
(from rev 19674,
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowBottom.java)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowBottom.java
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowBottom.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class SpinnerArrowBottom extends SpinnerArrowBase {
+
+ @Override
+ public void paint(Graphics2D graphics2d, Dimension dimension) {
+ super.paint(graphics2d, dimension);
+ graphics2d.drawLine(0, 0, 4, 0);
+ graphics2d.drawLine(1, 1, 3, 1);
+ graphics2d.drawLine(2, 2, 2, 2);
+ }
+}
Copied:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowTop.java
(from rev 19674,
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowTop.java)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowTop.java
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerArrowTop.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class SpinnerArrowTop extends SpinnerArrowBase {
+
+ @Override
+ public void paint(Graphics2D graphics2d, Dimension dimension) {
+ super.paint(graphics2d, dimension);
+ graphics2d.drawLine(2, 0, 2, 0);
+ graphics2d.drawLine(1, 1, 3, 1);
+ graphics2d.drawLine(0, 2, 4, 2);
+ }
+}
Copied:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerDisabledArrowBottom.java
(from rev 19674,
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerDisabledArrowBottom.java)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerDisabledArrowBottom.java
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerDisabledArrowBottom.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html.images;
+
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class SpinnerDisabledArrowBottom extends SpinnerArrowBottom {
+
+ public SpinnerDisabledArrowBottom() {
+ setColorName("tabDisabledTextColor");
+ }
+}
Copied:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerDisabledArrowTop.java
(from rev 19674,
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerDisabledArrowTop.java)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerDisabledArrowTop.java
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/SpinnerDisabledArrowTop.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html.images;
+
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class SpinnerDisabledArrowTop extends SpinnerArrowTop {
+
+ public SpinnerDisabledArrowTop() {
+ setColorName("tabDisabledTextColor");
+ }
+}
Modified:
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/java/org/richfaces/view/facelets/AutocompleteHandler.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -38,7 +38,6 @@
/**
* @author Nick Belaevski
- *
*/
//TODO nick - this should be generated by CDK
public class AutocompleteHandler extends ComponentHandler {
@@ -47,11 +46,11 @@
@Override
public Metadata applyRule(String name, TagAttribute attribute,
- MetadataTarget meta) {
+ MetadataTarget meta) {
if (meta.isTargetInstanceOf(AbstractAutocomplete.class)) {
if ("autocompleteMethod".equals(name)) {
return new MethodMetadata(attribute, FacesContext.class,
- UIComponent.class, String.class) {
+ UIComponent.class, String.class) {
public void applyMetadata(FaceletContext ctx, Object instance) {
((AbstractAutocomplete)
instance).setAutocompleteMethod(getMethodExpression(ctx));
}
@@ -62,8 +61,8 @@
return new ConverterMetadata(attribute) {
public void applyMetadata(FaceletContext ctx, Object instance) {
((AbstractAutocomplete)
instance).setConverter(this.getConverter(ctx,
- (AbstractAutocomplete) instance,
- this.getAttr().getValueExpression(ctx,
Converter.class)));
+ (AbstractAutocomplete) instance,
+ this.getAttr().getValueExpression(ctx,
Converter.class)));
}
};
}
@@ -72,8 +71,8 @@
return new ConverterMetadata(attribute) {
public void applyMetadata(FaceletContext ctx, Object instance) {
((AbstractAutocomplete)
instance).setItemConverter(this.getConverter(ctx,
- (AbstractAutocomplete) instance,
- this.getAttr().getValueExpression(ctx,
Converter.class)));
+ (AbstractAutocomplete) instance,
+ this.getAttr().getValueExpression(ctx,
Converter.class)));
}
};
}
@@ -85,7 +84,7 @@
};
public AutocompleteHandler(ComponentConfig config) {
- super(config);
+ super(config);
}
@Override
@@ -108,7 +107,7 @@
}
public Converter getConverter(FaceletContext ctx,
- AbstractAutocomplete component, ValueExpression converter) {
+ AbstractAutocomplete component, ValueExpression
converter) {
ValueExpression ve = null;
Converter c = null;
if (converter != null) {
@@ -116,7 +115,7 @@
try {
c = (Converter) ve.getValue(ctx);
} catch (Exception e) {
- // ok
+ // ok
}
}
@@ -124,8 +123,8 @@
c = this.createConverter(ctx, component);
}
if (c == null) {
- // throw new TagException(this.getTag(), "No Converter was
- // created");
+ // throw new TagException(this.getTag(), "No Converter was
+ // created");
}
return c;
}
@@ -135,9 +134,9 @@
}
private Converter createConverter(FaceletContext ctx,
- AbstractAutocomplete component) {
+ AbstractAutocomplete component) {
return ctx.getFacesContext().getApplication().createConverter(
- getConverterId(ctx));
+ getConverterId(ctx));
}
}
Modified:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.ecss
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.ecss 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.ecss 2010-10-27
15:23:56 UTC (rev 19691)
@@ -1,29 +1,18 @@
-.rf-au-field-width{
- width: 200px;
-}
-.rf-au-list-width{
- width: 200px;
-}
-
-.rf-au-list-height{
- max-height: 100px;
- min-height: 20px;
-}
-
-.rf-au-input.rf-au-font, .rf-au-option.rf-au-font{
+.rf-au-inp.rf-au-fnt, .rf-au-opt.rf-au-fnt{
color: '#{richSkin.generalTextColor}';
font-size: '#{richSkin.generalSizeFont}';
font-family: '#{richSkin.generalFamilyFont}';
}
-input.rf-au-input {
+input.rf-au-inp {
border-width: 0px;
background: none;
width: 100%;
}
-.rf-au-field{
+.rf-au-fld{
+ width: 200px;
position: inline-block;
border-width: 1px;
border-style: solid;
@@ -35,7 +24,7 @@
background-color: '#{richSkin.controlBackgroundColor}';
}
-.rf-au-button{
+.rf-au-btn{
background-image:
"url(#{resource['org.richfaces.renderkit.html.images.AutocompleteButtonGradient']})";
background-repeat: repeat-x;
background-position: top left;
@@ -52,7 +41,7 @@
padding-top: 1px
}
-.rf-au-button-arrow{
+.rf-au-btn-arrow{
background-position: center;
background-repeat: no-repeat;
background-image:
"url(#{resource['org.richfaces:combo_down_button.gif']})";
@@ -61,13 +50,13 @@
height: 15px;
}
-.rf-au-list-cord{
+.rf-au-lst-cord{
position: absolute;
/* TODO nick - review: font-size: 0px; */
display: none;
}
-.rf-au-list-decoration{
+.rf-au-lst-dcrtn{
border-width: 1px;
border-style: solid;
border-color: '#{richSkin.panelBorderColor}';
@@ -75,19 +64,22 @@
background-color: '#{richSkin.tableBackgroundColor}';
}
-.rf-au-list-scroll{
+.rf-au-lst-scrl{
overflow: auto;
overflow-x: hidden;
+ width: 200px;
+ max-height: 100px;
+ min-height: 20px;
}
-.rf-au-option{
+.rf-au-opt{
padding: 2px;
white-space: nowrap;
cursor: default;
list-style-type: none;
}
-.rf-au-select{
+.rf-au-sel{
padding: 1px;
width: 100%;
background-color: '#{richSkin.headerBackgroundColor}';
@@ -96,7 +88,7 @@
border-color: '#{richSkin.generalTextColor}';
}
-.rf-au-shadow{
+.rf-au-shdw{
border: 0px solid red;
display: inline-block;
position: absolute;
@@ -106,7 +98,7 @@
left: -7px;
}
-.rf-au-shadow-t{
+.rf-au-shdw-t{
background-image:
"url(#{resource['org.richfaces:combo_list_shadow.png']})";
background-position: top left;
position: absolute;
@@ -116,7 +108,7 @@
left: 0px
}
-.rf-au-shadow-l{
+.rf-au-shdw-l{
background-image:
"url(#{resource['org.richfaces:combo_list_shadow.png']})";
background-position: bottom left;
position: absolute;
@@ -126,7 +118,7 @@
right: 6px;
}
-.rf-au-shadow-r{
+.rf-au-shdw-r{
background-image:
"url(#{resource['org.richfaces:combo_list_shadow.png']})";
background-position: bottom right;
position: absolute;
@@ -136,7 +128,7 @@
right: 0px;
}
-.rf-au-shadow-b{
+.rf-au-shdw-b{
background-image:
"url(#{resource['org.richfaces:combo_list_shadow.png']})";
background-position: right top;
position: absolute;
@@ -146,7 +138,7 @@
right: 0px;
}
-.rf-au-list-ul{
+.rf-au-lst-ul{
margin: 0px;
padding: 0px;
}
\ No newline at end of file
Modified:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-10-27
15:23:56 UTC (rev 19691)
@@ -94,7 +94,7 @@
rf.ui = rf.ui || {};
// Constructor definition
rf.ui.Autocomplete = function(componentId, fieldId, options) {
- this.namespace = "."+rf.Event.createNamespace(this.name, this.id);
+ this.namespace = "."+rf.Event.createNamespace(this.name, componentId);
this.options = {};
// call constructor of parent class
$super.constructor.call(this, componentId, componentId+ID.SELECT, fieldId, options);
@@ -115,8 +115,8 @@
var $super = rf.ui.Autocomplete.$super;
var defaultOptions = {
- selectedItemClass:'rf-au-select',
- itemClass:'rf-au-option',
+ selectedItemClass:'rf-au-sel',
+ itemClass:'rf-au-opt',
autofill:true,
minChars:1,
selectFirst:true,
@@ -168,7 +168,7 @@
var index = this.items.index(element);
selectItem.call(this, event, index);
} else {
- this.__onChangeValue(event, getSelectedItemValue.call(this));
+ this.__onEnter(event);
rf.Selection.setCaretTo(rf.getDomElement(this.fieldId));
this.hide(event);
}
@@ -431,10 +431,9 @@
__onBeforeShow: function (event) {
},
__onEnter: function (event) {
- this.__onChangeValue(event, getSelectedItemValue.call(this));
- //rf.getDomElement(this.fieldId).blur();
- //rf.Selection.setCaretTo(rf.getDomElement(this.fieldId));
- //rf.getDomElement(this.fieldId).focus();
+ var value = getSelectedItemValue.call(this);
+ this.__onChangeValue(event, value);
+ this.invokeEvent("selectitem", rf.getDomElement(this.fieldId), event,
value);
},
__onShow: function (event) {
if (this.options.selectFirst) {
Modified:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js 2010-10-27
15:23:56 UTC (rev 19691)
@@ -1,24 +1,3 @@
-// TODO: move this extend to RichFaces.Event for exapmle
-$.extend(RichFaces.Event, {
- bindScrollEventHandlers: function(element, handler, component) {
- var elements = [];
- element = RichFaces.getDomElement(element).parentNode;
- while (element && element!=window.document.body)
- {
- if (element.offsetWidth!=element.scrollWidth ||
element.offsetHeight!=element.scrollHeight)
- {
- elements.push(element);
- RichFaces.Event.bind(element, "scroll"+component.getNamespace(), handler,
component);
- }
- element = element.parentNode;
- }
- return elements;
- },
- unbindScrollEventHandlers: function(elements, component) {
- RichFaces.Event.unbind(elements, "scroll"+component.getNamespace());
- }
-});
-
(function (rf) {
rf.KEYS = {
BACKSPACE: 8,
@@ -31,8 +10,8 @@
UP: 38,
RIGHT: 39,
DOWN: 40,
- DEL: 46,
- }
+ DEL: 46
+ };
})(RichFaces);
(function ($, rf) {
@@ -76,6 +55,7 @@
inputEventHandlers["blur"+this.namespace] = onBlur;
inputEventHandlers["click"+this.namespace] = onClick;
inputEventHandlers[($.browser.opera ? "keypress" :
"keydown")+this.namespace] = onKeyDown;
+ inputEventHandlers["change"+this.namespace] = function (event) {if
(this.focused) {event.stopPropagation()}};
rf.Event.bindById(this.fieldId, inputEventHandlers, this);
inputEventHandlers = {};
@@ -107,17 +87,29 @@
};
var onFocus = function (event) {
- this.focused = true;
+ if (!this.focused) {
+ this.__focusValue = this.getInputValue();
+ this.focused = true;
+ this.invokeEvent("focus", rf.getDomElement(this.fieldId), event);
+ }
};
var onBlur = function (event) {
if (this.isMouseDown) {
rf.getDomElement(this.fieldId).focus();
this.isMouseDown = false;
- } else if (this.isVisible && !this.isMouseDown) {
- var _this = this;
- this.timeoutId = window.setTimeout(function(){_this.hide();}, 200);
- this.focused=false;
+ } else if (!this.isMouseDown) {
+ if (this.isVisible) {
+ var _this = this;
+ this.timeoutId = window.setTimeout(function(){_this.hide();}, 200);
+ }
+ if (this.focused) {
+ this.focused=false;
+ this.invokeEvent("blur", rf.getDomElement(this.fieldId), event);
+ if (this.__focusValue != this.getInputValue()) {
+ this.invokeEvent("change", rf.getDomElement(this.fieldId), event);
+ }
+ }
}
};
@@ -192,7 +184,7 @@
}
break;
}
- }
+ };
/*
* public API functions definition
Copied:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js
(from rev 19674,
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,158 @@
+// TODO: remove when these functions will be moved to the RichFaces.Event <!--
+
+(function (rf) {
+ rf.KEYS = {
+ BACKSPACE: 8,
+ TAB: 9,
+ RETURN: 13,
+ ESC: 27,
+ PAGEUP: 33,
+ PAGEDOWN: 34,
+ LEFT: 37,
+ UP: 38,
+ RIGHT: 39,
+ DOWN: 40,
+ DEL: 46
+ };
+})(RichFaces);
+
+
+$.extend(RichFaces.Event, {
+ bindScrollEventHandlers: function(element, handler, component) {
+ var elements = [];
+ element = RichFaces.getDomElement(element).parentNode;
+ while (element && element!=window.document.body)
+ {
+ if (element.offsetWidth!=element.scrollWidth ||
element.offsetHeight!=element.scrollHeight)
+ {
+ elements.push(element);
+ RichFaces.Event.bind(element, "scroll"+component.getNamespace(), handler,
component);
+ }
+ element = element.parentNode;
+ }
+ return elements;
+ },
+ unbindScrollEventHandlers: function(elements, component) {
+ RichFaces.Event.unbind(elements, "scroll"+component.getNamespace());
+ }
+});
+// -->
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.InplaceBase = function(id, options) {
+ $super.constructor.call(this, id);
+ var mergedOptions = $.extend({}, defaultOptions, options);
+ this.editEvent = mergedOptions.editEvent;
+ this.noneCss = mergedOptions.noneCss;
+ this.changedCss = mergedOptions.changedCss;
+ this.defaultLabel = mergedOptions.defaultLabel;
+ this.state = mergedOptions.state;
+ this.element = $(document.getElementById(id));
+ this.editContainer = $(document.getElementById(id+"Edit"));
+ this.element.bind(this.editEvent, $.proxy(this.__editHandler, this));
+ this.isSaved = false;
+ this.useDefaultLabel = false;
+ };
+
+ rf.ui.InputBase.extend(rf.ui.InplaceBase);
+ var $super = rf.ui.InplaceBase.$super;
+
+ var defaultOptions = {
+ editEvent: "click",
+ state: "ready"
+ };
+
+ $.extend(rf.ui.InplaceBase.prototype, ( function () {
+
+ var STATE = {
+ READY : 'ready',
+ CHANGED: 'changed',
+ DISABLE: 'disable',
+ EDIT: 'edit'
+ };
+
+ return {
+
+ getLabel: function() {
+ },
+
+ setLabel: function(value) {
+ },
+
+ onshow: function(){
+ },
+
+ onhide: function() {
+ },
+
+ isValueSaved: function() {
+ return this.isSaved;
+ },
+
+ save: function() {
+ var value = this.getValue()
+ if(value.length > 0) {
+ this.setLabel(value);
+ } else {
+ this.setLabel(this.defaultLabel);
+ this.useDefaultLabel = true;
+ }
+
+ this.isSaved = true;
+
+ this.__applyChangedStyles();
+ this.__hide();
+ },
+
+ cancel: function(){
+ var text = "";
+ if(!this.useDefaultLabel) {
+ text = this.getLabel()
+ }
+ this.setValue(text);
+ this.isSaved = true;
+ this.__hide();
+ },
+
+ __applyChangedStyles: function() {
+ if(this.isValueChanged()) {
+ this.element.addClass(this.changedCss);
+ } else {
+ this.element.removeClass(this.changedCss);
+ }
+ },
+
+ __show: function() {
+ this.scrollElements = rf.Event.bindScrollEventHandlers(this.id, this.__scrollHandler,
this);
+ this.onshow();
+ },
+
+ __hide: function() {
+ if(this.scrollElements) {
+ rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
+ this.scrollElements = null;
+ }
+ this.onhide();
+ this.editContainer.addClass(this.noneCss);
+ },
+
+ __editHandler: function(e) {
+ this.isSaved = false;
+ this.editContainer.removeClass(this.noneCss);
+ this.__show();
+ },
+ __scrollHandler: function(e) {
+ this.cancel();
+ },
+
+ destroy: function () {
+ $super.destroy.call(this);
+ }
+ }
+
+ })());
+
+})(jQuery, window.RichFaces);
Modified:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-10-27
15:23:56 UTC (rev 19691)
@@ -1,6 +1,7 @@
-input.rf-ii-f {
+input.rf-ii-fld {
background-image: none;
background-color : '#{richSkin.editBackgroundColor}';
+ /*TODO: seems these styles are incorrect*/
border-bottom-width : 10px;
border-bottom-style: solid;
border-bottom-color: '#{richSkin.editBackgroundColor}';
@@ -13,6 +14,17 @@
font-size : inherit;
}
+.rf-ii-edit {
+ position : absolute;
+ top : 0px;
+ left : 0px;
+ display : inline-block;
+ width: 100%;
+}
+
+.rf-ii-dis-s {
+}
+
.rf-ii-lbl {
white-space : nowrap;
}
@@ -38,14 +50,9 @@
}
.rf-ii-e-s {
- position : absolute;
- top : 0px;
- left : 0px;
- display : inline-block;
- width: 100%;
}
-.rf-ii-f {
+.rf-ii-fld {
background-color : '#{richSkin.editBackgroundColor}';
border-bottom-width : 10px;
border-bottom-style: solid;
@@ -63,7 +70,7 @@
}
.rf-ii-btn {
- background-image :
"url(#{resource['org.richfaces.images:inplaceBtnGrad.png']})";
+ background-image :
url("#{resource['org.richfaces.images:inplaceBtnGrad.png']}");
background-attachment: scroll;
background-position: center top;
background-repeat: repeat-x;
@@ -76,7 +83,7 @@
}
.rf-ii-btn-p {
- background-image :
"url(#{resource['org.richfaces.images:inplaceBtnPressGrad.png']})";
+ background-image :
url("#{resource['org.richfaces.images:inplaceBtnPressGrad.png']}");
background-position: top;
background-repeat: repeat-x;
background-color: '#{richSkin.tabBackgroundColor}';
@@ -109,7 +116,7 @@
white-space : nowrap;
}
-.rf-ii-btn-shadow {
+.rf-ii-btn-shdw {
display: inline-block;
position: relative;
padding : 6px 6px 6px 6px;
@@ -117,7 +124,7 @@
right : -6px;
}
-.rf-ii-btn-shadow-t {
+.rf-ii-btn-shdw-t {
background-position : left top;
background-image : url("#{resource['org.richfaces:bg_shadow.png']}");
background-attachment: scroll;
@@ -130,7 +137,7 @@
left : 0px
}
-.rf-ii-btn-shadow-l {
+.rf-ii-btn-shdw-l {
background-position : left bottom;
background-image : url("#{resource['org.richfaces:bg_shadow.png']}");
background-attachment: scroll;
@@ -143,7 +150,7 @@
right : 6px;
}
-.rf-ii-btn-shadow-r {
+.rf-ii-btn-shdw-r {
background-position : right bottom;
background-image : url("#{resource['org.richfaces:bg_shadow.png']}");
background-attachment: scroll;
@@ -156,7 +163,7 @@
right: 0px;
}
-.rf-ii-btn-shadow-b {
+.rf-ii-btn-shdw-b {
background-position : right top;
background-image : url("#{resource['org.richfaces:bg_shadow.png']}");
background-attachment: scroll;
Modified:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-10-27
15:23:56 UTC (rev 19691)
@@ -1,134 +1,96 @@
-// TODO: remove when these functions will be moved to the RichFaces.Event
-$.extend(RichFaces.Event, {
- bindScrollEventHandlers: function(element, handler, component) {
- var elements = [];
- element = RichFaces.getDomElement(element).parentNode;
- while (element && element!=window.document.body)
- {
- if (element.offsetWidth!=element.scrollWidth ||
element.offsetHeight!=element.scrollHeight)
- {
- elements.push(element);
- RichFaces.Event.bind(element, "scroll"+component.getNamespace(), handler,
component);
- }
- element = element.parentNode;
- }
- return elements;
- },
- unbindScrollEventHandlers: function(elements, component) {
- RichFaces.Event.unbind(elements, "scroll"+component.getNamespace());
- }
-});
-
(function ($, rf) {
rf.ui = rf.ui || {};
rf.ui.InplaceInput = function(id, options) {
- /*TODO: use defaultOptions*/
- $super.constructor.call(this, id);
- this.attachToDom(id);
+ var mergedOptions = $.extend({}, defaultOptions, options);
+ $super.constructor.call(this, id, mergedOptions);
+ this.label = $(document.getElementById(id+"Label"));
+ var labelText = this.label.text();
+ var inputLabel = this.getValue();
+ this.initialValue = (labelText == inputLabel) ? labelText : "";
+ this.saveOnBlur = mergedOptions.saveOnBlur;
+ this.showControls = mergedOptions.showControls;
+ this.getInput().bind("focus", $.proxy(this.__editHandler, this));
- this.namespace = this.namespace || "." +
rf.Event.createNamespace(this.name, this.id);
-
- this.currentState = options.state;
- this.editEvent = options.editEvent;
- this.noneCss = options.noneCss;
- this.changedCss = options.changedCss;
- this.showControls = options.showControls;
- this.defaultLabel = options.defaultLabel;
-
- this.element = $(document.getElementById(id));
- this.editContainer = $(document.getElementById(options.editContainer));
- this.input = $(document.getElementById(options.input));
- this.label = $(document.getElementById(options.label));
- this.focusElement = $(document.getElementById(options.focusElement));
-
- var label = this.label.text();
- var inputLabel = this.input.val();
-
- this.initialValue = (label == inputLabel) ? label : "";
-
- this.element.bind(this.editEvent, $.proxy(this.__editHandler, this));
- this.input.bind("focus", $.proxy(this.__editHandler, this));
- this.input.bind("change", $.proxy(this.__changeHandler, this));
- this.input.bind("blur", $.proxy(this.__blurHandler, this));
- this.input.bind("keydown", $.proxy(this.__keydownHandler, this));
-
- if(this.showControls) {
- this.okbtn = $(document.getElementById(options.okbtn));
- this.cancelbtn = $(document.getElementById(options.cancelbtn));
+ if(this.showControls) {
+ this.okbtn = $(document.getElementById(id+"Okbtn"));
+ this.cancelbtn = $(document.getElementById(id+"Cancelbtn"));
this.okbtn.bind("mousedown", $.proxy(this.__saveBtnHandler,
this));
this.cancelbtn.bind("mousedown", $.proxy(this.__cancelBtnHandler,
this));
}
+ this.focusElement = $(document.getElementById(id+"Focus"));
};
-
- // Extend component class and add protected methods from parent class to our
container
- rf.BaseComponent.extend( rf.ui.InplaceInput);
-
- // define super class link
+
+ rf.ui.InplaceBase.extend(rf.ui.InplaceInput);
var $super = rf.ui.InplaceInput.$super;
+ var defaultOptions = {
+ defaultLabel: "",
+ saveOnBlur: true,
+ showControl: true,
+ itemCss: "rf-ii-opt",
+ selectItemCss: "rf-ii-sel",
+ listCss: "rf-ii-lst-cord",
+ noneCss: "rf-ii-none",
+ //not used in inputBase?
+ editCss: "rf-ii-edit",
+ changedCss: "rf-ii-c-s"
+ };
+
$.extend(rf.ui.InplaceInput.prototype, ( function () {
-
- var isSaved = false;
- var isValueChanged = false;
-
+
return {
- name : "inplaceInput",
-/****************** public methods *****************************************/
+ name : "inplaceInput",
+
+ geName: function() {
+ return this.name;
+ },
+
+ geNamespace: function() {
+ return this.namespace;
+ },
- getNamespace: function () {
- return this.namespace;
- },
-
- edit: function() {
- isSaved = false;
- this.__show();
- this.input.focus();
- },
-
- save: function() {
- var inputValue = this.input.val();
- if(inputValue.length > 0) {
- this.label.text(inputValue);
- isValueChanged = true;
- } else {
- this.label.text(this.defaultLabel);
- isValueChanged = false;
+ __keydownHandler: function(e) {
+ switch(e.keyCode || e.which) {
+ case 27:
+ e.preventDefault();
+ this.cancel();
+ break;
+ case 13:
+ e.preventDefault();
+ this.save();
+ return false;
+ break;
}
-
- if(inputValue != this.initialValue) {
- this.element.addClass(this.changedCss);
+ },
+
+ __blurHandler: function(e) {
+ if(!this.isValueSaved() && this.__isSaveOnBlur()) {
+ this.save();
} else {
- this.element.removeClass(this.changedCss);
+ this.__hide();
}
- isSaved = true;
- this.__hide();
- },
+ return false;
+ },
+
+ __changeHandler: function(e) {
+ if(!this.isValueSaved()) {
+ this.save();
+ }
+ },
- cancel: function() {
- var text = "";
- if(isValueChanged) {
- text = this.label.text();
- }
- this.input.val(text);
- isSaved = true;
- this.__hide();
- this.element.focus();
+ __isSaveOnBlur: function() {
+ return this.saveOnBlur;
},
- setValue: function (value) {
- this.input.val(value);
- this.save();
+ __setInputFocus: function() {
+ this.getInput().unbind("focus", this.__editHandler);
+ this.getInput().focus();
+ this.getInput().bind("focus", $.proxy(this.__editHandler,
this));
},
- getValue: function() {
- return this.input.val();
- },
-
-/****************** private methods *****************************************/
-
__saveBtnHandler: function(e) {
this.save();
return false;
@@ -137,63 +99,29 @@
__cancelBtnHandler: function(e) {
this.cancel();
return false;
+ },
+
+ getLabel: function() {
+ return this.label.text();
},
-
- __editHandler: function(e) {
- this.input.unbind("focus", this.__editHandler);
- this.edit();
- this.input.bind("focus", $.proxy(this.__editHandler, this));
+
+ setLabel: function(value) {
+ this.label.text(value);
},
- __changeHandler: function(e) {
- if(!isSaved) {
- this.save();
- }
- },
-
- __blurHandler: function(e) {
- if(!isSaved) {
- this.save();
- }
- return false;
+ isValueChanged: function () {
+ return (this.getValue() != this.initialValue);
},
-
- __scrollHandler: function(e) {
- this.cancel();
- },
-
- __keydownHandler: function(e) {
- switch(e.keyCode) {
- /*Esc*/
- case 27:
- this.cancel();
- break;
- /*Enter*/
- case 13:
- this.save();
- return false;
- }
-
- },
-
- __show: function() {
- this.scrollElements = rf.Event.bindScrollEventHandlers(this.id,
this.__scrollHandler, this);
- this.editContainer.removeClass(this.noneCss);
- },
-
- __hide: function() {
- rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
- this.scrollElements = null;
- this.editContainer.addClass(this.noneCss);
- this.focusElement.focus();
- },
+
+ onshow: function(){
+ this.__setInputFocus();
+ },
+
+ onhide: function() {
+ this.focusElement.focus();
+ }
- destroy: function () {
- //TODO: unbind handlers
- $super.destroy.call(this);
- }
- }
- })());
+ }
+ })());
-})(jQuery, window.RichFaces);
-
+})(jQuery, window.RichFaces);
\ No newline at end of file
Copied:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
(from rev 19674,
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,224 @@
+input.rf-is-fld {
+ background : '#{richSkin.editBackgroundColor}';
+ padding : 0px 0px 0px 0px;
+ border : 0px;
+ margin : 0px;
+ width : 112px;
+ background-image:"url(#{resource['org.richfaces:mark_list.gif']})";
+ background-position : center right;
+ background-repeat : no-repeat;
+ font-family:inherit;
+ font-size : inherit;
+}
+
+.rf-is-none {
+ clip: "rect(0px 0px 1px 1px)";
+}
+
+.rf-is-none {
+ clip: rect(0px, 0px, 1px, 1px);
+}
+
+.rf-is-dis-s {
+}
+
+.rf-is-edit {
+ position : absolute;
+ top : 0px;
+ left : 0px;
+ width : 100px;
+ background-color : '#{richSkin.editBackgroundColor}';
+}
+
+.rf-is-fnt {
+}
+
+.rf-is-d-s {
+ display : inline-block;
+ position : relative;
+ white-space : nowrap;
+ background-color : '#{richSkin.editorBackgroundColor}';
+ border-bottom-width : 1px;
+ border-bottom-style : dashed;
+ border-bottom-color : '#{richSkin.generalTextColor}';
+ padding-left : 3px;
+ padding-right : 3px;
+}
+
+.rf-is-c-s {
+ display : inline-block;
+ background-image :
"url(#{resource['org.richfaces:mark_changed.gif']})";
+ background-position : top left;
+ background-repeat : no-repeat;
+}
+
+.rf-is-e-s {
+}
+
+.rf-is-fld {
+ background-color : '#{richSkin.editBackgroundColor}';
+ padding : 0px 0px 0px 0px;
+ border : 0px;
+ margin : 0px;
+ width : 112px;
+ background-image: "url(#{resource['org.richfaces:mark_list.gif']})";
+ background-position : center right;
+ background-repeat : no-repeat;
+}
+
+.rf-is-btn {
+ background-image :
url("#{resource['org.richfaces.images:inplaceBtnGrad.png']}");
+ background-position : top;
+ background-repeat: repeat-x;
+ background-color: '#{richSkin.tabBackgroundColor}';
+ border-width : 1px;
+ border-style : outset;
+ border-color : '#{richSkin.panelBorderColor}';
+ padding : 3px;
+ margin : 0px;
+}
+
+.rf-is-btn-p {
+ background-image :
url("#{resource['org.richfaces.images:inplaceBtnPressGrad.png']}");
+ background-position : top;
+ background-repeat : repeat-x;
+ background-color : '#{richSkin.tabBackgroundColor}';
+ border-width : 1px;
+ border-style : inset;
+ border-color : '#{richSkin.panelBorderColor}';
+ padding : 3px;
+ margin : 0px;
+}
+
+.rf-is-btn-set {
+ position : absolute;
+ top : 0px;
+ left : 112px;
+ white-space : nowrap;
+}
+
+.rf-is-lst-cord {
+ display : block;
+ /*font-size : 0px;*/
+ position : relative;
+ font-family:inherit;
+ font-size : inherit;
+}
+
+.rf-is-lst-pos {
+ display : block;
+ position : absolute;
+ top: 0px;
+ left: -1px;
+}
+
+.rf-is-lst-dec {
+ display : block;
+ border-width : 1px;
+ border-style : solid;
+ border-color : '#{richSkin.panelBorderColor}';
+ padding : 0px;
+ /*width: 100%;*/
+ background-color : '#{richSkin.editBackgroundColor}';
+}
+
+.rf-is-lst-scrl {
+ display : block;
+ overflow : auto;
+ overflow-x : hidden;
+ /*height : 100px;*/
+}
+
+.rf-is-opt {
+ display : block;
+ padding : 2px;
+ white-space : nowrap;
+ background-color : '#{richSkin.editBackgroundColor}';
+ cursor : default;
+}
+
+.rf-is-sel {
+ display : block;
+ padding : 1px;
+ background-color: #DFE8F6; /*get from skin???*/
+ border-width : 1px;
+ border-style : dotted;
+ border-color : '#{richSkin.generalTextColor}';
+}
+
+.rf-is-btn-prepos {
+ display : block;
+ position : absolute;
+ top : -4px;
+ right : 0px;
+ wigth : 1px;
+ height : 1px;
+}
+
+.rf-is-btn-pos {
+ display : block;
+ position : absolute;
+ top : 0px;
+ left : 0px;
+ white-space : nowrap;
+}
+
+.rf-is-btn-shdw {
+ display : block;
+ position: relative;
+ padding : 6px 6px 6px 6px;
+ top : -6px;
+ right : -6px;
+}
+
+.rf-is-shdw {
+ display : block;
+ position: relative;
+ padding : 6px 6px 6px 6px;
+ top : -6px;
+ left : -6px;
+}
+
+.rf-is-shdw-t {
+ display : block;
+ background-image :
"url(#{resource['org.richfaces:bg_shadow.png']})";
+ background-position : top left;
+ position: absolute;
+ width: 6px;
+ top: 0px;
+ bottom: 6px;
+ left : 0px
+}
+
+.rf-is-shdw-l {
+ display : block;
+ background-image : "url(#{resource['org.richfaces:bg_shadow.png']})";
+ background-position : bottom left;
+ position : absolute;
+ height : 6px;
+ bottom : 0px;
+ left : 0px;
+ right : 6px;
+}
+
+.rf-is-shdw-r {
+ display : block;
+ background : "url(#{resource['org.richfaces:bg_shadow.png']})";
+ background-position : bottom right;
+ position : absolute;
+ width : 6px;
+ top : 6px;
+ bottom : 0px;
+ right : 0px;
+}
+
+.rf-is-shdw-b {
+ display : block;
+ background : "url(#{resource['org.richfaces:bg_shadow.png']})";
+ background-position : right top;
+ position: absolute;
+ height : 6px;
+ top: 0px;
+ left : 6px;
+ right : 0px;
+}
Copied:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
(from rev 19674,
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,142 @@
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.InplaceSelect = function(id, options) {
+ var mergedOptions = $.extend({}, defaultOptions, options);
+ $super.constructor.call(this, id, mergedOptions)
+ mergedOptions['attachTo'] = id;
+ this.popupList = new rf.ui.PopupList(id+"List", this, mergedOptions);
+ this.items = mergedOptions.items;
+ this.selValueInput = $(document.getElementById(id+"selValue"));
+ this.openPopup = false;
+ }
+
+ rf.ui.InplaceInput.extend(rf.ui.InplaceSelect);
+ var $super = rf.ui.InplaceSelect.$super;
+
+ var defaultOptions = {
+ defaultLabel: "",
+ showControl: false,
+ itemCss: "rf-is-opt",
+ selectItemCss: "rf-is-sel",
+ listCss: "rf-is-lst-cord",
+ noneCss: "rf-is-none",
+ editCss: "rf-is-edit",
+ changedCss: "rf-is-c-s"
+ };
+
+
+ $.extend(rf.ui.InplaceSelect.prototype, ( function () {
+
+ return{
+ name : "inplaceSelect",
+
+ getName: function() {
+ return this.name;
+ },
+
+ geNamespace: function() {
+ return this.namespace;
+ },
+
+ onshow: function() {
+ if(this.openPopup) {
+ this.popupList.show();
+ }
+
+ if(!this.openPopup) {
+ this.openPopup = true;
+ }
+
+ $super.onshow.call(this);
+ },
+
+ onhide: function() {
+ this.popupList.hide();
+ this.openPopup = false;
+ },
+
+ processItem: function(item) {
+ var key = $(item).attr("id");
+ var value = this.getItemValue(key);
+ this.saveItemValue(value);
+ var label = this.getItemLabel(key);
+ this.setValue(label);
+
+ this.popupList.hide();
+ this.openPopup = false;
+ this.__setInputFocus();
+ },
+
+ getItemValue: function(key) {
+ for(var i in this.items) {
+ var item = this.items[i];
+ if(item && item.id == key) {
+ return item.value;
+ }
+ }
+ },
+
+ saveItemValue: function(value) {
+ this.selValueInput.val(value);
+ },
+
+ getItemLabel: function(key) {
+ for(var i in this.items) {
+ var item = this.items[i];
+ if(item && item.id == key) {
+ return item.label;
+ }
+ }
+ },
+
+ __keydownHandler: function(e) {
+
+ var code;
+
+ if(e.keyCode) {
+ code = e.keyCode;
+ } else if(e.which) {
+ code = e.which;
+ }
+
+ if(this.popupList.isVisible()) {
+ switch(code) {
+ case rf.KEYS.DOWN:
+ e.preventDefault();
+ this.popupList.__selectNext();
+ this.__setInputFocus();
+ break;
+
+ case rf.KEYS.UP:
+ e.preventDefault();
+ this.popupList.__selectPrev();
+ this.__setInputFocus();
+ break;
+
+ case rf.KEYS.RETURN:
+ e.preventDefault();
+ this.popupList.__selectCurrent();
+ this.__setInputFocus();
+ return false;
+ break;
+ }
+ }
+
+ $super.__keydownHandler.call(this,e);
+
+ },
+
+ __blurHandler: function(e) {
+ var target = $(e.originalEvent.explicitOriginalTarget);
+ if(!this.popupList.isPopupList(target)) {
+ $super.__blurHandler.call(this,e);
+ }
+ return false;
+ }
+ }
+
+ })());
+
+})(jQuery, window.RichFaces);
Copied:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputBase.js
(from rev 19674,
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputBase.js)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputBase.js
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputBase.js 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,91 @@
+(function (rf) {
+ rf.KEYS = {
+ BACKSPACE: 8,
+ TAB: 9,
+ RETURN: 13,
+ ESC: 27,
+ PAGEUP: 33,
+ PAGEDOWN: 34,
+ LEFT: 37,
+ UP: 38,
+ RIGHT: 39,
+ DOWN: 40,
+ DEL: 46
+ };
+})(RichFaces);
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.InputBase = function(id, options) {
+ $super.constructor.call(this, id);
+ this.namespace = this.getNamespace() || "." +
rf.Event.createNamespace(this.getName(), this.getId());
+
+ this.id = id;
+ this.input = $(document.getElementById(id + "Input"));
+ this.attachToDom(id);
+
+ this.input.bind("keydown", $.proxy(this.__keydownHandler, this));
+ this.input.bind("blur", $.proxy(this.__blurHandler, this));
+ this.input.bind("change", $.proxy(this.__changeHandler, this));
+ this.input.bind("click", $.proxy(this.__clickHandler, this));
+ this.input.bind("focus", $.proxy(this.__focusHandler, this));
+ };
+
+ rf.BaseComponent.extend(rf.ui.InputBase);
+ var $super = rf.ui.InputBase.$super;
+
+ $.extend(rf.ui.InputBase.prototype, ( function () {
+
+ return {
+
+ name : "inputBase",
+
+ getName: function() {
+ return this.name;
+ },
+
+ getNamespace: function() {
+ return this.namespace;
+ },
+
+ __focusHandler: function(e) {
+
+ },
+
+ __clickHandler: function(e) {
+ },
+
+ __keydownHandler: function(e) {
+ },
+
+ __blurHandler: function(e) {
+ },
+
+ __changeHandler: function(e) {
+ },
+
+ __setInputFocus: function() {
+ this.input.focus();
+ },
+
+ getValue: function() {
+ return this.input.val();
+ },
+
+ setValue: function(value){
+ this.input.val(value);
+ },
+
+ getInput: function() {
+ return this.input;
+ },
+
+ getId: function() {
+ return this.id;
+ }
+ }
+ })());
+
+})(jQuery, window.RichFaces);
\ No newline at end of file
Modified:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.ecss
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.ecss 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.ecss 2010-10-27
15:23:56 UTC (rev 19691)
@@ -19,31 +19,31 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-.rf-ins, .rf-ins-ta {
+.rf-insl, .rf-insl-trc-cntr {
display: inline-block;
}
-.rf-ins {
+.rf-insl {
white-space: nowrap;
}
-.rf-ins-ta {
+.rf-insl-trc-cntr {
width: 200px; /*TODO remove it*/
vertical-align: top;
}
-.rf-ins-mn, .rf-ins-mx, input.rf-ins-i, .rf-ins-tt {
+.rf-insl-mn, .rf-insl-mx, input.rf-insl-inp, .rf-insl-tt {
font-size: '#{richSkin.generalSizeFont}';
font-family: '#{richSkin.generalFamilyFont}';
color: '#{richSkin.generalTextColor}';
}
-.rf-ins-mn, .rf-ins-mx {
+.rf-insl-mn, .rf-insl-mx {
display: block;
margin-bottom: 3px;
}
-.rf-ins-mn {
+.rf-insl-mn {
border-left-width: 1px;
border-left-style: solid;
border-left-color: '#{richSkin.panelBorderColor}';
@@ -51,7 +51,7 @@
float: left;
}
-.rf-ins-mx {
+.rf-insl-mx {
border-right-width: 1px;
border-right-style: solid;
border-right-color: '#{richSkin.panelBorderColor}';
@@ -60,12 +60,12 @@
text-align: right;
}
-.rf-ins-ci {
+.rf-insl-inp-cntr {
margin: 0px;
vertical-align: bottom;
}
-input.rf-ins-i {
+input.rf-insl-inp {
background:
url("#{resource['org.richfaces.renderkit.html.images.InputBackgroundImage']}")
top repeat-x;
background-color: '#{richSkin.controlBackgroundColor}';
border-width: 1px;
@@ -75,7 +75,7 @@
vertical-align: bottom;
}
-.rf-ins-tt {
+.rf-insl-tt {
position: absolute;
display: none;
/* TODO padding: 2px;
@@ -83,7 +83,7 @@
background-color: '#{richSkin.tipBackgroundColor}';*/
}
-.rf-ins-t {
+.rf-insl-trc {
background:
url("#{resource['org.richfaces.images:insldrTrackGrad.png']}") 1px 1px
repeat-x;
background-color: '#{richSkin.controlBackgroundColor}';
border-width: 1px;
@@ -97,53 +97,53 @@
font-size: 0px;
}
-.rf-ins-h, .rf-ins-h-d, .rf-ins-db, .rf-ins-ib, .rf-ins-db-d, .rf-ins-ib-d {
+.rf-insl-hnd, .rf-insl-hnd-dis, .rf-insl-dec, .rf-insl-inc, .rf-insl-dec-dis,
.rf-insl-inc-dis {
display: inline-block;
width: 7px;
height: 7px;
}
-.rf-ins-h, .rf-ins-h-d {
+.rf-insl-hnd, .rf-insl-hnd-dis {
vertical-align: top;
}
-.rf-ins-db, .rf-ins-ib, .rf-ins-db-d, .rf-ins-ib-d {
+.rf-insl-dec, .rf-insl-inc, .rf-insl-dec-dis, .rf-insl-inc-dis {
vertical-align: bottom;
}
-.rf-ins-h {
+.rf-insl-hnd {
background-image:
url("#{resource['org.richfaces.renderkit.html.images.SliderArrowBottom']}");
}
-.rf-ins-h-s {
+.rf-insl-hnd-sel {
background-image:
url("#{resource['org.richfaces.renderkit.html.images.SliderSelectedArrowBottom']}");
}
-.rf-ins-h-d {
+.rf-insl-hnd-dis {
background-image:
url("#{resource['org.richfaces.renderkit.html.images.SliderDisabledArrowBottom']}");
}
-.rf-ins-db {
+.rf-insl-dec {
background-image:
url("#{resource['org.richfaces.renderkit.html.images.SliderArrowLeft']}");
}
-.rf-ins-db-s {
+.rf-insl-dec-sel {
background-image:
url("#{resource['org.richfaces.renderkit.html.images.SliderSelectedArrowLeft']}");
}
-.rf-ins-db-d {
+.rf-insl-dec-dis {
background-image:
url("#{resource['org.richfaces.renderkit.html.images.SliderDisabledArrowLeft']}");
}
-.rf-ins-ib {
+.rf-insl-inc {
background-image:
url("#{resource['org.richfaces.renderkit.html.images.SliderArrowRight']}");
}
-.rf-ins-ib-s {
+.rf-insl-inc-sel {
background-image:
url("#{resource['org.richfaces.renderkit.html.images.SliderSelectedArrowRight']}");
}
-.rf-ins-ib-d {
+.rf-insl-inc-dis {
background-image:
url("#{resource['org.richfaces.renderkit.html.images.SliderDisabledArrowRight']}");
}
\ No newline at end of file
Modified:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-10-27
15:23:56 UTC (rev 19691)
@@ -32,32 +32,32 @@
step: 1,
tabIndex: 0,
- decreaseSelectedClass: "rf-ins-db-s",
- handleSelectedClass: "rf-ins-h-s",
- increaseSelectedClass: "rf-ins-ib-s",
+ decreaseSelectedClass: "rf-insl-dec-sel",
+ handleSelectedClass: "rf-insl-hnd-sel",
+ increaseSelectedClass: "rf-insl-inc-sel",
init: function (id, options, selectedClasses) {
jQuery.extend(this, options);
this.range = this.maxValue - this.minValue;
this.id = id;
this.element = jQuery(this.attachToDom());
- this.input =
this.element.children(".rf-ins-ci").children(".rf-ins-i");
- this.track =
this.element.children(".rf-ins-ta").children(".rf-ins-t");
- this.handle = this.track.children(".rf-ins-h, .rf-ins-h-d");
- this.tooltip = this.element.children(".rf-ins-tt");
+ this.input =
this.element.children(".rf-insl-inp-cntr").children(".rf-insl-inp");
+ this.track =
this.element.children(".rf-insl-trc-cntr").children(".rf-insl-trc");
+ this.handle = this.track.children(".rf-insl-hnd, .rf-insl-hnd-dis");
+ this.tooltip = this.element.children(".rf-insl-tt");
- this.__inputHandler();
+ var proxy = jQuery.proxy(this.__inputHandler, this);
+ jQuery(document).ready(proxy);
if (!this.disabled) {
- this.decreaseButton = this.element.children(".rf-ins-db");
- this.increaseButton = this.element.children(".rf-ins-ib");
+ this.decreaseButton = this.element.children(".rf-insl-dec");
+ this.increaseButton = this.element.children(".rf-insl-inc");
this.track[0].tabIndex = this.tabIndex;
for (var i in selectedClasses) {
this[i] += " " + selectedClasses[i];
}
- var proxy = jQuery.proxy(this.__inputHandler, this)
this.input.change(proxy);
this.input.submit(proxy);
this.track.keydown(jQuery.proxy(this.__keydownHandler, this));
@@ -68,20 +68,20 @@
},
decrease: function (event) {
- this.setValue(this.value - this.step);
+ this.setValue(this.value - this.step, event);
},
increase: function (event) {
- this.setValue(this.value + this.step);
+ this.setValue(this.value + this.step, event);
},
- setValue: function (value) {
+ setValue: function (value, event) {
if (!this.disabled) {
- this.__setValue(value);
+ this.__setValue(value, event);
}
},
- __setValue: function (value) {
+ __setValue: function (value, event) {
if (!isNaN(value)) {
value = Math.round(value / this.step) * this.step; //TODO Add normal support of
float values. E.g. '0.3' should be instead of '0.30000000000000004'.
if (value > this.maxValue) {
@@ -96,34 +96,37 @@
this.tooltip.text(value);
this.tooltip.setPosition(this.handle,{from: 'LT', offset: [0, -3]});
//TODO Seems offset doesn't work now.
this.value = value;
+ if (this.onchange && (!event || event.type)) {
+ this.onchange.call(this.element[0], event);
+ }
}
}
},
- __inputHandler: function () {
+ __inputHandler: function (event) {
var value = Number(this.input.val());
if (isNaN(value)) {
this.input.val(this.value);
} else {
- this.__setValue(value);
+ this.__setValue(value, event);
}
},
__keydownHandler: function (event) {
if (event.keyCode == 37) { //LEFT
- this.__setValue(Number(this.input.val()) - this.step);
+ this.__setValue(Number(this.input.val()) - this.step, event);
event.preventDefault();
} else if (event.keyCode == 39) { //RIGHT
- this.__setValue(Number(this.input.val()) + this.step);
+ this.__setValue(Number(this.input.val()) + this.step, event);
event.preventDefault();
}
},
__decreaseHandler: function (event) {
var component = this;
- component.decrease();
+ component.decrease(event);
this.intervalId = window.setInterval(function() {
- component.decrease();
+ component.decrease(event);
}, this.delay);
jQuery(document).one("mouseup", true, jQuery.proxy(this.__clearInterval,
this));
this.decreaseButton.addClass(this.decreaseSelectedClass);
@@ -132,9 +135,9 @@
__increaseHandler: function (event) {
var component = this;
- component.increase();
+ component.increase(event);
this.intervalId = window.setInterval(function() {
- component.increase();
+ component.increase(event);
}, this.delay);
jQuery(document).one("mouseup",jQuery.proxy(this.__clearInterval,
this));
this.increaseButton.addClass(this.increaseSelectedClass);
@@ -163,7 +166,7 @@
__mousemoveHandler: function (event) {
var value = this.range * (event.pageX - this.track.position().left) /
(this.track.width()
- this.handle.width()) + this.minValue;
- this.__setValue(value);
+ this.__setValue(value, event);
event.preventDefault();
},
Copied:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.ecss
(from rev 19674,
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.ecss)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.ecss
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.ecss 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+.rf-insp {
+ border-width: 1px;
+ border-style: solid;
+ border-color: '#{richSkin.panelBorderColor}';
+ display: inline-block;
+ font-size: 1px;
+ white-space: nowrap;
+}
+
+input.rf-insp-inp[type="text"] {
+ background-color: '#{richSkin.controlBackgroundColor}';
+ background-imaage:
url("#{resource['org.richfaces.renderkit.html.images.InputBackgroundImage']}");
+ background-position:1px 1px;
+ background-repeat:no-repeat;
+ border: 0px;
+ color: '#{richSkin.generalTextColor}';
+ font-family : '#{richSkin.generalFamilyFont}';
+ font-size : '#{richSkin.generalSizeFont}';
+ margin: 0px;
+ padding: 0px;
+ vertical-align: top;
+}
+
+.rf-insp-btns {
+ background-color: '#{richSkin.headerBackgroundColor}';
+ background-image:
"url(#{resource['org.richfaces.renderkit.html.images.ButtonBackgroundImage']})";
+ background-position: top left;
+ background-repeat: repeat-x;
+ border-left-width: 1px;
+ border-left-style: solid;
+ border-left-color: '#{richSkin.panelBorderColor}';
+ display: inline-block;
+ vertical-align: top;
+}
+
+
+.rf-insp-dec, .rf-insp-inc, .rf-insp-dec-dis, .rf-insp-inc-dis {
+ background-position: 50% 40%;
+ background-repeat: no-repeat;
+ display: block;
+ height: 8px;
+ width: 15px;
+}
+
+.rf-insp-dec {
+ background-image:
url("#{resource['org.richfaces.renderkit.html.images.SpinnerArrowBottom']}");
+}
+
+.rf-insp-inc {
+ background-image:
url("#{resource['org.richfaces.renderkit.html.images.SpinnerArrowTop']}");
+}
+
+.rf-insp-dec-dis {
+ background-image:
url("#{resource['org.richfaces.renderkit.html.images.SpinnerDisabledArrowBottom']}");
+}
+
+.rf-insp-inc-dis {
+ background-image:
url("#{resource['org.richfaces.renderkit.html.images.SpinnerDisabledArrowTop']}");
+}
\ No newline at end of file
Copied:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js
(from rev 19674,
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSpinner.js 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+(function(richfaces, jQuery) {
+ richfaces.ui = richfaces.ui || {};
+
+ richfaces.ui.InputNumberSpinner = richfaces.BaseComponent.extendClass({
+
+ name: "InputNumberSpinner",
+
+ cycled: true,
+ delay: 200,
+ maxValue: 100,
+ minValue: 0,
+ step: 1,
+
+ init: function (id, options) {
+ jQuery.extend(this, options);
+ this.id = id;
+ this.element = jQuery(this.attachToDom());
+ this.input = this.element.children(".rf-insp-inp");
+
+ var value = Number(this.input.val());
+ if (isNaN(value)) {
+ value = this.minValue;
+ }
+ this.__setValue(value, null, true);
+
+ if (!this.input.attr("disabled")) {
+ var buttonsArea = this.element.children(".rf-insp-btns");
+ this.decreaseButton = buttonsArea.children(".rf-insp-dec");
+ this.increaseButton = buttonsArea.children(".rf-insp-inc");
+
+ var proxy = jQuery.proxy(this.__inputHandler, this)
+ this.input.change(proxy);
+ this.input.submit(proxy);
+ this.input.submit(proxy);
+ this.input.keydown(jQuery.proxy(this.__keydownHandler, this));
+ this.decreaseButton.mousedown(jQuery.proxy(this.__decreaseHandler, this));
+ this.increaseButton.mousedown(jQuery.proxy(this.__increaseHandler, this));
+ }
+ },
+
+ decrease: function (event) {
+ var value = this.value - this.step;
+ if (value < this.minValue && this.cycled) {
+ value = this.maxValue;
+ }
+ this.__setValue(value, event);
+ },
+
+ increase: function (event) {
+ var value = this.value + this.step;
+ if (value > this.maxValue && this.cycled) {
+ value = this.minValue;
+ }
+ this.__setValue(value, event);
+ },
+
+ getValue: function () {
+ return this.value;
+ },
+
+ setValue: function (value, event) {
+ if (!this.input.attr("disabled")) {
+ this.__setValue(value);
+ }
+ },
+
+ __setValue: function (value, event, skipOnchange) {
+ if (!isNaN(value)) {
+ value = Math.round(value / this.step) * this.step; //TODO Add normal support of
float values. E.g. '0.3' should be instead of '0.30000000000000004'.
+ if (value > this.maxValue) {
+ value = this.maxValue;
+ } else if (value < this.minValue) {
+ value = this.minValue;
+ }
+ if (value != this.value) {
+ this.input.val(value);
+ this.value = value;
+ if (this.onchange && !skipOnchange) {
+ this.onchange.call(this.element[0], event);
+ }
+ }
+ }
+ },
+
+ __inputHandler: function (event) {
+ var value = Number(this.input.val());
+ if (isNaN(value)) {
+ this.input.val(this.value);
+ } else {
+ this.__setValue(value, event);
+ }
+ },
+
+ __keydownHandler: function (event) {
+ if (event.keyCode == 40) { //DOWN
+ this.decrease(event);
+ event.preventDefault();
+ } else if (event.keyCode == 38) { //UP
+ this.increase(event);
+ event.preventDefault();
+ }
+ },
+
+ __decreaseHandler: function (event) {
+ var component = this;
+ component.decrease(event);
+ this.intervalId = window.setInterval(function() {
+ component.decrease(event);
+ }, this.delay);
+ var proxy = jQuery.proxy(this.__clearInterval, this);
+ this.decreaseButton.bind("mouseup", true,
proxy).bind("mouseout", true, proxy)
+ .css("backgroundPosition", "60% 60%");
+ event.preventDefault();
+ },
+
+ __increaseHandler: function (event) {
+ var component = this;
+ component.increase(event);
+ this.intervalId = window.setInterval(function() {
+ component.increase(event);
+ }, this.delay);
+ var proxy = jQuery.proxy(this.__clearInterval, this);
+ this.increaseButton.bind("mouseup", proxy).bind("mouseout",
proxy)
+ .css("backgroundPosition", "60% 60%");
+ event.preventDefault();
+ },
+
+ __clearInterval: function (event) {
+ window.clearInterval(this.intervalId);
+ var button = this.increaseButton;
+ if (event.data) { // decreaseButton
+ button = this.decreaseButton;
+ }
+ button.css("backgroundPosition", " 50%
40%").unbind("mouseout", this.__clearInterval)
+ .unbind("mouseup", this.__clearInterval);
+ }
+ });
+}(window.RichFaces, jQuery));
\ No newline at end of file
Copied:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
(from rev 19674,
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,74 @@
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.Popup = function(id, options) {
+ this.id = id;
+ this.attachToDom(id);
+ this.popup = $(document.getElementById(id));
+
+ var mergedOptions = $.extend({}, defaultOptions, options);
+ this.visible = mergedOptions.visible;
+ this.attachTo = mergedOptions.attachTo;
+ this.attachToBody = mergedOptions.attachToBody;
+ this.positionType = mergedOptions.positionType;
+ this.positionOffset = mergedOptions.positionOffset;
+
+ this.popup.bind("mouseover", $.proxy(this.__onMouseOver, this));
+ this.popup.bind("click", $.proxy(this.__onClick, this));
+ };
+
+ rf.BaseComponent.extend(rf.ui.Popup);
+ var $super = rf.ui.Popup.$super;
+
+
+ var defaultOptions = {
+ visible: false
+ };
+
+ $.extend(rf.ui.Popup.prototype, (function () {
+
+ return{
+
+ name : "popup",
+
+ show: function() {
+ if(!this.visible) {
+ if(this.attachToBody) {
+ this.parentElement = this.popup.parent();
+ this.popup.detach().appendTo("body");
+ }
+ this.popup.setPosition({id: this.attachTo}, {type: this.positionType , offset:
this.positionOffset}).show();
+ this.visible = true;
+ }
+ },
+
+ hide: function() {
+ if(this.visible) {
+ this.popup.hide();
+ this.visible = false;
+ if (this.attachToBody && this.parentElement) {
+ this.popup.detach().appendTo(this.parentElement);
+ this.parentElement = null;
+ }
+ }
+ },
+
+ isVisible: function() {
+ return this.visible;
+ },
+
+ getId: function() {
+ return this.id;
+ },
+
+ __onMouseOver: function(e) {
+ },
+
+ __onClick: function(e) {
+ }
+ }
+
+ })());
+
+})(jQuery, window.RichFaces);
\ No newline at end of file
Copied:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js
(from rev 19674,
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,156 @@
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.PopupList = function(id, listener, options) {
+ var mergedOptions = $.extend({}, defaultOptions, options);
+ $super.constructor.call(this, id, mergedOptions);
+ this.selectListener = listener;
+ this.selectItemCss = mergedOptions.selectItemCss;
+ this.itemCss = mergedOptions.itemCss;
+ this.listCss = mergedOptions.listCss;
+ this.index = -1;
+ this.__updateItemsList();
+ };
+
+ rf.ui.Popup.extend(rf.ui.PopupList);
+ var $super = rf.ui.PopupList.$super;
+
+ var defaultOptions = {
+ attachToBody: true,
+ positionType: "DROPDOWN",
+ positionOffset: [0,20]
+ };
+
+
+ $.extend(rf.ui.PopupList.prototype, ( function () {
+
+ return{
+
+ name : "popupList",
+
+ processItem: function(item) {
+ if(this.selectListener.processItem && typeof
this.selectListener.processItem == 'function') {
+ this.selectListener.processItem(item);
+ }
+ },
+
+ selectItem: function(item) {
+ if(this.selectListener.selectItem && typeof
this.selectListener.selectItem == 'function') {
+ this.selectListener.selectItem(item);
+ } else {
+ item.addClass(this.selectItemCss);
+ }
+ },
+
+ unselectItem: function(item) {
+ if(this.selectListener.unselectItem && typeof
this.selectListener.unselectItem == 'function') {
+ this.selectListener.unselectItem(item);
+ } else {
+ item.removeClass(this.selectItemCss);
+ }
+ },
+
+ resetItemsSelection: function() {
+ if(this.items) {
+ var popup = this;
+ this.items.each(function(i,item){
+ popup.unselectItem($(item));
+ }
+ );
+ }
+ },
+
+ isPopupList: function(target) {
+ var parentId = target.parents("." +
this.listCss).attr("id");
+ return (parentId && (parentId == this.getId()));
+ },
+
+ __updateItemsList: function () {
+ return (this.items = this.popup.find("."+this.itemCss));
+ },
+
+ __select: function(item) {
+ var index = this.items.index(item);
+ this.__selectByIndex(index);
+ },
+
+ __selectByIndex: function(index, isOffset) {
+ if (this.items.length==0 || (!isOffset && this.index == index)) return;
+
+ var item;
+ if (this.index != -1) {
+ item = this.items.eq(this.index);
+ this.unselectItem(item);
+ }
+
+ if (index==undefined) {
+ this.index = -1;
+ return;
+ }
+
+ if (isOffset) {
+ this.index += index;
+ if ( this.index<0 ) {
+ this.index = this.items.length - 1;
+ } else if (this.index >= this.items.length) {
+ this.index = 0;
+ }
+ } else {
+ if (index<0) {
+ index = 0;
+ } else if (index>=this.items.length) {
+ index = this.items.length - 1;
+ }
+ this.index = index;
+ }
+
+ item = this.items.eq(this.index);
+ this.selectItem(item);
+ },
+
+ __selectCurrent: function() {
+ var item;
+ if(this.items && this.index >= 0) {
+ item = this.items.eq(this.index);
+ this.processItem(item);
+ }
+ },
+
+ __selectPrev: function() {
+ this.__selectByIndex(-1, true);
+ },
+
+ __selectNext: function() {
+ this.__selectByIndex(1, true);
+ },
+
+ __onMouseOver: function(e) {
+ var item = this.__getItem(e);
+ if(item) {
+ this.__select(item);
+ }
+ },
+
+ __onClick: function(e) {
+ var item = this.__getItem(e);
+ this.processItem(item);
+ this.__select(item);
+ },
+
+ __getItem: function(e) {
+ return $(e.target).closest("."+this.itemCss, e.currentTarget).get(0);
+ },
+
+ __getItems: function () {
+ return this.items;
+ },
+
+ __setItems: function(items) {
+ this.items = items;
+ }
+
+ }
+ })());
+
+})(jQuery, window.RichFaces);
\ No newline at end of file
Copied:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.ecss
(from rev 19674,
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.ecss)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.ecss
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.ecss 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,144 @@
+
+.rf-sel-inp.rf-s-fnt, .rf-sel-opt.rf-sel-fnt{
+ color: '#{richSkin.generalTextColor}';
+ font-size: '#{richSkin.generalSizeFont}';
+ font-family: '#{richSkin.generalFamilyFont}';
+}
+
+input.rf-sel-inp {
+ border-width: 0px;
+ background: none;
+ width: 100%;
+}
+
+.rf-sel-fld{
+ width: 200px;
+ position: inline-block;
+ border-width: 1px;
+ border-style: solid;
+ border-color: '#{richSkin.panelBorderColor}';
+ display: inline-block;
+ background-image:
"url(#{resource['org.richfaces.renderkit.html.images.AutocompleteFieldGradient']})";
+ background-repeat: repeat-x;
+ background-position: top left;
+ background-color: '#{richSkin.controlBackgroundColor}';
+}
+
+.rf-sel-btn{
+ background-image:
"url(#{resource['org.richfaces.renderkit.html.images.AutocompleteButtonGradient']})";
+ background-repeat: repeat-x;
+ background-position: top left;
+ background-color: '#{richSkin.headerBackgroundColor}';
+ text-align: center;
+ border-left-style: solid;
+ border-left-width: 1px;
+ border-left-color: '#{richSkin.panelBorderColor}';
+ width: 15px;
+ position: absolute;
+ top: 0px;
+ right: 0px;
+ height: 200px;
+ padding-top: 1px
+}
+
+.rf-sel-btn-arrow{
+ background-position: center;
+ background-repeat: no-repeat;
+ background-image:
"url(#{resource['org.richfaces:combo_down_button.gif']})";
+ cursor: pointer;
+ width: 15px;
+ height: 15px;
+}
+
+.rf-sel-lst-cord{
+ position: absolute;
+ /* TODO nick - review: font-size: 0px; */
+ display: none;
+}
+
+.rf-sel-lst-dcrtn{
+ border-width: 1px;
+ border-style: solid;
+ border-color: '#{richSkin.panelBorderColor}';
+ padding: 0px;
+ background-color: '#{richSkin.tableBackgroundColor}';
+}
+
+.rf-sel-lst-scrl{
+ overflow: auto;
+ overflow-x: hidden;
+ width: 200px;
+ max-height: 100px;
+ min-height: 20px;
+}
+
+.rf-sel-opt{
+ padding: 2px;
+ white-space: nowrap;
+ cursor: default;
+ list-style-type: none;
+}
+
+.rf-sel-sel{
+ padding: 1px;
+ width: 100%;
+ background-color: '#{richSkin.headerBackgroundColor}';
+ border-width: 1px;
+ border-style: dotted;
+ border-color: '#{richSkin.generalTextColor}';
+}
+
+.rf-sel-shdw{
+ border: 0px solid red;
+ display: inline-block;
+ position: absolute;
+ float: left;
+ padding: 6px 6px 6px 6px;
+ top: -6px;
+ left: -7px;
+}
+
+.rf-sel-shdw-t{
+ background-image:
"url(#{resource['org.richfaces:combo_list_shadow.png']})";
+ background-position: top left;
+ position: absolute;
+ width: 6px;
+ top: 0px;
+ bottom: 6px;
+ left: 0px
+}
+
+.rf-sel-shdw-l{
+ background-image:
"url(#{resource['org.richfaces:combo_list_shadow.png']})";
+ background-position: bottom left;
+ position: absolute;
+ height: 6px;
+ bottom: 0px;
+ left: 0px;
+ right: 6px;
+}
+
+.rf-sel-u-shdw-r{
+ background-image:
"url(#{resource['org.richfaces:combo_list_shadow.png']})";
+ background-position: bottom right;
+ position: absolute;
+ width: 6px;
+ top: 6px;
+ bottom: 0px;
+ right: 0px;
+}
+
+.rf-sel-shdw-b{
+ background-image:
"url(#{resource['org.richfaces:combo_list_shadow.png']})";
+ background-position: right top;
+ position: absolute;
+ height: 6px;
+ top: 0px;
+ left: 6px;
+ right: 0px;
+}
+
+.rf-sel-lst-ul{
+ margin: 0px;
+ padding: 0px;
+}
\ No newline at end of file
Copied:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
(from rev 19674,
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,301 @@
+//TODO: to the utils? <--
+(function (rf) {
+ rf.KEYS = {
+ BACKSPACE: 8,
+ TAB: 9,
+ RETURN: 13,
+ ESC: 27,
+ PAGEUP: 33,
+ PAGEDOWN: 34,
+ LEFT: 37,
+ UP: 38,
+ RIGHT: 39,
+ DOWN: 40,
+ DEL: 46
+ };
+})(RichFaces);
+
+
+//TODO: remove when cache will be moved to utils <--
+(function ($, rf) {
+ rf.utils = rf.utils || {};
+
+ rf.utils.Cache = function (key, items, values, useCache) {
+ this.key = key.toLowerCase();
+ this.cache = {}
+ this.cache[this.key] = items || [];
+ this.originalValues = typeof values == "function" ? values(items) : values ||
this.cache[this.key];
+ this.values = processValues(this.originalValues);
+ this.useCache = useCache || checkValuesPrefix.call(this);
+ };
+
+ var processValues = function (values) {
+ var processedValues = [];
+ for (var i = 0; i<values.length; i++) {
+ processedValues.push(values[i].toLowerCase());
+ }
+ return processedValues;
+ }
+
+ var checkValuesPrefix = function () {
+ var result = true;
+ for (var i = 0; i<this.values.length; i++) {
+ if (this.values[i].indexOf(this.key)!=0) {
+ result = false;
+ break;
+ }
+ }
+ return result;
+ }
+
+ var getItems = function (key, filterFunction) {
+ key = key.toLowerCase();
+ var newCache = [];
+
+ if (key.length < this.key.length) {
+ return newCache;
+ }
+
+ if (this.cache[key]) {
+ newCache = this.cache[key];
+ } else {
+ var useCustomFilterFunction = typeof filterFunction == "function";
+ var itemsCache = this.cache[this.key];
+ for (var i = 0; i<this.values.length; i++) {
+ var value = this.values[i];
+ if (useCustomFilterFunction && filterFunction(key, value)) {
+ newCache.push(itemsCache[i]);
+ } else {
+ var p = value.indexOf(key);
+ if (p == 0) {
+ newCache.push(itemsCache[i]);
+ }
+ }
+ }
+
+ if ((!this.lastKey || key.indexOf(this.lastKey)!=0) && newCache.length > 0)
{
+ this.cache[key] = newCache;
+ if (newCache.length==1) {
+ this.lastKey = key;
+ }
+ }
+ }
+
+ return newCache;
+ };
+
+ var getItemValue = function (item) {
+ return this.originalValues[this.cache[this.key].index(item)];
+ };
+
+ var isCached = function (key) {
+ key = key.toLowerCase();
+ return this.cache[key] || this.useCache && key.indexOf(this.key)==0;
+ };
+
+ $.extend(rf.utils.Cache.prototype, (function () {
+ return {
+ getItems: getItems,
+ getItemValue: getItemValue,
+ isCached: isCached
+ };
+ })());
+
+
+})(jQuery, RichFaces);
+
+//-->
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.Select = function(id, options) {
+ $super.constructor.call(this, id);
+ this.id = id;
+ var mergedOptions = $.extend({}, defaultOptions, options);
+ mergedOptions['attachTo'] = id;
+
+ this.defaultLabel = mergedOptions.defaultLabel;
+ var inputLabel = this.getValue() ;
+ this.initialValue = (inputLabel != this.defaultLabel) ? inputLabel :
"";
+
+ this.selValueInput = $(document.getElementById(id+"selValue"));
+ this.clientItems = mergedOptions.items;
+
+ if(mergedOptions.showControl) {
+ this.btn = $(document.getElementById(id+"Button"));
+ this.btn.bind("click", $.proxy(this.__clickHandler, this));
+ }
+ this.selectFirst = mergedOptions.selectFirst;
+ this.popupList = new rf.ui.SelectList((id+"List"), this,
mergedOptions);
+
+ var items = this.popupList.__getItems();
+ var enableManualInput = mergedOptions.enableManualInput;
+ if (items.length>0 && enableManualInput) {
+ this.cache = new rf.utils.Cache("", items, getData, true);
+ }
+
+ this.changeDelay = mergedOptions.changeDelay;
+ };
+
+ rf.ui.InputBase.extend(rf.ui.Select);
+ var $super = rf.ui.Select.$super;
+
+ var defaultOptions = {
+ defaultLabel: "",
+ selectFirst: true,
+ showControl: true,
+ enableManualInput: false,
+ itemCss: "rf-sel-opt",
+ selectItemCss: "rf-sel-sel",
+ listCss: "rf-sel-lst-cord",
+ changeDelay: 8
+ };
+
+ var REGEXP_TRIM = /^[\n\s]*(.*)[\n\s]*$/;
+
+ var getData = function (nodeList) {
+ var data = [];
+ nodeList.each(function () {;
+ data.push($(this).text().replace(REGEXP_TRIM, "$1"));
+ });
+ return data;
+ }
+
+ $.extend(rf.ui.Select.prototype, ( function () {
+
+ return{
+ name : "select",
+
+ __clickHandler: function(e) {
+ e.preventDefault();
+ if(!this.popupList.isVisible()) {
+ this.popupList.show();
+ this.__setInputFocus();
+ } else {
+ this.popupList.hide();
+ }
+ },
+
+ __focusHandler: function(e) {
+ if(this.getValue() == this.defaultLabel) {
+ this.setValue("");
+ }
+ },
+
+ __keydownHandler: function(e) {
+ var code;
+
+ if(e.keyCode) {
+ code = e.keyCode;
+ } else if(e.which) {
+ code = e.which;
+ }
+
+ var visible = this.popupList.isVisible();
+ switch(code) {
+ case rf.KEYS.DOWN:
+ e.preventDefault();
+ if(!visible) {
+ this.popupList.show();
+ } else {
+ this.popupList.__selectNext() ;
+ }
+ break;
+
+ case rf.KEYS.UP:
+ e.preventDefault();
+ if(visible) {
+ this.popupList.__selectPrev();
+ }
+ break;
+
+ case rf.KEYS.RETURN:
+ e.preventDefault();
+ if(visible) {
+ this.popupList.__selectCurrent();
+ }
+ return false;
+ break;
+
+ default:
+ var _this = this;
+ window.clearTimeout(this.changeTimerId);
+ this.changeTimerId =
window.setTimeout(function(){_this.__onChangeValue(e);}, this.changeDelay);
+ break;
+ }
+ },
+
+ __onChangeValue: function(e) {
+ this.popupList.__selectByIndex();
+ var newValue = this.getValue();
+
+ if(this.cache && this.cache.isCached(newValue)) {
+
+ if(this.initialValue !=newValue) {
+ var newItems = this.cache.getItems(newValue);
+ var items = $(newItems);
+ this.popupList.__setItems(items);
+ $(document.getElementById(this.id+"Items")).empty().append(items);
+ }
+
+ if(!this.popupList.isVisible()) {
+ this.popupList.show();
+ }
+
+ if(this.selectFirst) {
+ this.popupList.__selectByIndex(0);
+ }
+ }
+ },
+
+ __blurHandler: function(e) {
+ var target = $(e.originalEvent.explicitOriginalTarget);
+ if(!this.popupList.isPopupList(target)) {
+ var inputLabel = this.getValue();
+ if(!inputLabel || inputLabel == "") {
+ this.setValue(this.defaultLabel);
+ }
+ this.popupList.hide();
+ return true;
+ }
+ return false;
+ },
+
+ processItem: function(item) {
+ var key = $(item).attr("id");
+ var value = this.getItemValue(key);
+ this.saveItemValue(value);
+ var label = this.getItemLabel(key);
+ this.setValue(label);
+ this.popupList.hide();
+ this.__setInputFocus();
+ },
+
+ getItemValue: function(key) {
+ for(var i in this.clientItems) {
+ var item = this.clientItems[i];
+ if(item && item.id == key) {
+ return item.value;
+ }
+ }
+ },
+
+ getItemLabel: function(key) {
+ for(var i in this.clientItems) {
+ var item = this.clientItems[i];
+ if(item && item.id == key) {
+ return item.label;
+ }
+ }
+ },
+
+ saveItemValue: function(value) {
+ this.selValueInput.val(value);
+ }
+ }
+
+ })());
+
+})(jQuery, window.RichFaces);
Copied:
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/selectList.js
(from rev 19674,
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/selectList.js)
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/selectList.js
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/selectList.js 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,37 @@
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.SelectList = function(id, listener, options) {
+ $super.constructor.call(this, id, listener, options);
+ this.selectFirst = options.selectFirst;
+ };
+
+ rf.ui.PopupList.extend(rf.ui.SelectList);
+ var $super = rf.ui.SelectList.$super;
+
+ $.extend(rf.ui.SelectList.prototype,(function () {
+
+ return{
+ name : "selectList",
+
+ show: function() {
+ if(!this.isVisible()) {
+ $super.show.call(this);
+ if(this.selectFirst) {
+ this.__selectByIndex(0);
+ }
+ }
+ },
+
+ hide: function() {
+ if(this.isVisible()) {
+ $super.hide.call(this);
+ this.__selectByIndex(-1);
+ }
+ }
+ }
+
+ })());
+
+})(jQuery, window.RichFaces);
\ No newline at end of file
Modified: branches/RF-7817/ui/input/ui/src/main/templates/autocomplete.template.xml
===================================================================
--- branches/RF-7817/ui/input/ui/src/main/templates/autocomplete.template.xml 2010-10-27
15:07:36 UTC (rev 19690)
+++ branches/RF-7817/ui/input/ui/src/main/templates/autocomplete.template.xml 2010-10-27
15:23:56 UTC (rev 19691)
@@ -15,30 +15,28 @@
<cc:implementation>
<cdk:object type="java.lang.Object" name="disabled"
value="#{component.attributes['disabled']}" />
- <div id="#{clientId}" class="rf-au-field-width
rf-au-field">
- <input id="#{clientId}Value" name="#{clientId}Value"
type="hidden" class="rf-au-font rf-au-input" />
+ <div id="#{clientId}" class="rf-au-fld">
+ <input id="#{clientId}Value" name="#{clientId}Value"
type="hidden" class="rf-au-fnt rf-au-inp" />
<div style="position : relative; overflow : hidden; text-align :
left; padding-right : 21px;">
<input onclick="#{component.attributes['onclick']}"
ondblclick="#{component.attributes['ondblclick']}"
onmouseup="#{component.attributes['onmouseup']}"
onmousedown="#{component.attributes['onmousedown']}"
onmousemove="#{component.attributes['onmousemove']}"
- onblur="#{component.attributes['onblur']}"
- onfocus="#{component.attributes['onfocus']}"
onmouseover="#{component.attributes['onmouseover']}"
onmouseout="#{component.attributes['onmouseout']}"
onkeyup="#{component.attributes['onkeyup']}"
onkeydown="#{component.attributes['onkeydown']}"
- onkeypress="#{component.attributes['onkeypress']}"
id="#{clientId}Input" value="#{component.attributes['value']}"
disabled="#{disabled}" name="#{clientId}" type="text"
class="rf-au-font rf-au-input" autocomplete="off"/>
+ onkeypress="#{component.attributes['onkeypress']}"
id="#{clientId}Input" value="#{component.attributes['value']}"
disabled="#{disabled}" name="#{clientId}" type="text"
class="rf-au-fnt rf-au-inp" autocomplete="off"/>
<c:if
test="#{component.attributes['showButton']}">
<c:if
test="#{component.attributes['disabled']}">
- <div id="#{clientId}Button"
class="rf-au-button">
- <div class="rf-au-button-arrow"></div>
+ <div id="#{clientId}Button" class="rf-au-btn">
+ <div class="rf-au-btn-arrow"></div>
</div>
</c:if>
<c:if
test="#{!component.attributes['disabled']}">
- <div id="#{clientId}Button"
class="rf-au-button">
- <div class="rf-au-button-arrow"></div>
+ <div id="#{clientId}Button" class="rf-au-btn">
+ <div class="rf-au-btn-arrow"></div>
</div>
</c:if>
</c:if>
@@ -51,21 +49,19 @@
onmousemove="#{component.attributes['onlistmousemove']}"
onmouseover="#{component.attributes['onlistmouseover']}"
onmouseout="#{component.attributes['onlistmouseout']}"
- onblur="#{component.attributes['onlistblur']}"
- onfocus="#{component.attributes['onlistfocus']}"
onkeyup="#{component.attributes['onlistkeyup']}"
onkeydown="#{component.attributes['onlistkeydown']}"
onkeypress="#{component.attributes['onlistkeypress']}"
- id="#{clientId}List" class="rf-au-list-cord">
+ id="#{clientId}List" class="rf-au-lst-cord">
- <div class="rf-au-shadow">
- <div class="rf-au-shadow-t"></div>
- <div class="rf-au-shadow-l"></div>
- <div class="rf-au-shadow-r"></div>
- <div class="rf-au-shadow-b"></div>
+ <div class="rf-au-shdw">
+ <div class="rf-au-shdw-t"></div>
+ <div class="rf-au-shdw-l"></div>
+ <div class="rf-au-shdw-r"></div>
+ <div class="rf-au-shdw-b"></div>
- <div class="rf-au-list-decoration">
- <div class="rf-au-list-scroll rf-au-list-width
rf-au-list-height">
+ <div class="rf-au-lst-dcrtn">
+ <div class="rf-au-lst-scrl">
<cdk:body>
<cdk:call
expression="encodeItemsContainer(facesContext, component)"/>
</cdk:body>
@@ -74,8 +70,18 @@
</div>
</div>
<script type="text/javascript">
+ <cdk:object name="mode" type="Object"
value="#{component.attributes['mode']}" />
+ <cdk:scriptObject name="options">
+ <cdk:scriptOption name="buttonId"
value="#{clientId}Button" />
+ <cdk:scriptOption attributes="selectedItemClass minChars
filterFunction autofill disabled selectFirst tokens" />
+ <cdk:scriptOption attributes="onbegin oncomplete onerror
onbeforedomupdate onchange onselectitem onfocus onblur"
wrapper="eventHandler"/>
+ <cdk:scriptOption name="filterFunction"
value="#{getClientFilterFunction(component)}" />
+ <cdk:scriptOption name="isCachedAjax"
value="#{'ajax'==mode ? false : true}" defaultValue="true"
/>
+ <cdk:scriptOption name="ajaxMode"
value="#{'client'==mode||'lazyClient'==mode ? false : true}"
defaultValue="true" />
+ <cdk:scriptOption name="lazyClientMode"
value="#{'lazyClient'==mode ? true : false}"
defaultValue="false" />
+ </cdk:scriptObject>
new RichFaces.ui.Autocomplete("#{clientId}",
- "#{clientId}Input", #{getScriptOptions(component)}
+ "#{clientId}Input", #{toScriptArgs(options)}
);
</script>
</div>
Modified: branches/RF-7817/ui/input/ui/src/main/templates/inplaceInput.template.xml
===================================================================
--- branches/RF-7817/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-10-27
15:07:36 UTC (rev 19690)
+++ branches/RF-7817/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-10-27
15:23:56 UTC (rev 19691)
@@ -30,7 +30,7 @@
<cc:interface>
<cdk:class>org.richfaces.renderkit.html.InplaceInputRenderer
</cdk:class>
- <cdk:superclass>org.richfaces.renderkit.InplaceInputBaseRenderer
+ <cdk:superclass>org.richfaces.renderkit.InplaceInputRendererBase
</cdk:superclass>
<cdk:component-family>org.richfaces.InplaceInput
</cdk:component-family>
@@ -41,48 +41,50 @@
<cc:implementation>
<cdk:object type="org.richfaces.component.InplaceState"
name="inplaceState" value="#{getInplaceState(component)}" />
<cdk:object type="java.lang.String" name="inplaceValue"
value="#{getValue(facesContext, component)}" />
-
- <span id="#{clientId}" class="#{getReadyStyleClass(component,
inplaceState)}" cdk:passThroughWithExclusions="id class">
- <span id="#{clientId}:label" class="rf-ii-lbl">
+
+ <span id="#{clientId}" class="#{getStateStyleClass(component,
inplaceState)}" cdk:passThroughWithExclusions="id class">
+ <span id="#{clientId}Label" class="rf-ii-lbl">
#{inplaceValue}
</span>
- <input id="#{clientId}:focus" type="image"
style="position: absolute; top: 0px; left: 0px; outline-style: none;"
class="rf-ii-none"/>
- <span id="#{clientId}:edit" class="#{getEditStyleClass(component,
inplaceState)}">
- <input id="#{clientId}:input" autocomplete="off"
name="#{clientId}"
- type="text" value="#{getInputValue(facesContext, component)}"
class="rf-ii-f" style="width:
#{component.attributes['inputWidth']};"
- cdk:passThrough="tabIndex">
- <cdk:call expression="renderInputHandlers(facesContext,
component);"/>
- </input>
- <c:if test="#{component.attributes['showControls']}">
- <span class="rf-ii-btn-prepos">
- <span class="rf-ii-btn-pos">
- <span id="#{clientId}:btnshadow"
class="rf-ii-btn-shadow">
- <span class="rf-ii-btn-shadow-t"></span>
- <span class="rf-ii-btn-shadow-l"></span>
- <span class="rf-ii-btn-shadow-r"></span>
- <span class="rf-ii-btn-shadow-b"></span>
-
- <span id="#{clientId}:btn" style="position :
relative">
- <input type="image"
- id="#{clientId}:okbtn"
- src="#{getResourcePath(facesContext,
'org.richfaces/ico_ok.gif')}"
- class="rf-ii-btn"
onmousedown="this.className='rf-ii-btn-p'"
- onmouseout="this.className='rf-ii-btn'"
onmouseup="this.className='rf-ii-btn'" />
- <input type="image"
- id="#{clientId}:cancelbtn"
- src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
- class="rf-ii-btn"
onmousedown="this.className='rf-ii-btn-press'"
- onmouseout="this.className='rf-ii-btn'"
onmouseup="this.className='rf-ii-btn'" />
- <br />
+
+ <c:if test="#{!isDisable(inplaceState)}">
+ <input id="#{clientId}Focus" type="image"
style="position: absolute; top: 0px; left: 0px; outline-style: none;"
class="rf-ii-none"/>
+ <span id="#{clientId}Edit" class="#{getEditStyleClass(component,
inplaceState)}">
+ <input id="#{clientId}Input" autocomplete="off"
name="#{clientId}"
+ type="text" value="#{getInputValue(facesContext,
component)}" class="rf-ii-fld" style="width:
#{component.attributes['inputWidth']};"
cdk:passThrough="tabIndex">
+ <cdk:call expression="renderInputHandlers(facesContext,
component);"/>
+ </input>
+ <c:if test="#{component.attributes['showControls']}">
+ <span class="rf-ii-btn-prepos">
+ <span class="rf-ii-btn-pos">
+ <span id="#{clientId}Btnshadow"
class="rf-ii-btn-shadow">
+ <span class="rf-ii-btn-shdw-t"></span>
+ <span class="rf-ii-btn-shdw-l"></span>
+ <span class="rf-ii-btn-shdw-r"></span>
+ <span class="rf-ii-btn-shdw-b"></span>
+
+ <span id="#{clientId}Btn" style="position :
relative">
+ <input type="image"
+ id="#{clientId}Okbtn"
+ src="#{getResourcePath(facesContext,
'org.richfaces/ico_ok.gif')}"
+ class="rf-ii-btn"
onmousedown="this.className='rf-ii-btn-p'"
+ onmouseout="this.className='rf-ii-btn'"
onmouseup="this.className='rf-ii-btn'" />
+ <input type="image"
+ id="#{clientId}Cancelbtn"
+ src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
+ class="rf-ii-btn"
onmousedown="this.className='rf-ii-btn-press'"
+ onmouseout="this.className='rf-ii-btn'"
onmouseup="this.className='rf-ii-btn'" />
+ <br />
+ </span>
</span>
</span>
</span>
- </span>
- </c:if>
- </span>
- <script type="text/javascript">
- <cdk:call expression="buildScript(responseWriter, facesContext,
component);"/>
- </script>
+ </c:if>
+ </span>
+ <script type="text/javascript">
+ <cdk:call expression="buildScript(responseWriter, facesContext, component,
null);"/>
+ </script>
+ </c:if>
</span>
</cc:implementation>
</cdk:root>
\ No newline at end of file
Copied: branches/RF-7817/ui/input/ui/src/main/templates/inplaceSelect.template.xml (from
rev 19674, trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml)
===================================================================
--- branches/RF-7817/ui/input/ui/src/main/templates/inplaceSelect.template.xml
(rev 0)
+++ branches/RF-7817/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- JBoss, Home of Professional Open Source Copyright ${year}, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the copyright.txt
+ in the distribution for a full listing of individual contributors. This is
+ free software; you can redistribute it and/or modify it under the terms of
+ the GNU Lesser General Public License as published by the Free Software Foundation;
+ either version 2.1 of the License, or (at your option) any later version.
+ This software is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ details. You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the
+ FSF site:
http://www.fsf.org. -->
+<cdk:root
xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el"
+
xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
+
xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
+
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.InplaceSelectRenderer
+ </cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.InplaceSelectRendererBase
+ </cdk:superclass>
+ <cdk:component-family>org.richfaces.InplaceSelect
+ </cdk:component-family>
+ <cdk:renderer-type>org.richfaces.InplaceSelectRenderer
+ </cdk:renderer-type>
+ </cc:interface>
+
+ <cc:implementation>
+ <cdk:object type="org.richfaces.component.InplaceState"
+ name="inplaceState" value="#{getInplaceState(component)}" />
+ <cdk:object type="java.lang.String" name="inplaceValue"
+ value="#{getSelectLabel(facesContext, component)}"/>
+
+ <cdk:object type="java.util.List"
type-arguments="InplaceSelectBaseRenderer.ClientSelectItem"
name="clientSelectItems"
+ value="#{getConvertedSelectItems(facesContext, component)}" />
+
+ <span id="#{clientId}" class="#{getStateStyleClass(component,
inplaceState)}" cdk:passThroughWithExclusions="id class">
+
+ <span id="#{clientId}Label" class="rf-is-lbl">
+ #{inplaceValue}
+ </span>
+
+ <c:if test="#{!isDisable(inplaceState)}">
+ <input id="#{clientId}Focus" type="image"
style="position: absolute; top: 0px; left: 0px; outline-style: none;"
class="rf-is-none" />
+
+ <span id="#{clientId}Edit" class="#{getEditStyleClass(component,
inplaceState)}">
+ <input id="#{clientId}selValue" name="#{clientId}"
type="hidden" value="#{getValue(facesContext, component)}"/>
+ <input id="#{clientId}Input" autocomplete="off"
+ type="text" value="#{getSelectInputLabel(facesContext,
component)}"
+ class="rf-is-fld" style="width:
#{component.attributes['inputWidth']};" readonly="readonly"
+ cdk:passThrough="tabIndex">
+ <cdk:call expression="renderInputHandlers(facesContext, component);"
/>
+ </input>
+ <c:if test="#{component.attributes['showControls']}">
+ <span class="rf-is-btn-prepos">
+ <span class="rf-is-btn-pos">
+ <span id="#{clientId}Btnshadow" class="rf-is-shdw">
+ <span class="rf-is-shdw-t"></span>
+ <span class="rf-is-shdw-l"></span>
+ <span class="rf-is-shdw-r"></span>
+ <span class="rf-is-shdw-b"></span>
+
+ <span id="#{clientId}Btn" style="position :
relative;">
+ <input type="image" id="#{clientId}Okbtn"
+ src="#{getResourcePath(facesContext,
'org.richfaces/ico_ok.gif')}"
+ class="rf-is-btn"
onmousedown="this.className='rf-is-btn-press'"
+ onmouseout="this.className='rf-is-btn'"
onmouseup="this.className='rf-is-btn'" />
+ <input type="image" id="#{clientId}Cancelbtn"
+ src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
+ class="rf-is-btn"
onmousedown="this.className='rf-is-btn-press'"
+ onmouseout="this.className='rf-is-btn'"
onmouseup="this.className='rf-is-btn'" />
+ <br />
+ </span>
+ </span>
+ </span>
+ </span>
+ </c:if>
+ <span id="#{clientId}List"
style="#{component.attributes['openOnEdit'] ? '' : 'display:
none'}" class="rf-is-lst-cord">
+ <cdk:call expression="renderListHandlers(facesContext,
component);"/>
+ <span class="rf-is-lst-pos" style="width:
#{component.attributes['listWidth']}">
+ <span class="rf-is-shdw">
+ <span class="rf-is-shdw-t"></span>
+ <span class="rf-is-shdw-l"></span>
+ <span class="rf-is-shdw-r"></span>
+ <span class="rf-is-shdw-b"></span>
+ <span class="rf-is-lst-dec">
+ <span class="rf-is-lst-scrl" id="#{clientId}Items"
style="height: #{component.attributes['listHeight']}">
+ <cdk:call expression="encodeItems(facesContext, component,
clientSelectItems);"/>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ <script type="text/javascript">
+ <cdk:call expression="buildScript(responseWriter, facesContext, component,
clientSelectItems);" />
+ </script>
+ </c:if>
+ </span>
+ </cc:implementation>
+</cdk:root>
\ No newline at end of file
Modified: branches/RF-7817/ui/input/ui/src/main/templates/input.template.inc
===================================================================
--- branches/RF-7817/ui/input/ui/src/main/templates/input.template.inc 2010-10-27 15:07:36
UTC (rev 19690)
+++ branches/RF-7817/ui/input/ui/src/main/templates/input.template.inc 2010-10-27 15:23:56
UTC (rev 19691)
@@ -22,9 +22,9 @@
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-->
-<span class="rf-ins-ci">
+<span class="rf-insl-inp-cntr">
<input
xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
name="#{clientId}" type="text"
- class="rf-ins-i #{component.attributes['inputClass']}"
value="#{getInputValue(facesContext, component)}"
+ class="rf-insl-inp #{component.attributes['inputClass']}"
value="#{getInputValue(facesContext, component)}"
cdk:passThrough="accesskey disabled maxlength size:inputSize tabindex"
readonly="#{!component.attributes['enableManualInput']}"
style="#{component.attributes['showInput'] ? null : 'display:
none;'}" />
</span>
\ No newline at end of file
Modified: branches/RF-7817/ui/input/ui/src/main/templates/inputnumberslider.template.xml
===================================================================
---
branches/RF-7817/ui/input/ui/src/main/templates/inputnumberslider.template.xml 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/main/templates/inputnumberslider.template.xml 2010-10-27
15:23:56 UTC (rev 19691)
@@ -37,7 +37,7 @@
<cdk:resource-dependency library="org.richfaces"
name="inputNumberSlider.js" />
</cc:interface>
<cc:implementation>
- <span id="#{clientId}" class="rf-ins
#{component.attributes['styleClass']}" cdk:passThroughWithExclusions="id
class">
+ <span id="#{clientId}" class="rf-insl
#{component.attributes['styleClass']}" cdk:passThroughWithExclusions="id
class">
<c:if test="#{isInputPosition(component, 'left') ||
isInputPosition(component, 'top')}">
<xi:include xpointer="xpointer(/*)" href="input.template.inc"
/>
<c:if test="#{isInputPosition(component, 'top') and
component.attributes['showInput']}">
@@ -45,19 +45,19 @@
</c:if>
</c:if>
<c:if test="#{component.attributes['showArrows']}">
- <span class="rf-ins-db#{component.attributes['disabled'] ?
'-d' : ''} #{component.attributes['decreaseClass']}" />
+ <span class="rf-insl-dec#{component.attributes['disabled'] ?
'-dis' : ''} #{component.attributes['decreaseClass']}" />
</c:if>
- <span class="rf-ins-ta">
+ <span class="rf-insl-trc-cntr">
<c:if test="#{component.attributes['showBoundaryValues']}">
- <span
class="rf-ins-mn">#{component.attributes['minValue']}</span>
- <span
class="rf-ins-mx">#{component.attributes['maxValue']}</span>
+ <span
class="rf-insl-mn">#{component.attributes['minValue']}</span>
+ <span
class="rf-insl-mx">#{component.attributes['maxValue']}</span>
</c:if>
- <span class="rf-ins-t
#{component.attributes['trackClass']}">
- <span class="rf-ins-h#{component.attributes['disabled'] ?
'-d' : ''} #{component.attributes['handleClass']}" />
+ <span class="rf-insl-trc
#{component.attributes['trackClass']}">
+ <span class="rf-insl-hnd#{component.attributes['disabled'] ?
'-dis' : ''} #{component.attributes['handleClass']}" />
</span>
</span>
<c:if test="#{component.attributes['showArrows']}">
- <span class="rf-ins-ib#{component.attributes['disabled'] ?
'-d' : ''} #{component.attributes['increaseClass']}" />
+ <span class="rf-insl-inc#{component.attributes['disabled'] ?
'-dis' : ''} #{component.attributes['increaseClass']}" />
</c:if>
<c:if test="#{isInputPosition(component, 'right') ||
isInputPosition(component, 'bottom')}">
<c:if test="#{isInputPosition(component, 'bottom') and
component.attributes['showInput']}">
@@ -66,13 +66,16 @@
<xi:include xpointer="xpointer(/*)" href="input.template.inc"
/>
</c:if>
<c:if test="#{component.attributes['showToolTip']}">
- <span class="rf-ins-tt
#{component.attributes['toolTipClass']}">#{getInputValue(facesContext,
component)}</span>
+ <span class="rf-insl-tt
#{component.attributes['toolTipClass']}">#{getInputValue(facesContext,
component)}</span>
</c:if>
+ <!-- TODO Rewrite the next line when the CDK will support normal way to take event
handlers from attributes and behaviors. -->
+ <cdk:object name="onchange" type="String"
value="#{convertToString(RenderKitUtils.getAttributeAndBehaviorsValue(facesContext,
component, RenderKitUtils.attributes().generic('onchange', 'onchange',
'change').first()))}" />
<script type="text/javascript">new
RichFaces.ui.InputNumberSlider('#{clientId}', {
delay: #{component.attributes['delay']},
disabled: #{component.attributes['disabled']},
maxValue: #{component.attributes['maxValue']},
minValue: #{component.attributes['minValue']},
+ onchange: #{onchange.length() > 0 ? 'function (event) {' + onchange +
'}' : 'null' },
step: #{component.attributes['step']},
tabIndex:
#{RenderKitUtils.shouldRenderAttribute(component.attributes['tabindex']) ?
component.attributes['tabindex'] : 'null'}
}, {
Copied: branches/RF-7817/ui/input/ui/src/main/templates/inputnumberspinner.template.xml
(from rev 19674, trunk/ui/input/ui/src/main/templates/inputnumberspinner.template.xml)
===================================================================
--- branches/RF-7817/ui/input/ui/src/main/templates/inputnumberspinner.template.xml
(rev 0)
+++
branches/RF-7817/ui/input/ui/src/main/templates/inputnumberspinner.template.xml 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+-->
+<cdk:root
xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el"
xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
+
xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
+
xmlns:xi="http://www.w3.org/2001/XInclude">
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.InputNumberSpinnerRenderer</cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.InputRendererBase</cdk:superclass>
+ <cdk:component-family>javax.faces.Input</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.InputNumberSpinnerRenderer</cdk:renderer-type>
+ <cdk:resource-dependency library="org.richfaces"
name="inputNumberSpinner.ecss" />
+ <cdk:resource-dependency library="org.richfaces"
name="base-component.reslib" />
+ <cdk:resource-dependency name="jquery.position.js" />
+ <cdk:resource-dependency library="org.richfaces"
name="inputNumberSpinner.js" />
+ </cc:interface>
+ <cc:implementation>
+ <span id="#{clientId}" class="rf-insp
#{component.attributes['styleClass']}" cdk:passThroughWithExclusions="id
class" >
+ <input name="#{clientId}" type="text"
+ class="rf-insp-inp #{component.attributes['inputClass']}"
value="#{getInputValue(facesContext, component)}"
+ cdk:passThrough="accesskey disabled maxlength onblur onfocus
onclick:oninputclick ondblclick:ondblinputclick onkeydown:oninputkeydown
+ onkeypress:oninputkeypress onkeyup:oninputkeyup onmousedown:oninputmousedown
onmousemove:oninputmousemove onmouseout:oninputmouseout
+ onmouseover:oninputmouseover onmouseup:oninputmouseup onselect size:inputSize
tabindex"
+ readonly="#{!component.attributes['enableManualInput']}"
autocomplete="#{component.attributes['disableBrowserAutoComplete'] ?
'off' : ''}" />
+ <span class="rf-insp-btns">
+ <span class="rf-insp-inc#{component.attributes['disabled'] ?
'-dis' : ''}" cdk:passThrough="onclick:onupclick" />
+ <span class="rf-insp-dec#{component.attributes['disabled'] ?
'-dis' : ''}" cdk:passThrough="onclick:ondownclick" />
+ </span>
+ <!-- TODO Rewrite the next line when the CDK will support normal way to take event
handlers from attributes and behaviors. -->
+ <cdk:object name="onchange" type="String"
value="#{convertToString(RenderKitUtils.getAttributeAndBehaviorsValue(facesContext,
component, RenderKitUtils.attributes().generic('onchange', 'onchange',
'change').first()))}" />
+ <script type="text/javascript">new
RichFaces.ui.InputNumberSpinner('#{clientId}', {
+ cycled: #{component.attributes['cycled']},
+ maxValue: #{component.attributes['maxValue']},
+ minValue: #{component.attributes['minValue']},
+ onchange: #{onchange.length() > 0 ? 'function (event) {' + onchange +
'}' : 'null' },
+ step: #{component.attributes['step']}
+ });</script>
+ </span>
+ </cc:implementation>
+</cdk:root>
Copied: branches/RF-7817/ui/input/ui/src/main/templates/select.template.xml (from rev
19674, trunk/ui/input/ui/src/main/templates/select.template.xml)
===================================================================
--- branches/RF-7817/ui/input/ui/src/main/templates/select.template.xml
(rev 0)
+++ branches/RF-7817/ui/input/ui/src/main/templates/select.template.xml 2010-10-27
15:23:56 UTC (rev 19691)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<cdk:root
xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el"
xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
+
xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
+
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.SelectRenderer</cdk:class>
+
<cdk:superclass>org.richfaces.renderkit.SelectRendererBase</cdk:superclass>
+ <cdk:component-family>org.richfaces.Select</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.SelectRenderer</cdk:renderer-type>
+ <cdk:renders-children>true</cdk:renders-children>
+ </cc:interface>
+
+ <cc:implementation>
+
+ <cdk:object type="java.util.List"
type-arguments="org.richfaces.renderkit.ClientSelectItem"
name="clientSelectItems"
+ value="#{getConvertedSelectItems(facesContext, component)}" />
+
+ <cdk:object type="java.lang.Object" name="disabled"
value="#{component.attributes['disabled']}" />
+
+ <div id="#{clientId}" class="rf-sel-fld">
+ <div style="position : relative; overflow : hidden; text-align :
left; padding-right : 21px;">
+ <input id="#{clientId}selValue" name="#{clientId}"
type="hidden" value="#{getInputValue(facesContext, component)}"/>
+ <input cdk:passThroughWithExclusions="class autocomplete id value
disabled name type readonly"
+ id="#{clientId}Input"
+ value="#{getSelectLabel(facesContext, component)}"
+ disabled="#{disabled}"
+ type="text"
+ class="rf-sel-fnt rf-sel-inp"
+ autocomplete="off"
+ readonly="#{component.attributes['enableManualInput'] ? '' :
'readonly'}"/>
+
+ <c:if
test="#{component.attributes['showButton']}">
+ <c:if
test="#{component.attributes['disabled']}">
+ <div id="#{clientId}Button"
class="rf-sel-btn">
+ <div class="rf-sel-btn-arrow"></div>
+ </div>
+ </c:if>
+ <c:if
test="#{!component.attributes['disabled']}">
+ <div id="#{clientId}Button"
class="rf-sel-btn">
+ <div class="rf-sel-btn-arrow"></div>
+ </div>
+ </c:if>
+ </c:if>
+ </div>
+
+ <div id="#{clientId}List" class="rf-sel-lst-cord">
+ <cdk:call expression="renderListHandlers(facesContext,
component);"/>
+ <div class="rf-sel-shdw">
+ <div class="rf-sel-shdw-t"></div>
+ <div class="rf-sel-shdw-l"></div>
+ <div class="rf-sel-shdw-r"></div>
+ <div class="rf-sel-shdw-b"></div>
+
+ <div class="rf-sel-lst-dcrtn">
+ <div class="rf-sel-lst-scrl"
id="#{clientId}Items" >
+ <cdk:call expression="encodeItems(facesContext, component,
clientSelectItems);"/>
+ </div>
+ </div>
+ </div>
+ </div>
+ <script type="text/javascript">
+ <cdk:call expression="buildScript(responseWriter, facesContext, component,
clientSelectItems);"/>
+ </script>
+ </div>
+ </cc:implementation>
+</cdk:root>
Modified:
branches/RF-7817/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java
===================================================================
---
branches/RF-7817/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java 2010-10-27
15:07:36 UTC (rev 19690)
+++
branches/RF-7817/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java 2010-10-27
15:23:56 UTC (rev 19691)
@@ -67,16 +67,16 @@
DomNode text = label.getFirstChild();
assertEquals(DomNode.TEXT_NODE, text.getNodeType());
- HtmlElement edit = page.getFirstByXPath("//*[@id =
'form:input_default:edit']");
+ HtmlElement edit = page.getFirstByXPath("//*[@id =
'form:input_defaultEdit']");
assertEquals("span", edit.getNodeName());
- assertEquals("rf-ii-e-s rf-ii-none",
edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-edit rf-ii-none",
edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
HtmlElement input = (HtmlElement)edit.getFirstChild();
assertEquals("input", input.getNodeName());
- assertEquals("rf-ii-f",
input.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-fld",
input.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
assertEquals(text.getNodeValue(),
input.getAttribute(HtmlConstants.VALUE_ATTRIBUTE));
- List<?> buttons = page.getByXPath("//*[@id =
'form:input_default:btn']");
+ List<?> buttons = page.getByXPath("//*[@id =
'form:input_defaultBtn']");
assertEquals(true, buttons.isEmpty());
}
@@ -87,7 +87,7 @@
HtmlElement span = page.getFirstByXPath("//*[@id =
'form:input_edit']");
assertEquals("span", span.getNodeName());
- assertEquals("rf-ii-d-s",
span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-d-s rf-ii-e-s",
span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
HtmlElement label = (HtmlElement)span.getFirstChild();
assertEquals("span", label.getNodeName());
@@ -95,24 +95,24 @@
DomNode text = label.getFirstChild();
assertEquals(DomNode.TEXT_NODE, text.getNodeType());
- HtmlElement edit = page.getFirstByXPath("//*[@id =
'form:input_edit:edit']");
+ HtmlElement edit = page.getFirstByXPath("//*[@id =
'form:input_editEdit']");
assertEquals("span", edit.getNodeName());
- assertEquals("rf-ii-e-s",
edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-edit",
edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
HtmlElement input = (HtmlElement)edit.getFirstChild();
assertEquals("input", input.getNodeName());
- assertEquals("rf-ii-f",
input.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-fld",
input.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
assertEquals(text.getNodeValue(),
input.getAttribute(HtmlConstants.VALUE_ATTRIBUTE));
- HtmlElement button = page.getFirstByXPath("//*[@id =
'form:input_edit:btn']");
+ HtmlElement button = page.getFirstByXPath("//*[@id =
'form:input_editBtn']");
assertEquals("span", button.getNodeName());
- HtmlElement okButton = page.getFirstByXPath("//*[@id =
'form:input_edit:okbtn']");
+ HtmlElement okButton = page.getFirstByXPath("//*[@id =
'form:input_editOkbtn']");
assertEquals("input", okButton.getNodeName());
assertEquals("rf-ii-btn",
okButton.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
assertEquals("image", okButton.getAttribute(HtmlConstants.TYPE_ATTR));
- HtmlElement cancelButton = page.getFirstByXPath("//*[@id =
'form:input_edit:cancelbtn']");
+ HtmlElement cancelButton = page.getFirstByXPath("//*[@id =
'form:input_editCancelbtn']");
assertEquals("input", cancelButton.getNodeName());
assertEquals("rf-ii-btn",
cancelButton.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
assertEquals("image",
cancelButton.getAttribute(HtmlConstants.TYPE_ATTR));
@@ -124,7 +124,7 @@
HtmlPage page = environment.getPage("/test.jsf");
edit(page, "input_default", "Another Test String");
blur(page);
- DomText text = page.getFirstByXPath("//*[@id =
'form:input_default:label']/text()");
+ DomText text = page.getFirstByXPath("//*[@id =
'form:input_defaultLabel']/text()");
assertEquals("Another Test String", text.getTextContent());
HtmlElement span = page.getFirstByXPath("//*[@id =
'form:input_default']");
assertEquals("rf-ii-d-s rf-ii-c-s",
span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
@@ -136,7 +136,7 @@
}
private void typeNewValue(HtmlPage page, String inplaceInputId, String value) throws
Exception {
- HtmlElement input = page.getFirstByXPath("//*[@id = 'form:" +
inplaceInputId + ":input']");
+ HtmlElement input = page.getFirstByXPath("//*[@id = 'form:" +
inplaceInputId + "Input']");
input.setAttribute(HtmlConstants.VALUE_ATTRIBUTE, "");
input.type(value);
}
@@ -144,8 +144,8 @@
private void edit(HtmlPage page, String inplaceInputId, String value) throws
Exception {
HtmlElement span = page.getFirstByXPath("//*[@id = 'form:" +
inplaceInputId + "']");
span.click();
- HtmlElement edit = page.getFirstByXPath("//*[@id = 'form:" +
inplaceInputId + ":edit']");
- assertEquals("rf-ii-e-s",
edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ HtmlElement edit = page.getFirstByXPath("//*[@id = 'form:" +
inplaceInputId + "Edit']");
+ assertEquals("rf-ii-edit",
edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
typeNewValue(page, inplaceInputId, value);
}
@@ -154,10 +154,10 @@
HtmlPage page = environment.getPage("/test.jsf");
edit(page, "input_controls", "Another Test String");
- HtmlElement cancel = page.getFirstByXPath("//*[@id =
'form:input_controls:cancelbtn']");
+ HtmlElement cancel = page.getFirstByXPath("//*[@id =
'form:input_controlsCancelbtn']");
cancel.mouseDown();
- DomText text = page.getFirstByXPath("//*[@id =
'form:input_controls:label']/text()");
+ DomText text = page.getFirstByXPath("//*[@id =
'form:input_controlsLabel']/text()");
assertEquals("Test String", text.getTextContent());
HtmlElement span = page.getFirstByXPath("//*[@id =
'form:input_controls']");
@@ -165,10 +165,10 @@
edit(page, "input_controls", "Another Test String");
- HtmlElement ok = page.getFirstByXPath("//*[@id =
'form:input_controls:okbtn']");
+ HtmlElement ok = page.getFirstByXPath("//*[@id =
'form:input_controlsOkbtn']");
ok.mouseDown();
- text = page.getFirstByXPath("//*[@id =
'form:input_controls:label']/text()");
+ text = page.getFirstByXPath("//*[@id =
'form:input_controlsLabel']/text()");
assertEquals("Another Test String", text.getTextContent());
span = page.getFirstByXPath("//*[@id =
'form:input_controls']");
@@ -178,7 +178,7 @@
blur(page);
- text = page.getFirstByXPath("//*[@id =
'form:input_controls:label']/text()");
+ text = page.getFirstByXPath("//*[@id =
'form:input_controlsLabel']/text()");
assertEquals("Test String", text.getTextContent());
}