[richfaces-svn-commits] JBoss Rich Faces SVN: r13625 - in trunk/test-applications/facelets/src/main: java/rich and 4 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Apr 17 07:04:11 EDT 2009


Author: adubovsky
Date: 2009-04-17 07:04:11 -0400 (Fri, 17 Apr 2009)
New Revision: 13625

Added:
   trunk/test-applications/facelets/src/main/java/treeSwing/
   trunk/test-applications/facelets/src/main/java/treeSwing/TreeSwing.java
   trunk/test-applications/facelets/src/main/webapp/TreeAll/
   trunk/test-applications/facelets/src/main/webapp/TreeSwing/
   trunk/test-applications/facelets/src/main/webapp/TreeSwing/TreeSwing.xhtml
   trunk/test-applications/facelets/src/main/webapp/TreeSwing/TreeSwingProperty.xhtml
   trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-TreeSwing.xml
Removed:
   trunk/test-applications/facelets/src/main/webapp/tTree/
Modified:
   trunk/test-applications/facelets/src/main/java/rich/RichBean.java
   trunk/test-applications/facelets/src/main/webapp/WEB-INF/web.xml
Log:
1) Rename tTree pages to TreeAll pages
2) + TreeSwing pages with default example of tree with javax.swing.tree.MutableTreeNode

Modified: trunk/test-applications/facelets/src/main/java/rich/RichBean.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/rich/RichBean.java	2009-04-17 10:51:59 UTC (rev 13624)
+++ trunk/test-applications/facelets/src/main/java/rich/RichBean.java	2009-04-17 11:04:11 UTC (rev 13625)
@@ -76,7 +76,8 @@
 		map.add("ExtendedDataTable", add("/ExtendedDataTable/ExtendedDataTable", new boolean [] {false, true, false}));
 		map.add("Editor", add("/Editor/Editor", new boolean [] {true, true, false}));
 		map.add("Queue", add("/Queue/Queue", new boolean [] {false, true, true}));
-		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("ColorPicker", add("/ColorPicker/ColorPicker", new boolean [] {false, true, false}));
 		map.add("LayoutComponents", add("/LayoutComponents/LayoutComponents", new boolean [] {true, true, true}));
 		Iterator<String> iterator = map.getSet().iterator();

Added: trunk/test-applications/facelets/src/main/java/treeSwing/TreeSwing.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/treeSwing/TreeSwing.java	                        (rev 0)
+++ trunk/test-applications/facelets/src/main/java/treeSwing/TreeSwing.java	2009-04-17 11:04:11 UTC (rev 13625)
@@ -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/facelets/src/main/webapp/TreeAll (from rev 13519, trunk/test-applications/facelets/src/main/webapp/tTree)

