You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2007/02/26 20:33:43 UTC

svn commit: r511963 - in /myfaces/tobago/trunk: example/sandbox/src/main/webapp/ sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/ sandbox/src/main/r...

Author: lofwyr
Date: Mon Feb 26 11:33:42 2007
New Revision: 511963

URL: http://svn.apache.org/viewvc?view=rev&rev=511963
Log:
TOBAGO-286: Target Attribute for Tree

Modified:
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree-menu.jsp
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree.jsp
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeNodeTag.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeNodeTagDeclaration.java
    myfaces/tobago/trunk/sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-tree.js

Modified: myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree-menu.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree-menu.jsp?view=diff&rev=511963&r1=511962&r2=511963
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree-menu.jsp (original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree-menu.jsp Mon Feb 26 11:33:42 2007
@@ -50,6 +50,7 @@
           </tcs:treeNode>
         </tcs:treeNode>
         <tcs:treeNode label="Link" link="http://myfaces.apache.org/tobago/" id="link" tip="Subnode Link"/>
+        <tcs:treeNode label="Target" action="#{controller.action2}" target="Target Window"/>
       </tcs:treeNode>
     </tcs:tree>
 

Modified: myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree.jsp?view=diff&rev=511963&r1=511962&r2=511963
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree.jsp (original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree.jsp Mon Feb 26 11:33:42 2007
@@ -45,6 +45,7 @@
           </tcs:treeNode>
         </tcs:treeNode>
         <tcs:treeNode label="Link" link="http://myfaces.apache.org/tobago/" id="link" tip="Subnode Link"/>
+        <tcs:treeNode label="Target" action="#{controller.action2}" target="Target Window"/>
       </tcs:treeNode>
     </tcs:tree>
 

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java?view=diff&rev=511963&r1=511962&r2=511963
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java Mon Feb 26 11:33:42 2007
@@ -33,6 +33,7 @@
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SELECTABLE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_CLASS;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TARGET;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
 import org.apache.myfaces.tobago.component.ComponentUtil;
 import org.apache.myfaces.tobago.component.UITree;
@@ -280,6 +281,16 @@
       if (actionLink != null) {
         writer.writeText("'", null);
         writer.writeText(actionLink, null);
+        writer.writeText("',", null);
+      } else {
+        writer.writeText("null,", null);
+      }
+
+      // target
+      String target = (String) treeNode.getAttributes().get(ATTR_TARGET);
+      if (target != null) {
+        writer.writeText("'", null);
+        writer.writeText(target, null);
         writer.writeText("',", null);
       } else {
         writer.writeText("null,", null);

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeNodeTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeNodeTag.java?view=diff&rev=511963&r1=511962&r2=511963
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeNodeTag.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeNodeTag.java Mon Feb 26 11:33:42 2007
@@ -18,6 +18,7 @@
  */
 
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TARGET;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VALUE;
 import org.apache.myfaces.tobago.component.ComponentUtil;
 import org.apache.myfaces.tobago.component.UITreeNode;
@@ -30,6 +31,7 @@
   private String value;
   private String markup;
   private String tip;
+  private String target;
 
   @Override
   public String getComponentType() {
@@ -43,6 +45,7 @@
     ComponentUtil.setStringProperty(component, ATTR_VALUE, value);
     ComponentUtil.setMarkup(component, markup);
     ComponentUtil.setStringProperty(component, ATTR_TIP, tip);
+    ComponentUtil.setStringProperty(component, ATTR_TARGET, target);
   }
 
   @Override
@@ -51,6 +54,7 @@
     value = null;
     markup = null;
     tip = null;
+    target = null;
   }
 
   public String getValue() {
@@ -71,5 +75,9 @@
 
   public void setTip(String tip) {
     this.tip = tip;
+  }
+
+  public void setTarget(String target) {
+    this.target = target;
   }
 }

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeNodeTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeNodeTagDeclaration.java?view=diff&rev=511963&r1=511962&r2=511963
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeNodeTagDeclaration.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeNodeTagDeclaration.java Mon Feb 26 11:33:42 2007
@@ -25,6 +25,7 @@
 import org.apache.myfaces.tobago.taglib.decl.HasValue;
 import org.apache.myfaces.tobago.taglib.decl.HasMarkup;
 import org.apache.myfaces.tobago.taglib.decl.HasTip;
+import org.apache.myfaces.tobago.taglib.decl.HasTarget;
 import org.apache.myfaces.tobago.taglib.component.AbstractCommandTagDeclaration;
 
 /**
@@ -36,5 +37,5 @@
     uiComponent = "org.apache.myfaces.tobago.component.UITreeNode",
     rendererType = "TreeNode")
 public interface TreeNodeTagDeclaration
-    extends HasIdBindingAndRendered, HasLabel, HasValue, HasMarkup, AbstractCommandTagDeclaration, HasTip {
+    extends HasIdBindingAndRendered, HasLabel, HasValue, HasMarkup, AbstractCommandTagDeclaration, HasTip, HasTarget {
 }

Modified: myfaces/tobago/trunk/sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-tree.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-tree.js?view=diff&rev=511963&r1=511962&r2=511963
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-tree.js (original)
+++ myfaces/tobago/trunk/sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-tree.js Mon Feb 26 11:33:42 2007
@@ -305,7 +305,7 @@
     hideRoot, treeHiddenId, selectable, mutable,
     formId, selected, marked,
     expanded, required, disabled, treeResources,
-    action, onclick, parent, icon, openIcon, width, cssClass, cssClassLabel) {
+    action, target, onclick, parent, icon, openIcon, width, cssClass, cssClassLabel) {
   this.label = label;
   this.tip = tip;
   this.id = id;
@@ -328,6 +328,7 @@
   this.treeResources = treeResources;
 	this.action = action;
 	this.onclick = onclick;
+  this.target = target;
   this.icon = icon
       || treeResources.getImage("foldericon.gif");
   this.openIcon = openIcon
@@ -536,19 +537,16 @@
     Tobago.navigateToUrl(this.action);
   } else if (this.onclick && !this.disabled) {
     eval(this.onclick);
-  } else {
-    if (this.mutable) {
+  } else if (this.mutable) {
       // nothing to do, storeMarker is already don in onFocus()
 //      storeMarker(Tobago.element(this.id), this.treeHiddenId);
-    } else if (this.selectable) {
-      toggleSelect(Tobago.element(this.id),
-          this.treeHiddenId,
-          this.treeResources.getImage("unchecked.gif"),
-          this.treeResources.getImage("checked.gif"));
-    } else {
-      Tobago.submitAction(this.id);
-    }
-
+  } else if (this.selectable) {
+    toggleSelect(Tobago.element(this.id),
+        this.treeHiddenId,
+        this.treeResources.getImage("unchecked.gif"),
+        this.treeResources.getImage("checked.gif"));
+  } else {
+    Tobago.submitAction(this.id, true, this.target);
   }
 }