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/12 17:08:33 UTC

svn commit: r506518 - in /myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago: component/ renderkit/html/scarborough/standard/tag/ taglib/sandbox/

Author: lofwyr
Date: Mon Feb 12 08:08:32 2007
New Revision: 506518

URL: http://svn.apache.org/viewvc?view=rev&rev=506518
Log:
Clean up

Modified:
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UITree.java
    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/renderkit/html/scarborough/standard/tag/TreeRenderer.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeTag.java
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeTagDeclaration.java

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UITree.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UITree.java?view=diff&rev=506518&r1=506517&r2=506518
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UITree.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UITree.java Mon Feb 12 08:08:32 2007
@@ -19,33 +19,21 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ICON_SIZE;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMAGE;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_POSITION;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MODE;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MUTABLE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SELECTABLE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_ICONS;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_JUNCTIONS;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_ROOT;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_ROOT_JUNCTION;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STATE;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_LINK;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_TOOL_BAR;
-import org.apache.myfaces.tobago.context.ResourceManagerUtil;
 import org.apache.myfaces.tobago.model.TreeState;
-import org.apache.myfaces.tobago.taglib.component.ToolBarTag;
 import org.apache.myfaces.tobago.util.MessageFactory;
-import org.apache.myfaces.tobago.util.StringUtil;
 
 import javax.faces.application.FacesMessage;
 import javax.faces.component.ActionSource;
 import javax.faces.component.NamingContainer;
-import javax.faces.component.UICommand;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIInput;
-import javax.faces.component.UIPanel;
 import javax.faces.context.FacesContext;
 import javax.faces.el.MethodBinding;
 import javax.faces.el.ValueBinding;
@@ -171,51 +159,6 @@
 
   public void removeActionListener(ActionListener actionListener) {
     removeFacesListener(actionListener);
-  }
-
-  public void encodeBegin(FacesContext facesContext)
-      throws IOException {
-    if (ComponentUtil.getBooleanAttribute(this, ATTR_MUTABLE)
-        && getFacet("mutableToolbar") == null
-        && getFacet("defaultToolbar") == null) {
-      createDefaultToolbar(facesContext);
-    }
-    super.encodeBegin(facesContext);
-  }
-  // TODO move this to renderkit
-  public void createDefaultToolbar(FacesContext facesContext) {
-
-    UIComponent toolbar = ComponentUtil.createComponent(
-        facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_TOOL_BAR);
-    toolbar.getAttributes().put(ATTR_ICON_SIZE, ToolBarTag.ICON_SMALL);
-    toolbar.getAttributes().put(ATTR_LABEL_POSITION, ToolBarTag.LABEL_OFF);
-    ActionListener[] handlers = getActionListeners();
-
-    if ((handlers == null || handlers.length == 0) && getActionListener() == null) {
-      LOG.error("No actionListener found in tree, so tree editing will not work!");
-    }
-
-    UITree.Command[] commands = getCommands();
-    for (int i = 0; i < commands.length; i++) {
-      UICommand command = (UICommand) ComponentUtil.createComponent(
-          facesContext, UICommand.COMPONENT_TYPE, RENDERER_TYPE_LINK);
-      toolbar.getChildren().add(command);
-      command.setId(commands[i].getCommand());
-
-      for (ActionListener listener : getActionListeners()) {
-        command.addActionListener(listener);
-      }
-      command.setActionListener(getActionListener());
-      command.getAttributes().put(
-          ATTR_IMAGE, "image/tobago.tree." + commands[i].getCommand() + ".gif");
-      String title = ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago",
-          "tree" + StringUtil.firstToUpperCase(commands[i].getCommand()));
-      command.getAttributes().put(ATTR_TIP, title);
-
-    }
-
-    getFacets().put("defaultToolbar", toolbar);
-
   }
 
   public UITreeNode getRoot() {

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=506518&r1=506517&r2=506518
==============================================================================
--- 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 12 08:08:32 2007
@@ -28,20 +28,19 @@
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_LINK;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MUTABLE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ONCLICK;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SELECTABLE;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
 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_TIP;
 import org.apache.myfaces.tobago.component.ComponentUtil;
 import org.apache.myfaces.tobago.component.UITree;
 import org.apache.myfaces.tobago.component.UITreeNode;
 import org.apache.myfaces.tobago.component.UITreeNodeData;
 import org.apache.myfaces.tobago.model.TreeState;
 import org.apache.myfaces.tobago.renderkit.CommandRendererBase;
-import org.apache.myfaces.tobago.renderkit.html.HtmlStyleMap;
 import org.apache.myfaces.tobago.renderkit.html.HtmlRendererUtil;
+import org.apache.myfaces.tobago.renderkit.html.HtmlStyleMap;
 
 import javax.faces.component.NamingContainer;
 import javax.faces.component.UIComponent;
@@ -226,8 +225,8 @@
         writer.writeText("false", null);
       }
       writer.writeText(",", null);