Added: trunk/test-applications/facelets/src/main/webapp/TreeSwing/TreeSwing.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/TreeSwing/TreeSwing.xhtml	                        (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/TreeSwing/TreeSwing.xhtml	2009-04-17 11:04:11 UTC (rev 13625)
@@ -0,0 +1,30 @@
+<f:subview xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:a4j="http://richfaces.org/a4j"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:rich="http://richfaces.org/rich" 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/facelets/src/main/webapp/TreeSwing/TreeSwingProperty.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/TreeSwing/TreeSwingProperty.xhtml	                        (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/TreeSwing/TreeSwingProperty.xhtml	2009-04-17 11:04:11 UTC (rev 13625)
@@ -0,0 +1,39 @@
+<f:subview xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:a4j="http://richfaces.org/a4j"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:rich="http://richfaces.org/rich" 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/facelets/src/main/webapp/WEB-INF/faces-config-TreeSwing.xml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-TreeSwing.xml	                        (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/WEB-INF/faces-config-TreeSwing.xml	2009-04-17 11:04:11 UTC (rev 13625)
@@ -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>

Modified: trunk/test-applications/facelets/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/WEB-INF/web.xml	2009-04-17 10:51:59 UTC (rev 13624)
+++ trunk/test-applications/facelets/src/main/webapp/WEB-INF/web.xml	2009-04-17 11:04:11 UTC (rev 13625)
@@ -47,7 +47,7 @@
 	<context-param>
 		<param-name>javax.faces.CONFIG_FILES</param-name>
 		<param-value>
-			/WEB-INF/faces-config-LayoutComponents.xml,/WEB-INF/faces-config-ColorPicker.xml,/WEB-INF/faces-config-tTree.xml,/WEB-INF/faces-config-Queue.xml,/WEB-INF/faces-config-Editor.xml,/WEB-INF/faces-config-ExtendedDataTable.xml,/WEB-INF/faces-config-DataGrid.xml,/WEB-INF/faces-config-Validator.xml,/WEB-INF/faces-config-ComponentInfo.xml,/WEB-INF/faces-config-HotKey.xml,/WEB-INF/faces-config-DataTable.xml,/WEB-INF/faces-config-SimpleTogglePanel.xml,/WEB-INF/faces-config-Panel.xml,/WEB-INF/faces-config-PanelBar.xml,/WEB-INF/faces-config-TabPanel.xml,/WEB-INF/faces-config-TogglePanel.xml,/WEB-INF/faces-config-Paint2D.xml,/WEB-INF/faces-config-InputNumberSlider.xml,/WEB-INF/faces-config-InputNumberSpinner.xml,/WEB-INF/faces-config-DDMenu.xml,/WEB-INF/faces-config-Tree.xml,/WEB-INF/faces-config-PanelMenu.xml,/WEB-INF/faces-config-Icon.xml,/WEB-INF/faces-config-ModalPanel.xml,/WEB-INF/faces-config-tooltip.xml,/WEB-INF/faces-config-Skin.xml,/WEB-INF/faces-config-Calendar.xml,/WEB-INF!
 /faces-config-Gmap.xml,/WEB-INF/faces-config-DataFilterSlider.xml,/WEB-INF/faces-config-Separator.xml,/WEB-INF/faces-config-Spacer.xml,/WEB-INF/faces-config-ToolBar.xml,/WEB-INF/faces-config-DataScroller.xml,/WEB-INF/faces-config-SuggestionBox.xml,/WEB-INF/faces-config-Message.xml,/WEB-INF/faces-config-VirtualEarth.xml,/WEB-INF/faces-config-Effect.xml,/WEB-INF/faces-config-Insert.xml,/WEB-INF/faces-config-RichBean.xml,/WEB-INF/faces-config-ScrollableDataTable.xml,/WEB-INF/faces-config-jQuery.xml,/WEB-INF/faces-config-DragAndDrop.xml,/WEB-INF/faces-config-OrderingList.xml,/WEB-INF/faces-config-DataOrderedList.xml,/WEB-INF/faces-config-DataDefinitionList.xml,/WEB-INF/faces-config-ContextMenu.xml,/WEB-INF/faces-config-ListShuttle.xml,/WEB-INF/faces-config-Converter.xml,/WEB-INF/faces-config-ComponentControl.xml,/WEB-INF/faces-config-Columns.xml,/WEB-INF/faces-config-PickList.xml,/WEB-INF/faces-config-Combobox.xml,/WEB-INF/faces-config-PTComponent.xml,/WEB-INF/faces-config-Even!
 t.xml,/WEB-INF/faces-config-ProgressBar.xml,/WEB-INF/faces-config-Opti
ons.xml,/WEB-INF/faces-config-SortingAndFiltering.xml,/WEB-INF/faces-config-Style.xml,/WEB-INF/faces-config-FileUpload.xml,/WEB-INF/faces-config-InplaceSelect.xml,/WEB-INF/faces-config-InplaceInput.xml,/WEB-INF/faces-config-Skinning.xml,/WEB-INF/faces-config-Custom.xml
+			/WEB-INF/faces-config-TreeSwing.xml,/WEB-INF/faces-config-LayoutComponents.xml,/WEB-INF/faces-config-ColorPicker.xml,/WEB-INF/faces-config-tTree.xml,/WEB-INF/faces-config-Queue.xml,/WEB-INF/faces-config-Editor.xml,/WEB-INF/faces-config-ExtendedDataTable.xml,/WEB-INF/faces-config-DataGrid.xml,/WEB-INF/faces-config-Validator.xml,/WEB-INF/faces-config-ComponentInfo.xml,/WEB-INF/faces-config-HotKey.xml,/WEB-INF/faces-config-DataTable.xml,/WEB-INF/faces-config-SimpleTogglePanel.xml,/WEB-INF/faces-config-Panel.xml,/WEB-INF/faces-config-PanelBar.xml,/WEB-INF/faces-config-TabPanel.xml,/WEB-INF/faces-config-TogglePanel.xml,/WEB-INF/faces-config-Paint2D.xml,/WEB-INF/faces-config-InputNumberSlider.xml,/WEB-INF/faces-config-InputNumberSpinner.xml,/WEB-INF/faces-config-DDMenu.xml,/WEB-INF/faces-config-Tree.xml,/WEB-INF/faces-config-PanelMenu.xml,/WEB-INF/faces-config-Icon.xml,/WEB-INF/faces-config-ModalPanel.xml,/WEB-INF/faces-config-tooltip.xml,/WEB-INF/faces-config-Skin.xml,/WEB-IN!
 F/faces-config-Calendar.xml,/WEB-INF/faces-config-Gmap.xml,/WEB-INF/faces-config-DataFilterSlider.xml,/WEB-INF/faces-config-Separator.xml,/WEB-INF/faces-config-Spacer.xml,/WEB-INF/faces-config-ToolBar.xml,/WEB-INF/faces-config-DataScroller.xml,/WEB-INF/faces-config-SuggestionBox.xml,/WEB-INF/faces-config-Message.xml,/WEB-INF/faces-config-VirtualEarth.xml,/WEB-INF/faces-config-Effect.xml,/WEB-INF/faces-config-Insert.xml,/WEB-INF/faces-config-RichBean.xml,/WEB-INF/faces-config-ScrollableDataTable.xml,/WEB-INF/faces-config-jQuery.xml,/WEB-INF/faces-config-DragAndDrop.xml,/WEB-INF/faces-config-OrderingList.xml,/WEB-INF/faces-config-DataOrderedList.xml,/WEB-INF/faces-config-DataDefinitionList.xml,/WEB-INF/faces-config-ContextMenu.xml,/WEB-INF/faces-config-ListShuttle.xml,/WEB-INF/faces-config-Converter.xml,/WEB-INF/faces-config-ComponentControl.xml,/WEB-INF/faces-config-Columns.xml,/WEB-INF/faces-config-PickList.xml,/WEB-INF/faces-config-Combobox.xml,/WEB-INF/faces-config-PTComp!
 onent.xml,/WEB-INF/faces-config-Event.xml,/WEB-INF/faces-config-Progre
ssBar.xml,/WEB-INF/faces-config-Options.xml,/WEB-INF/faces-config-SortingAndFiltering.xml,/WEB-INF/faces-config-Style.xml,/WEB-INF/faces-config-FileUpload.xml,/WEB-INF/faces-config-InplaceSelect.xml,/WEB-INF/faces-config-InplaceInput.xml,/WEB-INF/faces-config-Skinning.xml,/WEB-INF/faces-config-Custom.xml
 		</param-value>
 	</context-param>
 	<context-param>
@@ -55,6 +55,10 @@
 		<param-value>true</param-value>
 	</context-param>
 	<context-param>
+		<param-name>org.richfaces.LoadScriptStrategy</param-name>
+		<param-value>DEFAULT</param-value>
+	</context-param>
+	<context-param>
 		<param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
 		<param-value>NONE</param-value>
 	</context-param>




More information about the richfaces-svn-commits mailing list