JBoss Rich Faces SVN: r10328 - branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/validation.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2008-09-05 12:01:19 -0400 (Fri, 05 Sep 2008)
New Revision: 10328
Modified:
branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/validation/ValidationBean.java
Log:
Fix RF-4251 bug
Modified: branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/validation/ValidationBean.java
===================================================================
--- branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/validation/ValidationBean.java 2008-09-05 15:56:10 UTC (rev 10327)
+++ branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/validation/ValidationBean.java 2008-09-05 16:01:19 UTC (rev 10328)
@@ -20,7 +20,7 @@
private String progressString="Fill the form please";
@NotEmpty
- @Pattern(regex="[^\\s]+", message="This string contain only spaces")
+ @Pattern(regex=".*[^\\s].*", message="This string contain only spaces")
@Length(min=3,max=12)
private String name;
@Email
16 years, 3 months
JBoss Rich Faces SVN: r10327 - trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/validation.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2008-09-05 11:56:10 -0400 (Fri, 05 Sep 2008)
New Revision: 10327
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/validation/ValidationBean.java
Log:
Fix 4251 bug
Modified: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/validation/ValidationBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/validation/ValidationBean.java 2008-09-05 15:24:50 UTC (rev 10326)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/validation/ValidationBean.java 2008-09-05 15:56:10 UTC (rev 10327)
@@ -20,7 +20,7 @@
private String progressString="Fill the form please";
@NotEmpty
- @Pattern(regex="[^\\s]+", message="This string contain only spaces")
+ @Pattern(regex=".*[^\\s].*", message="This string contain only spaces")
@Length(min=3,max=12)
private String name;
@Email
16 years, 3 months
JBoss Rich Faces SVN: r10326 - trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-09-05 11:24:50 -0400 (Fri, 05 Sep 2008)
New Revision: 10326
Modified:
trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
Log:
https://jira.jboss.org/jira/browse/RF-4373
Modified: trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
===================================================================
--- trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2008-09-05 15:22:56 UTC (rev 10325)
+++ trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2008-09-05 15:24:50 UTC (rev 10326)
@@ -389,8 +389,10 @@
}
if (e.keyCode == 13) {
- if (this.required || "" != this.input.value)
- this.input.value=this.getNearestValue(this.value);
+ if (this.required || "" != this.input.value) {
+ this.setValue(Number(this.value));
+ this.input.value = this.value;
+ }
if (this.input.form) {
this.input.form.submit();
}
16 years, 3 months
JBoss Rich Faces SVN: r10325 - branches/3.2.x/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-09-05 11:22:56 -0400 (Fri, 05 Sep 2008)
New Revision: 10325
Modified:
branches/3.2.x/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
Log:
https://jira.jboss.org/jira/browse/RF-4373
Modified: branches/3.2.x/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
===================================================================
--- branches/3.2.x/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2008-09-05 15:18:27 UTC (rev 10324)
+++ branches/3.2.x/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2008-09-05 15:22:56 UTC (rev 10325)
@@ -389,8 +389,10 @@
}
if (e.keyCode == 13) {
- if (this.required || "" != this.input.value)
- this.input.value=this.getNearestValue(this.value);
+ if (this.required || "" != this.input.value) {
+ this.setValue(Number(this.value));
+ this.input.value = this.value;
+ }
if (this.input.form) {
this.input.form.submit();
}
16 years, 3 months
JBoss Rich Faces SVN: r10324 - branches/3.2.x/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-09-05 11:18:27 -0400 (Fri, 05 Sep 2008)
New Revision: 10324
Modified:
branches/3.2.x/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
Log:
Reset frame fix
Modified: branches/3.2.x/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
--- branches/3.2.x/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-09-05 15:17:38 UTC (rev 10323)
+++ branches/3.2.x/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-09-05 15:18:27 UTC (rev 10324)
@@ -541,7 +541,11 @@
},
resetFrame: function () {
- if (this.iframe && this.iframe.contentWindow.document && this.iframe.contentWindow.document.body) this.iframe.contentWindow.document.body.innerHTML = "";
+ if (window.opera && this.iframe && this.iframe.contentWindow.document && this.iframe.contentWindow.document.body) {
+ this.iframe.contentWindow.document.body.innerHTML = "";
+ } else {
+ this.iframe.src = "javascript:''";
+ }
},
initEvents : function() {
16 years, 3 months
JBoss Rich Faces SVN: r10323 - trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-09-05 11:17:38 -0400 (Fri, 05 Sep 2008)
New Revision: 10323
Modified:
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
Log:
Reset frame fix
Modified: trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
--- trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-09-05 13:13:42 UTC (rev 10322)
+++ trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2008-09-05 15:17:38 UTC (rev 10323)
@@ -541,7 +541,11 @@
},
resetFrame: function () {
- if (this.iframe && this.iframe.contentWindow.document && this.iframe.contentWindow.document.body) this.iframe.contentWindow.document.body.innerHTML = "";
+ if (window.opera && this.iframe && this.iframe.contentWindow.document && this.iframe.contentWindow.document.body) {
+ this.iframe.contentWindow.document.body.innerHTML = "";
+ } else {
+ this.iframe.src = "javascript:''";
+ }
},
initEvents : function() {
16 years, 3 months
JBoss Rich Faces SVN: r10322 - in branches/3.2.x/samples/richfaces-demo/src/main: webapp/richfaces/tree/examples and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alevkovsky
Date: 2008-09-05 09:13:42 -0400 (Fri, 05 Sep 2008)
New Revision: 10322
Added:
branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/DemoTreeNodeImpl.java
Modified:
branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/SimpleTreeDndBean.java
branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simple-tree-data-dnd.properties
branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simpleDnd.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-4394
Added: branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/DemoTreeNodeImpl.java
===================================================================
--- branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/DemoTreeNodeImpl.java (rev 0)
+++ branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/DemoTreeNodeImpl.java 2008-09-05 13:13:42 UTC (rev 10322)
@@ -0,0 +1,34 @@
+/*
+ * DemoTreeNodeImpl.java Date created: 05.09.2008
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.richfaces.demo.tree;
+
+import org.richfaces.model.TreeNodeImpl;
+
+/**
+ * TODO Class description goes here.
+ * @author Alexandr Levkovsky
+ *
+ */
+public class DemoTreeNodeImpl<T> extends TreeNodeImpl<T>{
+
+ private String type;
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+}
Property changes on: branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/DemoTreeNodeImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/SimpleTreeDndBean.java
===================================================================
--- branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/SimpleTreeDndBean.java 2008-09-05 11:17:23 UTC (rev 10321)
+++ branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/SimpleTreeDndBean.java 2008-09-05 13:13:42 UTC (rev 10322)
@@ -31,7 +31,6 @@
import java.util.Properties;
import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -43,183 +42,189 @@
import org.richfaces.event.DropEvent;
import org.richfaces.event.NodeSelectedEvent;
import org.richfaces.model.TreeNode;
-import org.richfaces.model.TreeNodeImpl;
import org.richfaces.model.TreeRowKey;
public class SimpleTreeDndBean {
-
- private TreeNode rootNode = null;
- private List<TreeNode<String>> selectedNodeChildren = new ArrayList<TreeNode<String>>();
- private String nodeTitle;
-
- private static final String DATA_PATH = "/richfaces/tree/examples/simple-tree-data-dnd.properties";
-
- private void addNodes(String path, TreeNode node, Properties properties) {
- boolean end = false;
- int counter = 1;
-
- while (!end) {
- String key = path != null ? path + '.' + counter : String.valueOf(counter);
- String value = properties.getProperty(key);
- if (value != null) {
- TreeNodeImpl nodeImpl = new TreeNodeImpl();
- nodeImpl.setData(value);
- node.addChild(new Integer(counter), nodeImpl);
-
- addNodes(key, nodeImpl, properties);
-
- counter++;
- } else {
- end = true;
- }
+ private TreeNode rootNode = null;
+
+ private List<TreeNode<String>> selectedNodeChildren = new ArrayList<TreeNode<String>>();
+
+ private String nodeTitle;
+
+ private static final String DATA_PATH = "/richfaces/tree/examples/simple-tree-data-dnd.properties";
+
+ private void addNodes(String path, TreeNode node, Properties properties) {
+ boolean end = false;
+ int counter = 1;
+
+ while (!end) {
+ String key = path != null ? path + '.' + counter : String.valueOf(counter);
+
+ String value = properties.getProperty(key);
+ if (value != null) {
+ DemoTreeNodeImpl nodeImpl = new DemoTreeNodeImpl();
+ String[] splittedValue = value.split(" - ");
+ if (splittedValue.length > 1) {
+ nodeImpl.setData(splittedValue[0]);
+ nodeImpl.setType(splittedValue[1]);
+ node.addChild(new Integer(counter), nodeImpl);
}
+ addNodes(key, nodeImpl, properties);
+
+ counter++;
+ } else {
+ end = true;
+ }
}
-
- private void loadTree() {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- ExternalContext externalContext = facesContext.getExternalContext();
- InputStream dataStream = externalContext.getResourceAsStream(DATA_PATH);
+ }
+
+ private void loadTree() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ExternalContext externalContext = facesContext.getExternalContext();
+ InputStream dataStream = externalContext.getResourceAsStream(DATA_PATH);
+ try {
+ Properties properties = new Properties();
+ properties.load(dataStream);
+
+ rootNode = new DemoTreeNodeImpl();
+ addNodes(null, rootNode, properties);
+
+ } catch (IOException e) {
+ throw new FacesException(e.getMessage(), e);
+ } finally {
+ if (dataStream != null) {
try {
- Properties properties = new Properties();
- properties.load(dataStream);
-
- rootNode = new TreeNodeImpl();
- addNodes(null, rootNode, properties);
-
+ dataStream.close();
} catch (IOException e) {
- throw new FacesException(e.getMessage(), e);
- } finally {
- if (dataStream != null) {
- try {
- dataStream.close();
- } catch (IOException e) {
- externalContext.log(e.getMessage(), e);
- }
- }
+ externalContext.log(e.getMessage(), e);
}
+ }
}
+ }
- public void processSelection(NodeSelectedEvent event) {
- HtmlTree tree = (HtmlTree) event.getComponent();
- nodeTitle = (String) tree.getRowData();
- selectedNodeChildren.clear();
- TreeNode<String> currentNode = tree.getModelTreeNode(tree.getRowKey());
- if (currentNode.isLeaf()){
- selectedNodeChildren.add(currentNode);
- }else
- {
- Iterator<Map.Entry<Object, TreeNode<String>>> it = currentNode.getChildren();
- while (it!=null &&it.hasNext()) {
- Map.Entry<Object, TreeNode<String>> entry = it.next();
- selectedNodeChildren.add(entry.getValue());
- }
- }
+ public void processSelection(NodeSelectedEvent event) {
+ HtmlTree tree = (HtmlTree) event.getComponent();
+ nodeTitle = (String) tree.getRowData();
+ selectedNodeChildren.clear();
+ TreeNode<String> currentNode = tree.getModelTreeNode(tree.getRowKey());
+ DemoTreeNodeImpl<String> demoCurrentNodeImpl = currentNode instanceof DemoTreeNodeImpl ? (DemoTreeNodeImpl) currentNode : null;
+ if (currentNode.isLeaf() && (demoCurrentNodeImpl != null && demoCurrentNodeImpl.getType().toLowerCase().equals("leaf") || demoCurrentNodeImpl == null)) {
+ selectedNodeChildren.add(currentNode);
+ } else {
+ Iterator<Map.Entry<Object, TreeNode<String>>> it = currentNode.getChildren();
+ while (it != null && it.hasNext()) {
+ Map.Entry<Object, TreeNode<String>> entry = it.next();
+ selectedNodeChildren.add(entry.getValue());
+ }
}
+ }
- private Object getNewId(TreeNode parentNode) {
- Map<Object, TreeNode> childs = new HashMap<Object, TreeNode>();
- Iterator<Map.Entry<Object, TreeNode>> iter = parentNode.getChildren();
- while (iter != null && iter.hasNext()) {
- Map.Entry<Object, TreeNode> entry = iter.next();
- childs.put(entry.getKey(), entry.getValue());
- }
-
- Integer index = 1;
- while (childs.containsKey(index)) {
- index++;
- }
- return index;
+ private Object getNewId(TreeNode parentNode) {
+ Map<Object, TreeNode> childs = new HashMap<Object, TreeNode>();
+ Iterator<Map.Entry<Object, TreeNode>> iter = parentNode.getChildren();
+ while (iter != null && iter.hasNext()) {
+ Map.Entry<Object, TreeNode> entry = iter.next();
+ childs.put(entry.getKey(), entry.getValue());
+ }
+
+ Integer index = 1;
+ while (childs.containsKey(index)) {
+ index++;
+ }
+ return index;
}
-
- public void dropListener(DropEvent dropEvent) {
-
- // resolve drag destination attributes
- UITreeNode destNode = (dropEvent.getSource() instanceof UITreeNode) ? (UITreeNode) dropEvent.getSource() : null;
- UITree destTree = destNode != null ? destNode.getUITree() : null;
- TreeRowKey dropNodeKey = (dropEvent.getDropValue() instanceof TreeRowKey) ? (TreeRowKey) dropEvent.getDropValue() : null;
- TreeNode droppedInNode = dropNodeKey != null ? destTree.getTreeNode(dropNodeKey) : null;
-
- // resolve drag source attributes
- UITreeNode srcNode = (dropEvent.getDraggableSource() instanceof UITreeNode) ? (UITreeNode) dropEvent.getDraggableSource() : null;
- UITree srcTree = srcNode != null ? srcNode.getUITree() : null;
- TreeRowKey dragNodeKey = (dropEvent.getDragValue() instanceof TreeRowKey) ? (TreeRowKey) dropEvent.getDragValue() : null;
- TreeNode draggedNode = dragNodeKey != null ? srcTree.getTreeNode(dragNodeKey) : null;
- if (dropEvent.getDraggableSource() instanceof UIDragSupport && srcTree == null && draggedNode == null && dropEvent.getDragValue() instanceof TreeNode) {
- srcTree = destTree;
- draggedNode = (TreeNode) dropEvent.getDragValue();
- dragNodeKey = srcTree.getTreeNodeRowKey(draggedNode) instanceof TreeRowKey ? (TreeRowKey) srcTree.getTreeNodeRowKey(draggedNode) : null;
- }
-
- // Note: check if we dropped node on to itself or to item instead of folder here
- if (droppedInNode != null && (droppedInNode.equals(draggedNode) || droppedInNode.getParent().getParent() != null || draggedNode.getParent().getParent() == null)) {
- System.out.println("Warning: Can't drop on itself or to pic itself! Also can't move folders");
- return;
- }
- FacesContext context = FacesContext.getCurrentInstance();
-
- if (dropNodeKey != null) {
- // add destination node for rerender
- destTree.addRequestKey(dropNodeKey);
-
- Object state = null;
- if (dragNodeKey != null) { // Drag from this or other tree
- TreeNode parentNode = draggedNode.getParent();
- // 1. remove node from tree
- state = srcTree.removeNode(dragNodeKey);
- // 2. add parent for rerender
- Object rowKey = srcTree.getTreeNodeRowKey(parentNode);
- srcTree.addRequestKey(rowKey);
- if (dropEvent.getDraggableSource() instanceof UIDragSupport){
- selectedNodeChildren.remove(draggedNode);
- // if node was gragged in it's parent place dragged node to the end of selected nodes in grid
- if (droppedInNode.equals(parentNode)) {
- selectedNodeChildren.add(draggedNode);
- }
- }
- } else if (dropEvent.getDragValue() != null) { // Drag from some drag source
- draggedNode = new TreeNodeImpl<String>();
- draggedNode.setData(dropEvent.getDragValue().toString());
- }
-
- // generate new node id
- Object id = getNewId(destTree.getTreeNode(dropNodeKey));
- destTree.addNode(dropNodeKey, draggedNode, id, state);
- }
-
- AjaxContext ac = AjaxContext.getCurrentInstance();
- // Add destination tree to reRender
- try {
- ac.addComponentToAjaxRender(destTree);
- } catch (Exception e) {
- System.err.print(e.getMessage());
- }
-
-
+ public void dropListener(DropEvent dropEvent) {
+
+ // resolve drag destination attributes
+ UITreeNode destNode = (dropEvent.getSource() instanceof UITreeNode) ? (UITreeNode) dropEvent.getSource() : null;
+ UITree destTree = destNode != null ? destNode.getUITree() : null;
+ TreeRowKey dropNodeKey = (dropEvent.getDropValue() instanceof TreeRowKey) ? (TreeRowKey) dropEvent.getDropValue() : null;
+ TreeNode droppedInNode = dropNodeKey != null ? destTree.getTreeNode(dropNodeKey) : null;
+
+ // resolve drag source attributes
+ UITreeNode srcNode = (dropEvent.getDraggableSource() instanceof UITreeNode) ? (UITreeNode) dropEvent.getDraggableSource() : null;
+ UITree srcTree = srcNode != null ? srcNode.getUITree() : null;
+ TreeRowKey dragNodeKey = (dropEvent.getDragValue() instanceof TreeRowKey) ? (TreeRowKey) dropEvent.getDragValue() : null;
+ TreeNode draggedNode = dragNodeKey != null ? srcTree.getTreeNode(dragNodeKey) : null;
+ if (dropEvent.getDraggableSource() instanceof UIDragSupport && srcTree == null && draggedNode == null && dropEvent.getDragValue() instanceof TreeNode) {
+ srcTree = destTree;
+ draggedNode = (TreeNode) dropEvent.getDragValue();
+ dragNodeKey = srcTree.getTreeNodeRowKey(draggedNode) instanceof TreeRowKey ? (TreeRowKey) srcTree.getTreeNodeRowKey(draggedNode) : null;
}
-
- public List<TreeNode<String>> getSelectedNodeChildren() {
- return selectedNodeChildren;
+
+ // Note: check if we dropped node on to itself or to item instead of
+ // folder here
+ if (droppedInNode != null && (droppedInNode.equals(draggedNode) || droppedInNode.getParent().getParent() != null || draggedNode.getParent().getParent() == null)) {
+ System.out.println("Warning: Can't drop on itself or to pic itself! Also can't move folders");
+ return;
}
- public void setSelectedNodeChildren(List<TreeNode<String>> selectedNodeChildren) {
- this.selectedNodeChildren = selectedNodeChildren;
- }
-
- public TreeNode getTreeNode() {
- if (rootNode == null) {
- loadTree();
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ if (dropNodeKey != null) {
+ // add destination node for rerender
+ destTree.addRequestKey(dropNodeKey);
+
+ Object state = null;
+ if (dragNodeKey != null) { // Drag from this or other tree
+ TreeNode parentNode = draggedNode.getParent();
+ // 1. remove node from tree
+ state = srcTree.removeNode(dragNodeKey);
+ // 2. add parent for rerender
+ Object rowKey = srcTree.getTreeNodeRowKey(parentNode);
+ srcTree.addRequestKey(rowKey);
+ if (dropEvent.getDraggableSource() instanceof UIDragSupport) {
+ selectedNodeChildren.remove(draggedNode);
+ // if node was gragged in it's parent place dragged node to
+ // the end of selected nodes in grid
+ if (droppedInNode.equals(parentNode)) {
+ selectedNodeChildren.add(draggedNode);
+ }
}
- return rootNode;
+ } else if (dropEvent.getDragValue() != null) { // Drag from some
+ // drag source
+ draggedNode = new DemoTreeNodeImpl<String>();
+ draggedNode.setData(dropEvent.getDragValue().toString());
+ }
+
+ // generate new node id
+ Object id = getNewId(destTree.getTreeNode(dropNodeKey));
+ destTree.addNode(dropNodeKey, draggedNode, id, state);
}
- public String getNodeTitle() {
- return nodeTitle;
+ AjaxContext ac = AjaxContext.getCurrentInstance();
+ // Add destination tree to reRender
+ try {
+ ac.addComponentToAjaxRender(destTree);
+ } catch (Exception e) {
+ System.err.print(e.getMessage());
}
- public void setNodeTitle(String nodeTitle) {
- this.nodeTitle = nodeTitle;
+ }
+
+ public List<TreeNode<String>> getSelectedNodeChildren() {
+ return selectedNodeChildren;
+ }
+
+ public void setSelectedNodeChildren(List<TreeNode<String>> selectedNodeChildren) {
+ this.selectedNodeChildren = selectedNodeChildren;
+ }
+
+ public TreeNode getTreeNode() {
+ if (rootNode == null) {
+ loadTree();
}
+ return rootNode;
+ }
+ public String getNodeTitle() {
+ return nodeTitle;
+ }
+
+ public void setNodeTitle(String nodeTitle) {
+ this.nodeTitle = nodeTitle;
+ }
+
}
Modified: branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simple-tree-data-dnd.properties
===================================================================
--- branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simple-tree-data-dnd.properties 2008-09-05 11:17:23 UTC (rev 10321)
+++ branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simple-tree-data-dnd.properties 2008-09-05 13:13:42 UTC (rev 10322)
@@ -1,11 +1,12 @@
-1=Unsorted
-1.1=pic1.jpg
-1.2=pic2.jpg
-1.3=pic3.jpg
-1.4=pic4.jpg
-1.5=pic5.jpg
-1.6=pic6.jpg
-1.7=pic7.jpg
-1.8=pic8.jpg
-2 = Favorites
-3 = Trash
\ No newline at end of file
+#path=name - type
+1=Unsorted - node
+1.1=pic1.jpg - leaf
+1.2=pic2.jpg - leaf
+1.3=pic3.jpg - leaf
+1.4=pic4.jpg - leaf
+1.5=pic5.jpg - leaf
+1.6=pic6.jpg - leaf
+1.7=pic7.jpg - leaf
+1.8=pic8.jpg - leaf
+2 = Favorites - node
+3 = Trash - node
\ No newline at end of file
Modified: branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simpleDnd.xhtml
===================================================================
--- branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simpleDnd.xhtml 2008-09-05 11:17:23 UTC (rev 10321)
+++ branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simpleDnd.xhtml 2008-09-05 13:13:42 UTC (rev 10322)
@@ -21,7 +21,7 @@
<rich:dragIndicator id="indicator1" >
<f:facet name="single">
- {draggedImage}
+ <h:graphicImage styleClass="indicatorPicture" value="/richfaces/jQuery/images/{draggedImage}" />
</f:facet>
</rich:dragIndicator>
<rich:dragIndicator id="indicator2" />
@@ -40,11 +40,9 @@
</rich:treeNode>
</rich:tree>
<rich:panel id="selectedNode">
- <rich:dataGrid id="selectedNodeGrid" value="#{simpleTreeDndBean.selectedNodeChildren}" var="item" columns="3" border="0">
+ <rich:dataGrid id="selectedNodeGrid" style="display: #{!empty simpleTreeDndBean.selectedNodeChildren ? '' : 'none'}" value="#{simpleTreeDndBean.selectedNodeChildren}" var="item" columns="3" border="0">
<rich:dragSupport dragIndicator="indicator1" dragType="pic" dragValue="#{item}" reRender="selectedNodeGrid">
- <rich:dndParam name="draggedImage">
- <h:graphicImage styleClass="indicatorPicture" value="/richfaces/jQuery/images/#{item.data}" />
- </rich:dndParam>
+ <rich:dndParam name="draggedImage" value="#{item.data}"/>
</rich:dragSupport>
<h:graphicImage value="/richfaces/jQuery/images/#{item.data}" />
</rich:dataGrid>
16 years, 3 months
JBoss Rich Faces SVN: r10321 - in trunk/samples/richfaces-demo/src/main: webapp/richfaces/tree/examples and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alevkovsky
Date: 2008-09-05 07:17:23 -0400 (Fri, 05 Sep 2008)
New Revision: 10321
Added:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/DemoTreeNodeImpl.java
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/SimpleTreeDndBean.java
trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simple-tree-data-dnd.properties
trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simpleDnd.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-4394
Added: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/DemoTreeNodeImpl.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/DemoTreeNodeImpl.java (rev 0)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/DemoTreeNodeImpl.java 2008-09-05 11:17:23 UTC (rev 10321)
@@ -0,0 +1,34 @@
+/*
+ * DemoTreeNodeImpl.java Date created: 05.09.2008
+ * Last modified by: $Author$
+ * $Revision$ $Date$
+ */
+
+package org.richfaces.demo.tree;
+
+import org.richfaces.model.TreeNodeImpl;
+
+/**
+ * TODO Class description goes here.
+ * @author Alexandr Levkovsky
+ *
+ */
+public class DemoTreeNodeImpl<T> extends TreeNodeImpl<T>{
+
+ private String type;
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+}
Property changes on: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/DemoTreeNodeImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/SimpleTreeDndBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/SimpleTreeDndBean.java 2008-09-05 10:57:33 UTC (rev 10320)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/SimpleTreeDndBean.java 2008-09-05 11:17:23 UTC (rev 10321)
@@ -31,7 +31,6 @@
import java.util.Properties;
import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -43,183 +42,189 @@
import org.richfaces.event.DropEvent;
import org.richfaces.event.NodeSelectedEvent;
import org.richfaces.model.TreeNode;
-import org.richfaces.model.TreeNodeImpl;
import org.richfaces.model.TreeRowKey;
public class SimpleTreeDndBean {
-
- private TreeNode rootNode = null;
- private List<TreeNode<String>> selectedNodeChildren = new ArrayList<TreeNode<String>>();
- private String nodeTitle;
-
- private static final String DATA_PATH = "/richfaces/tree/examples/simple-tree-data-dnd.properties";
-
- private void addNodes(String path, TreeNode node, Properties properties) {
- boolean end = false;
- int counter = 1;
-
- while (!end) {
- String key = path != null ? path + '.' + counter : String.valueOf(counter);
- String value = properties.getProperty(key);
- if (value != null) {
- TreeNodeImpl nodeImpl = new TreeNodeImpl();
- nodeImpl.setData(value);
- node.addChild(new Integer(counter), nodeImpl);
-
- addNodes(key, nodeImpl, properties);
-
- counter++;
- } else {
- end = true;
- }
+ private TreeNode rootNode = null;
+
+ private List<TreeNode<String>> selectedNodeChildren = new ArrayList<TreeNode<String>>();
+
+ private String nodeTitle;
+
+ private static final String DATA_PATH = "/richfaces/tree/examples/simple-tree-data-dnd.properties";
+
+ private void addNodes(String path, TreeNode node, Properties properties) {
+ boolean end = false;
+ int counter = 1;
+
+ while (!end) {
+ String key = path != null ? path + '.' + counter : String.valueOf(counter);
+
+ String value = properties.getProperty(key);
+ if (value != null) {
+ DemoTreeNodeImpl nodeImpl = new DemoTreeNodeImpl();
+ String[] splittedValue = value.split(" - ");
+ if (splittedValue.length > 1) {
+ nodeImpl.setData(splittedValue[0]);
+ nodeImpl.setType(splittedValue[1]);
+ node.addChild(new Integer(counter), nodeImpl);
}
+ addNodes(key, nodeImpl, properties);
+
+ counter++;
+ } else {
+ end = true;
+ }
}
-
- private void loadTree() {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- ExternalContext externalContext = facesContext.getExternalContext();
- InputStream dataStream = externalContext.getResourceAsStream(DATA_PATH);
+ }
+
+ private void loadTree() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ExternalContext externalContext = facesContext.getExternalContext();
+ InputStream dataStream = externalContext.getResourceAsStream(DATA_PATH);
+ try {
+ Properties properties = new Properties();
+ properties.load(dataStream);
+
+ rootNode = new DemoTreeNodeImpl();
+ addNodes(null, rootNode, properties);
+
+ } catch (IOException e) {
+ throw new FacesException(e.getMessage(), e);
+ } finally {
+ if (dataStream != null) {
try {
- Properties properties = new Properties();
- properties.load(dataStream);
-
- rootNode = new TreeNodeImpl();
- addNodes(null, rootNode, properties);
-
+ dataStream.close();
} catch (IOException e) {
- throw new FacesException(e.getMessage(), e);
- } finally {
- if (dataStream != null) {
- try {
- dataStream.close();
- } catch (IOException e) {
- externalContext.log(e.getMessage(), e);
- }
- }
+ externalContext.log(e.getMessage(), e);
}
+ }
}
+ }
- public void processSelection(NodeSelectedEvent event) {
- HtmlTree tree = (HtmlTree) event.getComponent();
- nodeTitle = (String) tree.getRowData();
- selectedNodeChildren.clear();
- TreeNode<String> currentNode = tree.getModelTreeNode(tree.getRowKey());
- if (currentNode.isLeaf()){
- selectedNodeChildren.add(currentNode);
- }else
- {
- Iterator<Map.Entry<Object, TreeNode<String>>> it = currentNode.getChildren();
- while (it!=null &&it.hasNext()) {
- Map.Entry<Object, TreeNode<String>> entry = it.next();
- selectedNodeChildren.add(entry.getValue());
- }
- }
+ public void processSelection(NodeSelectedEvent event) {
+ HtmlTree tree = (HtmlTree) event.getComponent();
+ nodeTitle = (String) tree.getRowData();
+ selectedNodeChildren.clear();
+ TreeNode<String> currentNode = tree.getModelTreeNode(tree.getRowKey());
+ DemoTreeNodeImpl<String> demoCurrentNodeImpl = currentNode instanceof DemoTreeNodeImpl ? (DemoTreeNodeImpl) currentNode : null;
+ if (currentNode.isLeaf() && (demoCurrentNodeImpl != null && demoCurrentNodeImpl.getType().toLowerCase().equals("leaf") || demoCurrentNodeImpl == null )) {
+ selectedNodeChildren.add(currentNode);
+ } else {
+ Iterator<Map.Entry<Object, TreeNode<String>>> it = currentNode.getChildren();
+ while (it != null && it.hasNext()) {
+ Map.Entry<Object, TreeNode<String>> entry = it.next();
+ selectedNodeChildren.add(entry.getValue());
+ }
}
+ }
- private Object getNewId(TreeNode parentNode) {
- Map<Object, TreeNode> childs = new HashMap<Object, TreeNode>();
- Iterator<Map.Entry<Object, TreeNode>> iter = parentNode.getChildren();
- while (iter != null && iter.hasNext()) {
- Map.Entry<Object, TreeNode> entry = iter.next();
- childs.put(entry.getKey(), entry.getValue());
- }
-
- Integer index = 1;
- while (childs.containsKey(index)) {
- index++;
- }
- return index;
+ private Object getNewId(TreeNode parentNode) {
+ Map<Object, TreeNode> childs = new HashMap<Object, TreeNode>();
+ Iterator<Map.Entry<Object, TreeNode>> iter = parentNode.getChildren();
+ while (iter != null && iter.hasNext()) {
+ Map.Entry<Object, TreeNode> entry = iter.next();
+ childs.put(entry.getKey(), entry.getValue());
+ }
+
+ Integer index = 1;
+ while (childs.containsKey(index)) {
+ index++;
+ }
+ return index;
}
-
- public void dropListener(DropEvent dropEvent) {
-
- // resolve drag destination attributes
- UITreeNode destNode = (dropEvent.getSource() instanceof UITreeNode) ? (UITreeNode) dropEvent.getSource() : null;
- UITree destTree = destNode != null ? destNode.getUITree() : null;
- TreeRowKey dropNodeKey = (dropEvent.getDropValue() instanceof TreeRowKey) ? (TreeRowKey) dropEvent.getDropValue() : null;
- TreeNode droppedInNode = dropNodeKey != null ? destTree.getTreeNode(dropNodeKey) : null;
-
- // resolve drag source attributes
- UITreeNode srcNode = (dropEvent.getDraggableSource() instanceof UITreeNode) ? (UITreeNode) dropEvent.getDraggableSource() : null;
- UITree srcTree = srcNode != null ? srcNode.getUITree() : null;
- TreeRowKey dragNodeKey = (dropEvent.getDragValue() instanceof TreeRowKey) ? (TreeRowKey) dropEvent.getDragValue() : null;
- TreeNode draggedNode = dragNodeKey != null ? srcTree.getTreeNode(dragNodeKey) : null;
- if (dropEvent.getDraggableSource() instanceof UIDragSupport && srcTree == null && draggedNode == null && dropEvent.getDragValue() instanceof TreeNode) {
- srcTree = destTree;
- draggedNode = (TreeNode) dropEvent.getDragValue();
- dragNodeKey = srcTree.getTreeNodeRowKey(draggedNode) instanceof TreeRowKey ? (TreeRowKey) srcTree.getTreeNodeRowKey(draggedNode) : null;
- }
-
- // Note: check if we dropped node on to itself or to item instead of folder here
- if (droppedInNode != null && (droppedInNode.equals(draggedNode) || droppedInNode.getParent().getParent() != null || draggedNode.getParent().getParent() == null)) {
- System.out.println("Warning: Can't drop on itself or to pic itself! Also can't move folders");
- return;
- }
- FacesContext context = FacesContext.getCurrentInstance();
-
- if (dropNodeKey != null) {
- // add destination node for rerender
- destTree.addRequestKey(dropNodeKey);
-
- Object state = null;
- if (dragNodeKey != null) { // Drag from this or other tree
- TreeNode parentNode = draggedNode.getParent();
- // 1. remove node from tree
- state = srcTree.removeNode(dragNodeKey);
- // 2. add parent for rerender
- Object rowKey = srcTree.getTreeNodeRowKey(parentNode);
- srcTree.addRequestKey(rowKey);
- if (dropEvent.getDraggableSource() instanceof UIDragSupport){
- selectedNodeChildren.remove(draggedNode);
- // if node was gragged in it's parent place dragged node to the end of selected nodes in grid
- if (droppedInNode.equals(parentNode)) {
- selectedNodeChildren.add(draggedNode);
- }
- }
- } else if (dropEvent.getDragValue() != null) { // Drag from some drag source
- draggedNode = new TreeNodeImpl<String>();
- draggedNode.setData(dropEvent.getDragValue().toString());
- }
-
- // generate new node id
- Object id = getNewId(destTree.getTreeNode(dropNodeKey));
- destTree.addNode(dropNodeKey, draggedNode, id, state);
- }
-
- AjaxContext ac = AjaxContext.getCurrentInstance();
- // Add destination tree to reRender
- try {
- ac.addComponentToAjaxRender(destTree);
- } catch (Exception e) {
- System.err.print(e.getMessage());
- }
-
-
+ public void dropListener(DropEvent dropEvent) {
+
+ // resolve drag destination attributes
+ UITreeNode destNode = (dropEvent.getSource() instanceof UITreeNode) ? (UITreeNode) dropEvent.getSource() : null;
+ UITree destTree = destNode != null ? destNode.getUITree() : null;
+ TreeRowKey dropNodeKey = (dropEvent.getDropValue() instanceof TreeRowKey) ? (TreeRowKey) dropEvent.getDropValue() : null;
+ TreeNode droppedInNode = dropNodeKey != null ? destTree.getTreeNode(dropNodeKey) : null;
+
+ // resolve drag source attributes
+ UITreeNode srcNode = (dropEvent.getDraggableSource() instanceof UITreeNode) ? (UITreeNode) dropEvent.getDraggableSource() : null;
+ UITree srcTree = srcNode != null ? srcNode.getUITree() : null;
+ TreeRowKey dragNodeKey = (dropEvent.getDragValue() instanceof TreeRowKey) ? (TreeRowKey) dropEvent.getDragValue() : null;
+ TreeNode draggedNode = dragNodeKey != null ? srcTree.getTreeNode(dragNodeKey) : null;
+ if (dropEvent.getDraggableSource() instanceof UIDragSupport && srcTree == null && draggedNode == null && dropEvent.getDragValue() instanceof TreeNode) {
+ srcTree = destTree;
+ draggedNode = (TreeNode) dropEvent.getDragValue();
+ dragNodeKey = srcTree.getTreeNodeRowKey(draggedNode) instanceof TreeRowKey ? (TreeRowKey) srcTree.getTreeNodeRowKey(draggedNode) : null;
}
-
- public List<TreeNode<String>> getSelectedNodeChildren() {
- return selectedNodeChildren;
+
+ // Note: check if we dropped node on to itself or to item instead of
+ // folder here
+ if (droppedInNode != null && (droppedInNode.equals(draggedNode) || droppedInNode.getParent().getParent() != null || draggedNode.getParent().getParent() == null)) {
+ System.out.println("Warning: Can't drop on itself or to pic itself! Also can't move folders");
+ return;
}
- public void setSelectedNodeChildren(List<TreeNode<String>> selectedNodeChildren) {
- this.selectedNodeChildren = selectedNodeChildren;
- }
-
- public TreeNode getTreeNode() {
- if (rootNode == null) {
- loadTree();
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ if (dropNodeKey != null) {
+ // add destination node for rerender
+ destTree.addRequestKey(dropNodeKey);
+
+ Object state = null;
+ if (dragNodeKey != null) { // Drag from this or other tree
+ TreeNode parentNode = draggedNode.getParent();
+ // 1. remove node from tree
+ state = srcTree.removeNode(dragNodeKey);
+ // 2. add parent for rerender
+ Object rowKey = srcTree.getTreeNodeRowKey(parentNode);
+ srcTree.addRequestKey(rowKey);
+ if (dropEvent.getDraggableSource() instanceof UIDragSupport) {
+ selectedNodeChildren.remove(draggedNode);
+ // if node was gragged in it's parent place dragged node to
+ // the end of selected nodes in grid
+ if (droppedInNode.equals(parentNode)) {
+ selectedNodeChildren.add(draggedNode);
+ }
}
- return rootNode;
+ } else if (dropEvent.getDragValue() != null) { // Drag from some
+ // drag source
+ draggedNode = new DemoTreeNodeImpl<String>();
+ draggedNode.setData(dropEvent.getDragValue().toString());
+ }
+
+ // generate new node id
+ Object id = getNewId(destTree.getTreeNode(dropNodeKey));
+ destTree.addNode(dropNodeKey, draggedNode, id, state);
}
- public String getNodeTitle() {
- return nodeTitle;
+ AjaxContext ac = AjaxContext.getCurrentInstance();
+ // Add destination tree to reRender
+ try {
+ ac.addComponentToAjaxRender(destTree);
+ } catch (Exception e) {
+ System.err.print(e.getMessage());
}
- public void setNodeTitle(String nodeTitle) {
- this.nodeTitle = nodeTitle;
+ }
+
+ public List<TreeNode<String>> getSelectedNodeChildren() {
+ return selectedNodeChildren;
+ }
+
+ public void setSelectedNodeChildren(List<TreeNode<String>> selectedNodeChildren) {
+ this.selectedNodeChildren = selectedNodeChildren;
+ }
+
+ public TreeNode getTreeNode() {
+ if (rootNode == null) {
+ loadTree();
}
+ return rootNode;
+ }
+ public String getNodeTitle() {
+ return nodeTitle;
+ }
+
+ public void setNodeTitle(String nodeTitle) {
+ this.nodeTitle = nodeTitle;
+ }
+
}
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simple-tree-data-dnd.properties
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simple-tree-data-dnd.properties 2008-09-05 10:57:33 UTC (rev 10320)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simple-tree-data-dnd.properties 2008-09-05 11:17:23 UTC (rev 10321)
@@ -1,11 +1,12 @@
-1=Unsorted
-1.1=pic1.jpg
-1.2=pic2.jpg
-1.3=pic3.jpg
-1.4=pic4.jpg
-1.5=pic5.jpg
-1.6=pic6.jpg
-1.7=pic7.jpg
-1.8=pic8.jpg
-2 = Favorites
-3 = Trash
\ No newline at end of file
+#path=name - type
+1=Unsorted - node
+1.1=pic1.jpg - leaf
+1.2=pic2.jpg - leaf
+1.3=pic3.jpg - leaf
+1.4=pic4.jpg - leaf
+1.5=pic5.jpg - leaf
+1.6=pic6.jpg - leaf
+1.7=pic7.jpg - leaf
+1.8=pic8.jpg - leaf
+2 = Favorites - node
+3 = Trash - node
\ No newline at end of file
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simpleDnd.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simpleDnd.xhtml 2008-09-05 10:57:33 UTC (rev 10320)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simpleDnd.xhtml 2008-09-05 11:17:23 UTC (rev 10321)
@@ -21,7 +21,7 @@
<rich:dragIndicator id="indicator1" >
<f:facet name="single">
- {draggedImage}
+ <h:graphicImage styleClass="indicatorPicture" value="/richfaces/jQuery/images/{draggedImage}" />
</f:facet>
</rich:dragIndicator>
<rich:dragIndicator id="indicator2" />
@@ -40,11 +40,9 @@
</rich:treeNode>
</rich:tree>
<rich:panel id="selectedNode">
- <rich:dataGrid id="selectedNodeGrid" value="#{simpleTreeDndBean.selectedNodeChildren}" var="item" columns="3" border="0">
+ <rich:dataGrid id="selectedNodeGrid" style="display: #{!empty simpleTreeDndBean.selectedNodeChildren ? '' : 'none'}" value="#{simpleTreeDndBean.selectedNodeChildren}" var="item" columns="3" border="0">
<rich:dragSupport dragIndicator="indicator1" dragType="pic" dragValue="#{item}" reRender="selectedNodeGrid">
- <rich:dndParam name="draggedImage">
- <h:graphicImage styleClass="indicatorPicture" value="/richfaces/jQuery/images/#{item.data}" />
- </rich:dndParam>
+ <rich:dndParam name="draggedImage" value="#{item.data}"/>
</rich:dragSupport>
<h:graphicImage value="/richfaces/jQuery/images/#{item.data}" />
</rich:dataGrid>
16 years, 3 months
JBoss Rich Faces SVN: r10320 - branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-09-05 06:57:33 -0400 (Fri, 05 Sep 2008)
New Revision: 10320
Modified:
branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/externalFiltering.xhtml
Log:
RF-4380
Modified: branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/externalFiltering.xhtml
===================================================================
--- branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/externalFiltering.xhtml 2008-09-05 10:09:20 UTC (rev 10319)
+++ branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/filteringFeature/examples/externalFiltering.xhtml 2008-09-05 10:57:33 UTC (rev 10320)
@@ -5,6 +5,24 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:fn="http://java.sun.com/jsp/jstl/functions">
+ <script type="text/javascript">
+ function setCaretToEnd (e) {
+ var control = $((e.target ? e.target : e.srcElement).id);
+ if (control.createTextRange) {
+ var range = control.createTextRange();
+ range.collapse(false);
+ range.select();
+ }
+ else if (control.setSelectionRange) {
+ control.focus();
+ var length = control.value.length;
+ control.setSelectionRange(length, length);
+ }
+ control.selectionStart = control.selectionEnd = control.value.length;
+ }
+
+ </script>
+
<h:form>
<rich:dataTable value="#{capitalsBean.capitals}" var="cap" id="table" rows="20">
<f:facet name="header">
@@ -24,7 +42,9 @@
<f:facet name="header">
<h:inputText value="#{filteringBean.filterValue}" id="input">
<a4j:support event="onkeyup" reRender="table , ds2"
- ignoreDupResponses="true" requestDelay="700" focus="input" />
+ ignoreDupResponses="true" requestDelay="700"
+ oncomplete="setCaretToEnd(event);"
+ />
</h:inputText>
</f:facet>
<h:outputText value="#{cap.state}" />
16 years, 3 months
JBoss Rich Faces SVN: r10319 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-09-05 06:09:20 -0400 (Fri, 05 Sep 2008)
New Revision: 10319
Modified:
trunk/docs/userguide/en/src/main/docbook/included/dataTable.xml
Log:
RF-4060 - added link and information for rich:dataTable
Modified: trunk/docs/userguide/en/src/main/docbook/included/dataTable.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/dataTable.xml 2008-09-05 09:38:50 UTC (rev 10318)
+++ trunk/docs/userguide/en/src/main/docbook/included/dataTable.xml 2008-09-05 10:09:20 UTC (rev 10319)
@@ -90,7 +90,7 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
- <rich:dataTable value="#{capitalsBean.capitals}" var="capitals"
+ <rich:dataTable value="#{capitalsBean.capitals}" var="capitals"
ajaxKeys="#{bean.ajaxSet}" binding="#{bean.table}" id="table">
...
</rich:dataTable>
@@ -106,7 +106,7 @@
</emphasis> attribute for <emphasis role="bold">
<property><rich:dataTable></property>
</emphasis> component. As a result the component is updated after an Ajax request.</para>
-
+
<para id="table_ex">The component allows to use <emphasis>
<property>"header"</property>
</emphasis>, <emphasis>
@@ -114,12 +114,12 @@
</emphasis> and <emphasis>
<property>"caption"</property>
</emphasis> facets for output. See an example below:</para>
-
+
<para>
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
- <rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="5">
+ <rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="5">
<f:facet name="caption"><h:outputText value="United States Capitals" /></f:facet>
<f:facet name="header"><h:outputText value="Capitals and States Table" /></f:facet>
<rich:column>
@@ -146,9 +146,9 @@
</rich:dataTable>
...
]]></programlisting>
-
+
<para>This is a result:</para>
-
+
<figure>
<title><emphasis role="bold">
<property><rich:dataTable></property>
@@ -160,6 +160,9 @@
</mediaobject>
</figure>
<para>Information about sorting and filtering you can find <link linkend="sortAndFilter">here</link>.</para>
+ <para>
+ You can find information how to remove header's gradient <ulink url="http://wiki.jboss.org/wiki/RichFacesDataTableBackgroundOut">here</ulink>.
+ </para>
</section>
<section>
<title>Look-and-Feel Customization</title>
@@ -437,7 +440,7 @@
<property><rich:dataTable></property>
</emphasis> components on a page using CSS, it's enough to create classes with the
same names (possible classes could be found in the tables <link linkend="dTC"> above</link>) and define necessary properties in them. </para>
-
+
<para>
<emphasis role="bold">Example:</emphasis>
</para>
@@ -445,10 +448,10 @@
.rich-table-cell{
font-weight:bold;
}
-...]]></programlisting>
-
+...]]></programlisting>
+
<para>This is a result:</para>
-
+
<figure>
<title>Redefinition styles with predefined classes</title>
<mediaobject>
@@ -457,13 +460,13 @@
</imageobject>
</mediaobject>
</figure>
-
+
<para>In the example the font weight for table cell was changed.</para>
-
+
<para>Also it's possible to change styles of particular <emphasis role="bold"
><property><rich:dataTable></property></emphasis> component. In this case you should create own style classes and use them in corresponding <emphasis role="bold"
><property><rich:dataTable></property></emphasis> <emphasis><property>styleClass</property></emphasis> attributes. An example is placed below:</para>
-
+
<para>
<emphasis role="bold">Example:</emphasis>
</para>
@@ -471,18 +474,18 @@
.myClass{
font-style:italic;
}
-...]]></programlisting>
+...]]></programlisting>
<para>The <emphasis><property>"headerClass"</property></emphasis> attribute for <emphasis role="bold"
><property><rich:dataTable></property></emphasis> is defined as it's shown in the example below:</para>
-
+
<para>
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[<rich:dataTable ... headerClass="myClass"/>
-]]></programlisting>
-
+]]></programlisting>
+
<para>This is a result:</para>
-
+
<figure>
<title>Redefinition styles with own classes and <emphasis><property>styleClass</property></emphasis> attributes</title>
<mediaobject>
@@ -490,10 +493,10 @@
<imagedata fileref="images/dataTable_oc.png"/>
</imageobject>
</mediaobject>
- </figure>
-
+ </figure>
+
<para>As it could be seen on the picture above, the font style for header was changed.</para>
-
+
<para>
Detailed information on how to set
<emphasis role="bold">
16 years, 3 months