[richfaces-svn-commits] JBoss Rich Faces SVN: r13623 - in trunk/test-applications/jsp/src/main: java/rich and 5 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Fri Apr 17 06:49:41 EDT 2009
Author: adubovsky
Date: 2009-04-17 06:49:40 -0400 (Fri, 17 Apr 2009)
New Revision: 13623
Added:
trunk/test-applications/jsp/src/main/java/treeSwing/
trunk/test-applications/jsp/src/main/java/treeSwing/TreeSwing.java
trunk/test-applications/jsp/src/main/webapp/TreeAll/
trunk/test-applications/jsp/src/main/webapp/TreeSwing/
trunk/test-applications/jsp/src/main/webapp/TreeSwing/TreeSwing.jsp
trunk/test-applications/jsp/src/main/webapp/TreeSwing/TreeSwingProperty.jsp
trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-TreeSwing.xml
Removed:
trunk/test-applications/jsp/src/main/webapp/tTree/
Modified:
trunk/test-applications/jsp/src/main/java/rich/RichBean.java
trunk/test-applications/jsp/src/main/webapp/TreeAll/tTree.jsp
trunk/test-applications/jsp/src/main/webapp/TreeAll/tTreeStraightforward.jsp
Log:
1) + TreeSwing pages - default example of tree with javax.swing.tree.MutableTreeNode
2) Rename tTree to TreeAll
Modified: trunk/test-applications/jsp/src/main/java/rich/RichBean.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/rich/RichBean.java 2009-04-17 01:11:45 UTC (rev 13622)
+++ trunk/test-applications/jsp/src/main/java/rich/RichBean.java 2009-04-17 10:49:40 UTC (rev 13623)
@@ -75,7 +75,8 @@
map.add("DataGrid", add("/DataGrid/DataGrid", new boolean [] {false, true, false}));
map.add("ExtendedDataTable", add("/ExtendedDataTable/ExtendedDataTable", new boolean [] {false, true, false}));
map.add("Editor", add("/Editor/Editor", new boolean [] {true, true, false}));
- map.add("tTree", add("/tTree/tTree", new boolean [] {true, true, true}));
+ map.add("TreeAll", add("/TreeAll/tTree", new boolean [] {true, true, true}));
+ map.add("TreeSwing", add("/TreeSwing/TreeSwing", new boolean [] {true, true, false}));
map.add("Queue", add("/Queue/Queue", new boolean [] {false, true, true}));
map.add("LayoutComponents", add("/LayoutComponents/LayoutComponents", new boolean [] {true, true, true}));
Iterator<String> iterator = map.getSet().iterator();
Added: trunk/test-applications/jsp/src/main/java/treeSwing/TreeSwing.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/treeSwing/TreeSwing.java (rev 0)
+++ trunk/test-applications/jsp/src/main/java/treeSwing/TreeSwing.java 2009-04-17 10:49:40 UTC (rev 13623)
@@ -0,0 +1,155 @@
+package treeSwing;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.MutableTreeNode;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.richfaces.component.UITree;
+import org.richfaces.event.NodeSelectedEvent;
+
+import util.componentInfo.ComponentInfo;
+
+public class TreeSwing {
+
+ MutableTreeNode top;
+
+ UITree tree;
+
+ private String switchType = "ajax";
+
+ private boolean rendered = true;
+
+ private boolean showConnectingLines = false;
+
+ private boolean useCustomIcons = false;
+
+ private boolean disableKeyboardNavigation = false;
+
+ public TreeSwing() {
+ top = new DefaultMutableTreeNode("The Java Series");
+ createNodes(top);
+ }
+
+ public void selectionListener(NodeSelectedEvent e) {
+ UITree uiTree = (UITree) e.getComponent();
+ Object rowKey = uiTree.getRowKey();
+ MutableTreeNode node = (MutableTreeNode) uiTree.getRowData();
+ if (node.isLeaf()) {
+ uiTree.removeNode(rowKey);
+ }
+
+ AjaxContext ac = AjaxContext.getCurrentInstance();
+ try {
+ ac.addComponentToAjaxRender(uiTree);
+ } catch (Exception exc) {
+ System.err.print(exc.getMessage());
+ }
+ }
+
+ private void createNodes(MutableTreeNode top) {
+ MutableTreeNode category = null;
+ MutableTreeNode book = null;
+
+ category = new DefaultMutableTreeNode("Books for Java Programmers");
+ top.insert(category, 0);
+
+ // original Tutorial
+ book = new DefaultMutableTreeNode(
+ "The Java Tutorial: A Short Course on the Basics");
+ category.insert(book, 0);
+
+ // Tutorial Continued
+ book = new DefaultMutableTreeNode(
+ "The Java Tutorial Continued: The Rest of the JDK");
+ category.insert(book, 1);
+
+ // JFC Swing Tutorial
+ book = new DefaultMutableTreeNode(
+ "The JFC Swing Tutorial: A Guide to Constructing GUIs");
+ category.insert(book, 2);
+
+ // ...add more books for programmers...
+ category = new DefaultMutableTreeNode("Books for Java Implementers");
+ top.insert(category, 1);
+
+ // VM
+ book = new DefaultMutableTreeNode(
+ "The Java Virtual Machine Specification");
+ category.insert(book, 0);
+
+ // Language Spec
+ book = new DefaultMutableTreeNode("The Java Language Specification");
+ category.insert(book, 1);
+ }
+
+ public void addCustomIcons() {
+ if (useCustomIcons) {
+ tree.setIcon("/pics/1.gif");
+ tree.setIconCollapsed("/pics/3.gif");
+ tree.setIconExpanded("/pics/4.gif");
+ tree.setIconLeaf("/pics/2.gif");
+ } else {
+ tree.setIcon(null);
+ tree.setIconCollapsed(null);
+ tree.setIconExpanded(null);
+ tree.setIconLeaf(null);
+ }
+ }
+
+ public void add() {
+ ComponentInfo info = ComponentInfo.getInstance();
+ info.addField(tree);
+ }
+
+ public MutableTreeNode getTop() {
+ return top;
+ }
+
+ public UITree getTree() {
+ return tree;
+ }
+
+ public void setTree(UITree tree) {
+ this.tree = tree;
+ }
+
+ public String getSwitchType() {
+ return switchType;
+ }
+
+ public void setSwitchType(String switchType) {
+ this.switchType = switchType;
+ }
+
+ public boolean isRendered() {
+ return rendered;
+ }
+
+ public void setRendered(boolean rendered) {
+ this.rendered = rendered;
+ }
+
+ public boolean isShowConnectingLines() {
+ return showConnectingLines;
+ }
+
+ public void setShowConnectingLines(boolean showConnectingLines) {
+ this.showConnectingLines = showConnectingLines;
+ }
+
+ public boolean isUseCustomIcons() {
+ return useCustomIcons;
+ }
+
+ public void setUseCustomIcons(boolean useCustomIcons) {
+ this.useCustomIcons = useCustomIcons;
+ }
+
+ public boolean isDisableKeyboardNavigation() {
+ return disableKeyboardNavigation;
+ }
+
+ public void setDisableKeyboardNavigation(boolean disableKeyboardNavigation) {
+ this.disableKeyboardNavigation = disableKeyboardNavigation;
+ }
+}
\ No newline at end of file
Copied: trunk/test-applications/jsp/src/main/webapp/TreeAll (from rev 13519, trunk/test-applications/jsp/src/main/webapp/tTree)
Modified: trunk/test-applications/jsp/src/main/webapp/TreeAll/tTree.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/tTree/tTree.jsp 2009-04-13 10:26:15 UTC (rev 13519)
+++ trunk/test-applications/jsp/src/main/webapp/TreeAll/tTree.jsp 2009-04-17 10:49:40 UTC (rev 13623)
@@ -55,7 +55,7 @@
onmousedown="#{event.onmousedown}"
onmousemove="#{event.onmousemove}" onmouseout="#{event.onmouseout}"
onmouseover="#{event.onmouseover}" onmouseup="#{event.onmouseup}"
- onselected="#{event.onselected}"
+ onselected="#{event.onselected}" oncontextmenu="#{event.oncontextmenu}"
disableKeyboardNavigation="#{tTree.disableKeyboardNavigation}">
<rich:treeNode type="input">
Modified: trunk/test-applications/jsp/src/main/webapp/TreeAll/tTreeStraightforward.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/tTree/tTreeStraightforward.jsp 2009-04-13 10:26:15 UTC (rev 13519)
+++ trunk/test-applications/jsp/src/main/webapp/TreeAll/tTreeStraightforward.jsp 2009-04-17 10:49:40 UTC (rev 13623)
@@ -46,7 +46,7 @@
<rich:separator height="10" />
</h:panelGrid>
</a4j:outputPanel>
-
+
<a4j:outputPanel id="tTreeDNDPanelID">
<h:panelGrid columns="1"
rendered="#{pVisability.tTreeDefaultSubviewID}">
@@ -79,7 +79,7 @@
dropListener="#{tTreeDND.onDrop}"
dragListener="#{tTreeDND.onDrag}" dragIndicator="treeIndicator"
acceptedTypes="treeNodeR" dragType="treeNodeL" rowKeyVar="key"
- var="item">
+ var="item" showConnectingLines="false">
<rich:dndParam name="treeParam" value="leftTree" />
</rich:tree>
Added: trunk/test-applications/jsp/src/main/webapp/TreeSwing/TreeSwing.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/TreeSwing/TreeSwing.jsp (rev 0)
+++ trunk/test-applications/jsp/src/main/webapp/TreeSwing/TreeSwing.jsp 2009-04-17 10:49:40 UTC (rev 13623)
@@ -0,0 +1,29 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="treeSwingSubviewID">
+ <h3>Click tree node to delete it. Only leaf node could be deleted. </h3>
+ <rich:tree id="tree" switchType="#{treeSwing.switchType}"
+ value="#{treeSwing.top}" var="data"
+ showConnectingLines="#{treeSwing.showConnectingLines}"
+ nodeSelectListener="#{treeSwing.selectionListener}"
+ rendered="#{treeSwing.rendered}" binding="#{treeSwing.tree}"
+ ajaxSubmitSelection="true"
+ onbeforedomupdate="#{event.onbeforedomupdate}"
+ onclick="#{event.onclick}" oncollapse="#{event.oncollapse}"
+ oncomplete="#{event.oncomplete}" ondblclick="#{event.ondblclick}"
+ ondragend="#{event.ondragend}" ondragenter="#{event.ondragenter}"
+ ondragexit="#{event.ondragexit}" ondragstart="#{event.ondragstart}"
+ ondrop="#{event.ondrop}" ondropend="#{event.ondropend}"
+ ondropout="#{event.ondropout}" ondropover="#{event.ondropover}"
+ onexpand="#{event.onexpand}" onkeydown="#{event.onkeydown}"
+ onkeypress="#{event.onkeypress}" onkeyup="#{event.onkeyup}"
+ onmousedown="#{event.onmousedown}" onmousemove="#{event.onmousemove}"
+ onmouseout="#{event.onmouseout}" onmouseover="#{event.onmouseover}"
+ onmouseup="#{event.onmouseup}" rowKeyVar="row"
+ onselected="return confirm('Do you want to delete the row you select?');"
+ oncontextmenu="#{event.oncontextmenu}"
+ disableKeyboardNavigation="#{treeSwing.disableKeyboardNavigation}">
+ </rich:tree>
+</f:subview>
\ No newline at end of file
Added: trunk/test-applications/jsp/src/main/webapp/TreeSwing/TreeSwingProperty.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/TreeSwing/TreeSwingProperty.jsp (rev 0)
+++ trunk/test-applications/jsp/src/main/webapp/TreeSwing/TreeSwingProperty.jsp 2009-04-17 10:49:40 UTC (rev 13623)
@@ -0,0 +1,38 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<f:subview id="treeSwingPropertySubviewID">
+
+ <h:commandButton id="focusID" action="#{treeSwing.add}" value="add test" />
+ <h:panelGrid columns="2">
+ <f:facet name="header">
+ <h:outputText value="Tree Properties" />
+ </f:facet>
+
+ <h:outputText value="Change tree switchType:" />
+ <h:selectOneRadio value="#{treeSwing.switchType}" onclick="submit();">
+ <f:selectItem itemLabel="client" itemValue="client" />
+ <f:selectItem itemLabel="server" itemValue="server" />
+ <f:selectItem itemLabel="ajax" itemValue="ajax" />
+ </h:selectOneRadio>
+
+ <h:outputText value="rendered:" />
+ <h:selectBooleanCheckbox value="#{treeSwing.rendered}"
+ onchange="submit();" />
+
+ <h:outputText value="disableKeyboardNavigation:" />
+ <h:selectBooleanCheckbox
+ value="#{treeSwing.disableKeyboardNavigation}" onchange="submit();" />
+
+ <h:outputText value="showConnectingLines:" />
+ <h:selectBooleanCheckbox value="#{treeSwing.showConnectingLines}"
+ onchange="submit();" />
+
+ <h:outputText value="use custom icons:" />
+ <h:selectBooleanCheckbox value="#{treeSwing.useCustomIcons}">
+ <a4j:support action="#{treeSwing.addCustomIcons}" event="onchange"
+ reRender="tree"></a4j:support>
+ </h:selectBooleanCheckbox>
+ </h:panelGrid>
+</f:subview>
\ No newline at end of file
Added: trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-TreeSwing.xml
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-TreeSwing.xml (rev 0)
+++ trunk/test-applications/jsp/src/main/webapp/WEB-INF/faces-config-TreeSwing.xml 2009-04-17 10:49:40 UTC (rev 13623)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
+<faces-config>
+ <managed-bean>
+ <managed-bean-name>treeSwing</managed-bean-name>
+ <managed-bean-class>treeSwing.TreeSwing</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+</faces-config>
More information about the richfaces-svn-commits
mailing list