JBoss Rich Faces SVN: r4066 - branches/3.1.x/cdk/generator/src/main/java/org/ajax4jsf/builder/generator.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-16 19:28:14 -0500 (Fri, 16 Nov 2007)
New Revision: 4066
Modified:
branches/3.1.x/cdk/generator/src/main/java/org/ajax4jsf/builder/generator/FaceletsTaglibGenerator.java
Log:
Tag handler records for listeners generated by default: fixed
Modified: branches/3.1.x/cdk/generator/src/main/java/org/ajax4jsf/builder/generator/FaceletsTaglibGenerator.java
===================================================================
--- branches/3.1.x/cdk/generator/src/main/java/org/ajax4jsf/builder/generator/FaceletsTaglibGenerator.java 2007-11-17 00:23:48 UTC (rev 4065)
+++ branches/3.1.x/cdk/generator/src/main/java/org/ajax4jsf/builder/generator/FaceletsTaglibGenerator.java 2007-11-17 00:28:14 UTC (rev 4066)
@@ -30,9 +30,9 @@
import java.util.List;
import org.ajax4jsf.builder.config.BuilderConfig;
+import org.ajax4jsf.builder.config.ComponentBaseBean;
import org.ajax4jsf.builder.config.ComponentBean;
import org.ajax4jsf.builder.config.ConverterBean;
-import org.ajax4jsf.builder.config.ComponentBaseBean;
import org.ajax4jsf.builder.config.ListenerBean;
import org.ajax4jsf.builder.config.ValidatorBean;
import org.apache.velocity.Template;
@@ -123,7 +123,7 @@
List<ListenerBean> listeners = new ArrayList<ListenerBean>();
for (ListenerBean bean : config.getListeners()) {
for (ComponentBaseBean componentBean : bean.getSuitableComponents()) {
- if (components.contains(componentBean)) {
+ if (components.contains(componentBean) && bean.getTaghandler() != null) {
listeners.add(bean);
break;
}
18 years, 5 months
JBoss Rich Faces SVN: r4065 - in trunk/sandbox: ui and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-16 19:23:48 -0500 (Fri, 16 Nov 2007)
New Revision: 4065
Removed:
trunk/sandbox/samples/orderingListDemo/
trunk/sandbox/ui/orderingList/
Modified:
trunk/sandbox/samples/pom.xml
trunk/sandbox/ui/pom.xml
Log:
http://jira.jboss.com/jira/browse/RF-1358
Modified: trunk/sandbox/samples/pom.xml
===================================================================
--- trunk/sandbox/samples/pom.xml 2007-11-17 00:19:41 UTC (rev 4064)
+++ trunk/sandbox/samples/pom.xml 2007-11-17 00:23:48 UTC (rev 4065)
@@ -15,7 +15,6 @@
<module>panel2-sample</module>
<module>simpleTogglePanel2-sample</module>
- <module>orderingListDemo</module>
<module>listShuttleDemo</module>
<module>columnsDemo</module>
<module>contextMenuDemo</module>
Modified: trunk/sandbox/ui/pom.xml
===================================================================
--- trunk/sandbox/ui/pom.xml 2007-11-17 00:19:41 UTC (rev 4064)
+++ trunk/sandbox/ui/pom.xml 2007-11-17 00:23:48 UTC (rev 4065)
@@ -16,7 +16,6 @@
<module>state</module>
<module>treeTable</module>
<module>listShuttle</module>
- <module>orderingList</module>
<module>columns</module>
<module>rex-resizable</module>
<module>rex-messageBox</module>
18 years, 5 months
JBoss Rich Faces SVN: r4064 - branches/3.1.x/ui/orderingList.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-16 19:19:41 -0500 (Fri, 16 Nov 2007)
New Revision: 4064
Modified:
branches/3.1.x/ui/orderingList/pom.xml
Log:
http://jira.jboss.com/jira/browse/RF-1358
Modified: branches/3.1.x/ui/orderingList/pom.xml
===================================================================
--- branches/3.1.x/ui/orderingList/pom.xml 2007-11-17 00:17:48 UTC (rev 4063)
+++ branches/3.1.x/ui/orderingList/pom.xml 2007-11-17 00:19:41 UTC (rev 4064)
@@ -40,5 +40,6 @@
<artifactId>dataTable</artifactId>
<version>${project.version}</version>
</dependency>
- </dependencies>
+ </dependencies>
+
</project>
\ No newline at end of file
18 years, 5 months
JBoss Rich Faces SVN: r4063 - in branches/3.1.x: samples/orderingListDemo and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-16 19:17:48 -0500 (Fri, 16 Nov 2007)
New Revision: 4063
Added:
branches/3.1.x/samples/orderingListDemo/
branches/3.1.x/samples/orderingListDemo/pom.xml
branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java
branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java
branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java
branches/3.1.x/samples/orderingListDemo/src/main/webapp/pages/index.jsp
branches/3.1.x/ui/orderingList/
branches/3.1.x/ui/orderingList/pom.xml
branches/3.1.x/ui/orderingList/src/main/config/component/orderinglist.xml
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java
Removed:
branches/3.1.x/samples/orderingListDemo/pom.xml
branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java
branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java
branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java
branches/3.1.x/samples/orderingListDemo/src/main/webapp/pages/index.jsp
branches/3.1.x/ui/orderingList/pom.xml
branches/3.1.x/ui/orderingList/src/main/config/component/orderinglist.xml
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java
branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java
Modified:
branches/3.1.x/samples/pom.xml
branches/3.1.x/ui/pom.xml
Log:
orderingList committed to 3.1.x
Copied: branches/3.1.x/samples/orderingListDemo (from rev 4060, trunk/sandbox/samples/orderingListDemo)
Deleted: branches/3.1.x/samples/orderingListDemo/pom.xml
===================================================================
--- trunk/sandbox/samples/orderingListDemo/pom.xml 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/samples/orderingListDemo/pom.xml 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>samples</artifactId>
- <groupId>org.richfaces.sandbox</groupId>
- <version>3.2.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.sandbox.samples</groupId>
- <artifactId>orderingListDemo</artifactId>
- <packaging>war</packaging>
- <name>orderingListDemo Maven Webapp</name>
- <build>
- <finalName>orderingListDemo</finalName>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.richfaces.sandbox.ui</groupId>
- <artifactId>orderingList</artifactId>
- <version>3.2.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.samples</groupId>
- <artifactId>skins</artifactId>
- <version>3.2.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
Copied: branches/3.1.x/samples/orderingListDemo/pom.xml (from rev 4062, trunk/sandbox/samples/orderingListDemo/pom.xml)
===================================================================
--- branches/3.1.x/samples/orderingListDemo/pom.xml (rev 0)
+++ branches/3.1.x/samples/orderingListDemo/pom.xml 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.1.3-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.samples</groupId>
+ <artifactId>orderingListDemo</artifactId>
+ <packaging>war</packaging>
+ <name>orderingListDemo Maven Webapp</name>
+ <build>
+ <finalName>orderingListDemo</finalName>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>orderingList</artifactId>
+ <version>3.1.3-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.samples</groupId>
+ <artifactId>skins</artifactId>
+ <version>3.1.3-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
Deleted: branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,203 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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,
- * 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-import javax.faces.event.PhaseId;
-
-import org.richfaces.component.UIOrderingList;
-
-/**
- * @author $Autor$
- *
- */
-public class Bean {
- private List<OrderingListDemoBean> lists = new ArrayList<OrderingListDemoBean>();
- private String [] simpleItems = new String [] {
- "First", "Second", "Third", "Fourth"
- };
-
- public static final class UIEventsOutput extends UIOutput {
- final class Event extends FacesEvent {
-
- /**
- *
- */
- private static final long serialVersionUID = -1390611902280951049L;
-
- private Object value;
-
- private String clientId;
-
- public Event(UIComponent component, Object value, String clientId, PhaseId phaseId) {
- super(component);
-
- this.value = value;
- this.clientId = clientId;
-
- setPhaseId(phaseId);
- }
-
- public boolean isAppropriateListener(FacesListener listener) {
- return false;
- }
-
- public void processListener(FacesListener listener) {
- throw new UnsupportedOperationException();
- }
-
- public Object getValue() {
- return value;
- }
-
- public String getClientId() {
- return clientId;
- }
- }
-
- private UIOrderingList getList() {
- UIComponent component = getParent();
- while (component != null && !(component instanceof UIOrderingList)) {
- component = component.getParent();
- }
-
- return (UIOrderingList) component;
- }
-
- private void queueEvent(PhaseId phaseId) {
- new Event(this, getList().getRowData(),
- getList().getClientId(FacesContext.getCurrentInstance()), phaseId).queue();
- }
-
- public void processDecodes(FacesContext context) {
- super.processDecodes(context);
-
- queueEvent(PhaseId.PROCESS_VALIDATIONS);
- queueEvent(PhaseId.UPDATE_MODEL_VALUES);
- queueEvent(PhaseId.INVOKE_APPLICATION);
- }
-
- public void processUpdates(FacesContext context) {
- super.processUpdates(context);
-
- queueEvent(PhaseId.INVOKE_APPLICATION);
- }
-
- public void processValidators(FacesContext context) {
- super.processValidators(context);
-
- queueEvent(PhaseId.UPDATE_MODEL_VALUES);
- queueEvent(PhaseId.INVOKE_APPLICATION);
- }
-
- public void broadcast(FacesEvent event)
- throws AbortProcessingException {
- if (event instanceof Event) {
- String cid = getList().getClientId(FacesContext.getCurrentInstance());
- if (!cid.equals(((Event) event).getClientId())) {
- System.out.println(cid + " !!! " + ((Event) event).getClientId());
- }
-
- Object rd = getList().getRowData();
- if (!rd.equals(((Event) event).getValue())) {
- System.out.println(rd + " !!! " + ((Event) event).getValue());
- }
- } else {
- super.broadcast(event);
- }
- }
- }
-
- public Bean() {
- for (int i = 0; i < 3; i++) {
- lists.add(new OrderingListDemoBean());
- }
- }
-
- public List<OrderingListDemoBean> getLists() {
- return lists;
- }
-
- public void setLists(List<OrderingListDemoBean> lists) {
- this.lists = lists;
- }
-
- public String[] getSimpleItems() {
- return simpleItems;
- }
-
- public void setSimpleItems(String[] simpleItems) {
- this.simpleItems = simpleItems;
- }
-
- private UIComponent eventsBouncer;
-
- public UIComponent getEventsBouncer() {
- if (eventsBouncer == null) {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- UIComponent output = facesContext.getApplication().createComponent(UIOutput.COMPONENT_TYPE);
- UIOutput o = new UIEventsOutput();
-
- o.getAttributes().put("escape", Boolean.FALSE);
- output.getChildren().add(o);
-
- eventsBouncer = output;
- }
-
- return eventsBouncer;
- }
-
- public void setEventsBouncer(UIComponent component) {
- this.eventsBouncer = component;
- }
-
- private Collection selection;
-
- private Object activeItem;
-
- public Collection getSelection() {
- return selection;
- }
-
- public void setSelection(Collection selection) {
- System.out.println("Bean.setSelection() " + selection);
- this.selection = selection;
- }
-
- public Object getActiveItem() {
- return activeItem;
- }
-
- public void setActiveItem(Object activeItem) {
- System.out.println("Bean.setActiveItem() " + activeItem);
- this.activeItem = activeItem;
- }
-}
\ No newline at end of file
Copied: branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java (from rev 4062, trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java)
===================================================================
--- branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java (rev 0)
+++ branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,203 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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,
+ * 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+import javax.faces.event.PhaseId;
+
+import org.richfaces.component.UIOrderingList;
+
+/**
+ * @author $Autor$
+ *
+ */
+public class Bean {
+ private List lists = new ArrayList();
+ private String [] simpleItems = new String [] {
+ "First", "Second", "Third", "Fourth"
+ };
+
+ public static final class UIEventsOutput extends UIOutput {
+ final class Event extends FacesEvent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1390611902280951049L;
+
+ private Object value;
+
+ private String clientId;
+
+ public Event(UIComponent component, Object value, String clientId, PhaseId phaseId) {
+ super(component);
+
+ this.value = value;
+ this.clientId = clientId;
+
+ setPhaseId(phaseId);
+ }
+
+ public boolean isAppropriateListener(FacesListener listener) {
+ return false;
+ }
+
+ public void processListener(FacesListener listener) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public String getClientId() {
+ return clientId;
+ }
+ }
+
+ private UIOrderingList getList() {
+ UIComponent component = getParent();
+ while (component != null && !(component instanceof UIOrderingList)) {
+ component = component.getParent();
+ }
+
+ return (UIOrderingList) component;
+ }
+
+ private void queueEvent(PhaseId phaseId) {
+ new Event(this, getList().getRowData(),
+ getList().getClientId(FacesContext.getCurrentInstance()), phaseId).queue();
+ }
+
+ public void processDecodes(FacesContext context) {
+ super.processDecodes(context);
+
+ queueEvent(PhaseId.PROCESS_VALIDATIONS);
+ queueEvent(PhaseId.UPDATE_MODEL_VALUES);
+ queueEvent(PhaseId.INVOKE_APPLICATION);
+ }
+
+ public void processUpdates(FacesContext context) {
+ super.processUpdates(context);
+
+ queueEvent(PhaseId.INVOKE_APPLICATION);
+ }
+
+ public void processValidators(FacesContext context) {
+ super.processValidators(context);
+
+ queueEvent(PhaseId.UPDATE_MODEL_VALUES);
+ queueEvent(PhaseId.INVOKE_APPLICATION);
+ }
+
+ public void broadcast(FacesEvent event)
+ throws AbortProcessingException {
+ if (event instanceof Event) {
+ String cid = getList().getClientId(FacesContext.getCurrentInstance());
+ if (!cid.equals(((Event) event).getClientId())) {
+ System.out.println(cid + " !!! " + ((Event) event).getClientId());
+ }
+
+ Object rd = getList().getRowData();
+ if (!rd.equals(((Event) event).getValue())) {
+ System.out.println(rd + " !!! " + ((Event) event).getValue());
+ }
+ } else {
+ super.broadcast(event);
+ }
+ }
+ }
+
+ public Bean() {
+ for (int i = 0; i < 3; i++) {
+ lists.add(new OrderingListDemoBean());
+ }
+ }
+
+ public List getLists() {
+ return lists;
+ }
+
+ public void setLists(List lists) {
+ this.lists = lists;
+ }
+
+ public String[] getSimpleItems() {
+ return simpleItems;
+ }
+
+ public void setSimpleItems(String[] simpleItems) {
+ this.simpleItems = simpleItems;
+ }
+
+ private UIComponent eventsBouncer;
+
+ public UIComponent getEventsBouncer() {
+ if (eventsBouncer == null) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIComponent output = facesContext.getApplication().createComponent(UIOutput.COMPONENT_TYPE);
+ UIOutput o = new UIEventsOutput();
+
+ o.getAttributes().put("escape", Boolean.FALSE);
+ output.getChildren().add(o);
+
+ eventsBouncer = output;
+ }
+
+ return eventsBouncer;
+ }
+
+ public void setEventsBouncer(UIComponent component) {
+ this.eventsBouncer = component;
+ }
+
+ private Collection selection;
+
+ private Object activeItem;
+
+ public Collection getSelection() {
+ return selection;
+ }
+
+ public void setSelection(Collection selection) {
+ System.out.println("Bean.setSelection() " + selection);
+ this.selection = selection;
+ }
+
+ public Object getActiveItem() {
+ return activeItem;
+ }
+
+ public void setActiveItem(Object activeItem) {
+ System.out.println("Bean.setActiveItem() " + activeItem);
+ this.activeItem = activeItem;
+ }
+}
\ No newline at end of file
Deleted: branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,40 +0,0 @@
-package org.richfaces;
-
-import javax.faces.context.FacesContext;
-
-public class OptionItem {
- private String name;
- private int price;
-
- public OptionItem(String name, int price) {
- super();
- this.name = name;
- this.price = price;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getPrice() {
- return price;
- }
-
- public String action() {
- String actionResult = "OptionItem.action(): " + name + ", " + price;
- System.out.println(actionResult);
- FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("actionResult", actionResult);
-
- return null;
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName() + " [" + name + "] by " + price;
- }
-
-}
Copied: branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java (from rev 4062, trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java)
===================================================================
--- branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java (rev 0)
+++ branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,39 @@
+package org.richfaces;
+
+import javax.faces.context.FacesContext;
+
+public class OptionItem {
+ private String name;
+ private int price;
+
+ public OptionItem(String name, int price) {
+ super();
+ this.name = name;
+ this.price = price;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getPrice() {
+ return price;
+ }
+
+ public String action() {
+ String actionResult = "OptionItem.action(): " + name + ", " + price;
+ System.out.println(actionResult);
+ FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("actionResult", actionResult);
+
+ return null;
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName() + " [" + name + "] by " + price;
+ }
+
+}
Deleted: branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,107 +0,0 @@
-package org.richfaces;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-import javax.faces.context.FacesContext;
-
-public class OrderingListDemoBean {
-
- private List<OptionItem> items = new ArrayList<OptionItem>();
-
- private String controlsType = "link";
- private String controlsHorizontalAlign = "right";
- private String controlsVerticalAlign = "center";
- private String headerLabel = "headerLabel";
-
- private String ontopclick = "new Effect.Highlight('form:ontopclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});";
- private String onbottomclick = "new Effect.Highlight('form:onbottomclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});";
-
- private boolean orderControlsVisible = true;
- private boolean fastOrderControlsVisible = true;
-
- public OrderingListDemoBean() {
- for (int i = 0; i < 10; i++) {
- items.add(new OptionItem("Item " + i, new Random().nextInt(2000)));
- }
- }
-
- public void setItems(List<OptionItem> items) {
- this.items = items;
- }
-
- public List<OptionItem> getItems() {
- return items;
- }
-
- public String getControlsType() {
- return controlsType;
- }
-
- public void setControlsType(String controlsType) {
- this.controlsType = controlsType;
- }
-
- public String getControlsHorizontalAlign() {
- return controlsHorizontalAlign;
- }
-
- public void setControlsHorizontalAlign(String controlsHorizontalAlign) {
- this.controlsHorizontalAlign = controlsHorizontalAlign;
- }
-
- public String getControlsVerticalAlign() {
- return controlsVerticalAlign;
- }
-
- public void setControlsVerticalAlign(String controlsVerticalAlign) {
- this.controlsVerticalAlign = controlsVerticalAlign;
- }
-
- public String getHeaderLabel() {
- return headerLabel;
- }
-
- public void setHeaderLabel(String headerLabel) {
- this.headerLabel = headerLabel;
- }
-
- public boolean isOrderControlsVisible() {
- return orderControlsVisible;
- }
-
- public void setOrderControlsVisible(boolean orderControlsVisible) {
- this.orderControlsVisible = orderControlsVisible;
- }
-
- public boolean isFastOrderControlsVisible() {
- return fastOrderControlsVisible;
- }
-
- public void setFastOrderControlsVisible(boolean fastOrderControlsVisible) {
- this.fastOrderControlsVisible = fastOrderControlsVisible;
- }
-
- public Object getActionResult() {
- return FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("actionResult");
- }
-
- public String getOntopclick() {
- return ontopclick;
- }
-
- public void setOntopclick(String ontopclick) {
- this.ontopclick = ontopclick;
- }
-
- public String getOnbottomclick() {
- return onbottomclick;
- }
-
- public void setOnbottomclick(String onbottomclick) {
- this.onbottomclick = onbottomclick;
- }
-
-
-}
Copied: branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java (from rev 4062, trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java)
===================================================================
--- branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java (rev 0)
+++ branches/3.1.x/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,107 @@
+package org.richfaces;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import javax.faces.context.FacesContext;
+
+public class OrderingListDemoBean {
+
+ private List items = new ArrayList();
+
+ private String controlsType = "link";
+ private String controlsHorizontalAlign = "right";
+ private String controlsVerticalAlign = "center";
+ private String headerLabel = "headerLabel";
+
+ private String ontopclick = "new Effect.Highlight('form:ontopclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});";
+ private String onbottomclick = "new Effect.Highlight('form:onbottomclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});";
+
+ private boolean orderControlsVisible = true;
+ private boolean fastOrderControlsVisible = true;
+
+ public OrderingListDemoBean() {
+ for (int i = 0; i < 10; i++) {
+ items.add(new OptionItem("Item " + i, new Random().nextInt(2000)));
+ }
+ }
+
+ public void setItems(List items) {
+ this.items = items;
+ }
+
+ public List getItems() {
+ return items;
+ }
+
+ public String getControlsType() {
+ return controlsType;
+ }
+
+ public void setControlsType(String controlsType) {
+ this.controlsType = controlsType;
+ }
+
+ public String getControlsHorizontalAlign() {
+ return controlsHorizontalAlign;
+ }
+
+ public void setControlsHorizontalAlign(String controlsHorizontalAlign) {
+ this.controlsHorizontalAlign = controlsHorizontalAlign;
+ }
+
+ public String getControlsVerticalAlign() {
+ return controlsVerticalAlign;
+ }
+
+ public void setControlsVerticalAlign(String controlsVerticalAlign) {
+ this.controlsVerticalAlign = controlsVerticalAlign;
+ }
+
+ public String getHeaderLabel() {
+ return headerLabel;
+ }
+
+ public void setHeaderLabel(String headerLabel) {
+ this.headerLabel = headerLabel;
+ }
+
+ public boolean isOrderControlsVisible() {
+ return orderControlsVisible;
+ }
+
+ public void setOrderControlsVisible(boolean orderControlsVisible) {
+ this.orderControlsVisible = orderControlsVisible;
+ }
+
+ public boolean isFastOrderControlsVisible() {
+ return fastOrderControlsVisible;
+ }
+
+ public void setFastOrderControlsVisible(boolean fastOrderControlsVisible) {
+ this.fastOrderControlsVisible = fastOrderControlsVisible;
+ }
+
+ public Object getActionResult() {
+ return FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("actionResult");
+ }
+
+ public String getOntopclick() {
+ return ontopclick;
+ }
+
+ public void setOntopclick(String ontopclick) {
+ this.ontopclick = ontopclick;
+ }
+
+ public String getOnbottomclick() {
+ return onbottomclick;
+ }
+
+ public void setOnbottomclick(String onbottomclick) {
+ this.onbottomclick = onbottomclick;
+ }
+
+
+}
Deleted: branches/3.1.x/samples/orderingListDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,185 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
-<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/ui/orderingList" prefix="ol" %>
-<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
-
-<html>
- <head>
- <style type="text/css">
- .columnClass {
- vertical-align: top;
- }
- .eventDiv {
- background-color: green;
- color: white;
- width: 200px;
- height: 50px;
- font-weight: bold;
- }
-
- </style>
-
- <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/effects.js"></script>
- <title>Ordering List Demo.</title>
- </head>
- <body>
- <f:view>
- <h:form id="form" >
- <h:selectOneRadio binding="#{skinBean.component}" />
- <h:commandLink action="#{skinBean.change}" value="set skin" />
- <br />
- <a4j:status startText="START" startStyle="color: red;"
- stopText="STOP" stopStyle="color: green;" />
- <br />
- <h:panelGrid columns="2" columnClasses="columnClass">
- <h:panelGroup>
- <ol:orderingList id="orderingList1"
- value="#{demoBean.items}" var="item"
- headerLabel="#{demoBean.headerLabel}"
- controlsType="#{demoBean.controlsType}"
- controlsHorizontalAlign="#{demoBean.controlsHorizontalAlign}"
- controlsVerticalAlign="#{demoBean.controlsVerticalAlign}"
- orderControlsVisible="#{demoBean.orderControlsVisible}"
- fastOrderControlsVisible="#{demoBean.fastOrderControlsVisible}"
-
- selection="#{bean.selection}"
- activeItem="#{bean.activeItem}"
-
- ontopclick="#{demoBean.ontopclick}"
- onbottomclick="#{demoBean.onbottomclick}"
- onorderchanged="new Effect.Highlight('form:onorderchangedDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
- ondownclick="new Effect.Highlight('form:ondownclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
- onheaderclick="new Effect.Highlight('form:onheaderclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
- onupclick="new Effect.Highlight('form:onupclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});" >
-
- <h:column>
- <f:facet name="header">
- <h:outputText value="Name" />
- </f:facet>
- <h:inputText value="#{item.name}" />
- </h:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="Price" />
- </f:facet>
- <h:outputText value="#{item.price}" />
- </h:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="Ajax Action" />
- </f:facet>
- <a4j:commandButton value="Ajax Action" reRender="actionResult"
- action="#{item.action}" />
- </h:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="Server Action" />
- </f:facet>
- <h:commandLink value="Server Action" action="#{item.action}" />
- </h:column>
- <h:column>
- <h:outputText binding="#{bean.eventsBouncer}"></h:outputText>
- </h:column>
- </ol:orderingList>
-
- <h:panelGrid columns="2">
- <h:panelGroup layout="block" styleClass="eventDiv" id="ontopclickDiv" >
- <h:outputText value="ontopclick" />
- </h:panelGroup>
- <h:panelGroup layout="block" styleClass="eventDiv" id="onbottomclickDiv" >
- <h:outputText value="onbottomclick" />
- </h:panelGroup>
- <h:panelGroup layout="block" styleClass="eventDiv" id="onorderchangedDiv" >
- <h:outputText value="onorderchanged" />
- </h:panelGroup>
- <h:panelGroup layout="block" styleClass="eventDiv" id="ondownclickDiv" >
- <h:outputText value="ondownclick" />
- </h:panelGroup>
- <h:panelGroup layout="block" styleClass="eventDiv" id="onupclickDiv">
- <h:outputText value="onupclick" />
- </h:panelGroup>
- <h:panelGroup layout="block" styleClass="eventDiv" id="onheaderclickDiv" >
- <h:outputText value="onheaderclick" />
- </h:panelGroup>
- </h:panelGrid>
-
- <h:panelGrid columns="2">
- <h:outputText value="Item Clicked: " />
- <h:outputText value="#{demoBean.actionResult}" id="actionResult" />
-
- <h:outputText value="Header Label" />
- <h:inputText value="#{demoBean.headerLabel}" >
- <a4j:support event="onchange" reRender="orderingList1" />
- </h:inputText>
-
- <h:outputText value="Controls Type" />
- <h:selectOneRadio value="#{demoBean.controlsType}" >
- <f:selectItem itemValue="button" itemLabel="button" />
- <f:selectItem itemValue="link" itemLabel="link" />
- <f:selectItem itemValue="none" itemLabel="none" />
- <a4j:support event="onchange" reRender="orderingList1" />
- </h:selectOneRadio>
-
- <h:outputText value="Controls Horizontal Align" />
- <h:selectOneRadio value="#{demoBean.controlsHorizontalAlign}" >
- <f:selectItem itemValue="left" itemLabel="left" />
- <f:selectItem itemValue="right" itemLabel="right" />
- <a4j:support event="onchange" reRender="orderingList1" />
- </h:selectOneRadio>
-
- <h:outputText value="Controls Vertical Align" />
- <h:selectOneRadio value="#{demoBean.controlsVerticalAlign}" >
- <f:selectItem itemValue="top" itemLabel="top" />
- <f:selectItem itemValue="bottom" itemLabel="bottom" />
- <f:selectItem itemValue="center" itemLabel="center" />
- <a4j:support event="onchange" reRender="orderingList1" />
- </h:selectOneRadio>
-
- <h:outputText value="Order Controls Visible" />
- <h:selectOneRadio value="#{demoBean.orderControlsVisible}" >
- <f:selectItem itemValue="true" itemLabel="true" />
- <f:selectItem itemValue="false" itemLabel="false" />
- <a4j:support event="onchange" reRender="orderingList1" />
- </h:selectOneRadio>
-
- <h:outputText value="Fast Order Controls Visible" />
- <h:selectOneRadio value="#{demoBean.fastOrderControlsVisible}" >
- <f:selectItem itemValue="true" itemLabel="true" />
- <f:selectItem itemValue="false" itemLabel="false" />
- <a4j:support event="onchange" reRender="orderingList1" />
- </h:selectOneRadio>
-
- <h:outputText value="ontopclick JavaScript" />
- <h:inputText value="#{demoBean.ontopclick}" >
- <a4j:support event="onchange" reRender="orderingList1" />
- </h:inputText>
-
- <h:outputText value="onbottomclick JavaScript" />
- <h:inputText value="#{demoBean.onbottomclick}" >
- <a4j:support event="onchange" reRender="orderingList1" />
- </h:inputText>
-
- <h:commandButton value="Submit" />
- <h:commandButton value="Submit immediate" immediate="true" />
- </h:panelGrid>
- </h:panelGroup>
- <h:panelGroup>
- <ol:orderingList value="#{bean.simpleItems}" var="item"
- controlsType="link">
- <h:column>
- <f:facet name="header">
- <h:outputText value="Name" />
- </f:facet>
- <h:outputText value="#{item}" />
- </h:column>
- </ol:orderingList>
- </h:panelGroup>
- </h:panelGrid>
- <h3>Ordering lists within a4j:repeat</h3>
- <a4j:commandButton reRender="repeat" value="Rerender a4j:repeat" />
- </h:form>
- </f:view>
- </body>
-</html>
Copied: branches/3.1.x/samples/orderingListDemo/src/main/webapp/pages/index.jsp (from rev 4062, trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp)
===================================================================
--- branches/3.1.x/samples/orderingListDemo/src/main/webapp/pages/index.jsp (rev 0)
+++ branches/3.1.x/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,185 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/orderingList" prefix="ol" %>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
+
+<html>
+ <head>
+ <style type="text/css">
+ .columnClass {
+ vertical-align: top;
+ }
+ .eventDiv {
+ background-color: green;
+ color: white;
+ width: 200px;
+ height: 50px;
+ font-weight: bold;
+ }
+
+ </style>
+
+ <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/effects.js"></script>
+ <title>Ordering List Demo.</title>
+ </head>
+ <body>
+ <f:view>
+ <h:form id="form" >
+ <h:selectOneRadio binding="#{skinBean.component}" />
+ <h:commandLink action="#{skinBean.change}" value="set skin" />
+ <br />
+ <a4j:status startText="START" startStyle="color: red;"
+ stopText="STOP" stopStyle="color: green;" />
+ <br />
+ <h:panelGrid columns="2" columnClasses="columnClass">
+ <h:panelGroup>
+ <ol:orderingList id="orderingList1"
+ value="#{demoBean.items}" var="item"
+ headerLabel="#{demoBean.headerLabel}"
+ controlsType="#{demoBean.controlsType}"
+ controlsHorizontalAlign="#{demoBean.controlsHorizontalAlign}"
+ controlsVerticalAlign="#{demoBean.controlsVerticalAlign}"
+ orderControlsVisible="#{demoBean.orderControlsVisible}"
+ fastOrderControlsVisible="#{demoBean.fastOrderControlsVisible}"
+
+ selection="#{bean.selection}"
+ activeItem="#{bean.activeItem}"
+
+ ontopclick="#{demoBean.ontopclick}"
+ onbottomclick="#{demoBean.onbottomclick}"
+ onorderchanged="new Effect.Highlight('form:onorderchangedDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
+ ondownclick="new Effect.Highlight('form:ondownclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
+ onheaderclick="new Effect.Highlight('form:onheaderclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
+ onupclick="new Effect.Highlight('form:onupclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});" >
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Name" />
+ </f:facet>
+ <h:inputText value="#{item.name}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Price" />
+ </f:facet>
+ <h:outputText value="#{item.price}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Ajax Action" />
+ </f:facet>
+ <a4j:commandButton value="Ajax Action" reRender="actionResult"
+ action="#{item.action}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Server Action" />
+ </f:facet>
+ <h:commandLink value="Server Action" action="#{item.action}" />
+ </h:column>
+ <h:column>
+ <h:outputText binding="#{bean.eventsBouncer}"></h:outputText>
+ </h:column>
+ </ol:orderingList>
+
+ <h:panelGrid columns="2">
+ <h:panelGroup layout="block" styleClass="eventDiv" id="ontopclickDiv" >
+ <h:outputText value="ontopclick" />
+ </h:panelGroup>
+ <h:panelGroup layout="block" styleClass="eventDiv" id="onbottomclickDiv" >
+ <h:outputText value="onbottomclick" />
+ </h:panelGroup>
+ <h:panelGroup layout="block" styleClass="eventDiv" id="onorderchangedDiv" >
+ <h:outputText value="onorderchanged" />
+ </h:panelGroup>
+ <h:panelGroup layout="block" styleClass="eventDiv" id="ondownclickDiv" >
+ <h:outputText value="ondownclick" />
+ </h:panelGroup>
+ <h:panelGroup layout="block" styleClass="eventDiv" id="onupclickDiv">
+ <h:outputText value="onupclick" />
+ </h:panelGroup>
+ <h:panelGroup layout="block" styleClass="eventDiv" id="onheaderclickDiv" >
+ <h:outputText value="onheaderclick" />
+ </h:panelGroup>
+ </h:panelGrid>
+
+ <h:panelGrid columns="2">
+ <h:outputText value="Item Clicked: " />
+ <h:outputText value="#{demoBean.actionResult}" id="actionResult" />
+
+ <h:outputText value="Header Label" />
+ <h:inputText value="#{demoBean.headerLabel}" >
+ <a4j:support event="onchange" reRender="orderingList1" />
+ </h:inputText>
+
+ <h:outputText value="Controls Type" />
+ <h:selectOneRadio value="#{demoBean.controlsType}" >
+ <f:selectItem itemValue="button" itemLabel="button" />
+ <f:selectItem itemValue="link" itemLabel="link" />
+ <f:selectItem itemValue="none" itemLabel="none" />
+ <a4j:support event="onchange" reRender="orderingList1" />
+ </h:selectOneRadio>
+
+ <h:outputText value="Controls Horizontal Align" />
+ <h:selectOneRadio value="#{demoBean.controlsHorizontalAlign}" >
+ <f:selectItem itemValue="left" itemLabel="left" />
+ <f:selectItem itemValue="right" itemLabel="right" />
+ <a4j:support event="onchange" reRender="orderingList1" />
+ </h:selectOneRadio>
+
+ <h:outputText value="Controls Vertical Align" />
+ <h:selectOneRadio value="#{demoBean.controlsVerticalAlign}" >
+ <f:selectItem itemValue="top" itemLabel="top" />
+ <f:selectItem itemValue="bottom" itemLabel="bottom" />
+ <f:selectItem itemValue="center" itemLabel="center" />
+ <a4j:support event="onchange" reRender="orderingList1" />
+ </h:selectOneRadio>
+
+ <h:outputText value="Order Controls Visible" />
+ <h:selectOneRadio value="#{demoBean.orderControlsVisible}" >
+ <f:selectItem itemValue="true" itemLabel="true" />
+ <f:selectItem itemValue="false" itemLabel="false" />
+ <a4j:support event="onchange" reRender="orderingList1" />
+ </h:selectOneRadio>
+
+ <h:outputText value="Fast Order Controls Visible" />
+ <h:selectOneRadio value="#{demoBean.fastOrderControlsVisible}" >
+ <f:selectItem itemValue="true" itemLabel="true" />
+ <f:selectItem itemValue="false" itemLabel="false" />
+ <a4j:support event="onchange" reRender="orderingList1" />
+ </h:selectOneRadio>
+
+ <h:outputText value="ontopclick JavaScript" />
+ <h:inputText value="#{demoBean.ontopclick}" >
+ <a4j:support event="onchange" reRender="orderingList1" />
+ </h:inputText>
+
+ <h:outputText value="onbottomclick JavaScript" />
+ <h:inputText value="#{demoBean.onbottomclick}" >
+ <a4j:support event="onchange" reRender="orderingList1" />
+ </h:inputText>
+
+ <h:commandButton value="Submit" />
+ <h:commandButton value="Submit immediate" immediate="true" />
+ </h:panelGrid>
+ </h:panelGroup>
+ <h:panelGroup>
+ <ol:orderingList value="#{bean.simpleItems}" var="item"
+ controlsType="link">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Name" />
+ </f:facet>
+ <h:outputText value="#{item}" />
+ </h:column>
+ </ol:orderingList>
+ </h:panelGroup>
+ </h:panelGrid>
+ <h3>Ordering lists within a4j:repeat</h3>
+ <a4j:commandButton reRender="repeat" value="Rerender a4j:repeat" />
+ </h:form>
+ </f:view>
+ </body>
+</html>
Modified: branches/3.1.x/samples/pom.xml
===================================================================
--- branches/3.1.x/samples/pom.xml 2007-11-17 00:08:52 UTC (rev 4062)
+++ branches/3.1.x/samples/pom.xml 2007-11-17 00:17:48 UTC (rev 4063)
@@ -425,6 +425,7 @@
<module>calendar-sample</module>
<module>treeModelDemo</module>
<module>local-value-demo</module>
+ <module>orderingListDemo</module>
<!--
<module>ajaxPortlet</module>
-->
Copied: branches/3.1.x/ui/orderingList (from rev 4060, trunk/sandbox/ui/orderingList)
Deleted: branches/3.1.x/ui/orderingList/pom.xml
===================================================================
--- trunk/sandbox/ui/orderingList/pom.xml 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/pom.xml 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,44 +0,0 @@
-<?xml version="1.0"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>ui</artifactId>
- <groupId>org.richfaces.sandbox</groupId>
- <version>3.2.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.sandbox.ui</groupId>
- <artifactId>orderingList</artifactId>
- <name>orderingList</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.richfaces.cdk</groupId>
- <artifactId>maven-cdk-plugin</artifactId>
- <version>3.2.0-SNAPSHOT</version>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <library>
- <prefix>org.richfaces</prefix>
- <taglib>
- <shortName>orderingList</shortName>
- </taglib>
- </library>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.richfaces.ui</groupId>
- <artifactId>dataTable</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
Copied: branches/3.1.x/ui/orderingList/pom.xml (from rev 4061, trunk/sandbox/ui/orderingList/pom.xml)
===================================================================
--- branches/3.1.x/ui/orderingList/pom.xml (rev 0)
+++ branches/3.1.x/ui/orderingList/pom.xml 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>ui</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.1.3-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>orderingList</artifactId>
+ <name>orderingList</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>3.1.3-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <library>
+ <prefix>org.richfaces</prefix>
+ <taglib>
+ <shortName>orderingList</shortName>
+ </taglib>
+ </library>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>dataTable</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: branches/3.1.x/ui/orderingList/src/main/config/component/orderinglist.xml
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/config/component/orderinglist.xml 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/src/main/config/component/orderinglist.xml 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,237 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd" >
-<components>
- <component>
- <name>org.richfaces.OrderingList</name>
- <family>org.richfaces.OrderingList</family>
- <classname>org.richfaces.component.html.HtmlOrderingList</classname>
- <superclass>org.richfaces.component.UIOrderingList</superclass>
- <description>
- </description>
-
- <renderer generate="true" override="true">
- <name>org.richfaces.OrderingListRenderer</name>
- <template>org/richfaces/htmlOrderingList.jspx</template>
- </renderer>
-
- <tag>
- <name>orderingList</name>
- <classname>org.richfaces.taglib.OrderingListTag</classname>
- <superclass>
- org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
- </superclass>
- <test/>
- </tag>
-
- <taghandler generate="true">
- <classname>org.richfaces.taglib.OrderingListTagHandler</classname>
- <superclass>com.sun.facelets.tag.jsf.ComponentHandler</superclass>
- </taghandler>
-
- &ui_component_attributes;
-
- <property>
- <name>captionLabel</name>
- <classname>java.lang.String</classname>
- <description>
- Defines caption representation text
- </description>
- </property>
- <property>
- <name>label</name>
- <classname>java.lang.Boolean</classname>
- <description>
- </description>
- <defaultvalue><![CDATA[true]]></defaultvalue>
- </property>
- <property>
- <name>listWidth</name>
- <classname>int</classname>
- <description>
- listWidth
- </description>
- <defaultvalue><![CDATA[200]]></defaultvalue>
- </property>
- <property>
- <name>listHeight</name>
- <classname>int</classname>
- <description>
- listHeight
- </description>
- <defaultvalue><![CDATA[150]]></defaultvalue>
- </property>
- <property>
- <name>rowClasses</name>
- <classname>java.lang.String</classname>
- <description>
- rowClasses
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- <property>
- <name>rowClasses</name>
- <classname>java.lang.String</classname>
- <description>
- rowClasses
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- <property>
- <name>cellClasses</name>
- <classname>java.lang.String</classname>
- <description>
- cellClasses
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- <property>
- <name>headerLabel</name>
- <classname>java.lang.String</classname>
- <description>
- Defines text, which is placed inside a header.
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- <property>
- <name>controlsType</name>
- <classname>java.lang.String</classname>
- <description>
- Defines type of a control: button, link or none.
- </description>
- <defaultvalue><![CDATA["button"]]></defaultvalue>
- </property>
- <property>
- <name>controlsHorizontalAlign</name>
- <classname>java.lang.String</classname>
- <description>
- Controls horizontal rendering. Possible values:
- left - controls should be rendered to the left side of a list.
- right(Default)- controls should be rendered to the right side of a list.
- </description>
- <defaultvalue><![CDATA["right"]]></defaultvalue>
- </property>
- <property>
- <name>controlsVerticalAlign</name>
- <classname>java.lang.String</classname>
- <description>
- Controls vertical rendering. Possible values:
- top - controls should be rendered aligned to top side of a list.
- bottom - controls should be rendered aligned to bottom side of a list.
- center(Default) - controls should be rendered centered relatively to a list.
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- <property>
- <name>sortIconUp</name>
- <classname>java.lang.String</classname>
- <description>
- Specifies an icon for a sorting marker in sorting 'up' position.
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- <property>
- <name>sortIconDown</name>
- <classname>java.lang.String</classname>
- <description>
- Sspecifies an icon for a sorting marker in sorting 'down' position.
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- <property>
- <name>sortIcon</name>
- <classname>java.lang.String</classname>
- <description>
- Specifies a default icon for a sorting marker in non-sorting position.
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- <property>
- <name>orderControlsVisible</name>
- <classname>boolean</classname>
- <description>
- If false – 'Up' and 'Down' controls shouldn't be displayed.
- </description>
- <defaultvalue>true</defaultvalue>
- </property>
- <property>
- <name>fastOrderControlsVisible</name>
- <classname>boolean</classname>
- <description>
- If false 'Top' and 'Bottom' controls aren’t displayed.
- </description>
- <defaultvalue>true</defaultvalue>
- </property>
-
- <property>
- <name>selection</name>
- <description>Collection which stores a set of selected items</description>
- </property>
-
- <property hidden="true" el="false">
- <name>submittedValue</name>
- </property>
- <property hidden="true" el="false" exist="true">
- <name>submittedString</name>
- </property>
- <property hidden="true" el="false">
- <name>localValueSet</name>
- </property>
- <property hidden="true" el="false">
- <name>valid</name>
- </property>
- <property elonly="true">
- <name>validator</name>
- <classname>javax.faces.el.MethodBinding</classname>
- <methodargs>javax.faces.event.ValueChangeEvent</methodargs>
- </property>
-
- <property>
- <name>onorderchanged</name>
- <classname>java.lang.String</classname>
- <description>
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- <property>
- <name>ontopclick</name>
- <classname>java.lang.String</classname>
- <description>
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- <property>
- <name>onupclick</name>
- <classname>java.lang.String</classname>
- <description>
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- <property>
- <name>ondownclick</name>
- <classname>java.lang.String</classname>
- <description>
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- <property>
- <name>onbottomclick</name>
- <classname>java.lang.String</classname>
- <description>
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- <property>
- <name>onheaderclick</name>
- <classname>java.lang.String</classname>
- <description>
- </description>
- <defaultvalue><![CDATA[""]]></defaultvalue>
- </property>
- </component>
-
- <listener>
- <componentclass>javax.faces.component.EditableValueHolder</componentclass>
- <eventclass>javax.faces.event.ValueChangeEvent</eventclass>
- <name>valueChangeListener</name>
- </listener>
-</components>
Copied: branches/3.1.x/ui/orderingList/src/main/config/component/orderinglist.xml (from rev 4061, trunk/sandbox/ui/orderingList/src/main/config/component/orderinglist.xml)
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/config/component/orderinglist.xml (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/config/component/orderinglist.xml 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd" >
+<components>
+ <component>
+ <name>org.richfaces.OrderingList</name>
+ <family>org.richfaces.OrderingList</family>
+ <classname>org.richfaces.component.html.HtmlOrderingList</classname>
+ <superclass>org.richfaces.component.UIOrderingList</superclass>
+ <description>
+ </description>
+
+ <renderer generate="true" override="true">
+ <name>org.richfaces.OrderingListRenderer</name>
+ <template>org/richfaces/htmlOrderingList.jspx</template>
+ </renderer>
+
+ <tag>
+ <name>orderingList</name>
+ <classname>org.richfaces.taglib.OrderingListTag</classname>
+ <superclass>
+ org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
+ </superclass>
+ <test/>
+ </tag>
+
+ <taghandler generate="true">
+ <classname>org.richfaces.taglib.OrderingListTagHandler</classname>
+ <superclass>com.sun.facelets.tag.jsf.ComponentHandler</superclass>
+ </taghandler>
+
+ &ui_component_attributes;
+
+ <property>
+ <name>captionLabel</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Defines caption representation text
+ </description>
+ </property>
+ <property>
+ <name>showButtonLabels</name>
+ <classname>boolean</classname>
+ <description>
+ </description>
+ <defaultvalue><![CDATA[true]]></defaultvalue>
+ </property>
+
+ <property>
+ <name>topControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>upControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>downControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>bottomControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+
+ <property>
+ <name>listWidth</name>
+ <classname>int</classname>
+ <description>
+ listWidth
+ </description>
+ <defaultvalue><![CDATA[200]]></defaultvalue>
+ </property>
+ <property>
+ <name>listHeight</name>
+ <classname>int</classname>
+ <description>
+ listHeight
+ </description>
+ <defaultvalue><![CDATA[150]]></defaultvalue>
+ </property>
+ <property>
+ <name>rowClasses</name>
+ <classname>java.lang.String</classname>
+ <description>
+ rowClasses
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>rowClasses</name>
+ <classname>java.lang.String</classname>
+ <description>
+ rowClasses
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>cellClasses</name>
+ <classname>java.lang.String</classname>
+ <description>
+ cellClasses
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>headerLabel</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Defines text, which is placed inside a header.
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>controlsType</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Defines type of a control: button or none.
+ </description>
+ <defaultvalue><![CDATA["button"]]></defaultvalue>
+ </property>
+ <property>
+ <name>controlsHorizontalAlign</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Controls horizontal rendering. Possible values:
+ left - controls should be rendered to the left side of a list.
+ right(Default)- controls should be rendered to the right side of a list.
+ </description>
+ <defaultvalue><![CDATA["right"]]></defaultvalue>
+ </property>
+ <property>
+ <name>controlsVerticalAlign</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Controls vertical rendering. Possible values:
+ top - controls should be rendered aligned to top side of a list.
+ bottom - controls should be rendered aligned to bottom side of a list.
+ center(Default) - controls should be rendered centered relatively to a list.
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>sortIconUp</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Specifies an icon for a sorting marker in sorting 'up' position.
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>sortIconDown</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Sspecifies an icon for a sorting marker in sorting 'down' position.
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>sortIcon</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Specifies a default icon for a sorting marker in non-sorting position.
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>orderControlsVisible</name>
+ <classname>boolean</classname>
+ <description>
+ If false – 'Up' and 'Down' controls shouldn't be displayed.
+ </description>
+ <defaultvalue>true</defaultvalue>
+ </property>
+ <property>
+ <name>fastOrderControlsVisible</name>
+ <classname>boolean</classname>
+ <description>
+ If false 'Top' and 'Bottom' controls aren’t displayed.
+ </description>
+ <defaultvalue>true</defaultvalue>
+ </property>
+
+ <property>
+ <name>selection</name>
+ <description>Collection which stores a set of selected items</description>
+ </property>
+
+ <property hidden="true" el="false">
+ <name>submittedValue</name>
+ </property>
+ <property hidden="true" el="false" exist="true">
+ <name>submittedString</name>
+ </property>
+ <property hidden="true" el="false">
+ <name>localValueSet</name>
+ </property>
+ <property hidden="true" el="false">
+ <name>valid</name>
+ </property>
+ <property elonly="true">
+ <name>validator</name>
+ <classname>javax.faces.el.MethodBinding</classname>
+ <methodargs>java.lang.Object.class</methodargs>
+ </property>
+
+ <property>
+ <name>onorderchanged</name>
+ <classname>java.lang.String</classname>
+ <description>
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>ontopclick</name>
+ <classname>java.lang.String</classname>
+ <description>
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>onupclick</name>
+ <classname>java.lang.String</classname>
+ <description>
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>ondownclick</name>
+ <classname>java.lang.String</classname>
+ <description>
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>onbottomclick</name>
+ <classname>java.lang.String</classname>
+ <description>
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>onheaderclick</name>
+ <classname>java.lang.String</classname>
+ <description>
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ </component>
+
+ <listener>
+ <componentclass>javax.faces.component.EditableValueHolder</componentclass>
+ <eventclass>javax.faces.event.ValueChangeEvent</eventclass>
+ <name>valueChangeListener</name>
+ </listener>
+</components>
Deleted: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,239 +0,0 @@
-/**
- *
- */
-package org.richfaces.component;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.faces.component.EditableValueHolder;
-import javax.faces.component.UIColumn;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
-import javax.faces.el.ValueBinding;
-import javax.faces.validator.Validator;
-
-import org.ajax4jsf.component.UIDataAdaptor;
-import org.ajax4jsf.model.DataComponentState;
-import org.ajax4jsf.model.RepeatState;
-import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.iterators.EmptyIterator;
-import org.apache.commons.collections.iterators.FilterIterator;
-
-/**
- * @author Nick Belaevski
- * mailto:nbelaevski@exadel.com
- * created 16.11.2007
- * @since 3.2
- */
-public abstract class UIOrderingBaseComponent extends UIDataAdaptor implements EditableValueHolder {
-
- private Object value;
- private boolean localValueSet;
-
- private List validators = null;
- private MethodBinding validator;
-
- public static final Predicate isColumn = new Predicate() {
- public boolean evaluate(Object input) {
- return (input instanceof UIColumn || input instanceof Column) &&
- ((UIComponent) input).isRendered();
- }
- };
-
-
- private static class EditableState {
- private boolean translated = false;
-
- //setting this flag to true means we should reorder elements
- private boolean translatedRendering = false;
- }
-
- private static final class ValueHolder {
- private Object value;
- private Object state;
- }
-
- private transient EditableState editableState = new EditableState();
-
- protected abstract void restoreIterationState(Object object);
- protected abstract Object saveIterationState();
-
- protected abstract void restoreIterationSubmittedState(Object object);
- protected abstract Object saveIterationSubmittedState();
-
- protected void setTranslatedState() {
- this.editableState.translated = true;
- }
-
- protected boolean isTranslatedState() {
- return this.editableState.translated;
- }
-
- protected void setTranslatedRenderingState() {
- this.editableState.translatedRendering = true;
- }
-
- protected boolean isTranslatedRenderingState() {
- return this.editableState.translatedRendering;
- }
-
- public final Object getSubmittedValue() {
- Object[] state = new Object[2];
-
- state[0] = saveIterationSubmittedState();
- state[1] = editableState;
-
- return state;
- }
-
- public final void setSubmittedValue(Object object) {
- if (object != null) {
- Object[] state = (Object[]) object;
-
- restoreIterationSubmittedState(state[0]);
- editableState = (EditableState) state[1];
- } else {
- restoreIterationSubmittedState(null);
- }
- }
-
- public Object saveState(FacesContext faces) {
- Object[] state = new Object[6];
-
- state[0] = super.saveState(faces);
- state[1] = saveIterationState();
-
- state[2] = saveAttachedState(faces, validators);
- state[3] = saveAttachedState(faces, validator);
-
- state[4] = this.value;
- state[5] = localValueSet ? Boolean.TRUE : Boolean.FALSE;
-
- return state;
- }
-
- public void restoreState(FacesContext faces, Object object) {
- Object[] state = (Object[]) object;
-
- super.restoreState(faces, state[0]);
- restoreIterationState(state[1]);
-
- validators = (List) restoreAttachedState(faces, state[2]);
- validator = (MethodBinding) restoreAttachedState(faces, state[3]);
-
- value = state[4];
- localValueSet = ((Boolean) state[5]).booleanValue();
- }
-
- protected DataComponentState createComponentState() {
- return new RepeatState();
- }
-
- public Iterator columns() {
- return new FilterIterator(getChildren().iterator(), isColumn);
- }
-
- protected Iterator dataChildren() {
- if (getChildCount() != 0) {
- return columns();
- } else {
- return EmptyIterator.INSTANCE;
- }
- }
-
- protected Iterator fixedChildren() {
- if (getFacetCount() != 0) {
- return getFacets().values().iterator();
- } else {
- return EmptyIterator.INSTANCE;
- }
- }
-
- //validators
- public MethodBinding getValidator() {
- return validator;
- }
-
- public void setValidator(MethodBinding validatorBinding) {
- this.validator = validatorBinding;
- }
-
- public Validator[] getValidators() {
-
- if (validators == null) {
- return new Validator[0];
- } else {
- return (Validator[]) validators.toArray(new Validator[validators.size()]);
- }
- }
-
- public void addValidator(Validator validator) {
- if (validator == null) {
- throw new NullPointerException();
- }
-
- if (validators == null) {
- validators = new ArrayList();
- }
-
- validators.add(validator);
- }
-
- public void removeValidator(Validator validator) {
- if (validators != null) {
- validators.remove(validator);
- }
- }
- //validators end
-
- //value
- protected Object getLocalValueFieldValue() {
- return value;
- }
-
- public Object getLocalValue() {
- ValueHolder valueHolder = new ValueHolder();
- valueHolder.value = this.value;
- valueHolder.state = saveIterationState();
-
- return valueHolder;
- }
-
- public void setValue(Object value) {
- if (value instanceof ValueHolder) {
- ValueHolder holder = (ValueHolder) value;
-
- setValue(holder.value);
- restoreIterationState(holder.state);
- } else {
- super.setValue(value);
- this.value = value;
- setLocalValueSet(true);
- }
- }
-
- public Object getValue() {
- if (this.value != null) {
- return (this.value);
- }
- ValueBinding ve = getValueBinding("value");
- if (ve != null) {
- return (ve.getValue(getFacesContext()));
- } else {
- return (null);
- }
- }
- //value end
-
- public boolean isLocalValueSet() {
- return localValueSet;
- }
-
- public void setLocalValueSet(boolean localValueSet) {
- this.localValueSet = localValueSet;
- }
-
-}
Copied: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java (from rev 4061, trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java)
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,241 @@
+/**
+ *
+ */
+package org.richfaces.component;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.ValueBinding;
+import javax.faces.validator.Validator;
+
+import org.ajax4jsf.component.UIDataAdaptor;
+import org.ajax4jsf.model.DataComponentState;
+import org.ajax4jsf.model.RepeatState;
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.iterators.EmptyIterator;
+import org.apache.commons.collections.iterators.FilterIterator;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 16.11.2007
+ * @since 3.2
+ */
+public abstract class UIOrderingBaseComponent extends UIDataAdaptor implements EditableValueHolder {
+
+ private Object value;
+ private boolean localValueSet;
+
+ private List validators = null;
+ private MethodBinding validator;
+
+ public static final Predicate isColumn = new Predicate() {
+ public boolean evaluate(Object input) {
+ return (input instanceof UIColumn || input instanceof Column) &&
+ ((UIComponent) input).isRendered();
+ }
+ };
+
+
+ private static class EditableState {
+ private boolean translated = false;
+
+ //setting this flag to true means we should reorder elements
+ private boolean translatedRendering = false;
+ }
+
+ private static final class ValueHolder {
+ private Object value;
+ private Object state;
+ }
+
+ private transient EditableState editableState = new EditableState();
+
+ protected abstract void restoreIterationState(Object object);
+ protected abstract Object saveIterationState();
+
+ protected abstract void restoreIterationSubmittedState(Object object);
+ protected abstract Object saveIterationSubmittedState();
+
+ protected void setTranslatedState() {
+ this.editableState.translated = true;
+ }
+
+ protected boolean isTranslatedState() {
+ return this.editableState.translated;
+ }
+
+ protected void setTranslatedRenderingState() {
+ this.editableState.translatedRendering = true;
+ }
+
+ protected boolean isTranslatedRenderingState() {
+ return this.editableState.translatedRendering;
+ }
+
+ public final Object getSubmittedValue() {
+ Object[] state = new Object[2];
+
+ state[0] = saveIterationSubmittedState();
+ state[1] = editableState;
+
+ return state;
+ }
+
+ public final void setSubmittedValue(Object object) {
+ if (object != null) {
+ Object[] state = (Object[]) object;
+
+ restoreIterationSubmittedState(state[0]);
+ editableState = (EditableState) state[1];
+ } else {
+ restoreIterationSubmittedState(null);
+ }
+ }
+
+ public Object saveState(FacesContext faces) {
+ Object[] state = new Object[6];
+
+ state[0] = super.saveState(faces);
+ state[1] = saveIterationState();
+
+ state[2] = saveAttachedState(faces, validators);
+ state[3] = saveAttachedState(faces, validator);
+
+ state[4] = this.value;
+ state[5] = localValueSet ? Boolean.TRUE : Boolean.FALSE;
+
+ return state;
+ }
+
+ public void restoreState(FacesContext faces, Object object) {
+ Object[] state = (Object[]) object;
+
+ super.restoreState(faces, state[0]);
+ restoreIterationState(state[1]);
+
+ validators = (List) restoreAttachedState(faces, state[2]);
+ validator = (MethodBinding) restoreAttachedState(faces, state[3]);
+
+ value = state[4];
+ localValueSet = ((Boolean) state[5]).booleanValue();
+ }
+
+ protected DataComponentState createComponentState() {
+ return new RepeatState();
+ }
+
+ public Iterator columns() {
+ return new FilterIterator(getChildren().iterator(), isColumn);
+ }
+
+ protected Iterator dataChildren() {
+ if (getChildCount() != 0) {
+ return columns();
+ } else {
+ return EmptyIterator.INSTANCE;
+ }
+ }
+
+ protected Iterator fixedChildren() {
+ Map facets = getFacets();
+ if (facets != null) {
+ return facets.values().iterator();
+ } else {
+ return EmptyIterator.INSTANCE;
+ }
+ }
+
+ //validators
+ public MethodBinding getValidator() {
+ return validator;
+ }
+
+ public void setValidator(MethodBinding validatorBinding) {
+ this.validator = validatorBinding;
+ }
+
+ public Validator[] getValidators() {
+
+ if (validators == null) {
+ return new Validator[0];
+ } else {
+ return (Validator[]) validators.toArray(new Validator[validators.size()]);
+ }
+ }
+
+ public void addValidator(Validator validator) {
+ if (validator == null) {
+ throw new NullPointerException();
+ }
+
+ if (validators == null) {
+ validators = new ArrayList();
+ }
+
+ validators.add(validator);
+ }
+
+ public void removeValidator(Validator validator) {
+ if (validators != null) {
+ validators.remove(validator);
+ }
+ }
+ //validators end
+
+ //value
+ protected Object getLocalValueFieldValue() {
+ return value;
+ }
+
+ public Object getLocalValue() {
+ ValueHolder valueHolder = new ValueHolder();
+ valueHolder.value = this.value;
+ valueHolder.state = saveIterationState();
+
+ return valueHolder;
+ }
+
+ public void setValue(Object value) {
+ if (value instanceof ValueHolder) {
+ ValueHolder holder = (ValueHolder) value;
+
+ setValue(holder.value);
+ restoreIterationState(holder.state);
+ } else {
+ super.setValue(value);
+ this.value = value;
+ setLocalValueSet(true);
+ }
+ }
+
+ public Object getValue() {
+ if (this.value != null) {
+ return (this.value);
+ }
+ ValueBinding ve = getValueBinding("value");
+ if (ve != null) {
+ return (ve.getValue(getFacesContext()));
+ } else {
+ return (null);
+ }
+ }
+ //value end
+
+ public boolean isLocalValueSet() {
+ return localValueSet;
+ }
+
+ public void setLocalValueSet(boolean localValueSet) {
+ this.localValueSet = localValueSet;
+ }
+
+}
Deleted: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,1000 +0,0 @@
-package org.richfaces.component;
-
-import java.io.IOException;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.faces.FacesException;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-import javax.faces.component.UIInput;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.convert.ConverterException;
-import javax.faces.el.EvaluationException;
-import javax.faces.el.MethodBinding;
-import javax.faces.el.ValueBinding;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.ValueChangeEvent;
-import javax.faces.event.ValueChangeListener;
-import javax.faces.model.DataModel;
-import javax.faces.validator.Validator;
-import javax.faces.validator.ValidatorException;
-
-import org.ajax4jsf.javascript.ScriptUtils;
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.ExtendedDataModel;
-
-public abstract class UIOrderingList extends UIOrderingBaseComponent {
-
- public static final class ValueHolder {
- private Collection selection;
- private boolean selectionSet;
-
- private Object activeItem;
- private boolean activeItemSet;
- }
-
- public static final class SubmittedValue {
- private int[] permutationOrder;
- private Set selectedItems = new HashSet();
- private Integer activeItem;
-
- public SubmittedValue(String submittedString) {
- super();
- fromString(submittedString);
- }
-
- private void fromString(String string) {
- String[] valueOrder = string.split(",");
- permutationOrder = new int[valueOrder.length];
- for (int i = 0; i < valueOrder.length; i++) {
- Matcher matcher = Pattern.compile("(\\d+)(s?a?)").matcher(valueOrder[i]);
- matcher.matches();
-
- try {
- permutationOrder[i] = Integer.valueOf(matcher.group(1)).intValue();
- String group = matcher.group(2);
- for (int j = 0; j < group.length(); j++) {
- char c = group.charAt(j);
- if ('s' == c) {
- selectedItems.add(new Integer(permutationOrder[i]));
- } else if ('a' == c) {
- activeItem = new Integer(permutationOrder[i]);
- } else {
- break ;
- }
-
- }
- } catch (NumberFormatException e) {
- // TODO: handle exception
- }
- }
- }
-
- public String toString() {
- StringBuffer result = new StringBuffer();
- for (int i = 0; i < permutationOrder.length; i++) {
- result.append(permutationOrder[i]);
-
- Integer key = new Integer(i);
-
- if (selectedItems.contains(key)) {
- result.append('s');
- }
-
- if (key.equals(activeItem)) {
- result.append('a');
- }
-
- if (i < permutationOrder.length - 1) {
- result.append(',');
- }
- }
- return result.toString();
- }
-
- public int[] getPermutationOrder() {
- return permutationOrder;
- }
-
- }
-
- public interface ItemState {
- public boolean isSelected();
- public boolean isActive();
- }
-
- private final class SubmittedItemState implements ItemState {
- private Collection selectedItemsKeys;
- private Object activeItemKey;
-
- public SubmittedItemState(Collection selectedItemsKeys, Integer activeItemKey) {
- super();
- this.selectedItemsKeys = selectedItemsKeys;
- this.activeItemKey = activeItemKey;
- }
-
- public boolean isActive() {
- return activeItemKey != null && activeItemKey.equals(getTranslatedRowKey());
- }
-
- public boolean isSelected() {
- return selectedItemsKeys != null && selectedItemsKeys.contains(getTranslatedRowKey());
- }
- }
-
- private final class CommonItemState implements ItemState {
- private Collection selectedItems;
- private Object activeItem;
-
- public CommonItemState(Collection selectedItems, Object activeItem) {
- super();
- this.selectedItems = selectedItems;
- this.activeItem = activeItem;
- }
-
- public boolean isSelected() {
- return selectedItems != null && selectedItems.contains(getRowData());
- }
-
- public boolean isActive() {
- return activeItem != null && activeItem.equals(getRowData());
- }
- }
-
- protected ExtendedDataModel createDataModel() {
- DataModel dataModel = super.getDataModel();
- if (isTranslatedRenderingState() || isTranslatedState()) {
- return new TranslatedSequenceDataModel(dataModel, isTranslatedState(), submittedValueHolder != null ? submittedValueHolder.permutationOrder : null);
- } else {
- return new TranslatedSequenceDataModel(dataModel, false, null);
- }
- }
-
-
- private Collection localSelection;
- private boolean localSelectionSet;
-
- private Object localActiveItem;
- private boolean localActiveItemSet;
-
- private transient SubmittedValue submittedValueHolder = null;
-
- private void convertState(FacesContext faces) {
- final HashSet selectionItemsSet = new HashSet();
- final ExtendedDataModel dataModel = getExtendedDataModel();
- try {
- dataModel.walk(faces, new DataVisitor() {
-
- public void process(FacesContext context, Object rowKey,
- Object argument) throws IOException {
-
- dataModel.setRowKey(rowKey);
-
- if (localSelection != null && localSelection.contains(rowKey)) {
- selectionItemsSet.add(getRowData());
- }
-
- if (rowKey.equals(localActiveItem)) {
- localActiveItem = getRowData();
- }
- }
-
- }, null, null);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- if (this.localSelection != null) {
- this.localSelection = selectionItemsSet;
- }
- }
-
- public void restoreState(FacesContext faces, Object object) {
- final Object[] state = (Object[]) object;
- super.restoreState(faces, state[0]);
-
- localSelectionSet = ((Boolean) state[3]).booleanValue();
- localActiveItemSet = ((Boolean) state[4]).booleanValue();
-
- localSelection = (Collection) state[5];
- localActiveItem = state[6];
- }
-
- public Object saveState(FacesContext faces) {
- Object[] state = new Object[7];
- state[0] = super.saveState(faces);
-
- state[3] = localSelectionSet ? Boolean.TRUE : Boolean.FALSE;
- state[4] = localActiveItemSet ? Boolean.TRUE : Boolean.FALSE;
-
- final HashSet selectionKeySet = new HashSet();
- final HashSet activeItemSet = new HashSet(1);
-
- final ExtendedDataModel dataModel = getExtendedDataModel();
- try {
- dataModel.walk(faces, new DataVisitor() {
-
- public void process(FacesContext context, Object rowKey,
- Object argument) throws IOException {
-
- dataModel.setRowKey(rowKey);
- Object data = dataModel.getRowData();
- if (data.equals(localActiveItem)) {
- activeItemSet.add(getTranslatedRowKey());
- }
-
- if (localSelection != null && localSelection.contains(data)) {
- selectionKeySet.add(getTranslatedRowKey());
- }
-
- }
-
- }, null, null);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- state[5] = selectionKeySet;
-
- state[6] = activeItemSet.isEmpty() ? null : activeItemSet.iterator().next();
-
- return state;
- }
-
- public void addValueChangeListener(ValueChangeListener listener) {
- addFacesListener(listener);
- }
-
-
- public abstract MethodBinding getValueChangeListener();
-
- public ValueChangeListener[] getValueChangeListeners() {
- return (ValueChangeListener[]) getFacesListeners(ValueChangeListener.class);
- }
-
- public abstract boolean isImmediate();
-
- public abstract boolean isRequired();
-
- public abstract boolean isValid();
-
-
- public void removeValueChangeListener(ValueChangeListener listener) {
- removeFacesListener(listener);
- }
-
-
- public String getSubmittedString() {
- return submittedValueHolder != null ? submittedValueHolder.toString() : "";
- }
-
- public void setSubmittedString(String submittedString) {
- this.submittedValueHolder = new SubmittedValue(submittedString);
- }
-
- protected Object saveIterationSubmittedState() {
- return submittedValueHolder;
- }
-
- protected void restoreIterationSubmittedState(Object object) {
- this.submittedValueHolder = (SubmittedValue) object;
- }
-
- protected Object saveIterationState() {
- ValueHolder holder = new ValueHolder();
-
- holder.selection = localSelection;
- holder.selectionSet = localSelectionSet;
-
- holder.activeItem = localActiveItem;
- holder.activeItemSet = localActiveItemSet;
-
- return holder;
- }
-
- protected void restoreIterationState(Object object) {
- ValueHolder holder = (ValueHolder) object;
-
- this.localSelection = holder.selection;
- this.localSelectionSet = holder.selectionSet;
-
- this.localActiveItem = holder.activeItem;
- this.localActiveItemSet = holder.activeItemSet;
- }
-
- public abstract void setImmediate(boolean immediate);
-
- public abstract void setRequired(boolean required);
-
- public abstract void setValid(boolean valid);
-
- public abstract void setValueChangeListener(MethodBinding valueChangeMethod);
-
- public abstract Converter getConverter();
-
- public abstract void setConverter(Converter converter);
-
- /**
- * <p>Specialized decode behavior on top of that provided by the
- * superclass. In addition to the standard
- * <code>processDecodes</code> behavior inherited from {@link
- * UIComponentBase}, calls <code>validate()</code> if the the
- * <code>immediate</code> property is true; if the component is
- * invalid afterwards or a <code>RuntimeException</code> is thrown,
- * calls {@link FacesContext#renderResponse}. </p>
- * @exception NullPointerException {@inheritDoc}
- */
- public void processDecodes(FacesContext context) {
-
- convertState(context);
-
- if (context == null) {
- throw new NullPointerException();
- }
-
- // Skip processing if our rendered flag is false
- if (!isRendered()) {
- return;
- }
-
- super.processDecodes(context);
-
- if (isImmediate()) {
- executeValidate(context);
- }
- }
-
- /**
- * <p>In addition to the standard <code>processValidators</code> behavior
- * inherited from {@link UIComponentBase}, calls <code>validate()</code>
- * if the <code>immediate</code> property is false (which is the
- * default); if the component is invalid afterwards, calls
- * {@link FacesContext#renderResponse}.
- * If a <code>RuntimeException</code> is thrown during
- * validation processing, calls {@link FacesContext#renderResponse}
- * and re-throw the exception.
- * </p>
- * @exception NullPointerException {@inheritDoc}
- */
- public void processValidators(FacesContext context) {
-
- if (context == null) {
- throw new NullPointerException();
- }
-
- // Skip processing if our rendered flag is false
- if (!isRendered()) {
- return;
- }
-
- super.processValidators(context);
- if (!isImmediate()) {
- executeValidate(context);
- }
- }
-
- /**
- * <p>In addition to the standard <code>processUpdates</code> behavior
- * inherited from {@link UIComponentBase}, calls
- * <code>updateModel()</code>.
- * If the component is invalid afterwards, calls
- * {@link FacesContext#renderResponse}.
- * If a <code>RuntimeException</code> is thrown during
- * update processing, calls {@link FacesContext#renderResponse}
- * and re-throw the exception.
- * </p>
- * @exception NullPointerException {@inheritDoc}
- */
- public void processUpdates(FacesContext context) {
-
- if (context == null) {
- throw new NullPointerException();
- }
-
- // Skip processing if our rendered flag is false
- if (!isRendered()) {
- return;
- }
-
- super.processUpdates(context);
-
- try {
- updateModel(context);
- } catch (RuntimeException e) {
- context.renderResponse();
- throw e;
- }
-
- if (!isValid()) {
- context.renderResponse();
- }
- }
-
- /**
- * @exception NullPointerException {@inheritDoc}
- */
- public void decode(FacesContext context) {
-
- if (context == null) {
- throw new NullPointerException();
- }
-
- // Force validity back to "true"
- setValid(true);
- super.decode(context);
- }
-
- /**
- * <p>In addition to to the default {@link UIComponent#broadcast}
- * processing, pass the {@link ValueChangeEvent} being broadcast to the
- * method referenced by <code>valueChangeListener</code> (if any).</p>
- *
- * @param event {@link FacesEvent} to be broadcast
- *
- * @exception AbortProcessingException Signal the JavaServer Faces
- * implementation that no further processing on the current event
- * should be performed
- * @exception IllegalArgumentException if the implementation class
- * of this {@link FacesEvent} is not supported by this component
- * @exception NullPointerException if <code>event</code> is
- * <code>null</code>
- */
- public void broadcast(FacesEvent event)
- throws AbortProcessingException {
-
- // Perform standard superclass processing
- super.broadcast(event);
-
- if (event instanceof ValueChangeEvent) {
- MethodBinding method = getValueChangeListener();
- if (method != null) {
- FacesContext context = getFacesContext();
- method.invoke(context, new Object[] { event });
- }
- }
-
- }
-
- private interface UpdateModelCommand {
- public void execute(FacesContext context);
- }
-
- private final UpdateModelCommand updateValueCommand = new UpdateModelCommand() {
-
- public void execute(FacesContext context) {
- if (isLocalValueSet()) {
- ValueBinding vb = getValueBinding("value");
- if (vb != null) {
- vb.setValue(context, getLocalValueFieldValue());
- setValue(null);
- setLocalValueSet(false);
- }
- }
- }
-
- };
-
- private final UpdateModelCommand updateSelectionCommand = new UpdateModelCommand() {
-
- public void execute(FacesContext context) {
- if (localSelectionSet) {
- ValueBinding vb = getValueBinding("selection");
- if (vb != null) {
- vb.setValue(context, localSelection);
- localSelection = null;
- localSelectionSet = false;
- }
- }
- }
-
- };
-
- private final UpdateModelCommand updateActiveItemCommand = new UpdateModelCommand() {
-
- public void execute(FacesContext context) {
- if (localActiveItemSet) {
- ValueBinding vb = getValueBinding("activeItem");
- if (vb != null) {
- vb.setValue(context, localActiveItem);
- localActiveItem = null;
- localActiveItemSet = false;
- }
- }
- }
-
- };
-
- private void updateModel(FacesContext context, UpdateModelCommand command) {
- try {
- command.execute(context);
- } catch (EvaluationException e) {
- String messageStr = e.getMessage();
- FacesMessage message = null;
- if (null == messageStr) {
- message =
- MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
- }
- else {
- message = new FacesMessage(messageStr);
- }
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- context.addMessage(getClientId(context), message);
- setValid(false);
- }
- catch (FacesException e) {
- FacesMessage message =
- MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- context.addMessage(getClientId(context), message);
- setValid(false);
- } catch (IllegalArgumentException e) {
- FacesMessage message =
- MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- context.addMessage(getClientId(context), message);
- setValid(false);
- } catch (Exception e) {
- FacesMessage message =
- MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- context.addMessage(getClientId(context), message);
- setValid(false);
- }
- }
-
- /**
- * <p>Perform the following algorithm to update the model data
- * associated with this {@link UIInput}, if any, as appropriate.</p>
- * <ul>
- * <li>If the <code>valid</code> property of this component is
- * <code>false</code>, take no further action.</li>
- * <li>If the <code>localValueSet</code> property of this component is
- * <code>false</code>, take no further action.</li>
- * <li>If no {@link ValueBinding} for <code>value</code> exists,
- * take no further action.</li>
- * <li>Call <code>setValue()</code> method of the {@link ValueBinding}
- * to update the value that the {@link ValueBinding} points at.</li>
- * <li>If the <code>setValue()</code> method returns successfully:
- * <ul>
- * <li>Clear the local value of this {@link UIInput}.</li>
- * <li>Set the <code>localValueSet</code> property of this
- * {@link UIInput} to false.</li>
- * </ul></li>
- * <li>If the <code>setValue()</code> method call fails:
- * <ul>
- * <li>Enqueue an error message by calling <code>addMessage()</code>
- * on the specified {@link FacesContext} instance.</li>
- * <li>Set the <code>valid</code> property of this {@link UIInput}
- * to <code>false</code>.</li>
- * </ul></li>
- * </ul>
- *
- * @param context {@link FacesContext} for the request we are processing
- *
- * @exception NullPointerException if <code>context</code>
- * is <code>null</code>
- */
- public void updateModel(FacesContext context) {
-
- if (context == null) {
- throw new NullPointerException();
- }
-
- if (!isValid()) {
- return;
- }
-
- updateModel(context, updateValueCommand);
- updateModel(context, updateSelectionCommand);
- updateModel(context, updateActiveItemCommand);
- }
-
-
- // ------------------------------------------------------ Validation Methods
-
-
- /**
- * <p>Perform the following algorithm to validate the local value of
- * this {@link UIInput}.</p>
- * <ul>
- * <li>Retrieve the submitted value with <code>getSubmittedValue()</code>.
- * If this returns null, exit without further processing. (This
- * indicates that no value was submitted for this component.)</li>
- *
- * <li> Convert the submitted value into a "local value" of the
- * appropriate data type by calling {@link #getConvertedValue}.</li>
- *
- * <li>Validate the property by calling {@link #validateValue}.</li>
- *
- * <li>If the <code>valid</code> property of this component is still
- * <code>true</code>, retrieve the previous value of the component
- * (with <code>getValue()</code>), store the new local value using
- * <code>setValue()</code>, and reset the submitted value to
- * null. If the local value is different from
- * the previous value of this component, fire a
- * {@link ValueChangeEvent} to be broadcast to all interested
- * listeners.</li>
- * </ul>
- *
- * <p>Application components implementing {@link UIInput} that wish to
- * perform validation with logic embedded in the component should perform
- * their own correctness checks, and then call the
- * <code>super.validate()</code> method to perform the standard
- * processing described above.</p>
- *
- * @param context The {@link FacesContext} for the current request
- *
- * @exception NullPointerException if <code>context</code>
- * is null
- */
- public void validate(FacesContext context) {
-
- if (context == null) {
- throw new NullPointerException();
- }
-
- // Submitted value == null means "the component was not submitted
- // at all"; validation should not continue
- if (submittedValueHolder == null) {
- return;
- }
-
- Object newValue = null;
-
- try {
- newValue = getConvertedValue();
- }
- catch (ConverterException ce) {
- Object submittedValue = submittedValueHolder;
- addConversionErrorMessage(context, ce, submittedValue);
- setValid(false);
- }
-
- validateValue(context, newValue);
-
- // If our value is valid, store the new value, erase the
- // "submitted" value, and emit a ValueChangeEvent if appropriate
- if (isValid()) {
- Set selectionSet = new HashSet();
- ExtendedDataModel dataModel = getExtendedDataModel();
- Set selectedItems = submittedValueHolder.selectedItems;
- for (Iterator iterator = selectedItems.iterator(); iterator
- .hasNext();) {
- dataModel.setRowKey(iterator.next());
- Object selectionItem = dataModel.getRowData();
-
- selectionSet.add(selectionItem);
- }
-
- setSelection(selectionSet);
-
- if (submittedValueHolder.activeItem != null) {
- dataModel.setRowKey(submittedValueHolder.activeItem);
- Object activeItem = dataModel.getRowData();
-
- setActiveItem(activeItem);
- } else {
- setActiveItem(null);
- }
-
- Object previous = getValue();
- setValue(newValue);
- setTranslatedState();
- //setSubmittedValue(null);
- if (compareValues(previous, newValue)) {
- queueEvent(new ValueChangeEvent(this, previous, newValue));
- }
-
- this.submittedValueHolder = null;
- }
- }
-
- protected Object getConvertedValue() throws ConverterException {
- Object convertedValue = getValue();
- if (convertedValue == null) {
- convertedValue = Collections.EMPTY_LIST;
- }
-
- if (submittedValueHolder != null) {
- Object savedValue = convertedValue;
-
- int[] indexes = submittedValueHolder.permutationOrder;
-
- if (savedValue instanceof List) {
- List list = (List) savedValue;
- ArrayList arrayList = new ArrayList(list.size());
- for (int i = 0; i < indexes.length; i++) {
- int j = indexes[i];
- arrayList.add(list.get(j));
- }
- convertedValue = arrayList;
- } else {
- Object[] savedValueArray = (Object[]) savedValue;
- Object[] convertedValueArray = (Object[]) Array.newInstance(savedValue.getClass().getComponentType(),
- Array.getLength(savedValue));
-
- convertedValue = convertedValueArray;
-
- for (int i = 0; i < indexes.length; i++) {
- convertedValueArray[i] = savedValueArray[indexes[i]];
- }
- }
-
- //submittedValueHolder.newValue = convertedValue;
- }
-
- return convertedValue;
- }
-
- @Override
- protected void resetDataModel() {
- super.resetDataModel();
-
- if (this.submittedValueHolder != null) {
- setTranslatedRenderingState();
- }
- }
-
- /**
- *
- * <p>Set the "valid" property according to the below algorithm.</p>
- *
- * <ul>
- *
- * <li>If the <code>valid</code> property on this component is still
- * <code>true</code>, and the <code>required</code> property is also
- * true, ensure that the local value is not empty (where "empty" is
- * defined as <code>null</code> or a zero-length String. If the local
- * value is empty:
- * <ul>
- * <li>Enqueue an appropriate error message by calling the
- * <code>addMessage()</code> method on the <code>FacesContext</code>
- * instance for the current request.</li>
- * <li>Set the <code>valid</code> property on this component to
- * <code>false</code>.</li>
- * </ul></li>
- * <li>If the <code>valid</code> property on this component is still
- * <code>true</code>, and the local value is not empty, call the
- * <code>validate()</code> method of each {@link Validator}
- * registered for this {@link UIInput}, followed by the method
- * pointed at by the <code>validatorBinding</code> property (if any).
- * If any of these validators or the method throws a
- * {@link ValidatorException}, catch the exception, add
- * its message (if any) to the {@link FacesContext}, and set
- * the <code>valid</code> property of this component to false.</li>
- *
- * </ul>
- *
- */
-
- protected void validateValue(FacesContext context, Object newValue) {
- // If our value is valid, enforce the required property if present
- if (isValid() && isRequired() && isEmpty(newValue)) {
- FacesMessage message =
- MessageFactory.getMessage(context, UIInput.REQUIRED_MESSAGE_ID);
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- context.addMessage(getClientId(context), message);
- setValid(false);
- }
-
- // If our value is valid and not empty, call all validators
- if (isValid() && !isEmpty(newValue)) {
- Validator[] validators = getValidators();
- for (int i = 0; i < validators.length; i++) {
- Validator validator = (Validator) validators[i];
- try {
- validator.validate(context, this, newValue);
- }
- catch (ValidatorException ve) {
- // If the validator throws an exception, we're
- // invalid, and we need to add a message
- setValid(false);
- FacesMessage message = ve.getFacesMessage();
- if (message != null) {
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- context.addMessage(getClientId(context), message);
- }
- }
- }
-
- MethodBinding validator = getValidator();
- if (validator != null) {
- try {
- validator.invoke(context,
- new Object[] { context, this, newValue});
- }
- catch (EvaluationException ee) {
- if (ee.getCause() instanceof ValidatorException) {
- ValidatorException ve =
- (ValidatorException) ee.getCause();
-
- // If the validator throws an exception, we're
- // invalid, and we need to add a message
- setValid(false);
- FacesMessage message = ve.getFacesMessage();
- if (message != null) {
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- context.addMessage(getClientId(context), message);
- }
- } else {
- // Otherwise, rethrow the EvaluationException
- throw ee;
- }
- }
- }
- }
- }
-
-
-
- /**
- * <p>Return <code>true</code> if the new value is different from the
- * previous value.</p>
- *
- * @param previous old value of this component (if any)
- * @param value new value of this component (if any)
- */
- protected boolean compareValues(Object previous, Object value) {
-
- if (previous == null) {
- return (value != null);
- } else if (value == null) {
- return (true);
- } else {
- if (previous instanceof Object[]) {
- return !Arrays.equals((Object[]) previous, (Object[]) value);
- } else {
- return (!(previous.equals(value)));
- }
- }
-
- }
-
-
- /**
- * Executes validation logic.
- */
- private void executeValidate(FacesContext context) {
- try {
- validate(context);
- } catch (RuntimeException e) {
- context.renderResponse();
- throw e;
- }
-
- if (!isValid()) {
- context.renderResponse();
- }
- }
-
- private boolean isEmpty(Object value) {
-
- if (value == null) {
- return (true);
- } else if ((value instanceof String) &&
- (((String) value).length() < 1)) {
- return (true);
- } else if (value.getClass().isArray()) {
- if (0 == java.lang.reflect.Array.getLength(value)) {
- return (true);
- }
- }
- else if (value instanceof List) {
- if (0 == ((List) value).size()) {
- return (true);
- }
- }
- return (false);
- }
-
- public Object getTranslatedRowKey() {
- return ((TranslatedSequenceDataModel) getExtendedDataModel()).getTranslatedRowKey();
- }
-
- private void addConversionErrorMessage(FacesContext context,
- ConverterException ce, Object value) {
- FacesMessage message = ce.getFacesMessage();
- if (message == null) {
- message = MessageFactory.getMessage(context,
- UIInput.CONVERSION_MESSAGE_ID);
- if (message.getDetail() == null) {
- message.setDetail(ce.getMessage());
- }
- }
-
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- context.addMessage(getClientId(context), message);
- }
-
- public String getElementsOrder() {
- Object order = null;
-
- if (isTranslatedRenderingState()) {
- if (this.submittedValueHolder != null) {
- order = this.submittedValueHolder.permutationOrder;
- }
- }
-
- return ScriptUtils.toScript(order);
- }
-
- public int getModelSize() {
- return getExtendedDataModel().getRowCount();
- }
-
- public ItemState getItemState() {
- if (submittedValueHolder != null) {
- return new SubmittedItemState(submittedValueHolder.selectedItems, submittedValueHolder.activeItem);
- } else {
- return new CommonItemState(getSelection(), getActiveItem());
- }
- }
-
- public Collection getSelection() {
- if (this.localSelection != null) {
- return this.localSelection;
- } else {
- ValueBinding vb = getValueBinding("selection");
- if (vb != null) {
- return (Collection) vb.getValue(FacesContext.getCurrentInstance());
- }
- }
-
- return null;
- }
-
- public void setSelection(Collection collection) {
- this.localSelection = collection;
- this.localSelectionSet = true;
- }
-
- public Object getActiveItem() {
- if (this.localActiveItem != null) {
- return this.localActiveItem;
- } else {
- ValueBinding vb = getValueBinding("activeItem");
- if (vb != null) {
- return vb.getValue(FacesContext.getCurrentInstance());
- }
- }
-
- return null;
- }
-
- public void setActiveItem(Object activeItem) {
- this.localActiveItem = activeItem;
- this.localActiveItemSet = true;
- }
-
- public abstract boolean isOrderControlsVisible();
- public abstract void setOrderControlsVisible(boolean visible);
-
- public abstract boolean isFastOrderControlsVisible();
- public abstract void setFastOrderControlsVisible(boolean visible);
-
- public abstract String getControlsType();
- public abstract void setControlsType(String type);
-
- public abstract int getListWidth();
-
- public abstract void setListWidth(int listWidth);
-
- public abstract int getListHeight();
-
- public abstract void setListHeight(int listHeight);
-}
Copied: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java (from rev 4061, trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java)
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,1012 @@
+package org.richfaces.component;
+
+import java.io.IOException;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.faces.FacesException;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.ValueBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.event.ValueChangeListener;
+import javax.faces.model.ArrayDataModel;
+import javax.faces.model.DataModel;
+import javax.faces.model.ListDataModel;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+import org.ajax4jsf.javascript.ScriptUtils;
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+
+public abstract class UIOrderingList extends UIOrderingBaseComponent {
+
+ public static final class ValueHolder {
+ private Collection selection;
+ private boolean selectionSet;
+
+ private Object activeItem;
+ private boolean activeItemSet;
+ }
+
+ public static final class SubmittedValue {
+ private int[] permutationOrder;
+ private Set selectedItems = new HashSet();
+ private Integer activeItem;
+
+ public SubmittedValue(String submittedString) {
+ super();
+ fromString(submittedString);
+ }
+
+ private void fromString(String string) {
+ String[] valueOrder = string.split(",");
+ permutationOrder = new int[valueOrder.length];
+ for (int i = 0; i < valueOrder.length; i++) {
+ Matcher matcher = Pattern.compile("(\\d+)(s?a?)").matcher(valueOrder[i]);
+ matcher.matches();
+
+ try {
+ permutationOrder[i] = Integer.valueOf(matcher.group(1)).intValue();
+ String group = matcher.group(2);
+ for (int j = 0; j < group.length(); j++) {
+ char c = group.charAt(j);
+ if ('s' == c) {
+ selectedItems.add(new Integer(permutationOrder[i]));
+ } else if ('a' == c) {
+ activeItem = new Integer(permutationOrder[i]);
+ } else {
+ break ;
+ }
+
+ }
+ } catch (NumberFormatException e) {
+ // TODO: handle exception
+ }
+ }
+ }
+
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+ for (int i = 0; i < permutationOrder.length; i++) {
+ result.append(permutationOrder[i]);
+
+ Integer key = new Integer(i);
+
+ if (selectedItems.contains(key)) {
+ result.append('s');
+ }
+
+ if (key.equals(activeItem)) {
+ result.append('a');
+ }
+
+ if (i < permutationOrder.length - 1) {
+ result.append(',');
+ }
+ }
+ return result.toString();
+ }
+
+ public int[] getPermutationOrder() {
+ return permutationOrder;
+ }
+
+ }
+
+ public interface ItemState {
+ public boolean isSelected();
+ public boolean isActive();
+ }
+
+ private final class SubmittedItemState implements ItemState {
+ private Collection selectedItemsKeys;
+ private Object activeItemKey;
+
+ public SubmittedItemState(Collection selectedItemsKeys, Integer activeItemKey) {
+ super();
+ this.selectedItemsKeys = selectedItemsKeys;
+ this.activeItemKey = activeItemKey;
+ }
+
+ public boolean isActive() {
+ return activeItemKey != null && activeItemKey.equals(getTranslatedRowKey());
+ }
+
+ public boolean isSelected() {
+ return selectedItemsKeys != null && selectedItemsKeys.contains(getTranslatedRowKey());
+ }
+ }
+
+ private final class CommonItemState implements ItemState {
+ private Collection selectedItems;
+ private Object activeItem;
+
+ public CommonItemState(Collection selectedItems, Object activeItem) {
+ super();
+ this.selectedItems = selectedItems;
+ this.activeItem = activeItem;
+ }
+
+ public boolean isSelected() {
+ return selectedItems != null && selectedItems.contains(getRowData());
+ }
+
+ public boolean isActive() {
+ return activeItem != null && activeItem.equals(getRowData());
+ }
+ }
+
+ protected ExtendedDataModel createDataModel() {
+ DataModel dataModel;
+ Object current = getValue();
+ if (current == null) {
+ dataModel = new ListDataModel(Collections.EMPTY_LIST);
+ } else if (current instanceof List) {
+ dataModel = new ListDataModel((List) current);
+ } else if (Object[].class.isAssignableFrom(current.getClass())) {
+ dataModel = new ArrayDataModel((Object[]) current);
+ } else {
+ throw new IllegalArgumentException();
+ }
+
+ if (isTranslatedRenderingState() || isTranslatedState()) {
+ return new TranslatedSequenceDataModel(dataModel, isTranslatedState(), submittedValueHolder != null ? submittedValueHolder.permutationOrder : null);
+ } else {
+ return new TranslatedSequenceDataModel(dataModel, false, null);
+ }
+ }
+
+
+ private Collection localSelection;
+ private boolean localSelectionSet;
+
+ private Object localActiveItem;
+ private boolean localActiveItemSet;
+
+ private transient SubmittedValue submittedValueHolder = null;
+
+ private void convertState(FacesContext faces) {
+ final HashSet selectionItemsSet = new HashSet();
+ final ExtendedDataModel dataModel = getExtendedDataModel();
+ try {
+ dataModel.walk(faces, new DataVisitor() {
+
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ dataModel.setRowKey(rowKey);
+
+ if (localSelection != null && localSelection.contains(rowKey)) {
+ selectionItemsSet.add(getRowData());
+ }
+
+ if (rowKey.equals(localActiveItem)) {
+ localActiveItem = getRowData();
+ }
+ }
+
+ }, null, null);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ if (this.localSelection != null) {
+ this.localSelection = selectionItemsSet;
+ }
+ }
+
+ public void restoreState(FacesContext faces, Object object) {
+ final Object[] state = (Object[]) object;
+ super.restoreState(faces, state[0]);
+
+ localSelectionSet = ((Boolean) state[3]).booleanValue();
+ localActiveItemSet = ((Boolean) state[4]).booleanValue();
+
+ localSelection = (Collection) state[5];
+ localActiveItem = state[6];
+ }
+
+ public Object saveState(FacesContext faces) {
+ Object[] state = new Object[7];
+ state[0] = super.saveState(faces);
+
+ state[3] = localSelectionSet ? Boolean.TRUE : Boolean.FALSE;
+ state[4] = localActiveItemSet ? Boolean.TRUE : Boolean.FALSE;
+
+ final HashSet selectionKeySet = new HashSet();
+ final HashSet activeItemSet = new HashSet(1);
+
+ final ExtendedDataModel dataModel = getExtendedDataModel();
+ try {
+ dataModel.walk(faces, new DataVisitor() {
+
+ public void process(FacesContext context, Object rowKey,
+ Object argument) throws IOException {
+
+ dataModel.setRowKey(rowKey);
+ Object data = dataModel.getRowData();
+ if (data.equals(localActiveItem)) {
+ activeItemSet.add(getTranslatedRowKey());
+ }
+
+ if (localSelection != null && localSelection.contains(data)) {
+ selectionKeySet.add(getTranslatedRowKey());
+ }
+
+ }
+
+ }, null, null);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ state[5] = selectionKeySet;
+
+ state[6] = activeItemSet.isEmpty() ? null : activeItemSet.iterator().next();
+
+ return state;
+ }
+
+ public void addValueChangeListener(ValueChangeListener listener) {
+ addFacesListener(listener);
+ }
+
+
+ public abstract MethodBinding getValueChangeListener();
+
+ public ValueChangeListener[] getValueChangeListeners() {
+ return (ValueChangeListener[]) getFacesListeners(ValueChangeListener.class);
+ }
+
+ public abstract boolean isImmediate();
+
+ public abstract boolean isRequired();
+
+ public abstract boolean isValid();
+
+
+ public void removeValueChangeListener(ValueChangeListener listener) {
+ removeFacesListener(listener);
+ }
+
+
+ public String getSubmittedString() {
+ return submittedValueHolder != null ? submittedValueHolder.toString() : "";
+ }
+
+ public void setSubmittedString(String submittedString) {
+ this.submittedValueHolder = new SubmittedValue(submittedString);
+ }
+
+ protected Object saveIterationSubmittedState() {
+ return submittedValueHolder;
+ }
+
+ protected void restoreIterationSubmittedState(Object object) {
+ this.submittedValueHolder = (SubmittedValue) object;
+ }
+
+ protected Object saveIterationState() {
+ ValueHolder holder = new ValueHolder();
+
+ holder.selection = localSelection;
+ holder.selectionSet = localSelectionSet;
+
+ holder.activeItem = localActiveItem;
+ holder.activeItemSet = localActiveItemSet;
+
+ return holder;
+ }
+
+ protected void restoreIterationState(Object object) {
+ ValueHolder holder = (ValueHolder) object;
+
+ this.localSelection = holder.selection;
+ this.localSelectionSet = holder.selectionSet;
+
+ this.localActiveItem = holder.activeItem;
+ this.localActiveItemSet = holder.activeItemSet;
+ }
+
+ public abstract void setImmediate(boolean immediate);
+
+ public abstract void setRequired(boolean required);
+
+ public abstract void setValid(boolean valid);
+
+ public abstract void setValueChangeListener(MethodBinding valueChangeMethod);
+
+ public abstract Converter getConverter();
+
+ public abstract void setConverter(Converter converter);
+
+ /**
+ * <p>Specialized decode behavior on top of that provided by the
+ * superclass. In addition to the standard
+ * <code>processDecodes</code> behavior inherited from {@link
+ * UIComponentBase}, calls <code>validate()</code> if the the
+ * <code>immediate</code> property is true; if the component is
+ * invalid afterwards or a <code>RuntimeException</code> is thrown,
+ * calls {@link FacesContext#renderResponse}. </p>
+ * @exception NullPointerException {@inheritDoc}
+ */
+ public void processDecodes(FacesContext context) {
+
+ convertState(context);
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Skip processing if our rendered flag is false
+ if (!isRendered()) {
+ return;
+ }
+
+ super.processDecodes(context);
+
+ if (isImmediate()) {
+ executeValidate(context);
+ }
+ }
+
+ /**
+ * <p>In addition to the standard <code>processValidators</code> behavior
+ * inherited from {@link UIComponentBase}, calls <code>validate()</code>
+ * if the <code>immediate</code> property is false (which is the
+ * default); if the component is invalid afterwards, calls
+ * {@link FacesContext#renderResponse}.
+ * If a <code>RuntimeException</code> is thrown during
+ * validation processing, calls {@link FacesContext#renderResponse}
+ * and re-throw the exception.
+ * </p>
+ * @exception NullPointerException {@inheritDoc}
+ */
+ public void processValidators(FacesContext context) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Skip processing if our rendered flag is false
+ if (!isRendered()) {
+ return;
+ }
+
+ super.processValidators(context);
+ if (!isImmediate()) {
+ executeValidate(context);
+ }
+ }
+
+ /**
+ * <p>In addition to the standard <code>processUpdates</code> behavior
+ * inherited from {@link UIComponentBase}, calls
+ * <code>updateModel()</code>.
+ * If the component is invalid afterwards, calls
+ * {@link FacesContext#renderResponse}.
+ * If a <code>RuntimeException</code> is thrown during
+ * update processing, calls {@link FacesContext#renderResponse}
+ * and re-throw the exception.
+ * </p>
+ * @exception NullPointerException {@inheritDoc}
+ */
+ public void processUpdates(FacesContext context) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Skip processing if our rendered flag is false
+ if (!isRendered()) {
+ return;
+ }
+
+ super.processUpdates(context);
+
+ try {
+ updateModel(context);
+ } catch (RuntimeException e) {
+ context.renderResponse();
+ throw e;
+ }
+
+ if (!isValid()) {
+ context.renderResponse();
+ }
+ }
+
+ /**
+ * @exception NullPointerException {@inheritDoc}
+ */
+ public void decode(FacesContext context) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Force validity back to "true"
+ setValid(true);
+ super.decode(context);
+ }
+
+ /**
+ * <p>In addition to to the default {@link UIComponent#broadcast}
+ * processing, pass the {@link ValueChangeEvent} being broadcast to the
+ * method referenced by <code>valueChangeListener</code> (if any).</p>
+ *
+ * @param event {@link FacesEvent} to be broadcast
+ *
+ * @exception AbortProcessingException Signal the JavaServer Faces
+ * implementation that no further processing on the current event
+ * should be performed
+ * @exception IllegalArgumentException if the implementation class
+ * of this {@link FacesEvent} is not supported by this component
+ * @exception NullPointerException if <code>event</code> is
+ * <code>null</code>
+ */
+ public void broadcast(FacesEvent event)
+ throws AbortProcessingException {
+
+ // Perform standard superclass processing
+ super.broadcast(event);
+
+ if (event instanceof ValueChangeEvent) {
+ MethodBinding method = getValueChangeListener();
+ if (method != null) {
+ FacesContext context = getFacesContext();
+ method.invoke(context, new Object[] { event });
+ }
+ }
+
+ }
+
+ private interface UpdateModelCommand {
+ public void execute(FacesContext context);
+ }
+
+ private final UpdateModelCommand updateValueCommand = new UpdateModelCommand() {
+
+ public void execute(FacesContext context) {
+ if (isLocalValueSet()) {
+ ValueBinding vb = getValueBinding("value");
+ if (vb != null) {
+ vb.setValue(context, getLocalValueFieldValue());
+ setValue(null);
+ setLocalValueSet(false);
+ }
+ }
+ }
+
+ };
+
+ private final UpdateModelCommand updateSelectionCommand = new UpdateModelCommand() {
+
+ public void execute(FacesContext context) {
+ if (localSelectionSet) {
+ ValueBinding vb = getValueBinding("selection");
+ if (vb != null) {
+ vb.setValue(context, localSelection);
+ localSelection = null;
+ localSelectionSet = false;
+ }
+ }
+ }
+
+ };
+
+ private final UpdateModelCommand updateActiveItemCommand = new UpdateModelCommand() {
+
+ public void execute(FacesContext context) {
+ if (localActiveItemSet) {
+ ValueBinding vb = getValueBinding("activeItem");
+ if (vb != null) {
+ vb.setValue(context, localActiveItem);
+ localActiveItem = null;
+ localActiveItemSet = false;
+ }
+ }
+ }
+
+ };
+
+ private void updateModel(FacesContext context, UpdateModelCommand command) {
+ try {
+ command.execute(context);
+ } catch (EvaluationException e) {
+ String messageStr = e.getMessage();
+ FacesMessage message = null;
+ if (null == messageStr) {
+ message =
+ MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
+ }
+ else {
+ message = new FacesMessage(messageStr);
+ }
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ setValid(false);
+ }
+ catch (FacesException e) {
+ FacesMessage message =
+ MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ setValid(false);
+ } catch (IllegalArgumentException e) {
+ FacesMessage message =
+ MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ setValid(false);
+ } catch (Exception e) {
+ FacesMessage message =
+ MessageFactory.getMessage(context, UIInput.CONVERSION_MESSAGE_ID);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ setValid(false);
+ }
+ }
+
+ /**
+ * <p>Perform the following algorithm to update the model data
+ * associated with this {@link UIInput}, if any, as appropriate.</p>
+ * <ul>
+ * <li>If the <code>valid</code> property of this component is
+ * <code>false</code>, take no further action.</li>
+ * <li>If the <code>localValueSet</code> property of this component is
+ * <code>false</code>, take no further action.</li>
+ * <li>If no {@link ValueBinding} for <code>value</code> exists,
+ * take no further action.</li>
+ * <li>Call <code>setValue()</code> method of the {@link ValueBinding}
+ * to update the value that the {@link ValueBinding} points at.</li>
+ * <li>If the <code>setValue()</code> method returns successfully:
+ * <ul>
+ * <li>Clear the local value of this {@link UIInput}.</li>
+ * <li>Set the <code>localValueSet</code> property of this
+ * {@link UIInput} to false.</li>
+ * </ul></li>
+ * <li>If the <code>setValue()</code> method call fails:
+ * <ul>
+ * <li>Enqueue an error message by calling <code>addMessage()</code>
+ * on the specified {@link FacesContext} instance.</li>
+ * <li>Set the <code>valid</code> property of this {@link UIInput}
+ * to <code>false</code>.</li>
+ * </ul></li>
+ * </ul>
+ *
+ * @param context {@link FacesContext} for the request we are processing
+ *
+ * @exception NullPointerException if <code>context</code>
+ * is <code>null</code>
+ */
+ public void updateModel(FacesContext context) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ if (!isValid()) {
+ return;
+ }
+
+ updateModel(context, updateValueCommand);
+ updateModel(context, updateSelectionCommand);
+ updateModel(context, updateActiveItemCommand);
+ }
+
+
+ // ------------------------------------------------------ Validation Methods
+
+
+ /**
+ * <p>Perform the following algorithm to validate the local value of
+ * this {@link UIInput}.</p>
+ * <ul>
+ * <li>Retrieve the submitted value with <code>getSubmittedValue()</code>.
+ * If this returns null, exit without further processing. (This
+ * indicates that no value was submitted for this component.)</li>
+ *
+ * <li> Convert the submitted value into a "local value" of the
+ * appropriate data type by calling {@link #getConvertedValue}.</li>
+ *
+ * <li>Validate the property by calling {@link #validateValue}.</li>
+ *
+ * <li>If the <code>valid</code> property of this component is still
+ * <code>true</code>, retrieve the previous value of the component
+ * (with <code>getValue()</code>), store the new local value using
+ * <code>setValue()</code>, and reset the submitted value to
+ * null. If the local value is different from
+ * the previous value of this component, fire a
+ * {@link ValueChangeEvent} to be broadcast to all interested
+ * listeners.</li>
+ * </ul>
+ *
+ * <p>Application components implementing {@link UIInput} that wish to
+ * perform validation with logic embedded in the component should perform
+ * their own correctness checks, and then call the
+ * <code>super.validate()</code> method to perform the standard
+ * processing described above.</p>
+ *
+ * @param context The {@link FacesContext} for the current request
+ *
+ * @exception NullPointerException if <code>context</code>
+ * is null
+ */
+ public void validate(FacesContext context) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Submitted value == null means "the component was not submitted
+ // at all"; validation should not continue
+ if (submittedValueHolder == null) {
+ return;
+ }
+
+ Object newValue = null;
+
+ try {
+ newValue = getConvertedValue();
+ }
+ catch (ConverterException ce) {
+ Object submittedValue = submittedValueHolder;
+ addConversionErrorMessage(context, ce, submittedValue);
+ setValid(false);
+ }
+
+ validateValue(context, newValue);
+
+ // If our value is valid, store the new value, erase the
+ // "submitted" value, and emit a ValueChangeEvent if appropriate
+ if (isValid()) {
+ Set selectionSet = new HashSet();
+ ExtendedDataModel dataModel = getExtendedDataModel();
+ Set selectedItems = submittedValueHolder.selectedItems;
+ for (Iterator iterator = selectedItems.iterator(); iterator
+ .hasNext();) {
+ dataModel.setRowKey(iterator.next());
+ Object selectionItem = dataModel.getRowData();
+
+ selectionSet.add(selectionItem);
+ }
+
+ setSelection(selectionSet);
+
+ if (submittedValueHolder.activeItem != null) {
+ dataModel.setRowKey(submittedValueHolder.activeItem);
+ Object activeItem = dataModel.getRowData();
+
+ setActiveItem(activeItem);
+ } else {
+ setActiveItem(null);
+ }
+
+ Object previous = getValue();
+ setValue(newValue);
+ setTranslatedState();
+ //setSubmittedValue(null);
+ if (compareValues(previous, newValue)) {
+ queueEvent(new ValueChangeEvent(this, previous, newValue));
+ }
+
+ this.submittedValueHolder = null;
+ }
+ }
+
+ protected Object getConvertedValue() throws ConverterException {
+ Object convertedValue = getValue();
+ if (convertedValue == null) {
+ convertedValue = Collections.EMPTY_LIST;
+ }
+
+ if (submittedValueHolder != null) {
+ Object savedValue = convertedValue;
+
+ int[] indexes = submittedValueHolder.permutationOrder;
+
+ if (savedValue instanceof List) {
+ List list = (List) savedValue;
+ ArrayList arrayList = new ArrayList(list.size());
+ for (int i = 0; i < indexes.length; i++) {
+ int j = indexes[i];
+ arrayList.add(list.get(j));
+ }
+ convertedValue = arrayList;
+ } else {
+ Object[] savedValueArray = (Object[]) savedValue;
+ Object[] convertedValueArray = (Object[]) Array.newInstance(savedValue.getClass().getComponentType(),
+ Array.getLength(savedValue));
+
+ convertedValue = convertedValueArray;
+
+ for (int i = 0; i < indexes.length; i++) {
+ convertedValueArray[i] = savedValueArray[indexes[i]];
+ }
+ }
+
+ //submittedValueHolder.newValue = convertedValue;
+ }
+
+ return convertedValue;
+ }
+
+ protected void resetDataModel() {
+ super.resetDataModel();
+
+ if (this.submittedValueHolder != null) {
+ setTranslatedRenderingState();
+ }
+ }
+
+ /**
+ *
+ * <p>Set the "valid" property according to the below algorithm.</p>
+ *
+ * <ul>
+ *
+ * <li>If the <code>valid</code> property on this component is still
+ * <code>true</code>, and the <code>required</code> property is also
+ * true, ensure that the local value is not empty (where "empty" is
+ * defined as <code>null</code> or a zero-length String. If the local
+ * value is empty:
+ * <ul>
+ * <li>Enqueue an appropriate error message by calling the
+ * <code>addMessage()</code> method on the <code>FacesContext</code>
+ * instance for the current request.</li>
+ * <li>Set the <code>valid</code> property on this component to
+ * <code>false</code>.</li>
+ * </ul></li>
+ * <li>If the <code>valid</code> property on this component is still
+ * <code>true</code>, and the local value is not empty, call the
+ * <code>validate()</code> method of each {@link Validator}
+ * registered for this {@link UIInput}, followed by the method
+ * pointed at by the <code>validatorBinding</code> property (if any).
+ * If any of these validators or the method throws a
+ * {@link ValidatorException}, catch the exception, add
+ * its message (if any) to the {@link FacesContext}, and set
+ * the <code>valid</code> property of this component to false.</li>
+ *
+ * </ul>
+ *
+ */
+
+ protected void validateValue(FacesContext context, Object newValue) {
+ // If our value is valid, enforce the required property if present
+ if (isValid() && isRequired() && isEmpty(newValue)) {
+ FacesMessage message =
+ MessageFactory.getMessage(context, UIInput.REQUIRED_MESSAGE_ID);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ setValid(false);
+ }
+
+ // If our value is valid and not empty, call all validators
+ if (isValid() && !isEmpty(newValue)) {
+ Validator[] validators = getValidators();
+ for (int i = 0; i < validators.length; i++) {
+ Validator validator = (Validator) validators[i];
+ try {
+ validator.validate(context, this, newValue);
+ }
+ catch (ValidatorException ve) {
+ // If the validator throws an exception, we're
+ // invalid, and we need to add a message
+ setValid(false);
+ FacesMessage message = ve.getFacesMessage();
+ if (message != null) {
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ }
+ }
+ }
+
+ MethodBinding validator = getValidator();
+ if (validator != null) {
+ try {
+ validator.invoke(context,
+ new Object[] { context, this, newValue});
+ }
+ catch (EvaluationException ee) {
+ if (ee.getCause() instanceof ValidatorException) {
+ ValidatorException ve =
+ (ValidatorException) ee.getCause();
+
+ // If the validator throws an exception, we're
+ // invalid, and we need to add a message
+ setValid(false);
+ FacesMessage message = ve.getFacesMessage();
+ if (message != null) {
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ }
+ } else {
+ // Otherwise, rethrow the EvaluationException
+ throw ee;
+ }
+ }
+ }
+ }
+ }
+
+
+
+ /**
+ * <p>Return <code>true</code> if the new value is different from the
+ * previous value.</p>
+ *
+ * @param previous old value of this component (if any)
+ * @param value new value of this component (if any)
+ */
+ protected boolean compareValues(Object previous, Object value) {
+
+ if (previous == null) {
+ return (value != null);
+ } else if (value == null) {
+ return (true);
+ } else {
+ if (previous instanceof Object[]) {
+ return !Arrays.equals((Object[]) previous, (Object[]) value);
+ } else {
+ return (!(previous.equals(value)));
+ }
+ }
+
+ }
+
+
+ /**
+ * Executes validation logic.
+ */
+ private void executeValidate(FacesContext context) {
+ try {
+ validate(context);
+ } catch (RuntimeException e) {
+ context.renderResponse();
+ throw e;
+ }
+
+ if (!isValid()) {
+ context.renderResponse();
+ }
+ }
+
+ private boolean isEmpty(Object value) {
+
+ if (value == null) {
+ return (true);
+ } else if ((value instanceof String) &&
+ (((String) value).length() < 1)) {
+ return (true);
+ } else if (value.getClass().isArray()) {
+ if (0 == java.lang.reflect.Array.getLength(value)) {
+ return (true);
+ }
+ }
+ else if (value instanceof List) {
+ if (0 == ((List) value).size()) {
+ return (true);
+ }
+ }
+ return (false);
+ }
+
+ public Object getTranslatedRowKey() {
+ return ((TranslatedSequenceDataModel) getExtendedDataModel()).getTranslatedRowKey();
+ }
+
+ private void addConversionErrorMessage(FacesContext context,
+ ConverterException ce, Object value) {
+ FacesMessage message = ce.getFacesMessage();
+ if (message == null) {
+ message = MessageFactory.getMessage(context,
+ UIInput.CONVERSION_MESSAGE_ID);
+ if (message.getDetail() == null) {
+ message.setDetail(ce.getMessage());
+ }
+ }
+
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ }
+
+ public String getElementsOrder() {
+ Object order = null;
+
+ if (isTranslatedRenderingState()) {
+ if (this.submittedValueHolder != null) {
+ order = this.submittedValueHolder.permutationOrder;
+ }
+ }
+
+ return ScriptUtils.toScript(order);
+ }
+
+ public int getModelSize() {
+ return getExtendedDataModel().getRowCount();
+ }
+
+ public ItemState getItemState() {
+ if (submittedValueHolder != null) {
+ return new SubmittedItemState(submittedValueHolder.selectedItems, submittedValueHolder.activeItem);
+ } else {
+ return new CommonItemState(getSelection(), getActiveItem());
+ }
+ }
+
+ public Collection getSelection() {
+ if (this.localSelection != null) {
+ return this.localSelection;
+ } else {
+ ValueBinding vb = getValueBinding("selection");
+ if (vb != null) {
+ return (Collection) vb.getValue(FacesContext.getCurrentInstance());
+ }
+ }
+
+ return null;
+ }
+
+ public void setSelection(Collection collection) {
+ this.localSelection = collection;
+ this.localSelectionSet = true;
+ }
+
+ public Object getActiveItem() {
+ if (this.localActiveItem != null) {
+ return this.localActiveItem;
+ } else {
+ ValueBinding vb = getValueBinding("activeItem");
+ if (vb != null) {
+ return vb.getValue(FacesContext.getCurrentInstance());
+ }
+ }
+
+ return null;
+ }
+
+ public void setActiveItem(Object activeItem) {
+ this.localActiveItem = activeItem;
+ this.localActiveItemSet = true;
+ }
+
+ public abstract boolean isOrderControlsVisible();
+ public abstract void setOrderControlsVisible(boolean visible);
+
+ public abstract boolean isFastOrderControlsVisible();
+ public abstract void setFastOrderControlsVisible(boolean visible);
+
+ public abstract String getControlsType();
+ public abstract void setControlsType(String type);
+
+ public abstract int getListWidth();
+
+ public abstract void setListWidth(int listWidth);
+
+ public abstract int getListHeight();
+
+ public abstract void setListHeight(int listHeight);
+}
Deleted: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,650 +0,0 @@
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import javax.faces.component.UIColumn;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.UIOrderingList;
-import org.richfaces.component.UIOrderingList.ItemState;
-import org.richfaces.renderkit.html.images.OrderingListIconBottom;
-import org.richfaces.renderkit.html.images.OrderingListIconBottomDisabled;
-import org.richfaces.renderkit.html.images.OrderingListIconDown;
-import org.richfaces.renderkit.html.images.OrderingListIconDownDisabled;
-import org.richfaces.renderkit.html.images.OrderingListIconTop;
-import org.richfaces.renderkit.html.images.OrderingListIconTopDisabled;
-import org.richfaces.renderkit.html.images.OrderingListIconUp;
-import org.richfaces.renderkit.html.images.OrderingListIconUpDisabled;
-
-public abstract class OrderingListRendererBase extends AbstractRowsRenderer {
-
- private static final String MESSAGE_BUNDLE_NAME = OrderingListRendererBase.class.getPackage().getName() + "OrderingList";
-
- private final static Character ACTIVITY_MARKER = 'a';
-
- private final static Character SELECTION_MARKER = 's';
-
- private final static String ITEM_SEPARATOR = ",";
-
- private final static String FACET_TOP = "topControl";
-
- private final static String FACET_BOTTOM = "bottomControl";
-
- private final static String FACET_UP = "upControl";
-
- private final static String FACET_DOWN = "downControl";
-
- private final static String FACET_DIS_TOP = "topControlDisabled";
-
- private final static String FACET_DIS_BOTTOM = "bottomControlDisabled";
-
- private final static String FACET_DIS_UP = "upControlDisabled";
-
- private final static String FACET_DIS_DOWN = "downControlDisabled";
-
- private final static String FACET_CAPTION = "caption";
-
- private final static String CONTROL_TYPE_LINK = "link";
-
- private final static String CONTROL_TYPE_BUTTON = "button";
-
- private final static String CONTROL_TYPE_NONE = "none";
-
- private final static String ATTRIBUTE_LABEL = "label";
-
- private final static String ATTRIBUTE_CONTROLS_TYPE = "controlsType";
-
- private final static String ATTRIBUTE_CE_ONORDERCHANGED = "onorderchanged";
-
- private final static String ATTRIBUTE_CE_ONTOPCLICK = "ontopclick";
-
- private final static String ATTRIBUTE_CE_ONDOWNCLICK = "ondownclick";
-
- private final static String ATTRIBUTE_CE_ONUPCLICK = "onupclick";
-
- private final static String ATTRIBUTE_CE_ONBOTTOMCLICK = "onbottomclick";
-
- private final static String ATTRIBUTE_CE_ONHEADERCLICK = "onheaderclick";
-
- private final static String ATTRIBUTE_CAPTION_LABEL = "captionLabel";
-
- private final static String ATTRIBUTE_CLASS_TOP_CONTROL = "topControlClass";
-
- private final static String ATTRIBUTE_CLASS_BOTTOM_CONTROL = "bottomControlClass";
-
- private final static String ATTRIBUTE_CLASS_DOWN_CONTROL = "downControlClass";
-
- private final static String ATTRIBUTE_CLASS_UP_CONTROL = "upControlClass";
-
- private final static String ATTRIBUTE_CLASS_DISABLED_CONTROL = "disabledControlClass";
-
- private final static String STYLE_SKIN_CONTROL_BUTTON = "ol_button_control";
-
- private final static String DIS_CONTROL_ID_PREFIX = "dis";
-
- private final static String CONTROL_ID_UP = "up";
-
- private final static String CONTROL_ID_DOWN = "down";
-
- private final static String CONTROL_ID_TOP = "first";
-
- private final static String CONTROL_ID_BOTTOM = "last";
-
- private final static String DEFAULT_LABEL_TOP = "First";
- private final static String DEFAULT_LABEL_UP = "Up";
- private final static String DEFAULT_LABEL_DOWN = "Down";
- private final static String DEFAULT_LABEL_BOTTOM = "Last";
-
- private final static String ATTRIBUTE_CLASS_BUTTON = "ol_button";
- private final static String ATTRIBUTE_CLASS_BUTTON_DISABLED = "ol_button_disabled";
-
- protected static abstract class ControlsHelper {
- private String name;
-
- private String bundlePropertyName;
-
- private String imageURI;
-
- private String facetName;
-
- private String styleClassName;
-
- private String idSuffix;
-
- private String customEvent;
-
- private String styleFromAttribute;
-
- private String buttonStyleClass;
-
- private boolean enable;
-
- private String defaultText;
-
- public abstract boolean isRendered(FacesContext context, UIOrderingList list);
-
- public ControlsHelper(String name, String bundlePropertyName, String defaultText, String imageURI,
- String facetName, String styleClassName, String styleFromAttribute, String buttonStyleClass,
- String idSuffix, String customEvent, boolean isEnable) {
- super();
- this.name = name;
- this.bundlePropertyName = bundlePropertyName;
- this.defaultText = defaultText;
- this.imageURI = imageURI;
- this.facetName = facetName;
- this.styleClassName = styleClassName;
- this.styleFromAttribute = styleFromAttribute;
- this.idSuffix = idSuffix;
- this.customEvent = customEvent;
- this.buttonStyleClass = buttonStyleClass;
- this.enable = isEnable;
- }
-
- public String getName() {
- return name;
- }
-
- public String getBundlePropertyName() {
- return bundlePropertyName;
- }
-
- public String getImageURI() {
- return imageURI;
- }
-
- public String getFacetName() {
- return facetName;
- }
-
- public String getStyleClassName() {
- return styleClassName;
- }
-
- public String getIdSuffix() {
- return idSuffix;
- }
-
- public String getCustomEvent() {
- return customEvent;
- }
-
- public String getStyleFromAttribute() {
- return styleFromAttribute;
- }
-
- public String getButtonStyleClass() {
- return buttonStyleClass;
- }
-
- public boolean isEnable() {
- return enable;
- }
-
- public String getDefaultText() {
- return defaultText;
- }
- };
-
- protected static final ControlsHelper[] HELPERS = new ControlsHelper[] {
- new ControlsHelper("top", "TOP_LABEL", DEFAULT_LABEL_TOP, OrderingListIconTop.class.getName(), FACET_TOP,
- " rich-ordering-control-top", ATTRIBUTE_CLASS_TOP_CONTROL, ATTRIBUTE_CLASS_BUTTON,
- CONTROL_ID_TOP, ATTRIBUTE_CE_ONTOPCLICK, true) {
-
- public boolean isRendered(FacesContext context, UIOrderingList list) {
- return list.isFastOrderControlsVisible();
- }
-
- },
- new ControlsHelper("disabledTop", "TOP_LABEL", DEFAULT_LABEL_TOP, OrderingListIconTopDisabled.class.getName(), FACET_DIS_TOP,
- " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_TOP), null, false) {
-
- public boolean isRendered(FacesContext context, UIOrderingList list) {
- return list.isFastOrderControlsVisible();
- }
-
- },
- new ControlsHelper("up", "UP_LABEL", DEFAULT_LABEL_UP, OrderingListIconUp.class.getName(), FACET_UP,
- " rich-ordering-control-up", ATTRIBUTE_CLASS_UP_CONTROL, ATTRIBUTE_CLASS_BUTTON,
- CONTROL_ID_UP, ATTRIBUTE_CE_ONUPCLICK ,true) {
-
- public boolean isRendered(FacesContext context, UIOrderingList list) {
- return list.isOrderControlsVisible();
- }
-
- },
- new ControlsHelper("disabledUp", "UP_LABEL", DEFAULT_LABEL_UP, OrderingListIconUpDisabled.class.getName(), FACET_DIS_UP,
- " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_UP), null, false) {
-
- public boolean isRendered(FacesContext context, UIOrderingList list) {
- return list.isOrderControlsVisible();
- }
-
- },
- new ControlsHelper("down", "DOWN_LABEL", DEFAULT_LABEL_DOWN, OrderingListIconDown.class.getName(), FACET_DOWN,
- " rich-ordering-control-down", ATTRIBUTE_CLASS_DOWN_CONTROL, ATTRIBUTE_CLASS_BUTTON,
- CONTROL_ID_DOWN, ATTRIBUTE_CE_ONDOWNCLICK, true) {
-
- public boolean isRendered(FacesContext context, UIOrderingList list) {
- return list.isFastOrderControlsVisible();
- }
-
- },
- new ControlsHelper("disabledDown", "DOWN_LABEL", DEFAULT_LABEL_DOWN, OrderingListIconDownDisabled.class.getName(), FACET_DIS_DOWN,
- " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_DOWN), null, false) {
-
- public boolean isRendered(FacesContext context, UIOrderingList list) {
- return list.isFastOrderControlsVisible();
- }
-
- },
- new ControlsHelper("bottom", "BOTTOM_LABEL", DEFAULT_LABEL_BOTTOM, OrderingListIconBottom.class.getName(), FACET_BOTTOM,
- " rich-ordering-control-bottom", ATTRIBUTE_CLASS_BOTTOM_CONTROL, ATTRIBUTE_CLASS_BUTTON,
- CONTROL_ID_BOTTOM, ATTRIBUTE_CE_ONBOTTOMCLICK, true) {
-
- public boolean isRendered(FacesContext context, UIOrderingList list) {
- return list.isOrderControlsVisible();
- }
-
- },
- new ControlsHelper("disabledBottom", "BOTTOM_LABEL", DEFAULT_LABEL_BOTTOM, OrderingListIconBottomDisabled.class.getName(), FACET_DIS_BOTTOM,
- " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_BOTTOM), null, false) {
-
- public boolean isRendered(FacesContext context, UIOrderingList list) {
- return list.isOrderControlsVisible();
- }
-
- }
- };
-
- protected Class getComponentClass() {
- return UIOrderingList.class;
- }
-
- public boolean getRendersChildren() {
- return true;
- }
-
- public void encodeCaption(FacesContext context, UIOrderingList orderingList)
- throws IOException {
- ResponseWriter writer = context.getResponseWriter();
- UIComponent facetEl = orderingList.getFacet(FACET_CAPTION);
- boolean renderFacet = ((facetEl != null) && facetEl.isRendered());
- String captionAttr = (String) orderingList.getAttributes().get(ATTRIBUTE_CAPTION_LABEL);
-
- if (renderFacet || (captionAttr != null)) {
- writer.startElement(HTML.DIV_ELEM, orderingList);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "ol_label ol_out_label rich-ordering-list-caption", null);
- if (renderFacet) {
- renderChild(context, facetEl);
- } else {
- writer.write(captionAttr);
- }
- writer.endElement(HTML.DIV_ELEM);
- }
-
- }
-
- public void encodeHeader(FacesContext context, UIOrderingList orderingList)
- throws IOException {
- ResponseWriter writer = context.getResponseWriter();
- //UIComponent header = orderingList.getHeader();
- Iterator headers = orderingList.columns();
-
- if (headers.hasNext()) {
- writer.startElement("thead", orderingList);
- String headerClass = (String) orderingList.getAttributes().get("headerClass");
-
- writer.startElement("tr", orderingList);
- encodeStyleClass(writer, null, "rich-table-header", null, headerClass);
- encodeHeaderFacets(context, writer, headers, "ol_col rich-table-header-cell", headerClass, "header", "th", orderingList);
-
- writer.endElement("tr");
- }
- writer.endElement("thead");
- }
-
- private static final ThreadLocal<ItemState> itemStates = new ThreadLocal<ItemState>();
-
- public void encodeBegin(FacesContext context, UIComponent component)
- throws IOException {
- itemStates.set(((UIOrderingList) component).getItemState());
- super.encodeBegin(context, component);
- }
-
- public void encodeEnd(FacesContext context, UIComponent component)
- throws IOException {
- try {
- super.encodeEnd(context, component);
- } finally {
- itemStates.set(null);
- }
- }
-
- public void encodeControlsFacets(FacesContext context, UIOrderingList orderingList)
- throws IOException {
- String clientId = orderingList.getClientId(context);
- ResponseWriter writer = context.getResponseWriter();
-
- Object key = orderingList.getRowKey();
- boolean selectedFirst = false;
- boolean selectedLast = false;
-
- try {
- ItemState state = itemStates.get();
-
- orderingList.setRowKey(new Integer(0));
- selectedFirst = state.isSelected();
- orderingList.setRowKey(new Integer(orderingList.getModelSize() - 1));
- selectedLast = state.isSelected();
- } finally {
- try {
- orderingList.setRowKey(key);
- } catch (Exception e) {
- context.getExternalContext().log(e.getLocalizedMessage(), e);
- }
- }
-
- //proper assumption about helpers ordering
- int divider = HELPERS.length / 2;
-
- for (int i = 0; i < HELPERS.length; i++) {
- boolean enabled = i < divider ? !selectedFirst : !selectedLast;
- if (i % 2 == 0) {
- enabled = !enabled;
- }
-
- if (HELPERS[i].isRendered(context, orderingList)) {
- //proper assumption about helpers ordering
- encodeControlFacet(context, orderingList, HELPERS[i], clientId, writer,
- enabled);
- }
- }
- }
-
- protected void encodeControlFacet(FacesContext context,
- UIOrderingList orderingList, ControlsHelper helper,
- String clientId, ResponseWriter writer, boolean enabled) throws IOException {
- Locale locale = null;
-
- UIViewRoot viewRoot = context.getViewRoot();
- if (viewRoot != null) {
- locale = viewRoot.getLocale();
- }
-
- ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
- ResourceBundle bundle = null;
-
- if (locale != null) {
- try {
- bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE_NAME, locale, contextClassLoader);
- } catch (MissingResourceException e) {
-
- }
- }
-
- Map attributes = orderingList.getAttributes();
- UIComponent facet = orderingList.getFacet(helper.getFacetName());
- boolean useFacet = (facet != null && facet.isRendered());
- String controlType = (String) attributes.get(ATTRIBUTE_CONTROLS_TYPE);
-
- if (CONTROL_TYPE_NONE.equals(controlType)) {
- if (useFacet) {
- renderChild(context, facet);
- }
- } else {
- renderDefaultControl(context, orderingList, writer, useFacet,
- helper, clientId, bundle ,enabled);
- }
- }
-
- protected void renderDefaultControl(FacesContext context,
- UIOrderingList orderingList, ResponseWriter writer,
- boolean useFacet, ControlsHelper helper, String clientId, ResourceBundle bundle, boolean enabled)
- throws IOException {
- String htmlElem = HTML.a_ELEMENT;
- UIComponent facet = orderingList.getFacet(helper.getFacetName());
- String customEvent = null;
- Map attributes = orderingList.getAttributes();
- if (helper.customEvent != null) {
- customEvent = (String) attributes.get(helper.customEvent);
- }
-
- String styleFromAttribute = (String) attributes
- .get(helper.styleFromAttribute);
- String currentStyle = helper.getStyleClassName();
-
- if (styleFromAttribute != null) {
- currentStyle = styleFromAttribute.concat(currentStyle);
- }
-
- writer.startElement(HTML.DIV_ELEM, orderingList);
- writer.writeAttribute(HTML.id_ATTRIBUTE, clientId + helper.getIdSuffix(), null); //FIXME:
- writer.writeAttribute(HTML.class_ATTRIBUTE, "ol_button_border " + (enabled ? "ol_control_shown" : "ol_control_hidden") + currentStyle, null);
- if (!useFacet) {
-
- writer.startElement(HTML.DIV_ELEM, orderingList);
- writer.writeAttribute(HTML.class_ATTRIBUTE, helper.getButtonStyleClass(), null);
- if (helper.enable) {
- writer.writeAttribute(HTML.onmouseover_ATTRIBUTE, "this.className='ol_button_light'", null);
- writer.writeAttribute(HTML.onmousedown_ATTRIBUTE, "this.className='ol_button_press'", null);
- writer.writeAttribute(HTML.onmouseup_ATTRIBUTE, "this.className='ol_button'", null);
- writer.writeAttribute(HTML.onmouseout_ATTRIBUTE, "this.className='ol_button'", null);
- }
-
- writer.startElement(HTML.DIV_ELEM, orderingList);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "ol_button_content", null);
-
- }
-
- writer.startElement(htmlElem, orderingList);
- if (customEvent != null) {
- writer.writeAttribute(HTML.onclick_ATTRIBUTE, customEvent,null);
- }
-
- if (useFacet) {
- renderChild(context, facet);
- } else {
- writer.startElement(HTML.IMG_ELEMENT, orderingList);
- writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
- writer.writeAttribute(HTML.height_ATTRIBUTE, "15", null);
- writer.writeAttribute(HTML.border_ATTRIBUTE, "0", null);
- writer.writeAttribute(HTML.alt_ATTRIBUTE, helper.getFacetName(),
- null);
- writer.writeAttribute(HTML.src_ATTRIBUTE, getResource(
- helper.getImageURI()).getUri(context, null), null);
-
- writer.endElement(HTML.IMG_ELEMENT);
-
- if ((Boolean) attributes.get(ATTRIBUTE_LABEL)) {
- String label = null;
-
- if (bundle != null) {
- try {
- label = bundle.getString(helper.getBundlePropertyName());
- } catch (MissingResourceException e) {
-
- }
- }
-
- if (label == null) {
- label = helper.getDefaultText();
- }
-
- writer.writeText(label, null);
- }
- }
- // writer.writeAttribute(HTML.id_ATTRIBUTE, clientId +
- // helper.getIdSuffix(), null);
-
- // writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
- writer.endElement(htmlElem);
-
- if (!useFacet) {
- writer.endElement(HTML.DIV_ELEM);
- writer.endElement(HTML.DIV_ELEM);
- }
- writer.endElement(HTML.DIV_ELEM);
- }
-
- protected void encodeHeaderFacets(FacesContext context, ResponseWriter writer,
- Iterator headers, String skinCellClass,
- String headerClass, String facetName, String element, UIOrderingList orderingList)
- throws IOException {
- while (headers.hasNext()) {
- UIComponent column = (UIComponent) headers.next();
- String classAttribute = facetName + "Class";
- String columnHeaderClass = (String) column.getAttributes().get(classAttribute);
-
- writer.startElement(element, column);
- if (!headers.hasNext()) {
- skinCellClass = "ol_endcol rich-table-header-cell-end";
- }
- encodeStyleClass(writer, null, skinCellClass, headerClass, columnHeaderClass);
- getUtils().encodeAttribute(context, column, "colspan");
- writer.startElement("div", column);
- writer.writeAttribute("style", "overflow:hidden;white-space: nowrap;", null);
- String onHeaderClickEvent = (String) orderingList.getAttributes().get(ATTRIBUTE_CE_ONHEADERCLICK);
- if (onHeaderClickEvent != null) {
- writer.writeAttribute(HTML.onclick_ATTRIBUTE, onHeaderClickEvent, null);
- }
-
- UIComponent facet = column.getFacet(facetName);
- if (facet != null && facet.isRendered()) {
- renderChild(context, facet);
- } else {
- writer.write(" ");
- }
-
- writer.endElement("div");
- writer.endElement(element);
- }
- }
-
- public void encodeOneRow(FacesContext context, TableHolder holder)
- throws IOException {
- ResponseWriter writer = context.getResponseWriter();
- UIOrderingList table = (UIOrderingList) holder.getTable();
- String clientId = holder.getTable().getClientId(context);
- writer.startElement(HTML.TR_ELEMENT, table);
- writer.writeAttribute("id", clientId, null);
-
- StringBuffer rowClassName = new StringBuffer("ol_normal rich-ordering-list-row");
- StringBuffer cellClassName = new StringBuffer("ol_cell rich-ordering-list-cell");
-
- ItemState state = itemStates.get();
-
- if (state.isActive()) {
- rowClassName.append(" ol_active rich-ordering-list-row-active");
- cellClassName.append(" rich-ordering-list-cell-active");
- }
-
- if (state.isSelected()) {
- rowClassName.append(" ol_select rich-ordering-list-row-selected");
- cellClassName.append(" rich-ordering-list-cell-selected");
- }
-
- writer.writeAttribute("class", rowClassName.toString(), null);
-
- List<UIComponent> children = table.getChildren();
- for (UIComponent component : children) {
- if (component instanceof UIColumn && component.isRendered()) {
- UIColumn column = (UIColumn) component;
-
- writer.startElement(HTML.td_ELEM, table);
-
- writer.writeAttribute("class", cellClassName.toString(), null);
-
- renderChildren(context, column);
-
- writer.endElement(HTML.td_ELEM);
- }
- }
-
- writer.endElement(HTML.TR_ELEMENT);
- }
-
- /*public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
- ResponseWriter writer = context.getResponseWriter();
- String clientId = component.getClientId(context);
-
- writer.startElement(HTML.TR_ELEMENT, component);
- writer.startElement(HTML.td_ELEM, component);
- encodeCaption(context, (UIOrderingList) component);
- writer.endElement(HTML.td_ELEM);
- writer.endElement(HTML.TR_ELEMENT);
-
- writer.startElement(HTML.TR_ELEMENT, component);
- writer.startElement(HTML.td_ELEM, component);
- writer.startElement(HTML.DIV_ELEM, component);
- writer.writeAttribute(HTML.id_ATTRIBUTE, clientId.concat("headerBox"), null);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "ol_list", null);
-
-
- encodeRows(context, component);
- }*/
-
- public void doDecode(FacesContext context, UIComponent component) {
- UIOrderingList orderingList = (UIOrderingList) component;
-
- String clientId = component.getClientId(context);
- Map requestParameterMap = context.getExternalContext()
- .getRequestParameterMap();
-
- String valueOrder = (String) requestParameterMap.get(clientId);
-
- if (valueOrder != null && valueOrder.length() != 0) {
- orderingList.setSubmittedString(valueOrder);
- }
- }
-
-
- private void valuesSynchronization(String[] valueOrder, List oldValues) {
- List synchronizedList = new ArrayList();
- List selectedItems = new ArrayList();
- Object activeItem = null;
- Integer itemIndex = null;
- String[] currentOrder;
-
- for (int i = 0; i < valueOrder.length; i++) {
- currentOrder = valueOrder[i].split("d+");
-
- try {
- itemIndex = new Integer(currentOrder[0]);
- } catch (NumberFormatException e) {
- // TODO: handle exception
- }
-
- Object currentItem = oldValues.get(itemIndex.intValue());
- synchronizedList.add(currentItem);
-
- if (currentOrder.length > 1) {
- Iterator it = Arrays.asList(currentOrder[1].toCharArray()).iterator();
- while (it.hasNext()) {
- Character marker = (Character) it.next();
- if (ACTIVITY_MARKER.equals(marker)) {
- activeItem = currentItem;
- } else if (SELECTION_MARKER.equals(marker)) {
- selectedItems.add(currentItem);
- }
- }
- }
- }
- }
-
-}
Copied: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java (from rev 4061, trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java)
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,619 @@
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.component.UIOrderingList;
+import org.richfaces.component.UIOrderingList.ItemState;
+import org.richfaces.renderkit.html.images.OrderingListIconBottom;
+import org.richfaces.renderkit.html.images.OrderingListIconBottomDisabled;
+import org.richfaces.renderkit.html.images.OrderingListIconDown;
+import org.richfaces.renderkit.html.images.OrderingListIconDownDisabled;
+import org.richfaces.renderkit.html.images.OrderingListIconTop;
+import org.richfaces.renderkit.html.images.OrderingListIconTopDisabled;
+import org.richfaces.renderkit.html.images.OrderingListIconUp;
+import org.richfaces.renderkit.html.images.OrderingListIconUpDisabled;
+
+public abstract class OrderingListRendererBase extends AbstractRowsRenderer {
+
+ private static final String MESSAGE_BUNDLE_NAME = OrderingListRendererBase.class.getPackage().getName() + "OrderingList";
+
+ private final static Character ACTIVITY_MARKER = new Character('a');
+
+ private final static Character SELECTION_MARKER = new Character('s');
+
+ private final static String ITEM_SEPARATOR = ",";
+
+ private final static String FACET_TOP = "topControl";
+
+ private final static String FACET_BOTTOM = "bottomControl";
+
+ private final static String FACET_UP = "upControl";
+
+ private final static String FACET_DOWN = "downControl";
+
+ private final static String FACET_DIS_TOP = "topControlDisabled";
+
+ private final static String FACET_DIS_BOTTOM = "bottomControlDisabled";
+
+ private final static String FACET_DIS_UP = "upControlDisabled";
+
+ private final static String FACET_DIS_DOWN = "downControlDisabled";
+
+ private final static String FACET_CAPTION = "caption";
+
+ private final static String CONTROL_TYPE_LINK = "link";
+
+ private final static String CONTROL_TYPE_BUTTON = "button";
+
+ private final static String CONTROL_TYPE_NONE = "none";
+
+ private final static String SHOW_LABELS_ATTRIBUTE_NAME = "showButtonLabels";
+
+ private final static String ATTRIBUTE_CONTROLS_TYPE = "controlsType";
+
+ private final static String ATTRIBUTE_CE_ONORDERCHANGED = "onorderchanged";
+
+ private final static String ATTRIBUTE_CE_ONTOPCLICK = "ontopclick";
+
+ private final static String ATTRIBUTE_CE_ONDOWNCLICK = "ondownclick";
+
+ private final static String ATTRIBUTE_CE_ONUPCLICK = "onupclick";
+
+ private final static String ATTRIBUTE_CE_ONBOTTOMCLICK = "onbottomclick";
+
+ private final static String ATTRIBUTE_CE_ONHEADERCLICK = "onheaderclick";
+
+ private final static String ATTRIBUTE_CAPTION_LABEL = "captionLabel";
+
+ private final static String ATTRIBUTE_CLASS_TOP_CONTROL = "topControlClass";
+
+ private final static String ATTRIBUTE_CLASS_BOTTOM_CONTROL = "bottomControlClass";
+
+ private final static String ATTRIBUTE_CLASS_DOWN_CONTROL = "downControlClass";
+
+ private final static String ATTRIBUTE_CLASS_UP_CONTROL = "upControlClass";
+
+ private final static String ATTRIBUTE_CLASS_DISABLED_CONTROL = "disabledControlClass";
+
+ private final static String STYLE_SKIN_CONTROL_BUTTON = "ol_button_control";
+
+ private final static String DIS_CONTROL_ID_PREFIX = "dis";
+
+ private final static String CONTROL_ID_UP = "up";
+
+ private final static String CONTROL_ID_DOWN = "down";
+
+ private final static String CONTROL_ID_TOP = "first";
+
+ private final static String CONTROL_ID_BOTTOM = "last";
+
+ private final static String DEFAULT_LABEL_TOP = "First";
+ private final static String DEFAULT_LABEL_UP = "Up";
+ private final static String DEFAULT_LABEL_DOWN = "Down";
+ private final static String DEFAULT_LABEL_BOTTOM = "Last";
+
+ private final static String ATTRIBUTE_CLASS_BUTTON = "ol_button";
+ private final static String ATTRIBUTE_CLASS_BUTTON_DISABLED = "ol_button_disabled";
+
+ protected static abstract class ControlsHelper {
+ private String name;
+
+ private String bundlePropertyName;
+
+ private String imageURI;
+
+ private String facetName;
+
+ private String styleClassName;
+
+ private String idSuffix;
+
+ private String customEvent;
+
+ private String styleFromAttribute;
+
+ private String buttonStyleClass;
+
+ private boolean enable;
+
+ private String defaultText;
+
+ private String labelAttributeName;
+
+ public abstract boolean isRendered(FacesContext context, UIOrderingList list);
+
+ public ControlsHelper(String name, String bundlePropertyName, String defaultText, String imageURI,
+ String facetName, String styleClassName, String styleFromAttribute, String buttonStyleClass,
+ String idSuffix, String customEvent, boolean isEnable, String labelAttributeName) {
+ super();
+ this.name = name;
+ this.bundlePropertyName = bundlePropertyName;
+ this.defaultText = defaultText;
+ this.imageURI = imageURI;
+ this.facetName = facetName;
+ this.styleClassName = styleClassName;
+ this.styleFromAttribute = styleFromAttribute;
+ this.idSuffix = idSuffix;
+ this.customEvent = customEvent;
+ this.buttonStyleClass = buttonStyleClass;
+ this.enable = isEnable;
+ this.labelAttributeName = labelAttributeName;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getBundlePropertyName() {
+ return bundlePropertyName;
+ }
+
+ public String getImageURI() {
+ return imageURI;
+ }
+
+ public String getFacetName() {
+ return facetName;
+ }
+
+ public String getStyleClassName() {
+ return styleClassName;
+ }
+
+ public String getIdSuffix() {
+ return idSuffix;
+ }
+
+ public String getCustomEvent() {
+ return customEvent;
+ }
+
+ public String getStyleFromAttribute() {
+ return styleFromAttribute;
+ }
+
+ public String getButtonStyleClass() {
+ return buttonStyleClass;
+ }
+
+ public boolean isEnable() {
+ return enable;
+ }
+
+ public String getDefaultText() {
+ return defaultText;
+ }
+
+ public String getLabelAttributeName() {
+ return labelAttributeName;
+ }
+ };
+
+ protected static final ControlsHelper[] HELPERS = new ControlsHelper[] {
+ new ControlsHelper("top", "TOP_LABEL", DEFAULT_LABEL_TOP, OrderingListIconTop.class.getName(), FACET_TOP,
+ " rich-ordering-control-top", ATTRIBUTE_CLASS_TOP_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ CONTROL_ID_TOP, ATTRIBUTE_CE_ONTOPCLICK, true, "topControlLabel") {
+
+ public boolean isRendered(FacesContext context, UIOrderingList list) {
+ return list.isFastOrderControlsVisible();
+ }
+
+ },
+ new ControlsHelper("disabledTop", "TOP_LABEL", DEFAULT_LABEL_TOP, OrderingListIconTopDisabled.class.getName(), FACET_DIS_TOP,
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_TOP), null, false, "topControlLabel") {
+
+ public boolean isRendered(FacesContext context, UIOrderingList list) {
+ return list.isFastOrderControlsVisible();
+ }
+
+ },
+ new ControlsHelper("up", "UP_LABEL", DEFAULT_LABEL_UP, OrderingListIconUp.class.getName(), FACET_UP,
+ " rich-ordering-control-up", ATTRIBUTE_CLASS_UP_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ CONTROL_ID_UP, ATTRIBUTE_CE_ONUPCLICK ,true, "upControlLabel") {
+
+ public boolean isRendered(FacesContext context, UIOrderingList list) {
+ return list.isOrderControlsVisible();
+ }
+
+ },
+ new ControlsHelper("disabledUp", "UP_LABEL", DEFAULT_LABEL_UP, OrderingListIconUpDisabled.class.getName(), FACET_DIS_UP,
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_UP), null, false, "upControlLabel") {
+
+ public boolean isRendered(FacesContext context, UIOrderingList list) {
+ return list.isOrderControlsVisible();
+ }
+
+ },
+ new ControlsHelper("down", "DOWN_LABEL", DEFAULT_LABEL_DOWN, OrderingListIconDown.class.getName(), FACET_DOWN,
+ " rich-ordering-control-down", ATTRIBUTE_CLASS_DOWN_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ CONTROL_ID_DOWN, ATTRIBUTE_CE_ONDOWNCLICK, true, "downControlLabel") {
+
+ public boolean isRendered(FacesContext context, UIOrderingList list) {
+ return list.isFastOrderControlsVisible();
+ }
+
+ },
+ new ControlsHelper("disabledDown", "DOWN_LABEL", DEFAULT_LABEL_DOWN, OrderingListIconDownDisabled.class.getName(), FACET_DIS_DOWN,
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_DOWN), null, false, "downControlLabel") {
+
+ public boolean isRendered(FacesContext context, UIOrderingList list) {
+ return list.isFastOrderControlsVisible();
+ }
+
+ },
+ new ControlsHelper("bottom", "BOTTOM_LABEL", DEFAULT_LABEL_BOTTOM, OrderingListIconBottom.class.getName(), FACET_BOTTOM,
+ " rich-ordering-control-bottom", ATTRIBUTE_CLASS_BOTTOM_CONTROL, ATTRIBUTE_CLASS_BUTTON,
+ CONTROL_ID_BOTTOM, ATTRIBUTE_CE_ONBOTTOMCLICK, true, "bottomControlLabel") {
+
+ public boolean isRendered(FacesContext context, UIOrderingList list) {
+ return list.isOrderControlsVisible();
+ }
+
+ },
+ new ControlsHelper("disabledBottom", "BOTTOM_LABEL", DEFAULT_LABEL_BOTTOM, OrderingListIconBottomDisabled.class.getName(), FACET_DIS_BOTTOM,
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_BOTTOM), null, false, "bottomControlLabel") {
+
+ public boolean isRendered(FacesContext context, UIOrderingList list) {
+ return list.isOrderControlsVisible();
+ }
+
+ }
+ };
+
+ protected Class getComponentClass() {
+ return UIOrderingList.class;
+ }
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ public void encodeCaption(FacesContext context, UIOrderingList orderingList)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ UIComponent facetEl = orderingList.getFacet(FACET_CAPTION);
+ boolean renderFacet = ((facetEl != null) && facetEl.isRendered());
+ String captionAttr = (String) orderingList.getAttributes().get(ATTRIBUTE_CAPTION_LABEL);
+
+ if (renderFacet || (captionAttr != null)) {
+ writer.startElement(HTML.DIV_ELEM, orderingList);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "ol_label ol_out_label rich-ordering-list-caption", null);
+ if (renderFacet) {
+ renderChild(context, facetEl);
+ } else {
+ writer.write(captionAttr);
+ }
+ writer.endElement(HTML.DIV_ELEM);
+ }
+
+ }
+
+ public void encodeHeader(FacesContext context, UIOrderingList orderingList)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ //UIComponent header = orderingList.getHeader();
+ Iterator headers = orderingList.columns();
+
+ if (headers.hasNext()) {
+ writer.startElement("thead", orderingList);
+ String headerClass = (String) orderingList.getAttributes().get("headerClass");
+
+ writer.startElement("tr", orderingList);
+ encodeStyleClass(writer, null, "rich-table-header", null, headerClass);
+ encodeHeaderFacets(context, writer, headers, "ol_col rich-table-header-cell", headerClass, "header", "th", orderingList);
+
+ writer.endElement("tr");
+ }
+ writer.endElement("thead");
+ }
+
+ private static final ThreadLocal itemStates = new ThreadLocal();
+
+ public void encodeBegin(FacesContext context, UIComponent component)
+ throws IOException {
+ itemStates.set(((UIOrderingList) component).getItemState());
+ super.encodeBegin(context, component);
+ }
+
+ public void encodeEnd(FacesContext context, UIComponent component)
+ throws IOException {
+ try {
+ super.encodeEnd(context, component);
+ } finally {
+ itemStates.set(null);
+ }
+ }
+
+ public void encodeControlsFacets(FacesContext context, UIOrderingList orderingList)
+ throws IOException {
+ String clientId = orderingList.getClientId(context);
+ ResponseWriter writer = context.getResponseWriter();
+
+ Object key = orderingList.getRowKey();
+ boolean selectedFirst = false;
+ boolean selectedLast = false;
+
+ try {
+ ItemState state = (ItemState) itemStates.get();
+
+ orderingList.setRowKey(new Integer(0));
+ selectedFirst = state.isSelected();
+ orderingList.setRowKey(new Integer(orderingList.getModelSize() - 1));
+ selectedLast = state.isSelected();
+ } finally {
+ try {
+ orderingList.setRowKey(key);
+ } catch (Exception e) {
+ context.getExternalContext().log(e.getLocalizedMessage(), e);
+ }
+ }
+
+ //proper assumption about helpers ordering
+ int divider = HELPERS.length / 2;
+
+ for (int i = 0; i < HELPERS.length; i++) {
+ boolean enabled = i < divider ? !selectedFirst : !selectedLast;
+ if (i % 2 == 0) {
+ enabled = !enabled;
+ }
+
+ if (HELPERS[i].isRendered(context, orderingList)) {
+ //proper assumption about helpers ordering
+ encodeControlFacet(context, orderingList, HELPERS[i], clientId, writer,
+ enabled);
+ }
+ }
+ }
+
+ protected void encodeControlFacet(FacesContext context,
+ UIOrderingList orderingList, ControlsHelper helper,
+ String clientId, ResponseWriter writer, boolean enabled) throws IOException {
+ Locale locale = null;
+
+ UIViewRoot viewRoot = context.getViewRoot();
+ if (viewRoot != null) {
+ locale = viewRoot.getLocale();
+ }
+
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ ResourceBundle bundle = null;
+
+ if (locale != null) {
+ try {
+ bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE_NAME, locale, contextClassLoader);
+ } catch (MissingResourceException e) {
+
+ }
+ }
+
+ Map attributes = orderingList.getAttributes();
+ UIComponent facet = orderingList.getFacet(helper.getFacetName());
+ boolean useFacet = (facet != null && facet.isRendered());
+ String controlType = (String) attributes.get(ATTRIBUTE_CONTROLS_TYPE);
+
+ if (CONTROL_TYPE_NONE.equals(controlType)) {
+ if (useFacet) {
+ renderChild(context, facet);
+ }
+ } else {
+ renderDefaultControl(context, orderingList, writer, useFacet,
+ helper, clientId, bundle ,enabled);
+ }
+ }
+
+ protected void renderDefaultControl(FacesContext context,
+ UIOrderingList orderingList, ResponseWriter writer,
+ boolean useFacet, ControlsHelper helper, String clientId, ResourceBundle bundle, boolean enabled)
+ throws IOException {
+ UIComponent facet = orderingList.getFacet(helper.getFacetName());
+ String customEvent = null;
+ Map attributes = orderingList.getAttributes();
+ if (helper.customEvent != null) {
+ customEvent = (String) attributes.get(helper.customEvent);
+ }
+
+ String styleFromAttribute = (String) attributes
+ .get(helper.styleFromAttribute);
+ String currentStyle = helper.getStyleClassName();
+
+ if (styleFromAttribute != null) {
+ currentStyle = styleFromAttribute.concat(currentStyle);
+ }
+
+ writer.startElement(HTML.DIV_ELEM, orderingList);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, clientId + helper.getIdSuffix(), null); //FIXME:
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "ol_button_border " + (enabled ? "ol_control_shown" : "ol_control_hidden") + currentStyle, null);
+ if (!useFacet) {
+
+ writer.startElement(HTML.DIV_ELEM, orderingList);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, helper.getButtonStyleClass(), null);
+ if (helper.enable) {
+ writer.writeAttribute(HTML.onmouseover_ATTRIBUTE, "this.className='ol_button_light'", null);
+ writer.writeAttribute(HTML.onmousedown_ATTRIBUTE, "this.className='ol_button_press'", null);
+ writer.writeAttribute(HTML.onmouseup_ATTRIBUTE, "this.className='ol_button'", null);
+ writer.writeAttribute(HTML.onmouseout_ATTRIBUTE, "this.className='ol_button'", null);
+ }
+
+ writer.startElement(HTML.DIV_ELEM, orderingList);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "ol_button_content", null);
+
+ }
+
+ if (customEvent != null) {
+ writer.writeAttribute(HTML.onclick_ATTRIBUTE, customEvent,null);
+ }
+
+ if (useFacet) {
+ renderChild(context, facet);
+ } else {
+ writer.startElement(HTML.IMG_ELEMENT, orderingList);
+ writer.writeAttribute(HTML.width_ATTRIBUTE, "15", null);
+ writer.writeAttribute(HTML.height_ATTRIBUTE, "15", null);
+ writer.writeAttribute(HTML.border_ATTRIBUTE, "0", null);
+ writer.writeAttribute(HTML.alt_ATTRIBUTE, helper.getFacetName(),
+ null);
+ writer.writeAttribute(HTML.src_ATTRIBUTE, getResource(
+ helper.getImageURI()).getUri(context, null), null);
+
+ writer.endElement(HTML.IMG_ELEMENT);
+
+ if (Boolean.TRUE.equals(attributes.get(SHOW_LABELS_ATTRIBUTE_NAME))) {
+ String label = (String) attributes.get(helper.getLabelAttributeName());
+
+ if (label == null && bundle != null) {
+ try {
+ label = bundle.getString(helper.getBundlePropertyName());
+ } catch (MissingResourceException e) {
+
+ }
+ }
+
+ if (label == null) {
+ label = helper.getDefaultText();
+ }
+
+ writer.writeText(label, null);
+ }
+ }
+ // writer.writeAttribute(HTML.id_ATTRIBUTE, clientId +
+ // helper.getIdSuffix(), null);
+
+ // writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
+
+ if (!useFacet) {
+ writer.endElement(HTML.DIV_ELEM);
+ writer.endElement(HTML.DIV_ELEM);
+ }
+ writer.endElement(HTML.DIV_ELEM);
+ }
+
+ protected void encodeHeaderFacets(FacesContext context, ResponseWriter writer,
+ Iterator headers, String skinCellClass,
+ String headerClass, String facetName, String element, UIOrderingList orderingList)
+ throws IOException {
+ while (headers.hasNext()) {
+ UIComponent column = (UIComponent) headers.next();
+ String classAttribute = facetName + "Class";
+ String columnHeaderClass = (String) column.getAttributes().get(classAttribute);
+
+ writer.startElement(element, column);
+ if (!headers.hasNext()) {
+ skinCellClass = "ol_endcol rich-table-header-cell-end";
+ }
+ encodeStyleClass(writer, null, skinCellClass, headerClass, columnHeaderClass);
+ getUtils().encodeAttribute(context, column, "colspan");
+ writer.startElement("div", column);
+ writer.writeAttribute("style", "overflow:hidden;white-space: nowrap;", null);
+ String onHeaderClickEvent = (String) orderingList.getAttributes().get(ATTRIBUTE_CE_ONHEADERCLICK);
+ if (onHeaderClickEvent != null) {
+ writer.writeAttribute(HTML.onclick_ATTRIBUTE, onHeaderClickEvent, null);
+ }
+
+ UIComponent facet = column.getFacet(facetName);
+ if (facet != null && facet.isRendered()) {
+ renderChild(context, facet);
+ } else {
+ writer.write(" ");
+ }
+
+ writer.endElement("div");
+ writer.endElement(element);
+ }
+ }
+
+ public void encodeOneRow(FacesContext context, TableHolder holder)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ UIOrderingList table = (UIOrderingList) holder.getTable();
+ String clientId = holder.getTable().getClientId(context);
+ writer.startElement(HTML.TR_ELEMENT, table);
+ writer.writeAttribute("id", clientId, null);
+
+ StringBuffer rowClassName = new StringBuffer("ol_normal rich-ordering-list-row");
+ StringBuffer cellClassName = new StringBuffer("ol_cell rich-ordering-list-cell");
+
+ ItemState state = (ItemState) itemStates.get();
+
+ if (state.isActive()) {
+ rowClassName.append(" ol_active rich-ordering-list-row-active");
+ cellClassName.append(" rich-ordering-list-cell-active");
+ }
+
+ if (state.isSelected()) {
+ rowClassName.append(" ol_select rich-ordering-list-row-selected");
+ cellClassName.append(" rich-ordering-list-cell-selected");
+ }
+
+ writer.writeAttribute("class", rowClassName.toString(), null);
+
+ List children = table.getChildren();
+ for (Iterator iterator = children.iterator(); iterator.hasNext();) {
+ UIComponent component = (UIComponent) iterator.next();
+
+ if (component instanceof UIColumn && component.isRendered()) {
+ UIColumn column = (UIColumn) component;
+
+ writer.startElement(HTML.td_ELEM, table);
+
+ writer.writeAttribute("class", cellClassName.toString(), null);
+
+ renderChildren(context, column);
+
+ writer.endElement(HTML.td_ELEM);
+ }
+ }
+
+ writer.endElement(HTML.TR_ELEMENT);
+ }
+
+ /*public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ String clientId = component.getClientId(context);
+
+ writer.startElement(HTML.TR_ELEMENT, component);
+ writer.startElement(HTML.td_ELEM, component);
+ encodeCaption(context, (UIOrderingList) component);
+ writer.endElement(HTML.td_ELEM);
+ writer.endElement(HTML.TR_ELEMENT);
+
+ writer.startElement(HTML.TR_ELEMENT, component);
+ writer.startElement(HTML.td_ELEM, component);
+ writer.startElement(HTML.DIV_ELEM, component);
+ writer.writeAttribute(HTML.id_ATTRIBUTE, clientId.concat("headerBox"), null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, "ol_list", null);
+
+
+ encodeRows(context, component);
+ }*/
+
+ public void doDecode(FacesContext context, UIComponent component) {
+ UIOrderingList orderingList = (UIOrderingList) component;
+
+ String clientId = component.getClientId(context);
+ Map requestParameterMap = context.getExternalContext()
+ .getRequestParameterMap();
+
+ String valueOrder = (String) requestParameterMap.get(clientId);
+
+ if (valueOrder != null && valueOrder.length() != 0) {
+ orderingList.setSubmittedString(valueOrder);
+ }
+ }
+}
Deleted: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,46 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * 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,
- * 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.html.gradientimages;
-
-import java.awt.Graphics2D;
-import java.awt.geom.AffineTransform;
-
-import org.ajax4jsf.resource.ResourceContext;
-import org.richfaces.renderkit.html.BaseGradient;
-import org.richfaces.skin.Skin;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListClickedGradient extends BaseGradient {
- @Override
- protected void paint(ResourceContext resourceContext, Graphics2D g2d) {
- g2d.transform(new AffineTransform(1., 0., 0., -1., 0., 15.));
- super.paint(resourceContext, g2d);
- }
-
- public OrderingListClickedGradient() {
- super(7, 15, 9, "headerGradientColor", Skin.headerBackgroundColor);
- }
-
-}
Copied: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java (from rev 4061, trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java)
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,45 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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,
+ * 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.gradientimages;
+
+import java.awt.Graphics2D;
+import java.awt.geom.AffineTransform;
+
+import org.ajax4jsf.resource.ResourceContext;
+import org.richfaces.renderkit.html.BaseGradient;
+import org.richfaces.skin.Skin;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListClickedGradient extends BaseGradient {
+ protected void paint(ResourceContext resourceContext, Graphics2D g2d) {
+ g2d.transform(new AffineTransform(1., 0., 0., -1., 0., 15.));
+ super.paint(resourceContext, g2d);
+ }
+
+ public OrderingListClickedGradient() {
+ super(7, 15, 9, "headerGradientColor", Skin.headerBackgroundColor);
+ }
+
+}
Deleted: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,174 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * 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,
- * 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.html.images;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.util.Date;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.resource.GifRenderer;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.resource.Java2Dresource;
-import org.ajax4jsf.resource.ResourceContext;
-import org.ajax4jsf.util.HtmlColor;
-import org.ajax4jsf.util.Zipper2;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public abstract class OrderingListIconBase extends Java2Dresource {
-
- private static final Dimension DIMENSION = new Dimension(15, 15);
-
- protected static final String ICON_COLOR = "headerTextColor";
- protected static final String BACKGROUND_COLOR = "headerBackgroundColor";
- protected static final String BORDER_COLOR = "subBorderColor";
-
- protected static final String DISABLED_ICON_COLOR = "tabDisabledTextColor";
- protected static final String DISABLED_BACKGROUND_COLOR = "tabBackgroundColor";
- protected static final String DISABLED_BORDER_COLOR = "subBorderColor";
-
- public OrderingListIconBase() {
- setRenderer(new GifRenderer());
- setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
- }
-
- abstract protected void paintImage(ResourceContext context, Graphics2D g2d, Color textColor, Color borderColor);
-
- protected void paintBaseTriangle(Graphics2D g2d) {
- for (int i = 0; i < 7; i++) {
- g2d.drawLine(-3 + i, 1, -3 + i, 1 + (i < 4 ? i : 6 - i));
- }
- }
-
- protected void paint(ResourceContext context, Graphics2D g2d) {
-
- Color [] data = (Color[]) restoreData(context);
- Color textColor = data[0];
- Color backgroundColor = data[1];
- Color borderColor = data[2];
-
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
- g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
- g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
-// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
-// g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
-// g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
-
- /*Dimension dim = getDimensions(context);
- g2d.setColor(backgroundColor);
- g2d.fillRect(0, 0, dim.width, dim.height);*/
-
- if (textColor != null && backgroundColor != null && g2d != null) {
- paintImage(context, g2d, textColor, borderColor);
- }
-
- }
-
- public Dimension getDimensions(FacesContext facesContext, Object data) {
- return DIMENSION;
- }
- protected Dimension getDimensions(ResourceContext resourceContext) {
- return DIMENSION;
- }
-
- /**
- * @param data - pass icon color and background color
- */
- @Override
- protected Object getDataToStore(FacesContext context, Object data) {
- return storeData(context, ICON_COLOR, BACKGROUND_COLOR, BORDER_COLOR);
- }
-
- protected Object storeData(FacesContext context, String colorSkinParam, String backgroundSkinParam, String borderSkinParam) {
- Skin skin = SkinFactory.getInstance().getSkin(context);
- Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
-
- byte [] ret = new byte[9];
-
- Color color = null;
- Zipper2 zipper = new Zipper2(ret);
-
- String color1 = (String) skin.getParameter(context, colorSkinParam);
- if (null == color1 || "".equals(color1))
- color1 = (String) defaultSkin.getParameter(context, colorSkinParam);
-
- if (color1 == null) {
- color1 = "#FFFFFF";
- }
-
- color = HtmlColor.decode(color1);
-
- zipper.addColor(color);
-
- String color2 = (String) skin.getParameter(context, backgroundSkinParam);
- if (null == color2 || "".equals(color2))
- color2 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
-
- if (color2 == null) {
- color2 = "#000000";
- }
-
- color = HtmlColor.decode(color2);
- zipper.addColor(color);
-
- String color3 = (String) skin.getParameter(context, borderSkinParam);
- if (null == color3 || "".equals(color3))
- color3 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
-
- if (color3 == null) {
- color3 = "#000000";
- }
-
- color = HtmlColor.decode(color3);
- zipper.addColor(color);
-
- return ret;
- }
-
- @Override
- protected Object deserializeData(byte[] objectArray) {
- if (objectArray == null) {
- return null;
- }
-
- Zipper2 zipper = new Zipper2(objectArray);
-
- return new Color[] {zipper.nextColor(), zipper.nextColor(), zipper.nextColor()};
- }
-
- public boolean isCacheable() {
- return true;
- }
-
-}
Copied: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java (from rev 4061, trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java)
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,172 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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,
+ * 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.util.Date;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.GifRenderer;
+import org.ajax4jsf.resource.InternetResourceBuilder;
+import org.ajax4jsf.resource.Java2Dresource;
+import org.ajax4jsf.resource.ResourceContext;
+import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper2;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public abstract class OrderingListIconBase extends Java2Dresource {
+
+ private static final Dimension DIMENSION = new Dimension(15, 15);
+
+ protected static final String ICON_COLOR = "headerTextColor";
+ protected static final String BACKGROUND_COLOR = "headerBackgroundColor";
+ protected static final String BORDER_COLOR = "subBorderColor";
+
+ protected static final String DISABLED_ICON_COLOR = "tabDisabledTextColor";
+ protected static final String DISABLED_BACKGROUND_COLOR = "tabBackgroundColor";
+ protected static final String DISABLED_BORDER_COLOR = "subBorderColor";
+
+ public OrderingListIconBase() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ abstract protected void paintImage(ResourceContext context, Graphics2D g2d, Color textColor, Color borderColor);
+
+ protected void paintBaseTriangle(Graphics2D g2d) {
+ for (int i = 0; i < 7; i++) {
+ g2d.drawLine(-3 + i, 1, -3 + i, 1 + (i < 4 ? i : 6 - i));
+ }
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+
+ Color [] data = (Color[]) restoreData(context);
+ Color textColor = data[0];
+ Color backgroundColor = data[1];
+ Color borderColor = data[2];
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+// g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+// g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+
+ /*Dimension dim = getDimensions(context);
+ g2d.setColor(backgroundColor);
+ g2d.fillRect(0, 0, dim.width, dim.height);*/
+
+ if (textColor != null && backgroundColor != null && g2d != null) {
+ paintImage(context, g2d, textColor, borderColor);
+ }
+
+ }
+
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return DIMENSION;
+ }
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return DIMENSION;
+ }
+
+ /**
+ * @param data - pass icon color and background color
+ */
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, ICON_COLOR, BACKGROUND_COLOR, BORDER_COLOR);
+ }
+
+ protected Object storeData(FacesContext context, String colorSkinParam, String backgroundSkinParam, String borderSkinParam) {
+ Skin skin = SkinFactory.getInstance().getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
+
+ byte [] ret = new byte[9];
+
+ Color color = null;
+ Zipper2 zipper = new Zipper2(ret);
+
+ String color1 = (String) skin.getParameter(context, colorSkinParam);
+ if (null == color1 || "".equals(color1))
+ color1 = (String) defaultSkin.getParameter(context, colorSkinParam);
+
+ if (color1 == null) {
+ color1 = "#FFFFFF";
+ }
+
+ color = HtmlColor.decode(color1);
+
+ zipper.addColor(color);
+
+ String color2 = (String) skin.getParameter(context, backgroundSkinParam);
+ if (null == color2 || "".equals(color2))
+ color2 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
+
+ if (color2 == null) {
+ color2 = "#000000";
+ }
+
+ color = HtmlColor.decode(color2);
+ zipper.addColor(color);
+
+ String color3 = (String) skin.getParameter(context, borderSkinParam);
+ if (null == color3 || "".equals(color3))
+ color3 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
+
+ if (color3 == null) {
+ color3 = "#000000";
+ }
+
+ color = HtmlColor.decode(color3);
+ zipper.addColor(color);
+
+ return ret;
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray == null) {
+ return null;
+ }
+
+ Zipper2 zipper = new Zipper2(objectArray);
+
+ return new Color[] {zipper.nextColor(), zipper.nextColor(), zipper.nextColor()};
+ }
+
+ public boolean isCacheable() {
+ return true;
+ }
+
+}
Deleted: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,77 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * 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,
- * 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.html.images;
-
-import java.awt.Color;
-import java.awt.Graphics2D;
-
-import org.ajax4jsf.resource.ResourceContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconBottom extends OrderingListIconBase {
-
- @Override
- protected void paintImage(ResourceContext context, Graphics2D g2d,
- Color textColor, Color borderColor) {
-
- g2d.translate(0, -3);
-
- g2d.setColor(textColor);
- g2d.translate(7, 5);
- paintBaseTriangle(g2d);
- g2d.translate(-7, -5);
-
- g2d.setColor(borderColor);
- g2d.drawLine(4, 5, 10, 5);
- g2d.drawLine(11, 6, 8, 9);
- g2d.drawLine(6, 9, 3, 6);
-
- g2d.translate(0, 4);
- g2d.setColor(textColor);
- g2d.translate(7, 5);
- paintBaseTriangle(g2d);
- g2d.translate(-7, -5);
-
- g2d.setColor(borderColor);
- g2d.drawLine(4, 5, 6, 5);
- g2d.drawLine(8, 5, 10, 5);
- g2d.drawLine(11, 6, 8, 9);
- g2d.drawLine(6, 9, 3, 6);
-
- g2d.translate(0, 4);
-
- g2d.setColor(borderColor);
- g2d.drawLine(4, 5, 6, 5);
- g2d.drawLine(8, 5, 10, 5);
-
- g2d.drawLine(11, 6, 10, 7);
- g2d.drawLine(4, 7, 3, 6);
- g2d.drawLine(4, 7, 10, 7);
-
- g2d.setColor(textColor);
- g2d.drawLine(4, 6, 10, 6);
- }
-
-}
Copied: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java (from rev 4061, trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java)
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,76 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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,
+ * 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+
+import org.ajax4jsf.resource.ResourceContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconBottom extends OrderingListIconBase {
+
+ protected void paintImage(ResourceContext context, Graphics2D g2d,
+ Color textColor, Color borderColor) {
+
+ g2d.translate(0, -3);
+
+ g2d.setColor(textColor);
+ g2d.translate(7, 5);
+ paintBaseTriangle(g2d);
+ g2d.translate(-7, -5);
+
+ g2d.setColor(borderColor);
+ g2d.drawLine(4, 5, 10, 5);
+ g2d.drawLine(11, 6, 8, 9);
+ g2d.drawLine(6, 9, 3, 6);
+
+ g2d.translate(0, 4);
+ g2d.setColor(textColor);
+ g2d.translate(7, 5);
+ paintBaseTriangle(g2d);
+ g2d.translate(-7, -5);
+
+ g2d.setColor(borderColor);
+ g2d.drawLine(4, 5, 6, 5);
+ g2d.drawLine(8, 5, 10, 5);
+ g2d.drawLine(11, 6, 8, 9);
+ g2d.drawLine(6, 9, 3, 6);
+
+ g2d.translate(0, 4);
+
+ g2d.setColor(borderColor);
+ g2d.drawLine(4, 5, 6, 5);
+ g2d.drawLine(8, 5, 10, 5);
+
+ g2d.drawLine(11, 6, 10, 7);
+ g2d.drawLine(4, 7, 3, 6);
+ g2d.drawLine(4, 7, 10, 7);
+
+ g2d.setColor(textColor);
+ g2d.drawLine(4, 6, 10, 6);
+ }
+
+}
Deleted: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,35 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * 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,
- * 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.html.images;
-
-import javax.faces.context.FacesContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconBottomDisabled extends OrderingListIconBottom {
- @Override
- protected Object getDataToStore(FacesContext context, Object data) {
- return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR, DISABLED_BORDER_COLOR);
- }
-}
Copied: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java (from rev 4061, trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java)
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,34 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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,
+ * 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconBottomDisabled extends OrderingListIconBottom {
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR, DISABLED_BORDER_COLOR);
+ }
+}
Deleted: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,50 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * 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,
- * 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.html.images;
-
-import java.awt.Color;
-import java.awt.Graphics2D;
-
-import org.ajax4jsf.resource.ResourceContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconDown extends OrderingListIconBase {
-
- @Override
- protected void paintImage(ResourceContext context, Graphics2D g2d,
- Color textColor, Color borderColor) {
-
- g2d.setColor(textColor);
- g2d.translate(7, 5);
- paintBaseTriangle(g2d);
- g2d.translate(-7, -5);
-
- g2d.setColor(borderColor);
- g2d.drawLine(4, 5, 10, 5);
- g2d.drawLine(11, 6, 7, 10);
- g2d.drawLine(7, 10, 3, 6);
- }
-
-}
Copied: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java (from rev 4061, trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java)
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,49 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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,
+ * 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+
+import org.ajax4jsf.resource.ResourceContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconDown extends OrderingListIconBase {
+
+ protected void paintImage(ResourceContext context, Graphics2D g2d,
+ Color textColor, Color borderColor) {
+
+ g2d.setColor(textColor);
+ g2d.translate(7, 5);
+ paintBaseTriangle(g2d);
+ g2d.translate(-7, -5);
+
+ g2d.setColor(borderColor);
+ g2d.drawLine(4, 5, 10, 5);
+ g2d.drawLine(11, 6, 7, 10);
+ g2d.drawLine(7, 10, 3, 6);
+ }
+
+}
Deleted: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,35 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * 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,
- * 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.html.images;
-
-import javax.faces.context.FacesContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconDownDisabled extends OrderingListIconDown {
- @Override
- protected Object getDataToStore(FacesContext context, Object data) {
- return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR, DISABLED_BORDER_COLOR);
- }
-}
Copied: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java (from rev 4061, trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java)
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,34 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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,
+ * 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconDownDisabled extends OrderingListIconDown {
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR, DISABLED_BORDER_COLOR);
+ }
+}
Deleted: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,45 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * 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,
- * 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.html.images;
-
-import java.awt.Color;
-import java.awt.Graphics2D;
-
-import org.ajax4jsf.resource.ResourceContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconTop extends OrderingListIconBottom {
-
- @Override
- protected void paintImage(ResourceContext context, Graphics2D g2d,
- Color textColor, Color borderColor) {
-
- g2d.translate(0, 14);
- g2d.scale(1, -1);
-
- super.paintImage(context, g2d, textColor, borderColor);
- }
-
-}
Copied: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java (from rev 4061, trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java)
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,44 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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,
+ * 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+
+import org.ajax4jsf.resource.ResourceContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconTop extends OrderingListIconBottom {
+
+ protected void paintImage(ResourceContext context, Graphics2D g2d,
+ Color textColor, Color borderColor) {
+
+ g2d.translate(0, 14);
+ g2d.scale(1, -1);
+
+ super.paintImage(context, g2d, textColor, borderColor);
+ }
+
+}
Deleted: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,35 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * 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,
- * 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.html.images;
-
-import javax.faces.context.FacesContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconTopDisabled extends OrderingListIconTop {
- @Override
- protected Object getDataToStore(FacesContext context, Object data) {
- return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR, DISABLED_BORDER_COLOR);
- }
-}
Copied: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java (from rev 4061, trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java)
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,34 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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,
+ * 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconTopDisabled extends OrderingListIconTop {
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR, DISABLED_BORDER_COLOR);
+ }
+}
Deleted: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,45 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * 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,
- * 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.html.images;
-
-import java.awt.Color;
-import java.awt.Graphics2D;
-
-import org.ajax4jsf.resource.ResourceContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconUp extends OrderingListIconDown {
-
- @Override
- protected void paintImage(ResourceContext context, Graphics2D g2d,
- Color textColor, Color borderColor) {
-
- g2d.translate(0, 14);
- g2d.scale(1, -1);
-
- super.paintImage(context, g2d, textColor, borderColor);
- }
-
-}
Copied: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java (from rev 4061, trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java)
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,44 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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,
+ * 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+
+import org.ajax4jsf.resource.ResourceContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconUp extends OrderingListIconDown {
+
+ protected void paintImage(ResourceContext context, Graphics2D g2d,
+ Color textColor, Color borderColor) {
+
+ g2d.translate(0, 14);
+ g2d.scale(1, -1);
+
+ super.paintImage(context, g2d, textColor, borderColor);
+ }
+
+}
Deleted: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -1,35 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * 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,
- * 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 library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.html.images;
-
-import javax.faces.context.FacesContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconUpDisabled extends OrderingListIconUp {
- @Override
- protected Object getDataToStore(FacesContext context, Object data) {
- return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR, DISABLED_BORDER_COLOR);
- }
-}
Copied: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java (from rev 4061, trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java)
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java (rev 0)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java 2007-11-17 00:17:48 UTC (rev 4063)
@@ -0,0 +1,34 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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,
+ * 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.images;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconUpDisabled extends OrderingListIconUp {
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR, DISABLED_BORDER_COLOR);
+ }
+}
Modified: branches/3.1.x/ui/pom.xml
===================================================================
--- branches/3.1.x/ui/pom.xml 2007-11-17 00:08:52 UTC (rev 4062)
+++ branches/3.1.x/ui/pom.xml 2007-11-17 00:17:48 UTC (rev 4063)
@@ -89,6 +89,7 @@
<module>message</module>
<module>scrollableDataTable</module>
<module>componentControl</module>
+ <module>orderingList</module>
<module>insert</module>
</modules>
<dependencies>
18 years, 5 months
JBoss Rich Faces SVN: r4062 - in trunk/sandbox/samples/orderingListDemo: src/main/java/org/richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-16 19:08:52 -0500 (Fri, 16 Nov 2007)
New Revision: 4062
Modified:
trunk/sandbox/samples/orderingListDemo/pom.xml
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java
trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp
Log:
orderingList is ready for 3.1.x
Modified: trunk/sandbox/samples/orderingListDemo/pom.xml
===================================================================
--- trunk/sandbox/samples/orderingListDemo/pom.xml 2007-11-17 00:08:44 UTC (rev 4061)
+++ trunk/sandbox/samples/orderingListDemo/pom.xml 2007-11-17 00:08:52 UTC (rev 4062)
@@ -2,11 +2,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>samples</artifactId>
- <groupId>org.richfaces.sandbox</groupId>
- <version>3.2.0-SNAPSHOT</version>
+ <groupId>org.richfaces</groupId>
+ <version>3.1.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.sandbox.samples</groupId>
+ <groupId>org.richfaces.samples</groupId>
<artifactId>orderingListDemo</artifactId>
<packaging>war</packaging>
<name>orderingListDemo Maven Webapp</name>
@@ -15,14 +15,14 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces.sandbox.ui</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>orderingList</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.1.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.richfaces.samples</groupId>
<artifactId>skins</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.1.3-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Modified: trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java 2007-11-17 00:08:44 UTC (rev 4061)
+++ trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java 2007-11-17 00:08:52 UTC (rev 4062)
@@ -40,7 +40,7 @@
*
*/
public class Bean {
- private List<OrderingListDemoBean> lists = new ArrayList<OrderingListDemoBean>();
+ private List lists = new ArrayList();
private String [] simpleItems = new String [] {
"First", "Second", "Third", "Fourth"
};
@@ -142,11 +142,11 @@
}
}
- public List<OrderingListDemoBean> getLists() {
+ public List getLists() {
return lists;
}
- public void setLists(List<OrderingListDemoBean> lists) {
+ public void setLists(List lists) {
this.lists = lists;
}
Modified: trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java 2007-11-17 00:08:44 UTC (rev 4061)
+++ trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OptionItem.java 2007-11-17 00:08:52 UTC (rev 4062)
@@ -32,7 +32,6 @@
return null;
}
- @Override
public String toString() {
return this.getClass().getSimpleName() + " [" + name + "] by " + price;
}
Modified: trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java 2007-11-17 00:08:44 UTC (rev 4061)
+++ trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/OrderingListDemoBean.java 2007-11-17 00:08:52 UTC (rev 4062)
@@ -8,7 +8,7 @@
public class OrderingListDemoBean {
- private List<OptionItem> items = new ArrayList<OptionItem>();
+ private List items = new ArrayList();
private String controlsType = "link";
private String controlsHorizontalAlign = "right";
@@ -27,11 +27,11 @@
}
}
- public void setItems(List<OptionItem> items) {
+ public void setItems(List items) {
this.items = items;
}
- public List<OptionItem> getItems() {
+ public List getItems() {
return items;
}
Modified: trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-17 00:08:44 UTC (rev 4061)
+++ trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-17 00:08:52 UTC (rev 4062)
@@ -2,7 +2,7 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
-<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/ui/orderingList" prefix="ol" %>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/orderingList" prefix="ol" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
<html>
@@ -53,7 +53,7 @@
ondownclick="new Effect.Highlight('form:ondownclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
onheaderclick="new Effect.Highlight('form:onheaderclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
onupclick="new Effect.Highlight('form:onupclickDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});" >
-
+
<h:column>
<f:facet name="header">
<h:outputText value="Name" />
18 years, 5 months
JBoss Rich Faces SVN: r4061 - in trunk/sandbox/ui/orderingList: src/main/config/component and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-16 19:08:44 -0500 (Fri, 16 Nov 2007)
New Revision: 4061
Modified:
trunk/sandbox/ui/orderingList/pom.xml
trunk/sandbox/ui/orderingList/src/main/config/component/orderinglist.xml
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java
Log:
orderingList is ready for 3.1.x
Modified: trunk/sandbox/ui/orderingList/pom.xml
===================================================================
--- trunk/sandbox/ui/orderingList/pom.xml 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/pom.xml 2007-11-17 00:08:44 UTC (rev 4061)
@@ -2,11 +2,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>ui</artifactId>
- <groupId>org.richfaces.sandbox</groupId>
- <version>3.2.0-SNAPSHOT</version>
+ <groupId>org.richfaces</groupId>
+ <version>3.1.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.sandbox.ui</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>orderingList</artifactId>
<name>orderingList</name>
<build>
@@ -14,7 +14,7 @@
<plugin>
<groupId>org.richfaces.cdk</groupId>
<artifactId>maven-cdk-plugin</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.1.3-SNAPSHOT</version>
<executions>
<execution>
<phase>generate-sources</phase>
Modified: trunk/sandbox/ui/orderingList/src/main/config/component/orderinglist.xml
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/config/component/orderinglist.xml 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/src/main/config/component/orderinglist.xml 2007-11-17 00:08:44 UTC (rev 4061)
@@ -38,13 +38,31 @@
</description>
</property>
<property>
- <name>label</name>
- <classname>java.lang.Boolean</classname>
+ <name>showButtonLabels</name>
+ <classname>boolean</classname>
<description>
</description>
<defaultvalue><![CDATA[true]]></defaultvalue>
</property>
+
<property>
+ <name>topControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>upControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>downControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>bottomControlLabel</name>
+ <classname>java.lang.String</classname>
+ </property>
+
+ <property>
<name>listWidth</name>
<classname>int</classname>
<description>
@@ -96,7 +114,7 @@
<name>controlsType</name>
<classname>java.lang.String</classname>
<description>
- Defines type of a control: button, link or none.
+ Defines type of a control: button or none.
</description>
<defaultvalue><![CDATA["button"]]></defaultvalue>
</property>
@@ -182,7 +200,7 @@
<property elonly="true">
<name>validator</name>
<classname>javax.faces.el.MethodBinding</classname>
- <methodargs>javax.faces.event.ValueChangeEvent</methodargs>
+ <methodargs>java.lang.Object.class</methodargs>
</property>
<property>
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2007-11-17 00:08:44 UTC (rev 4061)
@@ -6,6 +6,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIColumn;
@@ -145,8 +146,9 @@
}
protected Iterator fixedChildren() {
- if (getFacetCount() != 0) {
- return getFacets().values().iterator();
+ Map facets = getFacets();
+ if (facets != null) {
+ return facets.values().iterator();
} else {
return EmptyIterator.INSTANCE;
}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-17 00:08:44 UTC (rev 4061)
@@ -28,7 +28,9 @@
import javax.faces.event.FacesEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.event.ValueChangeListener;
+import javax.faces.model.ArrayDataModel;
import javax.faces.model.DataModel;
+import javax.faces.model.ListDataModel;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
@@ -155,7 +157,18 @@
}
protected ExtendedDataModel createDataModel() {
- DataModel dataModel = super.getDataModel();
+ DataModel dataModel;
+ Object current = getValue();
+ if (current == null) {
+ dataModel = new ListDataModel(Collections.EMPTY_LIST);
+ } else if (current instanceof List) {
+ dataModel = new ListDataModel((List) current);
+ } else if (Object[].class.isAssignableFrom(current.getClass())) {
+ dataModel = new ArrayDataModel((Object[]) current);
+ } else {
+ throw new IllegalArgumentException();
+ }
+
if (isTranslatedRenderingState() || isTranslatedState()) {
return new TranslatedSequenceDataModel(dataModel, isTranslatedState(), submittedValueHolder != null ? submittedValueHolder.permutationOrder : null);
} else {
@@ -741,7 +754,6 @@
return convertedValue;
}
- @Override
protected void resetDataModel() {
super.resetDataModel();
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-17 00:08:44 UTC (rev 4061)
@@ -1,8 +1,6 @@
package org.richfaces.renderkit;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
@@ -32,9 +30,9 @@
private static final String MESSAGE_BUNDLE_NAME = OrderingListRendererBase.class.getPackage().getName() + "OrderingList";
- private final static Character ACTIVITY_MARKER = 'a';
+ private final static Character ACTIVITY_MARKER = new Character('a');
- private final static Character SELECTION_MARKER = 's';
+ private final static Character SELECTION_MARKER = new Character('s');
private final static String ITEM_SEPARATOR = ",";
@@ -62,7 +60,7 @@
private final static String CONTROL_TYPE_NONE = "none";
- private final static String ATTRIBUTE_LABEL = "label";
+ private final static String SHOW_LABELS_ATTRIBUTE_NAME = "showButtonLabels";
private final static String ATTRIBUTE_CONTROLS_TYPE = "controlsType";
@@ -133,11 +131,13 @@
private String defaultText;
+ private String labelAttributeName;
+
public abstract boolean isRendered(FacesContext context, UIOrderingList list);
public ControlsHelper(String name, String bundlePropertyName, String defaultText, String imageURI,
String facetName, String styleClassName, String styleFromAttribute, String buttonStyleClass,
- String idSuffix, String customEvent, boolean isEnable) {
+ String idSuffix, String customEvent, boolean isEnable, String labelAttributeName) {
super();
this.name = name;
this.bundlePropertyName = bundlePropertyName;
@@ -150,6 +150,7 @@
this.customEvent = customEvent;
this.buttonStyleClass = buttonStyleClass;
this.enable = isEnable;
+ this.labelAttributeName = labelAttributeName;
}
public String getName() {
@@ -195,12 +196,16 @@
public String getDefaultText() {
return defaultText;
}
+
+ public String getLabelAttributeName() {
+ return labelAttributeName;
+ }
};
protected static final ControlsHelper[] HELPERS = new ControlsHelper[] {
new ControlsHelper("top", "TOP_LABEL", DEFAULT_LABEL_TOP, OrderingListIconTop.class.getName(), FACET_TOP,
" rich-ordering-control-top", ATTRIBUTE_CLASS_TOP_CONTROL, ATTRIBUTE_CLASS_BUTTON,
- CONTROL_ID_TOP, ATTRIBUTE_CE_ONTOPCLICK, true) {
+ CONTROL_ID_TOP, ATTRIBUTE_CE_ONTOPCLICK, true, "topControlLabel") {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isFastOrderControlsVisible();
@@ -209,7 +214,7 @@
},
new ControlsHelper("disabledTop", "TOP_LABEL", DEFAULT_LABEL_TOP, OrderingListIconTopDisabled.class.getName(), FACET_DIS_TOP,
" rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_TOP), null, false) {
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_TOP), null, false, "topControlLabel") {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isFastOrderControlsVisible();
@@ -218,7 +223,7 @@
},
new ControlsHelper("up", "UP_LABEL", DEFAULT_LABEL_UP, OrderingListIconUp.class.getName(), FACET_UP,
" rich-ordering-control-up", ATTRIBUTE_CLASS_UP_CONTROL, ATTRIBUTE_CLASS_BUTTON,
- CONTROL_ID_UP, ATTRIBUTE_CE_ONUPCLICK ,true) {
+ CONTROL_ID_UP, ATTRIBUTE_CE_ONUPCLICK ,true, "upControlLabel") {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isOrderControlsVisible();
@@ -227,7 +232,7 @@
},
new ControlsHelper("disabledUp", "UP_LABEL", DEFAULT_LABEL_UP, OrderingListIconUpDisabled.class.getName(), FACET_DIS_UP,
" rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_UP), null, false) {
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_UP), null, false, "upControlLabel") {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isOrderControlsVisible();
@@ -236,7 +241,7 @@
},
new ControlsHelper("down", "DOWN_LABEL", DEFAULT_LABEL_DOWN, OrderingListIconDown.class.getName(), FACET_DOWN,
" rich-ordering-control-down", ATTRIBUTE_CLASS_DOWN_CONTROL, ATTRIBUTE_CLASS_BUTTON,
- CONTROL_ID_DOWN, ATTRIBUTE_CE_ONDOWNCLICK, true) {
+ CONTROL_ID_DOWN, ATTRIBUTE_CE_ONDOWNCLICK, true, "downControlLabel") {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isFastOrderControlsVisible();
@@ -245,7 +250,7 @@
},
new ControlsHelper("disabledDown", "DOWN_LABEL", DEFAULT_LABEL_DOWN, OrderingListIconDownDisabled.class.getName(), FACET_DIS_DOWN,
" rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_DOWN), null, false) {
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_DOWN), null, false, "downControlLabel") {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isFastOrderControlsVisible();
@@ -254,7 +259,7 @@
},
new ControlsHelper("bottom", "BOTTOM_LABEL", DEFAULT_LABEL_BOTTOM, OrderingListIconBottom.class.getName(), FACET_BOTTOM,
" rich-ordering-control-bottom", ATTRIBUTE_CLASS_BOTTOM_CONTROL, ATTRIBUTE_CLASS_BUTTON,
- CONTROL_ID_BOTTOM, ATTRIBUTE_CE_ONBOTTOMCLICK, true) {
+ CONTROL_ID_BOTTOM, ATTRIBUTE_CE_ONBOTTOMCLICK, true, "bottomControlLabel") {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isOrderControlsVisible();
@@ -263,7 +268,7 @@
},
new ControlsHelper("disabledBottom", "BOTTOM_LABEL", DEFAULT_LABEL_BOTTOM, OrderingListIconBottomDisabled.class.getName(), FACET_DIS_BOTTOM,
" rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_BOTTOM), null, false) {
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_BOTTOM), null, false, "bottomControlLabel") {
public boolean isRendered(FacesContext context, UIOrderingList list) {
return list.isOrderControlsVisible();
@@ -319,7 +324,7 @@
writer.endElement("thead");
}
- private static final ThreadLocal<ItemState> itemStates = new ThreadLocal<ItemState>();
+ private static final ThreadLocal itemStates = new ThreadLocal();
public void encodeBegin(FacesContext context, UIComponent component)
throws IOException {
@@ -346,7 +351,7 @@
boolean selectedLast = false;
try {
- ItemState state = itemStates.get();
+ ItemState state = (ItemState) itemStates.get();
orderingList.setRowKey(new Integer(0));
selectedFirst = state.isSelected();
@@ -417,7 +422,6 @@
UIOrderingList orderingList, ResponseWriter writer,
boolean useFacet, ControlsHelper helper, String clientId, ResourceBundle bundle, boolean enabled)
throws IOException {
- String htmlElem = HTML.a_ELEMENT;
UIComponent facet = orderingList.getFacet(helper.getFacetName());
String customEvent = null;
Map attributes = orderingList.getAttributes();
@@ -452,7 +456,6 @@
}
- writer.startElement(htmlElem, orderingList);
if (customEvent != null) {
writer.writeAttribute(HTML.onclick_ATTRIBUTE, customEvent,null);
}
@@ -471,10 +474,10 @@
writer.endElement(HTML.IMG_ELEMENT);
- if ((Boolean) attributes.get(ATTRIBUTE_LABEL)) {
- String label = null;
+ if (Boolean.TRUE.equals(attributes.get(SHOW_LABELS_ATTRIBUTE_NAME))) {
+ String label = (String) attributes.get(helper.getLabelAttributeName());
- if (bundle != null) {
+ if (label == null && bundle != null) {
try {
label = bundle.getString(helper.getBundlePropertyName());
} catch (MissingResourceException e) {
@@ -493,7 +496,6 @@
// helper.getIdSuffix(), null);
// writer.writeAttribute(HTML.class_ATTRIBUTE, currentStyle, null);
- writer.endElement(htmlElem);
if (!useFacet) {
writer.endElement(HTML.DIV_ELEM);
@@ -547,7 +549,7 @@
StringBuffer rowClassName = new StringBuffer("ol_normal rich-ordering-list-row");
StringBuffer cellClassName = new StringBuffer("ol_cell rich-ordering-list-cell");
- ItemState state = itemStates.get();
+ ItemState state = (ItemState) itemStates.get();
if (state.isActive()) {
rowClassName.append(" ol_active rich-ordering-list-row-active");
@@ -561,8 +563,10 @@
writer.writeAttribute("class", rowClassName.toString(), null);
- List<UIComponent> children = table.getChildren();
- for (UIComponent component : children) {
+ List children = table.getChildren();
+ for (Iterator iterator = children.iterator(); iterator.hasNext();) {
+ UIComponent component = (UIComponent) iterator.next();
+
if (component instanceof UIColumn && component.isRendered()) {
UIColumn column = (UIColumn) component;
@@ -612,39 +616,4 @@
orderingList.setSubmittedString(valueOrder);
}
}
-
-
- private void valuesSynchronization(String[] valueOrder, List oldValues) {
- List synchronizedList = new ArrayList();
- List selectedItems = new ArrayList();
- Object activeItem = null;
- Integer itemIndex = null;
- String[] currentOrder;
-
- for (int i = 0; i < valueOrder.length; i++) {
- currentOrder = valueOrder[i].split("d+");
-
- try {
- itemIndex = new Integer(currentOrder[0]);
- } catch (NumberFormatException e) {
- // TODO: handle exception
- }
-
- Object currentItem = oldValues.get(itemIndex.intValue());
- synchronizedList.add(currentItem);
-
- if (currentOrder.length > 1) {
- Iterator it = Arrays.asList(currentOrder[1].toCharArray()).iterator();
- while (it.hasNext()) {
- Character marker = (Character) it.next();
- if (ACTIVITY_MARKER.equals(marker)) {
- activeItem = currentItem;
- } else if (SELECTION_MARKER.equals(marker)) {
- selectedItems.add(currentItem);
- }
- }
- }
- }
- }
-
}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java 2007-11-17 00:08:44 UTC (rev 4061)
@@ -33,7 +33,6 @@
*
*/
public class OrderingListClickedGradient extends BaseGradient {
- @Override
protected void paint(ResourceContext resourceContext, Graphics2D g2d) {
g2d.transform(new AffineTransform(1., 0., 0., -1., 0., 15.));
super.paint(resourceContext, g2d);
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBase.java 2007-11-17 00:08:44 UTC (rev 4061)
@@ -105,7 +105,6 @@
/**
* @param data - pass icon color and background color
*/
- @Override
protected Object getDataToStore(FacesContext context, Object data) {
return storeData(context, ICON_COLOR, BACKGROUND_COLOR, BORDER_COLOR);
}
@@ -156,7 +155,6 @@
return ret;
}
- @Override
protected Object deserializeData(byte[] objectArray) {
if (objectArray == null) {
return null;
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java 2007-11-17 00:08:44 UTC (rev 4061)
@@ -32,7 +32,6 @@
*/
public class OrderingListIconBottom extends OrderingListIconBase {
- @Override
protected void paintImage(ResourceContext context, Graphics2D g2d,
Color textColor, Color borderColor) {
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java 2007-11-17 00:08:44 UTC (rev 4061)
@@ -28,7 +28,6 @@
*
*/
public class OrderingListIconBottomDisabled extends OrderingListIconBottom {
- @Override
protected Object getDataToStore(FacesContext context, Object data) {
return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR, DISABLED_BORDER_COLOR);
}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java 2007-11-17 00:08:44 UTC (rev 4061)
@@ -32,7 +32,6 @@
*/
public class OrderingListIconDown extends OrderingListIconBase {
- @Override
protected void paintImage(ResourceContext context, Graphics2D g2d,
Color textColor, Color borderColor) {
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java 2007-11-17 00:08:44 UTC (rev 4061)
@@ -28,7 +28,6 @@
*
*/
public class OrderingListIconDownDisabled extends OrderingListIconDown {
- @Override
protected Object getDataToStore(FacesContext context, Object data) {
return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR, DISABLED_BORDER_COLOR);
}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java 2007-11-17 00:08:44 UTC (rev 4061)
@@ -32,7 +32,6 @@
*/
public class OrderingListIconTop extends OrderingListIconBottom {
- @Override
protected void paintImage(ResourceContext context, Graphics2D g2d,
Color textColor, Color borderColor) {
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java 2007-11-17 00:08:44 UTC (rev 4061)
@@ -28,7 +28,6 @@
*
*/
public class OrderingListIconTopDisabled extends OrderingListIconTop {
- @Override
protected Object getDataToStore(FacesContext context, Object data) {
return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR, DISABLED_BORDER_COLOR);
}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java 2007-11-17 00:08:44 UTC (rev 4061)
@@ -32,7 +32,6 @@
*/
public class OrderingListIconUp extends OrderingListIconDown {
- @Override
protected void paintImage(ResourceContext context, Graphics2D g2d,
Color textColor, Color borderColor) {
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java 2007-11-16 23:26:09 UTC (rev 4060)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java 2007-11-17 00:08:44 UTC (rev 4061)
@@ -28,7 +28,6 @@
*
*/
public class OrderingListIconUpDisabled extends OrderingListIconUp {
- @Override
protected Object getDataToStore(FacesContext context, Object data) {
return storeData(context, DISABLED_ICON_COLOR, DISABLED_BACKGROUND_COLOR, DISABLED_BORDER_COLOR);
}
18 years, 5 months
JBoss Rich Faces SVN: r4059 - in trunk/sandbox/ui/orderingList/src/main: resources/org/richfaces/renderkit/html/css and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-11-16 16:03:35 -0500 (Fri, 16 Nov 2007)
New Revision: 4059
Modified:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss
Log:
Ordering list: cursor style for disabled buttons.
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-16 20:44:13 UTC (rev 4058)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-16 21:03:35 UTC (rev 4059)
@@ -107,6 +107,9 @@
private final static String DEFAULT_LABEL_DOWN = "Down";
private final static String DEFAULT_LABEL_BOTTOM = "Last";
+ private final static String ATTRIBUTE_CLASS_BUTTON = "ol_button";
+ private final static String ATTRIBUTE_CLASS_BUTTON_DISABLED = "ol_button_disabled";
+
protected static abstract class ControlsHelper {
private String name;
@@ -124,7 +127,7 @@
private String styleFromAttribute;
- private String buttonStyle;
+ private String buttonStyleClass;
private boolean enable;
@@ -133,7 +136,7 @@
public abstract boolean isRendered(FacesContext context, UIOrderingList list);
public ControlsHelper(String name, String bundlePropertyName, String defaultText, String imageURI,
- String facetName, String styleClassName, String styleFromAttribute, String buttonStyle,
+ String facetName, String styleClassName, String styleFromAttribute, String buttonStyleClass,
String idSuffix, String customEvent, boolean isEnable) {
super();
this.name = name;
@@ -145,7 +148,7 @@
this.styleFromAttribute = styleFromAttribute;
this.idSuffix = idSuffix;
this.customEvent = customEvent;
- this.buttonStyle = buttonStyle;
+ this.buttonStyleClass = buttonStyleClass;
this.enable = isEnable;
}
@@ -181,8 +184,8 @@
return styleFromAttribute;
}
- public String getButtonStyle() {
- return buttonStyle;
+ public String getButtonStyleClass() {
+ return buttonStyleClass;
}
public boolean isEnable() {
@@ -196,7 +199,7 @@
protected static final ControlsHelper[] HELPERS = new ControlsHelper[] {
new ControlsHelper("top", "TOP_LABEL", DEFAULT_LABEL_TOP, OrderingListIconTop.class.getName(), FACET_TOP,
- " rich-ordering-control-top", ATTRIBUTE_CLASS_TOP_CONTROL, "ol_control_bn_top",
+ " rich-ordering-control-top", ATTRIBUTE_CLASS_TOP_CONTROL, ATTRIBUTE_CLASS_BUTTON,
CONTROL_ID_TOP, ATTRIBUTE_CE_ONTOPCLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
@@ -205,7 +208,7 @@
},
new ControlsHelper("disabledTop", "TOP_LABEL", DEFAULT_LABEL_TOP, OrderingListIconTopDisabled.class.getName(), FACET_DIS_TOP,
- " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "ol_control_dbn_top",
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_TOP), null, false) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
@@ -214,7 +217,7 @@
},
new ControlsHelper("up", "UP_LABEL", DEFAULT_LABEL_UP, OrderingListIconUp.class.getName(), FACET_UP,
- " rich-ordering-control-up", ATTRIBUTE_CLASS_UP_CONTROL, "ol_control_bn_up",
+ " rich-ordering-control-up", ATTRIBUTE_CLASS_UP_CONTROL, ATTRIBUTE_CLASS_BUTTON,
CONTROL_ID_UP, ATTRIBUTE_CE_ONUPCLICK ,true) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
@@ -223,7 +226,7 @@
},
new ControlsHelper("disabledUp", "UP_LABEL", DEFAULT_LABEL_UP, OrderingListIconUpDisabled.class.getName(), FACET_DIS_UP,
- " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "ol_control_dbn_up",
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_UP), null, false) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
@@ -232,7 +235,7 @@
},
new ControlsHelper("down", "DOWN_LABEL", DEFAULT_LABEL_DOWN, OrderingListIconDown.class.getName(), FACET_DOWN,
- " rich-ordering-control-down", ATTRIBUTE_CLASS_DOWN_CONTROL, "ol_control_bn_down",
+ " rich-ordering-control-down", ATTRIBUTE_CLASS_DOWN_CONTROL, ATTRIBUTE_CLASS_BUTTON,
CONTROL_ID_DOWN, ATTRIBUTE_CE_ONDOWNCLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
@@ -241,7 +244,7 @@
},
new ControlsHelper("disabledDown", "DOWN_LABEL", DEFAULT_LABEL_DOWN, OrderingListIconDownDisabled.class.getName(), FACET_DIS_DOWN,
- " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "ol_control_dbn_down",
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_DOWN), null, false) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
@@ -250,7 +253,7 @@
},
new ControlsHelper("bottom", "BOTTOM_LABEL", DEFAULT_LABEL_BOTTOM, OrderingListIconBottom.class.getName(), FACET_BOTTOM,
- " rich-ordering-control-bottom", ATTRIBUTE_CLASS_BOTTOM_CONTROL, "ol_control_bn_bottom",
+ " rich-ordering-control-bottom", ATTRIBUTE_CLASS_BOTTOM_CONTROL, ATTRIBUTE_CLASS_BUTTON,
CONTROL_ID_BOTTOM, ATTRIBUTE_CE_ONBOTTOMCLICK, true) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
@@ -259,7 +262,7 @@
},
new ControlsHelper("disabledBottom", "BOTTOM_LABEL", DEFAULT_LABEL_BOTTOM, OrderingListIconBottomDisabled.class.getName(), FACET_DIS_BOTTOM,
- " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "ol_control_dbn_bottom",
+ " rich-ordering-control-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, ATTRIBUTE_CLASS_BUTTON_DISABLED,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_BOTTOM), null, false) {
public boolean isRendered(FacesContext context, UIOrderingList list) {
@@ -436,7 +439,7 @@
if (!useFacet) {
writer.startElement(HTML.DIV_ELEM, orderingList);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "ol_button", null);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, helper.getButtonStyleClass(), null);
if (helper.enable) {
writer.writeAttribute(HTML.onmouseover_ATTRIBUTE, "this.className='ol_button_light'", null);
writer.writeAttribute(HTML.onmousedown_ATTRIBUTE, "this.className='ol_button_press'", null);
Modified: trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2007-11-16 20:44:13 UTC (rev 4058)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/css/orderingList.xcss 2007-11-16 21:03:35 UTC (rev 4059)
@@ -8,7 +8,20 @@
.ol_button_layout{padding : 15px 8px 15px 0px;}
.ol_button_border{border : 1px solid #bfbfc0; margin-bottom : 3px;}
-.ol_button{background : top left #C6D6EA repeat-x; cursor : pointer; padding : 2px; font-family : Arial; font-size :11px;}
+
+.ol_button {
+ background : top left #C6D6EA repeat-x;
+ cursor : pointer;
+ padding : 2px;
+ font-family : Arial; font-size :11px;
+}
+
+.ol_button_disabled {
+ background : top left #C6D6EA repeat-x;
+ padding : 2px;
+ font-family : Arial; font-size :11px;
+}
+
.ol_button_light{background : top left #C6D6EA repeat-x; border : 1px solid #E79A00;cursor : pointer; padding : 1px; font-family : Arial; font-size :11px;}
.ol_button_dis{background : #bfbfc0; border : 1px solid #bfbfc0; margin-bottom : 3px; padding : 1px}
.ol_button_press{background : top left repeat-x #EAF0F8; border : 1px solid #E79A00; padding : 2px 0px 0px 2px;font-family : Arial; font-size :11px;}
@@ -178,6 +191,13 @@
<u:style name="background-color" skin="headerBackgroundColor" />
</u:selector>
+<u:selector name=".ol_button_disabled">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient" />
+ </u:style>
+ <u:style name="background-color" skin="headerBackgroundColor" />
+</u:selector>
+
<u:selector name=".ol_button_light">
<u:style name="background-image">
<f:resource f:key="org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient" />
18 years, 5 months
JBoss Rich Faces SVN: r4058 - trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-16 15:44:13 -0500 (Fri, 16 Nov 2007)
New Revision: 4058
Modified:
trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp
Log:
Latest changes for orderingList
Modified: trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-16 20:44:08 UTC (rev 4057)
+++ trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-16 20:44:13 UTC (rev 4058)
@@ -19,8 +19,9 @@
font-weight: bold;
}
- </style>
- <script type="text/javascript" src="scripts/effects.js"></script>
+ </style>
+
+ <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/effects.js"></script>
<title>Ordering List Demo.</title>
</head>
<body>
18 years, 5 months
JBoss Rich Faces SVN: r4057 - in trunk/sandbox/ui/orderingList/src/main/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-16 15:44:08 -0500 (Fri, 16 Nov 2007)
New Revision: 4057
Added:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
Modified:
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
Log:
Latest changes for orderingList
Added: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java (rev 0)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2007-11-16 20:44:08 UTC (rev 4057)
@@ -0,0 +1,239 @@
+/**
+ *
+ */
+package org.richfaces.component;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.ValueBinding;
+import javax.faces.validator.Validator;
+
+import org.ajax4jsf.component.UIDataAdaptor;
+import org.ajax4jsf.model.DataComponentState;
+import org.ajax4jsf.model.RepeatState;
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections.iterators.EmptyIterator;
+import org.apache.commons.collections.iterators.FilterIterator;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 16.11.2007
+ * @since 3.2
+ */
+public abstract class UIOrderingBaseComponent extends UIDataAdaptor implements EditableValueHolder {
+
+ private Object value;
+ private boolean localValueSet;
+
+ private List validators = null;
+ private MethodBinding validator;
+
+ public static final Predicate isColumn = new Predicate() {
+ public boolean evaluate(Object input) {
+ return (input instanceof UIColumn || input instanceof Column) &&
+ ((UIComponent) input).isRendered();
+ }
+ };
+
+
+ private static class EditableState {
+ private boolean translated = false;
+
+ //setting this flag to true means we should reorder elements
+ private boolean translatedRendering = false;
+ }
+
+ private static final class ValueHolder {
+ private Object value;
+ private Object state;
+ }
+
+ private transient EditableState editableState = new EditableState();
+
+ protected abstract void restoreIterationState(Object object);
+ protected abstract Object saveIterationState();
+
+ protected abstract void restoreIterationSubmittedState(Object object);
+ protected abstract Object saveIterationSubmittedState();
+
+ protected void setTranslatedState() {
+ this.editableState.translated = true;
+ }
+
+ protected boolean isTranslatedState() {
+ return this.editableState.translated;
+ }
+
+ protected void setTranslatedRenderingState() {
+ this.editableState.translatedRendering = true;
+ }
+
+ protected boolean isTranslatedRenderingState() {
+ return this.editableState.translatedRendering;
+ }
+
+ public final Object getSubmittedValue() {
+ Object[] state = new Object[2];
+
+ state[0] = saveIterationSubmittedState();
+ state[1] = editableState;
+
+ return state;
+ }
+
+ public final void setSubmittedValue(Object object) {
+ if (object != null) {
+ Object[] state = (Object[]) object;
+
+ restoreIterationSubmittedState(state[0]);
+ editableState = (EditableState) state[1];
+ } else {
+ restoreIterationSubmittedState(null);
+ }
+ }
+
+ public Object saveState(FacesContext faces) {
+ Object[] state = new Object[6];
+
+ state[0] = super.saveState(faces);
+ state[1] = saveIterationState();
+
+ state[2] = saveAttachedState(faces, validators);
+ state[3] = saveAttachedState(faces, validator);
+
+ state[4] = this.value;
+ state[5] = localValueSet ? Boolean.TRUE : Boolean.FALSE;
+
+ return state;
+ }
+
+ public void restoreState(FacesContext faces, Object object) {
+ Object[] state = (Object[]) object;
+
+ super.restoreState(faces, state[0]);
+ restoreIterationState(state[1]);
+
+ validators = (List) restoreAttachedState(faces, state[2]);
+ validator = (MethodBinding) restoreAttachedState(faces, state[3]);
+
+ value = state[4];
+ localValueSet = ((Boolean) state[5]).booleanValue();
+ }
+
+ protected DataComponentState createComponentState() {
+ return new RepeatState();
+ }
+
+ public Iterator columns() {
+ return new FilterIterator(getChildren().iterator(), isColumn);
+ }
+
+ protected Iterator dataChildren() {
+ if (getChildCount() != 0) {
+ return columns();
+ } else {
+ return EmptyIterator.INSTANCE;
+ }
+ }
+
+ protected Iterator fixedChildren() {
+ if (getFacetCount() != 0) {
+ return getFacets().values().iterator();
+ } else {
+ return EmptyIterator.INSTANCE;
+ }
+ }
+
+ //validators
+ public MethodBinding getValidator() {
+ return validator;
+ }
+
+ public void setValidator(MethodBinding validatorBinding) {
+ this.validator = validatorBinding;
+ }
+
+ public Validator[] getValidators() {
+
+ if (validators == null) {
+ return new Validator[0];
+ } else {
+ return (Validator[]) validators.toArray(new Validator[validators.size()]);
+ }
+ }
+
+ public void addValidator(Validator validator) {
+ if (validator == null) {
+ throw new NullPointerException();
+ }
+
+ if (validators == null) {
+ validators = new ArrayList();
+ }
+
+ validators.add(validator);
+ }
+
+ public void removeValidator(Validator validator) {
+ if (validators != null) {
+ validators.remove(validator);
+ }
+ }
+ //validators end
+
+ //value
+ protected Object getLocalValueFieldValue() {
+ return value;
+ }
+
+ public Object getLocalValue() {
+ ValueHolder valueHolder = new ValueHolder();
+ valueHolder.value = this.value;
+ valueHolder.state = saveIterationState();
+
+ return valueHolder;
+ }
+
+ public void setValue(Object value) {
+ if (value instanceof ValueHolder) {
+ ValueHolder holder = (ValueHolder) value;
+
+ setValue(holder.value);
+ restoreIterationState(holder.state);
+ } else {
+ super.setValue(value);
+ this.value = value;
+ setLocalValueSet(true);
+ }
+ }
+
+ public Object getValue() {
+ if (this.value != null) {
+ return (this.value);
+ }
+ ValueBinding ve = getValueBinding("value");
+ if (ve != null) {
+ return (ve.getValue(getFacesContext()));
+ } else {
+ return (null);
+ }
+ }
+ //value end
+
+ public boolean isLocalValueSet() {
+ return localValueSet;
+ }
+
+ public void setLocalValueSet(boolean localValueSet) {
+ this.localValueSet = localValueSet;
+ }
+
+}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-16 20:25:49 UTC (rev 4056)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java 2007-11-16 20:44:08 UTC (rev 4057)
@@ -15,8 +15,6 @@
import javax.faces.FacesException;
import javax.faces.application.FacesMessage;
-import javax.faces.component.EditableValueHolder;
-import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.component.UIInput;
@@ -30,34 +28,17 @@
import javax.faces.event.FacesEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.event.ValueChangeListener;
-import javax.faces.model.ArrayDataModel;
import javax.faces.model.DataModel;
-import javax.faces.model.ListDataModel;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
-import org.ajax4jsf.component.UIDataAdaptor;
import org.ajax4jsf.javascript.ScriptUtils;
-import org.ajax4jsf.model.DataComponentState;
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.model.RepeatState;
-import org.apache.commons.collections.Predicate;
-import org.apache.commons.collections.iterators.EmptyIterator;
-import org.apache.commons.collections.iterators.FilterIterator;
-public abstract class UIOrderingList extends UIDataAdaptor implements EditableValueHolder {
+public abstract class UIOrderingList extends UIOrderingBaseComponent {
- protected static class EditableState {
- private boolean isTranslated = false;
-
- //setting this flag to true means we should reorder elements
- private boolean translatedRendering = false;
- }
-
public static final class ValueHolder {
- private Object value;
-
private Collection selection;
private boolean selectionSet;
@@ -130,72 +111,66 @@
}
- public static final Predicate isColumn = new Predicate() {
- public boolean evaluate(Object input) {
- return (input instanceof UIColumn || input instanceof Column) &&
- ((UIComponent) input).isRendered();
+ public interface ItemState {
+ public boolean isSelected();
+ public boolean isActive();
+ }
+
+ private final class SubmittedItemState implements ItemState {
+ private Collection selectedItemsKeys;
+ private Object activeItemKey;
+
+ public SubmittedItemState(Collection selectedItemsKeys, Integer activeItemKey) {
+ super();
+ this.selectedItemsKeys = selectedItemsKeys;
+ this.activeItemKey = activeItemKey;
}
- };
- protected DataComponentState createComponentState() {
- return new RepeatState();
+ public boolean isActive() {
+ return activeItemKey != null && activeItemKey.equals(getTranslatedRowKey());
+ }
+
+ public boolean isSelected() {
+ return selectedItemsKeys != null && selectedItemsKeys.contains(getTranslatedRowKey());
+ }
}
+
+ private final class CommonItemState implements ItemState {
+ private Collection selectedItems;
+ private Object activeItem;
+
+ public CommonItemState(Collection selectedItems, Object activeItem) {
+ super();
+ this.selectedItems = selectedItems;
+ this.activeItem = activeItem;
+ }
- protected DataModel getDataModel(Object current) {
- if (current == null) {
- return new ListDataModel(Collections.EMPTY_LIST);
- } else if (current instanceof List) {
- return new ListDataModel((List) current);
- } else if (Object[].class.isAssignableFrom(current.getClass())) {
- //TODO scalar
- return new ArrayDataModel((Object[]) current);
- }
- throw new IllegalArgumentException();
- }
+ public boolean isSelected() {
+ return selectedItems != null && selectedItems.contains(getRowData());
+ }
+
+ public boolean isActive() {
+ return activeItem != null && activeItem.equals(getRowData());
+ }
+ }
protected ExtendedDataModel createDataModel() {
DataModel dataModel = super.getDataModel();
- if (editableState.translatedRendering || editableState.isTranslated) {
- return new TranslatedSequenceDataModel(dataModel, editableState.isTranslated, submittedValueHolder != null ? submittedValueHolder.permutationOrder : null);
+ if (isTranslatedRenderingState() || isTranslatedState()) {
+ return new TranslatedSequenceDataModel(dataModel, isTranslatedState(), submittedValueHolder != null ? submittedValueHolder.permutationOrder : null);
} else {
return new TranslatedSequenceDataModel(dataModel, false, null);
}
}
- protected Iterator dataChildren() {
- if (getChildCount() != 0) {
- return getChildren().iterator();
- } else {
- return EmptyIterator.INSTANCE;
- }
- }
- protected Iterator fixedChildren() {
- if (getFacetCount() != 0) {
- return getFacets().values().iterator();
- } else {
- return EmptyIterator.INSTANCE;
- }
- }
-
- public Iterator columns() {
- return new FilterIterator(getChildren().iterator(), isColumn);
- }
-
- private List validators = null;
- private MethodBinding validator;
-
- private Object value;
- private boolean localValueSet;
-
- private Collection selection;
+ private Collection localSelection;
private boolean localSelectionSet;
- private Object activeItem;
+ private Object localActiveItem;
private boolean localActiveItemSet;
private transient SubmittedValue submittedValueHolder = null;
- private transient EditableState editableState = new EditableState();
private void convertState(FacesContext faces) {
final HashSet selectionItemsSet = new HashSet();
@@ -208,12 +183,12 @@
dataModel.setRowKey(rowKey);
- if (selection != null && selection.contains(rowKey)) {
+ if (localSelection != null && localSelection.contains(rowKey)) {
selectionItemsSet.add(getRowData());
}
- if (rowKey.equals(activeItem)) {
- activeItem = getRowData();
+ if (rowKey.equals(localActiveItem)) {
+ localActiveItem = getRowData();
}
}
@@ -223,39 +198,29 @@
e.printStackTrace();
}
- if (this.selection != null) {
- this.selection = selectionItemsSet;
+ if (this.localSelection != null) {
+ this.localSelection = selectionItemsSet;
}
}
public void restoreState(FacesContext faces, Object object) {
final Object[] state = (Object[]) object;
super.restoreState(faces, state[0]);
- validators = (List) restoreAttachedState(faces, state[1]);
- validator = (MethodBinding) restoreAttachedState(faces, state[2]);
- value = state[3];
- localValueSet = ((Boolean) state[4]).booleanValue();
-
- localSelectionSet = ((Boolean) state[5]).booleanValue();
- localActiveItemSet = ((Boolean) state[6]).booleanValue();
+ localSelectionSet = ((Boolean) state[3]).booleanValue();
+ localActiveItemSet = ((Boolean) state[4]).booleanValue();
- selection = (Collection) state[7];
- activeItem = state[8];
+ localSelection = (Collection) state[5];
+ localActiveItem = state[6];
}
public Object saveState(FacesContext faces) {
- Object[] state = new Object[9];
+ Object[] state = new Object[7];
state[0] = super.saveState(faces);
- state[1] = saveAttachedState(faces, validators);
- state[2] = saveAttachedState(faces, validator);
- state[3] = value;
- state[4] = localValueSet ? Boolean.TRUE : Boolean.FALSE;
+ state[3] = localSelectionSet ? Boolean.TRUE : Boolean.FALSE;
+ state[4] = localActiveItemSet ? Boolean.TRUE : Boolean.FALSE;
- state[5] = localSelectionSet ? Boolean.TRUE : Boolean.FALSE;
- state[6] = localActiveItemSet ? Boolean.TRUE : Boolean.FALSE;
-
final HashSet selectionKeySet = new HashSet();
final HashSet activeItemSet = new HashSet(1);
@@ -268,11 +233,11 @@
dataModel.setRowKey(rowKey);
Object data = dataModel.getRowData();
- if (data.equals(activeItem)) {
+ if (data.equals(localActiveItem)) {
activeItemSet.add(getTranslatedRowKey());
}
- if (selection != null && selection.contains(data)) {
+ if (localSelection != null && localSelection.contains(data)) {
selectionKeySet.add(getTranslatedRowKey());
}
@@ -284,41 +249,18 @@
e.printStackTrace();
}
- state[7] = selectionKeySet;
+ state[5] = selectionKeySet;
- state[8] = activeItemSet.isEmpty() ? null : activeItemSet.iterator().next();
+ state[6] = activeItemSet.isEmpty() ? null : activeItemSet.iterator().next();
return state;
}
- public void addValidator(Validator validator) {
- if (validator == null) {
- throw new NullPointerException();
- }
-
- if (validators == null) {
- validators = new ArrayList();
- }
-
- validators.add(validator);
- }
-
public void addValueChangeListener(ValueChangeListener listener) {
addFacesListener(listener);
}
- public MethodBinding getValidator() {
- return validator;
- }
- public Validator[] getValidators() {
- if (validators == null) {
- return new Validator[0];
- } else {
- return (Validator[]) validators.toArray(new Validator[validators.size()]);
- }
- }
-
public abstract MethodBinding getValueChangeListener();
public ValueChangeListener[] getValueChangeListeners() {
@@ -327,23 +269,10 @@
public abstract boolean isImmediate();
- public boolean isLocalValueSet() {
- return localValueSet;
- }
-
- public void setLocalValueSet(boolean localValueSet) {
- this.localValueSet = localValueSet;
- }
-
public abstract boolean isRequired();
public abstract boolean isValid();
- public void removeValidator(Validator validator) {
- if (validators != null) {
- validators.remove(validator);
- }
- }
public void removeValueChangeListener(ValueChangeListener listener) {
removeFacesListener(listener);
@@ -358,80 +287,48 @@
this.submittedValueHolder = new SubmittedValue(submittedString);
}
- public Object getSubmittedValue() {
- return new Object[] { submittedValueHolder, editableState };
+ protected Object saveIterationSubmittedState() {
+ return submittedValueHolder;
}
- public void setSubmittedValue(Object submittedValue) {
- if (submittedValue != null) {
- Object[] values = (Object[]) submittedValue;
-
- this.submittedValueHolder = (SubmittedValue) values[0];
- this.editableState = (EditableState) values[1];
- } else {
- this.submittedValueHolder = null;
- }
+ protected void restoreIterationSubmittedState(Object object) {
+ this.submittedValueHolder = (SubmittedValue) object;
}
+
+ protected Object saveIterationState() {
+ ValueHolder holder = new ValueHolder();
+ holder.selection = localSelection;
+ holder.selectionSet = localSelectionSet;
+
+ holder.activeItem = localActiveItem;
+ holder.activeItemSet = localActiveItemSet;
+
+ return holder;
+ }
+
+ protected void restoreIterationState(Object object) {
+ ValueHolder holder = (ValueHolder) object;
+
+ this.localSelection = holder.selection;
+ this.localSelectionSet = holder.selectionSet;
+
+ this.localActiveItem = holder.activeItem;
+ this.localActiveItemSet = holder.activeItemSet;
+ }
+
public abstract void setImmediate(boolean immediate);
public abstract void setRequired(boolean required);
public abstract void setValid(boolean valid);
- public void setValidator(MethodBinding validatorBinding) {
- this.validator = validatorBinding;
- }
-
public abstract void setValueChangeListener(MethodBinding valueChangeMethod);
public abstract Converter getConverter();
public abstract void setConverter(Converter converter);
-
- public Object getLocalValue() {
- ValueHolder holder = new ValueHolder();
- holder.value = value;
-
- holder.selection = selection;
- holder.selectionSet = localSelectionSet;
-
- holder.activeItem = activeItem;
- holder.activeItemSet = localActiveItemSet;
- return holder;
- }
-
- public void setValue(Object value) {
- if (value instanceof ValueHolder) {
- ValueHolder holder = (ValueHolder) value;
-
- setValue(holder.value);
-
- this.selection = holder.selection;
- this.localSelectionSet = holder.selectionSet;
-
- this.activeItem = holder.activeItem;
- this.localActiveItemSet = holder.activeItemSet;
- } else {
- super.setValue(value);
- this.value = value;
- setLocalValueSet(true);
- }
- }
-
- public Object getValue() {
- if (this.value != null) {
- return (this.value);
- }
- ValueBinding ve = getValueBinding("value");
- if (ve != null) {
- return (ve.getValue(getFacesContext()));
- } else {
- return (null);
- }
- }
-
/**
* <p>Specialized decode behavior on top of that provided by the
* superclass. In addition to the standard
@@ -583,8 +480,7 @@
if (isLocalValueSet()) {
ValueBinding vb = getValueBinding("value");
if (vb != null) {
- ValueHolder localValue = (ValueHolder) getLocalValue();
- vb.setValue(context, localValue.value);
+ vb.setValue(context, getLocalValueFieldValue());
setValue(null);
setLocalValueSet(false);
}
@@ -596,13 +492,12 @@
private final UpdateModelCommand updateSelectionCommand = new UpdateModelCommand() {
public void execute(FacesContext context) {
- ValueHolder localValue = (ValueHolder) getLocalValue();
- if (localValue.selectionSet) {
+ if (localSelectionSet) {
ValueBinding vb = getValueBinding("selection");
if (vb != null) {
- vb.setValue(context, localValue.selection);
- localValue.selection = null;
- localValue.selectionSet = false;
+ vb.setValue(context, localSelection);
+ localSelection = null;
+ localSelectionSet = false;
}
}
}
@@ -612,13 +507,12 @@
private final UpdateModelCommand updateActiveItemCommand = new UpdateModelCommand() {
public void execute(FacesContext context) {
- ValueHolder localValue = (ValueHolder) getLocalValue();
- if (localValue.activeItemSet) {
+ if (localActiveItemSet) {
ValueBinding vb = getValueBinding("activeItem");
if (vb != null) {
- vb.setValue(context, localValue.activeItem);
- localValue.activeItem = null;
- localValue.activeItemSet = false;
+ vb.setValue(context, localActiveItem);
+ localActiveItem = null;
+ localActiveItemSet = false;
}
}
}
@@ -800,7 +694,7 @@
Object previous = getValue();
setValue(newValue);
- this.editableState.isTranslated = true;
+ setTranslatedState();
//setSubmittedValue(null);
if (compareValues(previous, newValue)) {
queueEvent(new ValueChangeEvent(this, previous, newValue));
@@ -852,7 +746,7 @@
super.resetDataModel();
if (this.submittedValueHolder != null) {
- this.editableState.translatedRendering = true;
+ setTranslatedRenderingState();
}
}
@@ -900,25 +794,25 @@
// If our value is valid and not empty, call all validators
if (isValid() && !isEmpty(newValue)) {
- if (this.validators != null) {
- Iterator validators = this.validators.iterator();
- while (validators.hasNext()) {
- Validator validator = (Validator) validators.next();
- try {
- validator.validate(context, this, newValue);
+ Validator[] validators = getValidators();
+ for (int i = 0; i < validators.length; i++) {
+ Validator validator = (Validator) validators[i];
+ try {
+ validator.validate(context, this, newValue);
+ }
+ catch (ValidatorException ve) {
+ // If the validator throws an exception, we're
+ // invalid, and we need to add a message
+ setValid(false);
+ FacesMessage message = ve.getFacesMessage();
+ if (message != null) {
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
}
- catch (ValidatorException ve) {
- // If the validator throws an exception, we're
- // invalid, and we need to add a message
- setValid(false);
- FacesMessage message = ve.getFacesMessage();
- if (message != null) {
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- context.addMessage(getClientId(context), message);
- }
- }
}
}
+
+ MethodBinding validator = getValidator();
if (validator != null) {
try {
validator.invoke(context,
@@ -1030,7 +924,7 @@
public String getElementsOrder() {
Object order = null;
- if (this.editableState.translatedRendering) {
+ if (isTranslatedRenderingState()) {
if (this.submittedValueHolder != null) {
order = this.submittedValueHolder.permutationOrder;
}
@@ -1039,21 +933,21 @@
return ScriptUtils.toScript(order);
}
- public boolean isActive() {
- return activeItem != null && activeItem.equals(getRowData()) || submittedValueHolder != null && (submittedValueHolder.activeItem != null && submittedValueHolder.activeItem.equals(getTranslatedRowKey()));
- }
-
public int getModelSize() {
return getExtendedDataModel().getRowCount();
}
-
- public boolean isSelected() {
- return selection != null && selection.contains(getRowData()) || submittedValueHolder != null && submittedValueHolder.selectedItems.contains(getTranslatedRowKey());
+
+ public ItemState getItemState() {
+ if (submittedValueHolder != null) {
+ return new SubmittedItemState(submittedValueHolder.selectedItems, submittedValueHolder.activeItem);
+ } else {
+ return new CommonItemState(getSelection(), getActiveItem());
+ }
}
public Collection getSelection() {
- if (this.selection != null) {
- return this.selection;
+ if (this.localSelection != null) {
+ return this.localSelection;
} else {
ValueBinding vb = getValueBinding("selection");
if (vb != null) {
@@ -1065,13 +959,13 @@
}
public void setSelection(Collection collection) {
- this.selection = collection;
+ this.localSelection = collection;
this.localSelectionSet = true;
}
public Object getActiveItem() {
- if (this.activeItem != null) {
- return this.activeItem;
+ if (this.localActiveItem != null) {
+ return this.localActiveItem;
} else {
ValueBinding vb = getValueBinding("activeItem");
if (vb != null) {
@@ -1083,7 +977,7 @@
}
public void setActiveItem(Object activeItem) {
- this.activeItem = activeItem;
+ this.localActiveItem = activeItem;
this.localActiveItemSet = true;
}
Modified: trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-16 20:25:49 UTC (rev 4056)
+++ trunk/sandbox/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingListRendererBase.java 2007-11-16 20:44:08 UTC (rev 4057)
@@ -18,6 +18,7 @@
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.UIOrderingList;
+import org.richfaces.component.UIOrderingList.ItemState;
import org.richfaces.renderkit.html.images.OrderingListIconBottom;
import org.richfaces.renderkit.html.images.OrderingListIconBottomDisabled;
import org.richfaces.renderkit.html.images.OrderingListIconDown;
@@ -315,6 +316,23 @@
writer.endElement("thead");
}
+ private static final ThreadLocal<ItemState> itemStates = new ThreadLocal<ItemState>();
+
+ public void encodeBegin(FacesContext context, UIComponent component)
+ throws IOException {
+ itemStates.set(((UIOrderingList) component).getItemState());
+ super.encodeBegin(context, component);
+ }
+
+ public void encodeEnd(FacesContext context, UIComponent component)
+ throws IOException {
+ try {
+ super.encodeEnd(context, component);
+ } finally {
+ itemStates.set(null);
+ }
+ }
+
public void encodeControlsFacets(FacesContext context, UIOrderingList orderingList)
throws IOException {
String clientId = orderingList.getClientId(context);
@@ -325,10 +343,12 @@
boolean selectedLast = false;
try {
+ ItemState state = itemStates.get();
+
orderingList.setRowKey(new Integer(0));
- selectedFirst = orderingList.isSelected();
+ selectedFirst = state.isSelected();
orderingList.setRowKey(new Integer(orderingList.getModelSize() - 1));
- selectedLast = orderingList.isSelected();
+ selectedLast = state.isSelected();
} finally {
try {
orderingList.setRowKey(key);
@@ -523,12 +543,15 @@
StringBuffer rowClassName = new StringBuffer("ol_normal rich-ordering-list-row");
StringBuffer cellClassName = new StringBuffer("ol_cell rich-ordering-list-cell");
- if (table.isActive()) {
+
+ ItemState state = itemStates.get();
+
+ if (state.isActive()) {
rowClassName.append(" ol_active rich-ordering-list-row-active");
cellClassName.append(" rich-ordering-list-cell-active");
}
- if (table.isSelected()) {
+ if (state.isSelected()) {
rowClassName.append(" ol_select rich-ordering-list-row-selected");
cellClassName.append(" rich-ordering-list-cell-selected");
}
18 years, 5 months