JBoss Rich Faces SVN: r3672 - in trunk/ui/panelmenu/src/main: java/org/richfaces and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-11-01 10:31:53 -0400 (Thu, 01 Nov 2007)
New Revision: 3672
Added:
trunk/ui/panelmenu/src/main/java/org/richfaces/taglib/
trunk/ui/panelmenu/src/main/java/org/richfaces/taglib/PanelMenuGroupTagBase.java
trunk/ui/panelmenu/src/main/java/org/richfaces/taglib/PanelMenuGroupTagHandlerBase.java
Modified:
trunk/ui/panelmenu/src/main/config/component/panelMenu.xml
trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenu.java
trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
Log:
RF-902
Modified: trunk/ui/panelmenu/src/main/config/component/panelMenu.xml
===================================================================
--- trunk/ui/panelmenu/src/main/config/component/panelMenu.xml 2007-11-01 14:00:27 UTC (rev 3671)
+++ trunk/ui/panelmenu/src/main/config/component/panelMenu.xml 2007-11-01 14:31:53 UTC (rev 3672)
@@ -366,8 +366,14 @@
<tag>
<name>panelMenuGroup</name>
<classname>org.richfaces.taglib.PanelMenuGroupTag</classname>
- <superclass>org.ajax4jsf.webapp.taglib.HtmlComponentTagBase</superclass>
- </tag>
+ <superclass>org.richfaces.taglib.PanelMenuGroupTagBase</superclass>
+ </tag>
+
+ <taghandler generate="true">
+ <classname>org.richfaces.taglib.PanelMenuGroupTagHandler</classname>
+ <superclass>org.richfaces.taglib.PanelMenuGroupTagHandlerBase</superclass>
+ </taghandler>
+
<property>
<name>expandMode</name>
<classname>java.lang.String</classname>
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenu.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenu.java 2007-11-01 14:00:27 UTC (rev 3671)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenu.java 2007-11-01 14:31:53 UTC (rev 3672)
@@ -8,6 +8,8 @@
public static final String DEFAULT_SELECTED_CLASS = "dr-pmenu-selected-item";
public static final String USER_DEFINED_SELECTED_CLASS = "rich-pmenu-item-selected";
+
+ private boolean firstExpandedEncoded = false;
public abstract String getEvent();
public abstract void setEvent(String event);
@@ -113,4 +115,11 @@
public String getSelectedName(){
return getValue() != null ? getValue().toString() : getSelectedChild();
}
+ public boolean isFirstExpandedEncoded() {
+ return firstExpandedEncoded;
+ }
+ public void setFirstExpandedEncoded(boolean firstExpandedEncoded) {
+ this.firstExpandedEncoded = firstExpandedEncoded;
+ }
+
}
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2007-11-01 14:00:27 UTC (rev 3671)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2007-11-01 14:31:53 UTC (rev 3672)
@@ -73,14 +73,26 @@
public abstract void setOnexpand(String ongroupexpand);
public abstract String getLabel();
public abstract void setLabel(String label);
-
- public abstract boolean isExpanded();
- public abstract void setExpanded(boolean expanded);
-
public abstract void setName(String string);
public abstract String getName();
+ public boolean isExpanded(){
+
+ Object value = getValue();
+ if(value == null){
+ return false;
+ }
+ if(value instanceof String){
+ value = new Boolean((String)value);
+ }
+
+ return ((Boolean)value).booleanValue();
+ }
+ public void setExpanded(boolean expanded){
+ setValue(expanded);
+ }
+
public UIPanelMenuGroup(){
setConverter(new BooleanConverter());
}
@@ -129,4 +141,6 @@
}
}
}
+
+
}
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2007-11-01 14:00:27 UTC (rev 3671)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2007-11-01 14:31:53 UTC (rev 3672)
@@ -221,24 +221,26 @@
}
public boolean isOpened(FacesContext context, UIComponent component)throws IOException {
- UIPanelMenuGroup group = (UIPanelMenuGroup)component;
- Boolean value = (Boolean)group.getValue();
- if (value != null) {
- return value.booleanValue();
- } else {
+ boolean value = false;
+ if(component instanceof UIPanelMenuGroup){
+ UIPanelMenuGroup group = (UIPanelMenuGroup)component;
+ value = group.isExpanded();
+
boolean isParentDisabled = isParentDisabled(component);
- if(component instanceof UIPanelMenuGroup){
- if( ((UIPanelMenuGroup)component).isExpanded() && !((UIPanelMenuGroup)component).isDisabled() && !isParentDisabled ){
- return true;
- } else {
- //check expanded attributes in children groups, if exists
- boolean isChildrenExpanded = isChildrenExpanded(component);
- return isChildrenExpanded && !isParentDisabled && !((UIPanelMenuGroup)component).isDisabled();// ? "opened" : "closed";
- }
+ boolean disabled = !group.isDisabled() && !isParentDisabled ;
+
+ if( value && disabled){
+ value = true;
+ } else {
+ //check expanded attributes in children groups, if exists
+ boolean isChildrenExpanded = isChildrenExpanded(component);
+ value = isChildrenExpanded && disabled; // ? "opened" : "closed";
}
+
}
- return false;
+
+ return value;
}
public String getLabelClass(FacesContext context, UIComponent component) {
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2007-11-01 14:00:27 UTC (rev 3671)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2007-11-01 14:31:53 UTC (rev 3672)
@@ -36,7 +36,6 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.Messages;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
@@ -50,6 +49,7 @@
/* (non-Javadoc)
* @see org.ajax4jsf.framework.renderer.RendererBase#getComponentClass()
*/
+
protected Class getComponentClass() {
return UIComponent.class;
}
@@ -502,8 +502,36 @@
}
buffer.append("\"");
}
-
+ public void renderChildren(FacesContext facesContext, UIComponent component)throws IOException {
+
+ if(component instanceof UIPanelMenu){
+ UIPanelMenu panelMenu = (UIPanelMenu)component;
+ if(panelMenu.getChildCount() > 0){
+ for (Iterator it = component.getChildren().iterator(); it.hasNext();) {
+ UIComponent child = (UIComponent) it.next();
+ if(child instanceof UIPanelMenuGroup) {
+ UIPanelMenuGroup group = (UIPanelMenuGroup)child;
+
+ if(panelMenu.isExpandSingle()) {
+ if(!(Boolean)panelMenu.getAttributes().get("firstExpandedEncoded")) {
+ if(group.isExpanded()) {
+ panelMenu.getAttributes().put("firstExpandedEncoded", true);
+ }
+ }else {
+ group.setExpanded(false);
+ if((Boolean)group.getValue()){
+ group.setValue(null);
+ }
+ }
+ }
+ }
+ renderChild(facesContext, child);
+ }
+ }
+ }
+ }
+
public void doDecode(FacesContext context, UIComponent component) {
Map requestMap = context.getExternalContext().getRequestParameterMap();
String menuClientId = component.getClientId(context);
Added: trunk/ui/panelmenu/src/main/java/org/richfaces/taglib/PanelMenuGroupTagBase.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/taglib/PanelMenuGroupTagBase.java (rev 0)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/taglib/PanelMenuGroupTagBase.java 2007-11-01 14:31:53 UTC (rev 3672)
@@ -0,0 +1,72 @@
+package org.richfaces.taglib;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.webapp.taglib.HtmlComponentTagBase;
+import org.richfaces.component.UIPanelMenuGroup;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+public abstract class PanelMenuGroupTagBase extends HtmlComponentTagBase{
+
+ private boolean _setExpandedSet = false;
+ private ValueExpression _value = null;
+
+ private void logValueDeprecation(ValueExpression value) {
+ FacesContext facesContext = getFacesContext();
+ facesContext.getExternalContext().log("expanded attribute has been already set for component with id: " + this.getId() +
+ "[" + value.getExpressionString() + "]. value attribute is deprecated and thus has been dropped!");
+ }
+
+
+ public void setExpanded(ValueExpression value){
+
+ if (!_setExpandedSet && _value != null) {
+ logValueDeprecation(value);
+ }
+ _value = value;
+ _setExpandedSet = true;
+ }
+
+ public void setValue(ValueExpression value) {
+ if (!_setExpandedSet) {
+ _value = value;
+ } else {
+ logValueDeprecation(value);
+ }
+ }
+
+
+ protected void setProperties(UIComponent component) {
+ super.setProperties(component);
+
+ UIPanelMenuGroup panelMenu = (UIPanelMenuGroup) component;
+
+ if (_value != null) {
+ if (_value.isLiteralText()) {
+ try {
+ panelMenu.setExpanded(Boolean.parseBoolean(_value.getExpressionString()));
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ } else {
+ component.setValueExpression("expanded", _value);
+ }
+ }else{
+ panelMenu.setExpanded(false);
+ }
+ }
+
+
+ public void release() {
+ super.release();
+ _setExpandedSet = false;
+ _value = null;
+ }
+}
Added: trunk/ui/panelmenu/src/main/java/org/richfaces/taglib/PanelMenuGroupTagHandlerBase.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/taglib/PanelMenuGroupTagHandlerBase.java (rev 0)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/taglib/PanelMenuGroupTagHandlerBase.java 2007-11-01 14:31:53 UTC (rev 3672)
@@ -0,0 +1,39 @@
+/**
+ *
+ */
+package org.richfaces.taglib;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.webapp.taglib.AjaxComponentHandler;
+
+import com.sun.facelets.tag.MetaRuleset;
+import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.TagAttributes;
+import com.sun.facelets.tag.jsf.ComponentConfig;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+public abstract class PanelMenuGroupTagHandlerBase extends AjaxComponentHandler {
+ public PanelMenuGroupTagHandlerBase(ComponentConfig config) {
+ super(config);
+ }
+
+ protected MetaRuleset createMetaRuleset(Class type) {
+ TagAttributes attributes = this.tag.getAttributes();
+ TagAttribute attribute = attributes.get("value");
+ if (attribute != null && attributes.get("expanded") != null) {
+ TagAttribute idAttribute = attributes.get("id");
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ facesContext.getExternalContext().log("expanded attribute has been already set for component with id: " +
+ idAttribute != null ? idAttribute.getValue() : null +
+ "[" + attribute.getValue() + "]. value attribute is deprecated and thus has been dropped!");
+ }
+
+ return super.createMetaRuleset(type).alias("expanded", "value");
+ }
+
+
+}
16 years, 5 months
JBoss Rich Faces SVN: r3671 - trunk/framework/impl/src/main/javascript/ajaxjsf.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-11-01 10:00:27 -0400 (Thu, 01 Nov 2007)
New Revision: 3671
Modified:
trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
Log:
http://jira.jboss.com/jira/browse/RF-1089
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2007-11-01 13:27:21 UTC (rev 3670)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2007-11-01 14:00:27 UTC (rev 3671)
@@ -936,8 +936,9 @@
var data = request.getJSON('_ajax:data');
try {
var newscript = Sarissa.getText(oncomplete,true);
- if (event && event.target) {
- new Function(newscript).apply(event.target);
+ if (event) {
+ var target = event.target ? event.target : event.srcElement;
+ new Function(newscript).apply(target);
} else {
window.eval(newscript);
}
16 years, 5 months
JBoss Rich Faces SVN: r3669 - trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/component.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2007-11-01 08:32:12 -0400 (Thu, 01 Nov 2007)
New Revision: 3669
Added:
trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/component/ExpressionPropertyProcessor.java
Modified:
trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/component/ComponentModelBuilder.java
trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/component/ELPropertyProcessor.java
Log:
Fixed EL-only properties
Modified: trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/component/ComponentModelBuilder.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/component/ComponentModelBuilder.java 2007-11-01 11:30:10 UTC (rev 3668)
+++ trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/component/ComponentModelBuilder.java 2007-11-01 12:32:12 UTC (rev 3669)
@@ -51,6 +51,7 @@
private PropertyProcessor[] propertyProcessors = {
new ActionSource2PropertyProcessor(),
+ new ExpressionPropertyProcessor(),
new PrimitivePropertyProcessor(),
new ELPropertyProcessor(),
new ComponentPropertyProcessor()};
Modified: trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/component/ELPropertyProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/component/ELPropertyProcessor.java 2007-11-01 11:30:10 UTC (rev 3668)
+++ trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/component/ELPropertyProcessor.java 2007-11-01 12:32:12 UTC (rev 3669)
@@ -39,7 +39,7 @@
@Override
public boolean accept(PropertyBean propertyBean, JavaClass javaClass, JSFGeneratorConfiguration configuration) {
- return !(propertyBean.isExist() || propertyBean.isSimpleType() || propertyBean.isElonly()) && propertyBean.isEl() ;
+ return !(propertyBean.isExist() || propertyBean.isSimpleType()) && propertyBean.isEl() ;
}
@Override
Added: trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/component/ExpressionPropertyProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/component/ExpressionPropertyProcessor.java (rev 0)
+++ trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/component/ExpressionPropertyProcessor.java 2007-11-01 12:32:12 UTC (rev 3669)
@@ -0,0 +1,73 @@
+/**
+ * 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.ajax4jsf.builder.component;
+
+import javax.el.Expression;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.ValueBinding;
+
+import org.ajax4jsf.builder.config.PropertyBean;
+import org.ajax4jsf.builder.generator.JSFGeneratorConfiguration;
+import org.ajax4jsf.builder.model.JavaClass;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+@SuppressWarnings("deprecation")
+public class ExpressionPropertyProcessor extends ComponentPropertyProcessor {
+
+ private static final Class<?>[] acceptedClasses = {
+ MethodBinding.class,
+ ValueBinding.class,
+ Expression.class};
+
+ @Override
+ public boolean accept(PropertyBean propertyBean, JavaClass javaClass,
+ JSFGeneratorConfiguration configuration) {
+
+ boolean result =
+ !propertyBean.isExist() &&
+ propertyBean.isEl() &&
+ propertyBean.isElonly();
+
+ if (result) {
+ Class<?> type =
+ getType(propertyBean, configuration.getClassLoader());
+
+ result = false;
+
+ for (Class<?> clazz : acceptedClasses) {
+ if (clazz.isAssignableFrom(type)) {
+ result = true;
+ break;
+ }
+ }
+
+
+ }
+
+
+
+ return result;
+ }
+}
16 years, 5 months
JBoss Rich Faces SVN: r3668 - in trunk: ui/dropdown-menu/src/main/config/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2007-11-01 07:30:10 -0400 (Thu, 01 Nov 2007)
New Revision: 3668
Modified:
trunk/docs/highlight/pom.xml
trunk/ui/dropdown-menu/src/main/config/component/dropdownmenu.xml
trunk/ui/paint2D/pom.xml
Log:
fixed build
Modified: trunk/docs/highlight/pom.xml
===================================================================
--- trunk/docs/highlight/pom.xml 2007-11-01 11:18:29 UTC (rev 3667)
+++ trunk/docs/highlight/pom.xml 2007-11-01 11:30:10 UTC (rev 3668)
@@ -1,130 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
-<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">
+<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>docs</artifactId>
<groupId>org.richfaces</groupId>
<version>3.2.0-SNAPSHOT</version>
</parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.docs</groupId>
- <artifactId>highlight</artifactId>
- <version>3.2.0-SNAPSHOT</version>
- <name>RichFaces Code Highlighting</name>
-
-
- <dependencies>
-<!-- <dependency>
- <groupId>org.apache</groupId>
- <artifactId>xerces</artifactId>
- <version>2.8.0-v200702082200</version>
- <exclusions>
- <exclusion>
- <artifactId>bundle</artifactId>
- <groupId>system</groupId>
- </exclusion>
- </exclusions>
- </dependency> -->
- <dependency>
- <groupId>org.eclipse.wst.sse</groupId>
- <artifactId>core</artifactId>
- <version>1.1.201-v200703241528</version>
- <exclusions>
- <exclusion>
- <artifactId>xerces</artifactId>
- <groupId>org.apache</groupId>
- </exclusion>
- <exclusion>
- <artifactId>bundle</artifactId>
- <groupId>system</groupId>
- </exclusion>
- <exclusion>
- <artifactId>core</artifactId>
- <groupId>org.eclipse.wst.xml</groupId>
- </exclusion>
- <exclusion>
- <artifactId>runtime</artifactId>
- <groupId>org.eclipse.core</groupId>
- </exclusion>
- <exclusion>
- <artifactId>resources</artifactId>
- <groupId>org.eclipse.core</groupId>
- </exclusion>
- <exclusion>
- <artifactId>filebuffers</artifactId>
- <groupId>org.eclipse.core</groupId>
- </exclusion>
- <exclusion>
- <artifactId>text</artifactId>
- <groupId>org.eclipse</groupId>
- </exclusion>
- <exclusion>
- <artifactId>commands</artifactId>
- <groupId>org.eclipse.core</groupId>
- </exclusion>
- <exclusion>
- <artifactId>common</artifactId>
- <groupId>org.eclipse.emf</groupId>
- </exclusion>
- <exclusion>
- <artifactId>icu</artifactId>
- <groupId>com.ibm</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.eclipse.wst.css</groupId>
- <artifactId>core</artifactId>
- <version>1.1.101-v200704012321</version>
- <exclusions>
- <exclusion>
- <artifactId>xerces</artifactId>
- <groupId>org.apache</groupId>
- </exclusion>
- <exclusion>
- <artifactId>bundle</artifactId>
- <groupId>system</groupId>
- </exclusion>
- <exclusion>
- <artifactId>core</artifactId>
- <groupId>org.eclipse.wst.xml</groupId>
- </exclusion>
- <exclusion>
- <artifactId>runtime</artifactId>
- <groupId>org.eclipse.core</groupId>
- </exclusion>
- <exclusion>
- <artifactId>resources</artifactId>
- <groupId>org.eclipse.core</groupId>
- </exclusion>
- <exclusion>
- <artifactId>filebuffers</artifactId>
- <groupId>org.eclipse.core</groupId>
- </exclusion>
- <exclusion>
- <artifactId>text</artifactId>
- <groupId>org.eclipse</groupId>
- </exclusion>
- <exclusion>
- <artifactId>commands</artifactId>
- <groupId>org.eclipse.core</groupId>
- </exclusion>
- <exclusion>
- <artifactId>common</artifactId>
- <groupId>org.eclipse.emf</groupId>
- </exclusion>
- <exclusion>
- <artifactId>icu</artifactId>
- <groupId>com.ibm</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>com.uwyn</groupId>
- <artifactId>jhighlight</artifactId>
- <version>1.0</version>
- </dependency>
- </dependencies>
- <build>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.docs</groupId>
+ <artifactId>highlight</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <name>RichFaces Code Highlighting</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.wst.sse</groupId>
+ <artifactId>core</artifactId>
+ <version>(1.1.0,2.0)</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>xerces</artifactId>
+ <groupId>org.apache</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>bundle</artifactId>
+ <groupId>system</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>core</artifactId>
+ <groupId>org.eclipse.wst.xml</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>runtime</artifactId>
+ <groupId>org.eclipse.core</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>resources</artifactId>
+ <groupId>org.eclipse.core</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>filebuffers</artifactId>
+ <groupId>org.eclipse.core</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>text</artifactId>
+ <groupId>org.eclipse</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commands</artifactId>
+ <groupId>org.eclipse.core</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>common</artifactId>
+ <groupId>org.eclipse.emf</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>icu</artifactId>
+ <groupId>com.ibm</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.wst.css</groupId>
+ <artifactId>core</artifactId>
+ <version>(1.1, 2.0)</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>xerces</artifactId>
+ <groupId>org.apache</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>bundle</artifactId>
+ <groupId>system</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>core</artifactId>
+ <groupId>org.eclipse.wst.xml</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>runtime</artifactId>
+ <groupId>org.eclipse.core</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>resources</artifactId>
+ <groupId>org.eclipse.core</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>filebuffers</artifactId>
+ <groupId>org.eclipse.core</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>text</artifactId>
+ <groupId>org.eclipse</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>commands</artifactId>
+ <groupId>org.eclipse.core</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>common</artifactId>
+ <groupId>org.eclipse.emf</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>icu</artifactId>
+ <groupId>com.ibm</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.wst.css</groupId>
+ <artifactId>core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.wst.sse</groupId>
+ <artifactId>core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.uwyn</groupId>
+ <artifactId>jhighlight</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ <build>
<pluginManagement>
<plugins>
<plugin>
@@ -139,6 +142,6 @@
</plugins>
</pluginManagement>
</build>
-
+
</project>
Modified: trunk/ui/dropdown-menu/src/main/config/component/dropdownmenu.xml
===================================================================
--- trunk/ui/dropdown-menu/src/main/config/component/dropdownmenu.xml 2007-11-01 11:18:29 UTC (rev 3667)
+++ trunk/ui/dropdown-menu/src/main/config/component/dropdownmenu.xml 2007-11-01 11:30:10 UTC (rev 3668)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?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>
@@ -130,7 +130,7 @@
<property>
<name>selectItemStyle</name>
- <classname>java.lang. String</classname>
+ <classname>java.lang.String</classname>
<description>
CSS style(s) is/are to be applied to selected item when this component is rendered.
</description>
Modified: trunk/ui/paint2D/pom.xml
===================================================================
--- trunk/ui/paint2D/pom.xml 2007-11-01 11:18:29 UTC (rev 3667)
+++ trunk/ui/paint2D/pom.xml 2007-11-01 11:30:10 UTC (rev 3668)
@@ -1,55 +1,43 @@
-<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.2.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.ui</groupId>
- <artifactId>paint2D</artifactId>
- <name>Paint java 2D</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>
- <execution>
- <id>generate-test-sources</id>
- <phase>generate-test-sources</phase>
- <goals>
- <goal>generate-tests</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <library>
- <prefix>org.richfaces</prefix>
- <taglib>
- <shortName>paint2D</shortName>
- </taglib>
- </library>
- </configuration>
- </plugin>
- <!--
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.4</source>
- <target>1.4</target>
- </configuration>
- </plugin>
- -->
- </plugins>
- </build>
-</project>
\ No newline at end of file
+<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.2.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>paint2D</artifactId>
+ <name>Paint java 2D</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>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <library>
+ <prefix>org.richfaces</prefix>
+ <taglib>
+ <shortName>paint2D</shortName>
+ </taglib>
+ </library>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
16 years, 5 months
JBoss Rich Faces SVN: r3667 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: vkorluzhenko
Date: 2007-11-01 07:18:29 -0400 (Thu, 01 Nov 2007)
New Revision: 3667
Modified:
trunk/docs/userguide/en/src/main/docbook/included/tree.xml
Log:
http://jira.jboss.com/jira/browse/RF-672
Modified: trunk/docs/userguide/en/src/main/docbook/included/tree.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/tree.xml 2007-11-01 11:10:28 UTC (rev 3666)
+++ trunk/docs/userguide/en/src/main/docbook/included/tree.xml 2007-11-01 11:18:29 UTC (rev 3667)
@@ -103,11 +103,11 @@
<property>"data"</property>
</emphasis> which value is available as a request scope variable with a name that is defined by <emphasis>
<property>"var"</property>
- </emphasis> attribute of a tree component. <ulink
+ </emphasis> attribute of a <property>tree</property> component. <ulink
url="http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..."
>"XmlTreeDataBuilder" class</ulink> allows transforming XML into
structures of objects containing <property>"XmlNodeData"</property>
- instances as data, which could be represented by the tree component. </para>
+ instances as data, which could be represented by the <property>tree</property> component. </para>
<para>For particular visual representation of data <emphasis role="bold">
<property><rich:tree></property>
16 years, 5 months
JBoss Rich Faces SVN: r3666 - trunk/framework/impl/src/main/javascript/ajaxjsf.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-11-01 07:10:28 -0400 (Thu, 01 Nov 2007)
New Revision: 3666
Modified:
trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
Log:
http://jira.jboss.com/jira/browse/RF-1089
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2007-11-01 09:32:02 UTC (rev 3665)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2007-11-01 11:10:28 UTC (rev 3666)
@@ -936,9 +936,8 @@
var data = request.getJSON('_ajax:data');
try {
var newscript = Sarissa.getText(oncomplete,true);
- if (request.domEvt.target) {
- request.domEvt.target.oncomplete = new Function(newscript);
- request.domEvt.target.oncomplete();
+ if (event && event.target) {
+ new Function(newscript).apply(event.target);
} else {
window.eval(newscript);
}
16 years, 5 months
JBoss Rich Faces SVN: r3665 - trunk/ui/calendar/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: akushunin
Date: 2007-11-01 05:32:02 -0400 (Thu, 01 Nov 2007)
New Revision: 3665
Modified:
trunk/ui/calendar/src/main/config/component/calendar.xml
Log:
RF-914
Modified: trunk/ui/calendar/src/main/config/component/calendar.xml
===================================================================
--- trunk/ui/calendar/src/main/config/component/calendar.xml 2007-11-01 02:05:50 UTC (rev 3664)
+++ trunk/ui/calendar/src/main/config/component/calendar.xml 2007-11-01 09:32:02 UTC (rev 3665)
@@ -51,18 +51,6 @@
&ajax_component_attributes;
&ui_input_attributes;
&ui_output_attributes;
- <property>
- <name>width</name>
- <classname>java.lang.String</classname>
- <description>Defines a width of the calendar</description>
- <defaultvalue>"400px;"</defaultvalue>
- </property>
- <property>
- <name>height</name>
- <classname>java.lang.String</classname>
- <description>Defines a height of the calendar</description>
- <defaultvalue>"250px"</defaultvalue>
- </property>
<property elonly="true">
<name>dataModel</name>
<classname>org.richfaces.model.CalendarDataModel</classname>
16 years, 5 months
JBoss Rich Faces SVN: r3664 - in trunk/sandbox: impl/src/main/resources/META-INF and 19 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: SergeySmirnov
Date: 2007-10-31 22:05:50 -0400 (Wed, 31 Oct 2007)
New Revision: 3664
Added:
trunk/sandbox/impl/src/main/resources/META-INF/
trunk/sandbox/impl/src/main/resources/META-INF/resources-config.xml
trunk/sandbox/ui/rex-resizable/design/
trunk/sandbox/ui/rex-resizable/design/todo-list.txt
trunk/sandbox/ui/rex-resizable/src/main/java/org/richfaces/renderkit/
trunk/sandbox/ui/rex-resizable/src/main/java/org/richfaces/renderkit/ResizableRendererBase.java
trunk/sandbox/ui/rex-resizable/src/main/resources/
trunk/sandbox/ui/rex-resizable/src/main/resources/org/
trunk/sandbox/ui/rex-resizable/src/main/resources/org/richfaces/
trunk/sandbox/ui/rex-resizable/src/main/resources/org/richfaces/renderkit/
trunk/sandbox/ui/rex-resizable/src/main/resources/org/richfaces/renderkit/html/
trunk/sandbox/ui/rex-resizable/src/main/resources/org/richfaces/renderkit/html/script/
trunk/sandbox/ui/rex-resizable/src/main/resources/org/richfaces/renderkit/html/script/rexInitWidget.js
Modified:
trunk/sandbox/samples/rex-demo/src/main/resources/org/richfaces/demo/common/components.properties
trunk/sandbox/samples/rex-demo/src/main/webapp/css/common.css
trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/resizable.xhtml
trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/resizable/examples/simple.xhtml
trunk/sandbox/samples/rex-demo/src/main/webapp/templates/main.xhtml
trunk/sandbox/ui/pom.xml
trunk/sandbox/ui/rex-resizable/src/main/config/component/resizable.xml
trunk/sandbox/ui/rex-resizable/src/main/templates/resizable.jspx
Log:
rex resizable component and demo updates
Added: trunk/sandbox/impl/src/main/resources/META-INF/resources-config.xml
===================================================================
--- trunk/sandbox/impl/src/main/resources/META-INF/resources-config.xml (rev 0)
+++ trunk/sandbox/impl/src/main/resources/META-INF/resources-config.xml 2007-11-01 02:05:50 UTC (rev 3664)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<resource-config>
+ <resource>
+ <name>extjs/ext-all.js</name>
+ <path>org/richfaces/renderkit/html/scripts/extjs/ext-all.js</path>
+ <renderer class="org.ajax4jsf.resource.ScriptRenderer"/>
+ </resource>
+ <resource>
+ <name>extjs/ext-base.js</name>
+ <path>org/richfaces/renderkit/html/scripts/extjs/ext-base.js</path>
+ <renderer class="org.ajax4jsf.resource.ScriptRenderer"/>
+ </resource>
+ <resource>
+ <name>extjs/ext-all.css</name>
+ <path>org/richfaces/renderkit/html/scripts/extjs/ext-all.css</path>
+ <renderer class="org.ajax4jsf.resource.StyleRenderer"/>
+ </resource>
+ <resource>
+ <name>extjs/ext-css-patch.xcss</name>
+ <path>org/richfaces/renderkit/html/scripts/extjs/ext-css-patch.xcss</path>
+ </resource>
+</resource-config>
\ No newline at end of file
Modified: trunk/sandbox/samples/rex-demo/src/main/resources/org/richfaces/demo/common/components.properties
===================================================================
--- trunk/sandbox/samples/rex-demo/src/main/resources/org/richfaces/demo/common/components.properties 2007-11-01 01:37:44 UTC (rev 3663)
+++ trunk/sandbox/samples/rex-demo/src/main/resources/org/richfaces/demo/common/components.properties 2007-11-01 02:05:50 UTC (rev 3664)
@@ -1,4 +1,4 @@
# list of components in comma-separated format
#id=name,iconImage,captionImage,devGuideLocation,tldDocLocation,javaDocLocation
-resizable= rexc, resizable, /images/ico_common.gif, /images/cn_resizable.gif, RichFacesComponentsLibrary.html#resizable, jbossrichfaces/freezone/docs/tlddoc/rich/resizable.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIResizable.html, /richfaces/resizable.jsf
+resizable= rexc, Resizable, /images/ico_common.gif, /images/cn_resizable.gif, RichFacesComponentsLibrary.html#resizable, jbossrichfaces/freezone/docs/tlddoc/rich/resizable.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIResizable.html, /richfaces/resizable.jsf
jQuery= rexc, jQuery, /images/ico_common.gif, /images/cn_jQuery.gif, RichFacesComponentsLibrary.html#jQuery, jbossrichfaces/freezone/docs/tlddoc/rich/jQuery.html, jbossrichfaces/freezone/docs/apidoc/org/richfaces/component/UIJQuery.html, /richfaces/jQuery.jsf
Modified: trunk/sandbox/samples/rex-demo/src/main/webapp/css/common.css
===================================================================
--- trunk/sandbox/samples/rex-demo/src/main/webapp/css/common.css 2007-11-01 01:37:44 UTC (rev 3663)
+++ trunk/sandbox/samples/rex-demo/src/main/webapp/css/common.css 2007-11-01 02:05:50 UTC (rev 3664)
@@ -14,6 +14,12 @@
font-family: Verdana,Arial;
}
+.sheader {
+ font-size:18px;
+ }
+
+
+
.footer-text {
font-size: 10px;
}
Modified: trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/resizable/examples/simple.xhtml
===================================================================
--- trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/resizable/examples/simple.xhtml 2007-11-01 01:37:44 UTC (rev 3663)
+++ trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/resizable/examples/simple.xhtml 2007-11-01 02:05:50 UTC (rev 3664)
@@ -3,12 +3,24 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rex="http://labs.jboss.com/jbossrichfaces/ui/ui/rex-resizable"
xmlns:rich="http://richfaces.org/rich">
- <rich:separator lineType="solid" height="1" />
+ <h:form>
+ <rex:resizable preserveRatio="false" easing="easingInStrong" animate="true"
+ minWidth="450" minHeight="100" width="429" height="200"
+ style="padding-bottom:4px;z-index:2000">
+ <rich:panel style="height:100%">
+ <f:facet name="header">
+ Dialog Title
+ </f:facet>
+ Drag botton right hand corner to resize<br /><br />
+ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus.
+ </rich:panel>
+
+ </rex:resizable>
+ </h:form>
-
- <rich:separator height="1" style="padding-top:10px" />
</ui:composition>
\ No newline at end of file
Modified: trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/resizable.xhtml
===================================================================
--- trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/resizable.xhtml 2007-11-01 01:37:44 UTC (rev 3663)
+++ trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/resizable.xhtml 2007-11-01 02:05:50 UTC (rev 3664)
@@ -5,7 +5,7 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich">
<ui:composition template="/templates/main.xhtml">
- <ui:define name="title">RichFaces - Open Source Rich JSF Components - exj js resizable</ui:define>
+ <ui:define name="title">RichFaces ExtJS Intergation Demo exj js resizable</ui:define>
<ui:define name="body">
<rich:tabPanel switchType="server" value="#{componentNavigator.activeTab}" styleClass="top_tab" contentClass="content_tab" headerClass="header_tabs_class" inactiveTabClass="inactive_tab" activeTabClass="active_tab">
Modified: trunk/sandbox/samples/rex-demo/src/main/webapp/templates/main.xhtml
===================================================================
--- trunk/sandbox/samples/rex-demo/src/main/webapp/templates/main.xhtml 2007-11-01 01:37:44 UTC (rev 3663)
+++ trunk/sandbox/samples/rex-demo/src/main/webapp/templates/main.xhtml 2007-11-01 02:05:50 UTC (rev 3664)
@@ -32,10 +32,13 @@
</tr>
</tbody>
</table>
+<h:outputText styleClass="component_name sheader" value="#{componentNavigator.currentComponent.name}"
+ rendered="#{componentNavigator.hasCurrentComponent}" height="40" alt="" border="0"/>
+<ui:remove>
<h:graphicImage value="#{componentNavigator.currentComponent.captionImage}"
rendered="#{componentNavigator.hasCurrentComponent}" height="40" alt="" border="0" styleClass="component_name"/>
-
+</ui:remove>
<table cellpadding="0" cellspacing="0" border="0" class="content_container" width="100%">
<tbody>
<tr>
Modified: trunk/sandbox/ui/pom.xml
===================================================================
--- trunk/sandbox/ui/pom.xml 2007-11-01 01:37:44 UTC (rev 3663)
+++ trunk/sandbox/ui/pom.xml 2007-11-01 02:05:50 UTC (rev 3664)
@@ -18,5 +18,6 @@
<module>listShuttle</module>
<module>orderingList</module>
<module>columns</module>
+ <module>rex-resizable</module>
</modules>
</project>
\ No newline at end of file
Added: trunk/sandbox/ui/rex-resizable/design/todo-list.txt
===================================================================
--- trunk/sandbox/ui/rex-resizable/design/todo-list.txt (rev 0)
+++ trunk/sandbox/ui/rex-resizable/design/todo-list.txt 2007-11-01 02:05:50 UTC (rev 3664)
@@ -0,0 +1,4 @@
+1. name attribute that allow to specify the variable for the Ext.Resizable object
+2. enable wrap: false/true mode. 'for' attribute to point to the component or dom element to attach (equals to wrap:false)
+3. process right adjustments and resizeChild attributes that allow variable types
+4. skining for used images
\ No newline at end of file
Modified: trunk/sandbox/ui/rex-resizable/src/main/config/component/resizable.xml
===================================================================
--- trunk/sandbox/ui/rex-resizable/src/main/config/component/resizable.xml 2007-11-01 01:37:44 UTC (rev 3663)
+++ trunk/sandbox/ui/rex-resizable/src/main/config/component/resizable.xml 2007-11-01 02:05:50 UTC (rev 3664)
@@ -23,16 +23,218 @@
org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
</superclass>
</tag>
+
&ui_component_attributes;
+ &html_events;
+ &html_style_attributes;
<property>
- <name>name</name>
+ <name>adjustments</name>
<classname>java.lang.String</classname>
<description>
- The name of the function that will be generated to execute the query.
- The name attribute is required if timing attribute equals to "onJScall"
+ String "auto" or an array [width, height]
+ with values to be added to the resize operation's new size
+ (defaults to [0,0])
</description>
<defaultvalue>""</defaultvalue>
</property>
+ <property>
+ <name>animate</name>
+ <classname>java.lang.String</classname>
+ <description>
+ True to animate the resize
+ (not compatible with dynamic sizing, defaults to false)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>disableTrackOver</name>
+ <classname>java.lang.String</classname>
+ <description>
+ True to disable mouse tracking.
+ This is only applied at config time. (defaults to false)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>draggable</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Convenience to initialize drag drop (defaults to false)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>duration</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Animation duration if animate = true (defaults to .35)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>dynamic</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Animation duration if animate = true (defaults to .35)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>easing</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Animation easing if animate = true (defaults to 'easingOutStrong')
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>enabled</name>
+ <classname>java.lang.String</classname>
+ <description>
+ False to disable resizing (defaults to true)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>handles</name>
+ <classname>java.lang.String</classname>
+ <description>
+ String consisting of the resize handles to display (defaults to undefined)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>height</name>
+ <classname>java.lang.String</classname>
+ <description>
+ The height of the element in pixels (defaults to 50)
+ </description>
+ <defaultvalue>"50"</defaultvalue>
+ </property>
+ <property>
+ <name>heightIncrement</name>
+ <classname>java.lang.String</classname>
+ <description>
+ The increment to snap the height resize in pixels
+ (dynamic must be true, defaults to 0)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>maxHeight</name>
+ <classname>java.lang.String</classname>
+ <description>
+ The maximum height for the element (defaults to 10000)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>maxWidth</name>
+ <classname>java.lang.String</classname>
+ <description>
+ The maximum width for the element (defaults to 10000)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>minHeight</name>
+ <classname>java.lang.String</classname>
+ <description>
+ The minimum height for the element (defaults to 5)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>minWidth</name>
+ <classname>java.lang.String</classname>
+ <description>
+ The minimum width for the element (defaults to 5)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>minX</name>
+ <classname>java.lang.String</classname>
+ <description>
+ The minimum allowed page X for the element
+ (only used for west resizing, defaults to 0)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>minY</name>
+ <classname>java.lang.String</classname>
+ <description>
+ The minimum allowed page Y for the element
+ (only used for north resizing, defaults to 0)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>multiDirectional</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Deprecated. The old style of adding multi-direction
+ resize handles, deprecated in favor of the handles
+ config option (defaults to false)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>pinned</name>
+ <classname>java.lang.String</classname>
+ <description>
+ True to ensure that the resize handles are always visible,
+ false to display them only when the user mouses over the
+ resizable borders. This is only applied at config time.
+ (defaults to false)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>preserveRatio</name>
+ <classname>java.lang.String</classname>
+ <description>
+ True to preserve the original ratio between height and width
+ during resize (defaults to false)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>resizeChild</name>
+ <classname>java.lang.String</classname>
+ <description>
+ True to resize the first child, or id/element to resize
+ (defaults to false)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>transparent</name>
+ <classname>java.lang.String</classname>
+ <description>
+ True for transparent handles. This is only applied at
+ config time. (defaults to false)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+ <property>
+ <name>width</name>
+ <classname>java.lang.String</classname>
+ <description>
+ The width of the element in pixels (defaults to 100)
+ </description>
+ <defaultvalue>"100"</defaultvalue>
+ </property>
+ <property>
+ <name>widthIncrement</name>
+ <classname>java.lang.String</classname>
+ <description>
+ The increment to snap the width resize in pixels
+ (dynamic must be true, defaults to 0)
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
</component>
</components>
Added: trunk/sandbox/ui/rex-resizable/src/main/java/org/richfaces/renderkit/ResizableRendererBase.java
===================================================================
--- trunk/sandbox/ui/rex-resizable/src/main/java/org/richfaces/renderkit/ResizableRendererBase.java (rev 0)
+++ trunk/sandbox/ui/rex-resizable/src/main/java/org/richfaces/renderkit/ResizableRendererBase.java 2007-11-01 02:05:50 UTC (rev 3664)
@@ -0,0 +1,29 @@
+package org.richfaces.renderkit;
+
+import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
+import org.richfaces.component.UIResizable;
+import javax.faces.component.UIComponent;
+
+public class ResizableRendererBase extends HeaderResourcesRendererBase {
+ protected Class getComponentClass() {
+ return UIResizable.class;
+ }
+
+ protected void formParamList(UIComponent component,String[] vals,
+ StringBuffer strb, boolean quoted) {
+
+ for (int i=0; i < vals.length; i++) {
+ String val = (String)component.getAttributes().get(vals[i]);
+ if (! "".equals(val) ) {
+ if (strb.length()!=0)strb.append(",");
+ strb.append(vals[i]);
+ strb.append(":");
+ if (quoted) strb.append("'");
+ strb.append(val);
+ if (quoted) strb.append("'");
+ }
+ }
+
+ }
+
+}
Added: trunk/sandbox/ui/rex-resizable/src/main/resources/org/richfaces/renderkit/html/script/rexInitWidget.js
===================================================================
--- trunk/sandbox/ui/rex-resizable/src/main/resources/org/richfaces/renderkit/html/script/rexInitWidget.js (rev 0)
+++ trunk/sandbox/ui/rex-resizable/src/main/resources/org/richfaces/renderkit/html/script/rexInitWidget.js 2007-11-01 02:05:50 UTC (rev 3664)
@@ -0,0 +1,5 @@
+if (!window.Richfaces) window.Richfaces={};
+
+window.Richfaces.rexInitWidget =
+function(func) {Event.observe(window, "load", func );} ;
+
Modified: trunk/sandbox/ui/rex-resizable/src/main/templates/resizable.jspx
===================================================================
--- trunk/sandbox/ui/rex-resizable/src/main/templates/resizable.jspx 2007-11-01 01:37:44 UTC (rev 3663)
+++ trunk/sandbox/ui/rex-resizable/src/main/templates/resizable.jspx 2007-11-01 02:05:50 UTC (rev 3664)
@@ -6,16 +6,48 @@
xmlns:u=" http://ajax4jsf.org/cdk/u"
xmlns:x=" http://ajax4jsf.org/cdk/x"
class="org.richfaces.renderkit.html.ResizableRenderer"
- baseclass="org.ajax4jsf.renderkit.HeaderResourcesRendererBase"
+ baseclass="org.richfaces.renderkit.ResizableRendererBase"
component="org.richfaces.component.UIResizable">
+
<f:clientid var="clientId"/>
-
<c:set var="name" value="#{component.attributes['name']}"/>
- <!--
- <h:scripts></h:scripts>
- -->
+
+ <h:styles>extjs/ext-all.css,extjs/ext-css-patch.xcss</h:styles>
+ <h:scripts>extjs/ext-base.js,extjs/ext-all.js,script/rexInitWidget.js</h:scripts>
-<div>Start here</div>
+<jsp:scriptlet>
+<![CDATA[
+ String[] attr = {"animate","disableTrackOver", "draggable",
+ "duration", "dynamic", "enabled","height",
+ "heightIncrement", "maxHeight", "maxWidth", "minHeight",
+ "minWidth", "minX", "minY", "multiDirectional", "pinned",
+ "preserveRatio","resizeChild", "transparent", "width",
+ "widthIncrement"};
+ String[] qattr = { "adjustments", "easing", "handles"};
+ StringBuffer json = new StringBuffer();
+
+ formParamList(component, attr,json, false);
+ formParamList(component, qattr,json, true);
+
+ variables.setVariable("params", json.toString());
+
+]]>
+</jsp:scriptlet>
+
+
+
+<div id="#{clientId}" x:passThruWithExclusions="id,styleClass,class">
+ <vcp:body>
+ <f:call name="renderChildren" />
+ </vcp:body>
+ <f:clientid var="clientId"/>
+<script type="text/javascript">
+window.Richfaces.rexInitWidget(function(){
+new Ext.Resizable("#{clientId}", { #{params} });
+});
+
+</script>
+</div>
</f:root>
\ No newline at end of file
16 years, 5 months
JBoss Rich Faces SVN: r3663 - in trunk: samples/seamIntegration and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-10-31 21:37:44 -0400 (Wed, 31 Oct 2007)
New Revision: 3663
Added:
trunk/framework/api/src/main/java/org/richfaces/model/ClassicTreeDataModel.java
trunk/framework/api/src/main/java/org/richfaces/model/SwingTreeDataModel.java
trunk/framework/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java
trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModelNodeAdaptor.java
trunk/samples/tree-demo/src/main/java/org/richfaces/SwingTreeNode.java
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/AbstractTreeDataModel.java
trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModel.java
trunk/framework/api/src/main/java/org/richfaces/model/TreeNode.java
trunk/framework/api/src/main/java/org/richfaces/model/TreeRowKey.java
trunk/samples/seamIntegration/
trunk/samples/tree-demo/src/main/java/org/richfaces/Bean.java
trunk/samples/tree-demo/src/main/webapp/pages/index.jsp
trunk/ui/tree/src/main/java/org/richfaces/component/CacheableTreeDataModel.java
trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
trunk/ui/tree/src/test/java/org/richfaces/component/TreeModelTest.java
Log:
http://jira.jboss.com/jira/browse/RF-864
Modified: trunk/framework/api/src/main/java/org/richfaces/model/AbstractTreeDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/AbstractTreeDataModel.java 2007-11-01 01:04:03 UTC (rev 3662)
+++ trunk/framework/api/src/main/java/org/richfaces/model/AbstractTreeDataModel.java 2007-11-01 01:37:44 UTC (rev 3663)
@@ -37,8 +37,6 @@
public abstract class AbstractTreeDataModel extends ExtendedDataModel {
public final static char SEPARATOR = NamingContainer.SEPARATOR_CHAR;
- private TreeNode wrappedData;
-
public final int getRowCount() {
return -1;
}
@@ -53,14 +51,6 @@
}
}
- public final Object getWrappedData() {
- return wrappedData;
- }
-
- public final void setWrappedData(Object data) {
- wrappedData = (TreeNode) data;
- }
-
public final void walk(FacesContext context, DataVisitor dataVisitor,
Range range, Object argument) throws IOException {
walk(context, dataVisitor, range, null, argument, false);
@@ -132,6 +122,6 @@
dataVisitor.process(context, treeRowKey, argument);
}
}
-
+
public abstract TreeNode getTreeNode();
}
Added: trunk/framework/api/src/main/java/org/richfaces/model/ClassicTreeDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/ClassicTreeDataModel.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/ClassicTreeDataModel.java 2007-11-01 01:37:44 UTC (rev 3663)
@@ -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.model;
+
+/**
+ * Created 01.11.2007
+ * @author Nick Belaevski
+ * @since 3.2
+ */
+
+public class ClassicTreeDataModel extends TreeDataModel<TreeNode> {
+
+ public ClassicTreeDataModel() {
+ super(TreeNode.class, TreeDataModelNodeAdaptor.classicTreeNodeAdaptor);
+ }
+
+ public TreeNode getTreeNode() {
+ if (isRowAvailable()) {
+ return locateTreeNode((TreeRowKey) getRowKey());
+ }
+
+ throw new IllegalStateException(
+ "No tree element available or row key not set!");
+ }
+
+}
Modified: trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2007-11-01 01:04:03 UTC (rev 3662)
+++ trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2007-11-01 01:37:44 UTC (rev 3663)
@@ -573,4 +573,14 @@
}
};
+
+ @Override
+ public Object getWrappedData() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setWrappedData(Object data) {
+ throw new UnsupportedOperationException();
+ }
}
Added: trunk/framework/api/src/main/java/org/richfaces/model/SwingTreeDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/SwingTreeDataModel.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/SwingTreeDataModel.java 2007-11-01 01:37:44 UTC (rev 3663)
@@ -0,0 +1,85 @@
+/**
+ * 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.model;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.swing.tree.TreeNode;
+
+/**
+ * Created 01.11.2007
+ * @author Nick Belaevski
+ * @since 3.2
+ */
+
+public class SwingTreeDataModel extends TreeDataModel<TreeNode> {
+
+ private TreeNode treeNode;
+
+ public SwingTreeDataModel() {
+ super(TreeNode.class, TreeDataModelNodeAdaptor.swingTreeNodeAdaptor);
+ }
+
+ @Override
+ protected TreeNode getData() {
+ return treeNode;
+ }
+
+ @Override
+ public void setWrappedData(Object data) {
+ if (data != null) {
+ SwingTreeNodeImpl treeNodeImpl = new SwingTreeNodeImpl();
+
+ if (data instanceof Collection<?>) {
+ Collection<?> collection = (Collection<?>) data;
+
+ for (Iterator<?> iterator = collection.iterator(); iterator
+ .hasNext();) {
+ treeNodeImpl.addChild((TreeNode) iterator.next());
+ }
+ } else if (data.getClass().isArray()) {
+ Object[] nodes = (Object[]) data;
+ for (int i = 0; i < nodes.length; i++) {
+ treeNodeImpl.addChild((TreeNode) nodes[i]);
+ }
+ } else {
+ treeNodeImpl.addChild((TreeNode) data);
+ }
+
+ this.treeNode = treeNodeImpl;
+ } else {
+ this.treeNode = null;
+ }
+
+ super.setWrappedData(data);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.model.AbstractTreeDataModel#getTreeNode()
+ */
+ @Override
+ public org.richfaces.model.TreeNode getTreeNode() {
+ return null;
+ }
+
+}
Added: trunk/framework/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java 2007-11-01 01:37:44 UTC (rev 3663)
@@ -0,0 +1,98 @@
+/**
+ * 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.model;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import javax.swing.tree.TreeNode;
+
+/**
+ * Created 01.11.2007
+ * @author Nick Belaevski
+ * @since 3.2
+ */
+
+public class SwingTreeNodeImpl implements TreeNode {
+
+ private Vector<TreeNode> children = new Vector<TreeNode>();
+
+ /* (non-Javadoc)
+ * @see javax.swing.tree.TreeNode#children()
+ */
+ public Enumeration children() {
+ return children.elements();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.tree.TreeNode#getAllowsChildren()
+ */
+ public boolean getAllowsChildren() {
+ return true;
+ }
+
+ public void setAllowsChildren(boolean allowsChildren) {
+ if (!allowsChildren) {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.tree.TreeNode#getChildAt(int)
+ */
+ public TreeNode getChildAt(int childIndex) {
+ return children.get(childIndex);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.tree.TreeNode#getChildCount()
+ */
+ public int getChildCount() {
+ return children.size();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.tree.TreeNode#getIndex(javax.swing.tree.TreeNode)
+ */
+ public int getIndex(TreeNode node) {
+ return children.indexOf(node);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.tree.TreeNode#getParent()
+ */
+ public TreeNode getParent() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.tree.TreeNode#isLeaf()
+ */
+ public boolean isLeaf() {
+ return children.isEmpty();
+ }
+
+ public void addChild(TreeNode node) {
+ children.add(node);
+ }
+
+}
Modified: trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModel.java 2007-11-01 01:04:03 UTC (rev 3662)
+++ trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModel.java 2007-11-01 01:37:44 UTC (rev 3663)
@@ -36,13 +36,32 @@
* @author Nick Belaevski - nbelaevski(a)exadel.com created 16.11.2006
*
*/
-public class TreeDataModel extends AbstractTreeDataModel {
+public abstract class TreeDataModel<T> extends AbstractTreeDataModel {
+
+ private Object wrappedData;
+ private Class<T> clazz;
+
private TreeRowKey currentRowKey;
private TreeRowKey oldRowKey;
- private TreeNode rowTreeData;
+ private T rowTreeData;
+ protected final TreeDataModelNodeAdaptor<T> nodeAdaptor;
+
+ public TreeDataModel(Class<T> clazz, TreeDataModelNodeAdaptor<T> nodeAdaptor) {
+ this.clazz = clazz;
+ this.nodeAdaptor = nodeAdaptor;
+ }
+
+ public final Class<T> getClazz() {
+ return clazz;
+ }
+
+ public final TreeDataModelNodeAdaptor<T> getNodeAdaptor() {
+ return nodeAdaptor;
+ }
+
public Object getRowKey() {
return this.currentRowKey;
}
@@ -62,63 +81,65 @@
Range range, Object rowKey, Object argument, boolean last) throws IOException {
ListRowKey listRowKey = (ListRowKey) rowKey;
- TreeNode node = locateTreeNode(listRowKey);
+ T node = locateTreeNode(listRowKey);
if (node != null) {
TreeRange treeRange = (TreeRange) range;
if (treeRange == null || treeRange.processNode(listRowKey)) {
- if (node.getParent() != null) {
+ if (nodeAdaptor.getParent(node) != null) {
processElement(context, dataVisitor, argument, listRowKey, last);
}
if (treeRange == null || treeRange.processChildren(listRowKey)) {
- if (!node.isLeaf()) {
- Iterator children = node.getChildren();
+ if (!nodeAdaptor.isLeaf(node)) {
+ Iterator<Map.Entry<Object, T>> children = nodeAdaptor.getChildren(node);
- Map.Entry childEntry = children.hasNext() ? (Map.Entry) children.next() : null;
- TreeNode childNode;
- Object identifier;
+ if (children != null) {
+ Map.Entry<Object, T> childEntry = children.hasNext() ? children.next() : null;
+ T childNode;
+ Object identifier;
- if (childEntry != null) {
- childNode = (TreeNode) childEntry.getValue();
- identifier = childEntry.getKey();
- } else {
- childNode = null;
- identifier = null;
- }
-
- do {
- Map.Entry nextChildEntry = children.hasNext() ? (Map.Entry) children.next() : null;
- TreeNode nextChildNode;
- Object nextIdentifier;
-
- if (nextChildEntry != null) {
- nextChildNode = (TreeNode) nextChildEntry.getValue();
- nextIdentifier = nextChildEntry.getKey();
+ if (childEntry != null) {
+ childNode = childEntry.getValue();
+ identifier = childEntry.getKey();
} else {
- nextChildNode = null;
- nextIdentifier = null;
+ childNode = null;
+ identifier = null;
}
- if (childNode != null) {
+ do {
+ Map.Entry<Object, T> nextChildEntry = children.hasNext() ? children.next() : null;
+ T nextChildNode;
+ Object nextIdentifier;
- boolean isLast = nextChildNode == null;
+ if (nextChildEntry != null) {
+ nextChildNode = nextChildEntry.getValue();
+ nextIdentifier = nextChildEntry.getKey();
+ } else {
+ nextChildNode = null;
+ nextIdentifier = null;
+ }
- ListRowKey newRowKey;
- if (rowKey != null) {
- newRowKey = new ListRowKey(listRowKey, identifier);
- } else {
- newRowKey = new ListRowKey(identifier);
+ if (childNode != null) {
+
+ boolean isLast = nextChildNode == null;
+
+ ListRowKey newRowKey;
+ if (rowKey != null) {
+ newRowKey = new ListRowKey(listRowKey, identifier);
+ } else {
+ newRowKey = new ListRowKey(identifier);
+ }
+
+ this.doWalk(context, dataVisitor, range, newRowKey, argument, isLast);
}
- this.doWalk(context, dataVisitor, range, newRowKey, argument, isLast);
- }
-
- identifier = nextIdentifier;
- childNode = nextChildNode;
- } while (childNode != null);
+ identifier = nextIdentifier;
+ childNode = nextChildNode;
+ } while (childNode != null);
+ }
}
}
}
@@ -139,14 +160,14 @@
doWalk(context, dataVisitor, range, rowKey, argument, last);
}
- public TreeNode locateTreeNode(TreeRowKey rowKey) {
+ public T locateTreeNode(TreeRowKey rowKey) {
return locateTreeNode(rowKey, false);
}
- public TreeNode locateTreeNode(TreeRowKey rowKey, boolean allowCreate) {
+ public T locateTreeNode(TreeRowKey rowKey, boolean allowCreate) {
boolean useCached = (rowTreeData != null && rowKey != null && rowKey.equals(this.oldRowKey));
if (!useCached) {
- TreeNode rootNode = (TreeNode) getWrappedData();
+ T rootNode = getData();
if (rootNode != null) {
if (rowKey != null) {
@@ -162,7 +183,7 @@
for (int i = 0; i < oldRowKey.depth()
- commonPathLength; i++) {
- rowTreeData = rowTreeData.getParent();
+ rowTreeData = nodeAdaptor.getParent(rowTreeData);
}
} else {
commonPathLength = 0;
@@ -171,19 +192,18 @@
}
}
oldRowKey = rowKey;
- Iterator iterator = rowKey.getSubPathIterator(commonPathLength);
+ Iterator<?> iterator = rowKey.getSubPathIterator(commonPathLength);
while (iterator.hasNext()) {
//TODO nick - check rowTreeData for null
Object pathSegment = iterator.next();
- TreeNode childRowTreeData = rowTreeData.getChild(pathSegment);
+ T childRowTreeData = nodeAdaptor.getChild(rowTreeData, pathSegment);
if (childRowTreeData == null) {
if (!allowCreate) {
return null;
} else {
- childRowTreeData = new TreeNodeImpl();
- rowTreeData.addChild(pathSegment, childRowTreeData);
+ childRowTreeData = nodeAdaptor.addChild(rowTreeData, pathSegment);
}
}
@@ -200,7 +220,7 @@
}
public boolean isRowAvailable() {
- TreeNode data = locateTreeNode(this.currentRowKey);
+ T data = locateTreeNode(this.currentRowKey);
if (data != null) {
return true;
@@ -211,9 +231,9 @@
public Object getRowData() {
if (isRowAvailable()) {
- TreeNode treeNode = locateTreeNode(this.currentRowKey);
+ T treeNode = locateTreeNode(this.currentRowKey);
if (treeNode != null) {
- return treeNode.getData();
+ return nodeAdaptor.getRowData(treeNode);
}
return null;
@@ -226,9 +246,9 @@
public boolean isLeaf() {
if (isRowAvailable()) {
- TreeNode treeNode = locateTreeNode(this.currentRowKey);
+ T treeNode = locateTreeNode(this.currentRowKey);
if (treeNode != null) {
- return treeNode.isLeaf();
+ return nodeAdaptor.isLeaf(treeNode);
}
}
@@ -240,12 +260,17 @@
walk(context, visitor, range, key, argument, last);
}
- public TreeNode getTreeNode() {
- if (isRowAvailable()) {
- return locateTreeNode(this.currentRowKey);
- }
+ @Override
+ public Object getWrappedData() {
+ return wrappedData;
+ }
- throw new IllegalStateException(
- "No tree element available or row key not set!");
+ @Override
+ public void setWrappedData(Object data) {
+ this.wrappedData = data;
}
+
+ protected T getData() {
+ return clazz.cast(wrappedData);
+ }
}
Added: trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModelNodeAdaptor.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModelNodeAdaptor.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/TreeDataModelNodeAdaptor.java 2007-11-01 01:37:44 UTC (rev 3663)
@@ -0,0 +1,183 @@
+/**
+ * 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.model;
+
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.swing.tree.TreeNode;
+
+/**
+ * Created 01.11.2007
+ * @author Nick Belaevski
+ * @since 3.2
+ */
+
+public interface TreeDataModelNodeAdaptor<T> {
+ public T getParent(T node);
+
+ public boolean isLeaf(T node);
+
+ public T addChild(T node, Object key);
+
+ public T getChild(T node, Object key);
+
+ public Iterator<Map.Entry<Object, T>> getChildren(T node);
+
+ public Object getRowData(T node);
+
+ public void setRowData(T node, Object rowData);
+
+ public static final TreeDataModelNodeAdaptor<org.richfaces.model.TreeNode> classicTreeNodeAdaptor =
+ new TreeDataModelNodeAdaptor<org.richfaces.model.TreeNode>() {
+
+ public org.richfaces.model.TreeNode addChild(org.richfaces.model.TreeNode node,
+ Object key) {
+ //TODO nick - review implementation usage inside interface
+ TreeNodeImpl impl = new TreeNodeImpl();
+ node.addChild(key, impl);
+
+ return impl;
+ }
+
+ public org.richfaces.model.TreeNode getChild(org.richfaces.model.TreeNode node, Object key) {
+ return node.getChild(key);
+ }
+
+ public Iterator<Entry<Object, org.richfaces.model.TreeNode>> getChildren(
+ org.richfaces.model.TreeNode node) {
+ return node.getChildren();
+ }
+
+ public org.richfaces.model.TreeNode getParent(org.richfaces.model.TreeNode node) {
+ return node.getParent();
+ }
+
+ public Object getRowData(org.richfaces.model.TreeNode node) {
+ return node.getData();
+ }
+
+ public boolean isLeaf(org.richfaces.model.TreeNode node) {
+ return node.isLeaf();
+ }
+
+ public void setRowData(org.richfaces.model.TreeNode node,
+ Object rowData) {
+ node.setData(rowData);
+ }
+
+ };
+
+ public static final TreeDataModelNodeAdaptor<javax.swing.tree.TreeNode> swingTreeNodeAdaptor =
+ new TreeDataModelNodeAdaptor<javax.swing.tree.TreeNode>() {
+
+ final class SwingNodeMapEntry implements Map.Entry<Object, TreeNode> {
+
+ private Object key;
+ private TreeNode child;
+
+ public SwingNodeMapEntry(int i, TreeNode child) {
+ this.key = Integer.valueOf(i);
+ this.child = child;
+ }
+
+ public Object getKey() {
+ return this.key;
+ }
+
+ public TreeNode getValue() {
+ return child;
+ }
+
+ public TreeNode setValue(TreeNode value) {
+ TreeNode node = this.child;
+ this.child = value;
+
+ return node;
+ }
+
+ };
+
+ public javax.swing.tree.TreeNode addChild(
+ javax.swing.tree.TreeNode node, Object key) {
+
+ throw new UnsupportedOperationException();
+ }
+
+ public javax.swing.tree.TreeNode getChild(
+ javax.swing.tree.TreeNode node, Object key) {
+
+ Integer intKey = (Integer) key;
+ return node.getChildAt(intKey.intValue());
+ }
+
+ public Iterator<Entry<Object, javax.swing.tree.TreeNode>> getChildren(
+ final javax.swing.tree.TreeNode node) {
+
+ if (node.getAllowsChildren()) {
+ return new Iterator<Entry<Object,javax.swing.tree.TreeNode>>() {
+
+ private final Enumeration<?> e = node.children();
+ private int counter = 0;
+
+ public boolean hasNext() {
+ return e.hasMoreElements();
+ }
+
+ public Entry<Object, javax.swing.tree.TreeNode> next() {
+ javax.swing.tree.TreeNode child = (javax.swing.tree.TreeNode) e.nextElement();
+ SwingNodeMapEntry entry = new SwingNodeMapEntry(counter++, child);
+ return entry;
+
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+ }
+
+ return null;
+ }
+
+ public javax.swing.tree.TreeNode getParent(
+ javax.swing.tree.TreeNode node) {
+ return node.getParent();
+ }
+
+ public Object getRowData(javax.swing.tree.TreeNode node) {
+ return node;
+ }
+
+ public boolean isLeaf(javax.swing.tree.TreeNode node) {
+ return !node.getAllowsChildren() || node.isLeaf();
+ }
+
+ public void setRowData(TreeNode node, Object rowData) {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+}
Modified: trunk/framework/api/src/main/java/org/richfaces/model/TreeNode.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/TreeNode.java 2007-11-01 01:04:03 UTC (rev 3662)
+++ trunk/framework/api/src/main/java/org/richfaces/model/TreeNode.java 2007-11-01 01:37:44 UTC (rev 3663)
@@ -55,7 +55,7 @@
* @return {@link Iterator} of {@link Map.Entry} instances containing {@link TreeNode} as values
* and their identifiers as keys
*/
- public Iterator getChildren();
+ public Iterator<Map.Entry<Object, TreeNode>> getChildren();
/**
* find child by id
* @param id identifier of the child to find
Modified: trunk/framework/api/src/main/java/org/richfaces/model/TreeRowKey.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/TreeRowKey.java 2007-11-01 01:04:03 UTC (rev 3662)
+++ trunk/framework/api/src/main/java/org/richfaces/model/TreeRowKey.java 2007-11-01 01:37:44 UTC (rev 3663)
@@ -31,6 +31,11 @@
*/
public abstract class TreeRowKey implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7318192501938658798L;
+
public static final char SEPARATOR_ESCAPE_CHAR = '_';
/**
@@ -44,7 +49,7 @@
* @param fromIndex
* @return subpath segments iterator
*/
- public abstract Iterator getSubPathIterator(int fromIndex);
+ public abstract Iterator<?> getSubPathIterator(int fromIndex);
/**
* getter for path string representation
@@ -73,7 +78,7 @@
* getter for path iterator
* @return path segments iterator
*/
- public abstract Iterator iterator();
+ public abstract Iterator<?> iterator();
/**
* returns this row key and otherRowKey argument row key common path segments count
Property changes on: trunk/samples/seamIntegration
___________________________________________________________________
Name: svn:ignore
+ target
.classpath
.project
.settings
Modified: trunk/samples/tree-demo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/samples/tree-demo/src/main/java/org/richfaces/Bean.java 2007-11-01 01:04:03 UTC (rev 3662)
+++ trunk/samples/tree-demo/src/main/java/org/richfaces/Bean.java 2007-11-01 01:37:44 UTC (rev 3663)
@@ -22,9 +22,12 @@
package org.richfaces;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import javax.faces.FacesException;
import javax.faces.application.Application;
@@ -55,6 +58,8 @@
private TreeNode data;
+ private List<javax.swing.tree.TreeNode> swingTreeNodes;
+
private TreeNode selectedNode = null;
private Map selectedNodeChildren = new LinkedHashMap();
@@ -152,11 +157,38 @@
data1.addChild(id, child);
}
initData();
+
+ SwingTreeNode treeNode = convertToSwingTreeNode(this.data);
+ List<javax.swing.tree.TreeNode> list = new ArrayList<javax.swing.tree.TreeNode>();
+ for (int i = 0; i < treeNode.getChildCount(); i++) {
+ list.add(treeNode.getChildAt(i));
+ }
+
+ this.swingTreeNodes = list;
}
+ private SwingTreeNode convertToSwingTreeNode(TreeNode treeNode) {
+ SwingTreeNode node = new SwingTreeNode(treeNode.getData());
+ if (treeNode.isLeaf()) {
+ node.setAllowsChildren(false);
+ } else {
+ Iterator<Entry<Object, TreeNode>> children = treeNode.getChildren();
+ while (children.hasNext()) {
+ TreeNode value = children.next().getValue();
+ node.addChild(convertToSwingTreeNode(value));
+ }
+ }
+
+ return node;
+ }
+
public TreeNode getData() {
return data;
}
+
+ public List<javax.swing.tree.TreeNode> getSwingTreeNodes() {
+ return swingTreeNodes;
+ }
public String getSwitchType() {
return switchType;
Added: trunk/samples/tree-demo/src/main/java/org/richfaces/SwingTreeNode.java
===================================================================
--- trunk/samples/tree-demo/src/main/java/org/richfaces/SwingTreeNode.java (rev 0)
+++ trunk/samples/tree-demo/src/main/java/org/richfaces/SwingTreeNode.java 2007-11-01 01:37:44 UTC (rev 3663)
@@ -0,0 +1,132 @@
+/**
+ * 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;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import javax.swing.tree.TreeNode;
+
+/**
+ * Created 01.11.2007
+ * @author Nick Belaevski
+ * @since 3.2
+ */
+
+public class SwingTreeNode implements TreeNode {
+
+ private TreeNode parent;
+ private Vector<SwingTreeNode> children = new Vector<SwingTreeNode>();
+ private boolean allowsChildren = true;
+ private Object data;
+
+ public SwingTreeNode(Object data) {
+ super();
+ this.data = data;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.tree.TreeNode#children()
+ */
+ public Enumeration children() {
+ if (getAllowsChildren()) {
+ return children.elements();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.tree.TreeNode#getAllowsChildren()
+ */
+ public boolean getAllowsChildren() {
+ return allowsChildren;
+ }
+
+ public void setAllowsChildren(boolean allowsChildren) {
+ this.allowsChildren = allowsChildren;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.tree.TreeNode#getChildAt(int)
+ */
+ public TreeNode getChildAt(int childIndex) {
+ if (getAllowsChildren()) {
+ return children.get(childIndex);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.tree.TreeNode#getChildCount()
+ */
+ public int getChildCount() {
+ return children.size();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.tree.TreeNode#getIndex(javax.swing.tree.TreeNode)
+ */
+ public int getIndex(TreeNode node) {
+ if (getAllowsChildren()) {
+ return children.indexOf(node);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.tree.TreeNode#getParent()
+ */
+ public TreeNode getParent() {
+ return parent;
+ }
+
+ public void setParent(TreeNode parent) {
+ this.parent = parent;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.tree.TreeNode#isLeaf()
+ */
+ public boolean isLeaf() {
+ if (getAllowsChildren()) {
+ return children.isEmpty();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public void addChild(SwingTreeNode node) {
+ if (getAllowsChildren()) {
+ node.setParent(this);
+ children.add(node);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public Object getData() {
+ return data;
+ }
+}
Modified: trunk/samples/tree-demo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/tree-demo/src/main/webapp/pages/index.jsp 2007-11-01 01:04:03 UTC (rev 3662)
+++ trunk/samples/tree-demo/src/main/webapp/pages/index.jsp 2007-11-01 01:37:44 UTC (rev 3663)
@@ -185,6 +185,21 @@
<br />
</f:verbatim>
+ <h:outputText value="Swing Tree:" />
+
+ <rich:tree id="swingTree" switchType="client" value="#{bean.swingTreeNodes}" var="data"
+ preserveModel="none">
+
+ <rich:treeNode>
+ <h:outputText value="#{data.data}" />
+ </rich:treeNode>
+ </rich:tree>
+
+ <f:verbatim>
+ <br />
+ <br />
+ </f:verbatim>
+
<rich:tree id="testTree"
var="_data"
switchType="ajax"
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/CacheableTreeDataModel.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/CacheableTreeDataModel.java 2007-11-01 01:04:03 UTC (rev 3662)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/CacheableTreeDataModel.java 2007-11-01 01:37:44 UTC (rev 3663)
@@ -37,7 +37,7 @@
* @author Nick - mailto:nbelaevski@exadel.com created 08.01.2007
*
*/
-public class CacheableTreeDataModel extends TreeDataModel {
+public class CacheableTreeDataModel<T> extends TreeDataModel<T> {
private final class Visitor implements DataVisitor, LastElementAware {
private final DataVisitor visitor;
@@ -50,7 +50,7 @@
throws IOException {
TreeRowKey treeRowKey = (TreeRowKey) rowKey;
treeDataModel.setRowKey(treeRowKey);
- locateTreeNode(treeRowKey, true).setData(treeDataModel.getRowData());
+ nodeAdaptor.setRowData(locateTreeNode(treeRowKey, true), treeDataModel.getRowData());
if (visitor != null) {
visitor.process(context, rowKey, argument);
@@ -72,25 +72,25 @@
}
}
- private TreeDataModel treeDataModel;
+ private TreeDataModel<T> treeDataModel;
public boolean isLeaf() {
TreeRowKey rowKey = (TreeRowKey) getRowKey();
- TreeNode treeNode = locateTreeNode(rowKey);
- if (treeNode != null && !treeNode.isLeaf()) {
+ T treeNode = locateTreeNode(rowKey);
+ if (treeNode != null && !nodeAdaptor.isLeaf(treeNode)) {
return false;
}
treeNode = treeDataModel.locateTreeNode(rowKey);
if (treeNode != null) {
- return treeNode.isLeaf();
+ return nodeAdaptor.isLeaf(treeNode);
}
return false;
}
- public CacheableTreeDataModel(TreeDataModel model) {
- super();
+ public CacheableTreeDataModel(TreeDataModel<T> model) {
+ super(model.getClazz(), model.getNodeAdaptor());
setWrappedData(new TreeNodeImpl());
setTreeDataModel(model);
}
@@ -102,11 +102,11 @@
argument, last);
}
- public void setTreeDataModel(TreeDataModel treeDataModel) {
+ public void setTreeDataModel(TreeDataModel<T> treeDataModel) {
this.treeDataModel = treeDataModel;
}
- public TreeDataModel getTreeDataModel() {
+ public TreeDataModel<T> getTreeDataModel() {
return treeDataModel;
}
@@ -114,11 +114,11 @@
Range range, Object rowKey, Object argument, boolean last)
throws IOException {
- TreeNode cachedTreeNode = locateTreeNode((TreeRowKey) rowKey);
- TreeNode treeNode = treeDataModel.locateTreeNode((TreeRowKey) rowKey);
+ T cachedTreeNode = locateTreeNode((TreeRowKey) rowKey);
+ T treeNode = treeDataModel.locateTreeNode((TreeRowKey) rowKey);
if (treeNode != null) {
- if (cachedTreeNode == null || (cachedTreeNode.isLeaf() && !treeNode.isLeaf())) {
+ if (cachedTreeNode == null || (nodeAdaptor.isLeaf(cachedTreeNode) && !nodeAdaptor.isLeaf(treeNode))) {
//fill cache
treeDataModel.walk(context, new Visitor(dataVisitor), range,
rowKey, argument, last);
@@ -128,10 +128,6 @@
}
}
- public void setRowData(Object object) {
- (locateTreeNode((TreeRowKey)getRowKey())).setData(object);
- }
-
public boolean isTransient() {
return true;
}
@@ -142,4 +138,10 @@
"ReplaceableTreeDataModel shouldn't be transient!");
}
}
+
+ @Override
+ public TreeNode getTreeNode() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2007-11-01 01:04:03 UTC (rev 3662)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2007-11-01 01:37:44 UTC (rev 3663)
@@ -22,9 +22,7 @@
package org.richfaces.component;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import javax.faces.application.Application;
@@ -64,9 +62,10 @@
import org.richfaces.event.NodeSelectedListener;
import org.richfaces.event.TreeListenerEventsProducer;
import org.richfaces.model.AbstractTreeDataModel;
-import org.richfaces.model.ListRowKey;
+import org.richfaces.model.ClassicTreeDataModel;
import org.richfaces.model.StackingTreeModel;
import org.richfaces.model.StackingTreeModelProvider;
+import org.richfaces.model.SwingTreeDataModel;
import org.richfaces.model.TreeDataModel;
import org.richfaces.model.TreeModelVisualComponentProvider;
import org.richfaces.model.TreeNode;
@@ -511,14 +510,21 @@
private ExtendedDataModel createDataModel(boolean allowCached) {
Object value = this.getValue();
if (value != null) {
- TreeDataModel treeDataModel = new TreeDataModel();
- treeDataModel.setWrappedData(this.getValue());
-
- if (allowCached && PRESERVE_MODEL_REQUEST.equals(getPreserveModel())) {
- treeDataModel = new CacheableTreeDataModel(treeDataModel);
+ if (value instanceof TreeNode) {
+ TreeDataModel<TreeNode> treeDataModel = new ClassicTreeDataModel();
+ treeDataModel.setWrappedData(value);
+
+ if (allowCached && PRESERVE_MODEL_REQUEST.equals(getPreserveModel())) {
+ treeDataModel = new CacheableTreeDataModel<TreeNode>(treeDataModel);
+ }
+
+ return treeDataModel;
+ } else {
+ SwingTreeDataModel swingTreeDataModel = new SwingTreeDataModel();
+ swingTreeDataModel.setWrappedData(value);
+
+ return swingTreeDataModel;
}
-
- return treeDataModel;
} else {
//TODO implement request caching
StackingTreeModel stackingTreeModel = new VisualStackingTreeModel(null);
Modified: trunk/ui/tree/src/test/java/org/richfaces/component/TreeModelTest.java
===================================================================
--- trunk/ui/tree/src/test/java/org/richfaces/component/TreeModelTest.java 2007-11-01 01:04:03 UTC (rev 3662)
+++ trunk/ui/tree/src/test/java/org/richfaces/component/TreeModelTest.java 2007-11-01 01:37:44 UTC (rev 3663)
@@ -35,9 +35,9 @@
import org.richfaces.component.xml.XmlNodeData;
import org.richfaces.component.xml.XmlTreeDataBuilder;
import org.richfaces.model.AbstractTreeDataModel;
+import org.richfaces.model.ClassicTreeDataModel;
import org.richfaces.model.LastElementAware;
import org.richfaces.model.ListRowKey;
-import org.richfaces.model.TreeDataModel;
import org.richfaces.model.TreeNode;
import org.xml.sax.InputSource;
@@ -48,7 +48,7 @@
*/
public class TreeModelTest extends TestCase {
private TreeNode node = null;
- private AbstractTreeDataModel model = new TreeDataModel();
+ private AbstractTreeDataModel model = new ClassicTreeDataModel();
protected void setUp() throws Exception {
super.setUp();
16 years, 5 months