Author: ilya_shaikovsky
Date: 2008-09-09 10:17:03 -0400 (Tue, 09 Sep 2008)
New Revision: 10379
Added:
branches/3.2.x/samples/richfaces-demo/src/main/webapp/images/tree/dnd/
branches/3.2.x/samples/richfaces-demo/src/main/webapp/images/tree/dnd/favorites.gif
branches/3.2.x/samples/richfaces-demo/src/main/webapp/images/tree/dnd/image.gif
branches/3.2.x/samples/richfaces-demo/src/main/webapp/images/tree/dnd/trash.gif
branches/3.2.x/samples/richfaces-demo/src/main/webapp/images/tree/dnd/trash_full.gif
Modified:
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/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:
Modified:
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 2008-09-09
14:14:51 UTC (rev 10378)
+++
branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/DemoTreeNodeImpl.java 2008-09-09
14:17:03 UTC (rev 10379)
@@ -15,7 +15,10 @@
*/
public class DemoTreeNodeImpl<T> extends TreeNodeImpl<T>{
- private String type;
+ private String icon;
+ private String leafIcon;
+
+ private String type;
/**
* @return the type
@@ -29,6 +32,22 @@
*/
public void setType(String type) {
this.type = type;
- }
+ }
+
+ public String getIcon() {
+ return icon;
+ }
+
+ public void setIcon(String icon) {
+ this.icon = icon;
+ }
+
+ public String getLeafIcon() {
+ return leafIcon;
+ }
+
+ public void setLeafIcon(String leafIcon) {
+ this.leafIcon = leafIcon;
+ }
}
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-09
14:14:51 UTC (rev 10378)
+++
branches/3.2.x/samples/richfaces-demo/src/main/java/org/richfaces/demo/tree/SimpleTreeDndBean.java 2008-09-09
14:17:03 UTC (rev 10379)
@@ -52,6 +52,8 @@
private String nodeTitle;
+ private static final String ICONS_PATH = "/images/tree/dnd/";
+
private static final String DATA_PATH =
"/richfaces/tree/examples/simple-tree-data-dnd.properties";
private void addNodes(String path, TreeNode node, Properties properties) {
@@ -68,6 +70,13 @@
if (splittedValue.length > 1) {
nodeImpl.setData(splittedValue[0]);
nodeImpl.setType(splittedValue[1]);
+ if (splittedValue.length>2){
+ nodeImpl.setIcon(ICONS_PATH+splittedValue[2]);
+ nodeImpl.setLeafIcon(ICONS_PATH+splittedValue[2]);
+ }
+ if (splittedValue.length>3){
+ nodeImpl.setLeafIcon(ICONS_PATH+splittedValue[3]);
+ }
node.addChild(new Integer(counter), nodeImpl);
}
addNodes(key, nodeImpl, properties);
@@ -109,7 +118,7 @@
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)) {
+ 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();
@@ -148,7 +157,7 @@
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) {
+ 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;
@@ -184,7 +193,7 @@
}
}
} else if (dropEvent.getDragValue() != null) { // Drag from some
- // drag source
+ // drag source
draggedNode = new DemoTreeNodeImpl<String>();
draggedNode.setData(dropEvent.getDragValue().toString());
}
Added:
branches/3.2.x/samples/richfaces-demo/src/main/webapp/images/tree/dnd/favorites.gif
===================================================================
(Binary files differ)
Property changes on:
branches/3.2.x/samples/richfaces-demo/src/main/webapp/images/tree/dnd/favorites.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/3.2.x/samples/richfaces-demo/src/main/webapp/images/tree/dnd/image.gif
===================================================================
(Binary files differ)
Property changes on:
branches/3.2.x/samples/richfaces-demo/src/main/webapp/images/tree/dnd/image.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/3.2.x/samples/richfaces-demo/src/main/webapp/images/tree/dnd/trash.gif
===================================================================
(Binary files differ)
Property changes on:
branches/3.2.x/samples/richfaces-demo/src/main/webapp/images/tree/dnd/trash.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
branches/3.2.x/samples/richfaces-demo/src/main/webapp/images/tree/dnd/trash_full.gif
===================================================================
(Binary files differ)
Property changes on:
branches/3.2.x/samples/richfaces-demo/src/main/webapp/images/tree/dnd/trash_full.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
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-09
14:14:51 UTC (rev 10378)
+++
branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simple-tree-data-dnd.properties 2008-09-09
14:17:03 UTC (rev 10379)
@@ -1,5 +1,5 @@
-#path=name - type
-1=Unsorted - node
+#path=name - type - icon
+1=Unsorted - node - image.gif
1.1=pic1.jpg - leaf
1.2=pic2.jpg - leaf
1.3=pic3.jpg - leaf
@@ -8,5 +8,5 @@
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
+2=Favorites - node - favorites.gif
+3=Trash - node - trash_full.gif - trash.gif
\ 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-09
14:14:51 UTC (rev 10378)
+++
branches/3.2.x/samples/richfaces-demo/src/main/webapp/richfaces/tree/examples/simpleDnd.xhtml 2008-09-09
14:17:03 UTC (rev 10379)
@@ -31,7 +31,7 @@
reRender="selectedNode" ajaxSubmitSelection="true"
switchType="client" dragIndicator="indicator2"
value="#{simpleTreeDndBean.treeNode}" var="item"
id="tree" treeNodeVar="treeNode"
dropListener="#{simpleTreeDndBean.dropListener}"
nodeFace="#{treeNode.parent.parent == null ? 'node' :
'leaf'}">
- <rich:treeNode type="node" acceptedTypes="pic">
+ <rich:treeNode type="node" acceptedTypes="pic"
icon="#{treeNode.icon}" iconLeaf="#{treeNode.leafIcon}">
<h:outputText value="#{item}"/>
</rich:treeNode>
<rich:treeNode type="leaf" dragType="pic">