-      writer.writeText(Boolean.toString(ComponentUtil.getBooleanAttribute(root,
-          ATTR_MUTABLE)), null);
+      // mutable = false
+      writer.writeText("false", null);
       writer.writeText(",'", null);
       writer.writeText(ComponentUtil.findPage(treeNode).getFormId(facesContext), null);
       writer.writeText("',", null);

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java?view=diff&rev=506518&r1=506517&r2=506518
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java Mon Feb 12 08:08:32 2007
@@ -22,7 +22,6 @@
  * $Id$
  */
 
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MUTABLE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE;
 import org.apache.myfaces.tobago.component.ComponentUtil;
 import org.apache.myfaces.tobago.component.UITree;
@@ -88,9 +87,6 @@
       if (isSelectable(tree)) {
         state.clearSelection();
       }
-      if (ComponentUtil.getBooleanAttribute(tree, ATTR_MUTABLE)) {
-        state.setMarker(null);
-      }
     }
     tree.setValid(true);
   }
@@ -141,23 +137,6 @@
       writer.writeIdAttribute(clientId + UITree.SELECT_STATE);
       writer.writeAttribute(HtmlAttributes.VALUE, ";", null);
       writer.endElement(HtmlConstants.INPUT);
-    }
-
-    if (ComponentUtil.getBooleanAttribute(tree, ATTR_MUTABLE)) {
-
-
-//      writer.startElement(HtmlConstants.DIV, null);
-//      writer.writeAttribute(HtmlAttributes.STYLE, "border: 2px groove #ddeeff", null);
-//      writer.writeText("", null);
-
-      UIComponent toolbar = tree.getFacet("mutableToolbar");
-      if (toolbar == null) {
-        toolbar = tree.getFacet("defaultToolbar");
-      }
-      RenderUtil.encode(facesContext, toolbar);
-
-
-//      writer.endElement(HtmlConstants.DIV);
     }
 
 //    writer.startElement(HtmlConstants.DIV, null);

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeTag.java?view=diff&rev=506518&r1=506517&r2=506518
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeTag.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeTag.java Mon Feb 12 08:08:32 2007
@@ -45,7 +45,6 @@
   private String showRootJunction;
 
   private String selectable;
-  private String mutable;
 
   private String required;
 
@@ -71,7 +70,6 @@
     ComponentUtil.setBooleanProperty(component, ATTR_SHOW_ROOT_JUNCTION, showRootJunction);
 
     ComponentUtil.setStringProperty(component, ATTR_SELECTABLE, selectable);
-    ComponentUtil.setBooleanProperty(component, ATTR_MUTABLE, mutable);
 
     ComponentUtil.setBooleanProperty(component, ATTR_REQUIRED, required);
     ComponentUtil.setActionListener((ActionSource) component, actionListener);
@@ -88,7 +86,6 @@
     showRoot = null;
     showRootJunction = null;
     selectable = null;
-    mutable = null;
     required = null;
     actionListener = null;
     mode = null;
@@ -155,14 +152,6 @@
 
   public void setSelectable(String selectable) {
     this.selectable = selectable;
-  }
-
-  public String getMutable() {
-    return mutable;
-  }
-
-  public void setMutable(String mutable) {
-    this.mutable = mutable;
   }
 
   public String getRequired() {

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeTagDeclaration.java?view=diff&rev=506518&r1=506517&r2=506518
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeTagDeclaration.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeTagDeclaration.java Mon Feb 12 08:08:32 2007
@@ -68,11 +68,6 @@
   @TagAttribute
   @UIComponentTagAttribute(type = "java.lang.Boolean",
       defaultValue = "false")
-  void setMutable(String mutable);
-
-  @TagAttribute
-  @UIComponentTagAttribute(type = "java.lang.Boolean",
-      defaultValue = "false")
   void setShowRootJunction(String showRootJunction);
 
   @TagAttribute