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 2012/03/06 10:35:42 UTC
svn commit: r1297399 - in /myfaces/tobago/branches/tobago-tree-table:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/
tobago-core/src/main/java/org/a...
Author: lofwyr
Date: Tue Mar 6 09:35:41 2012
New Revision: 1297399
URL: http://svn.apache.org/viewvc?rev=1297399&view=rev
Log:
TOBAGO-1049: Tree inside of the Sheet (aka TreeTable)
- generalizing showRoot
Added:
myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeListbox.java
myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsShowRoot.java
Modified:
myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java
myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java
myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java
myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxTagDeclaration.java
myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuTagDeclaration.java
myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java
myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java
myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java?rev=1297399&r1=1297398&r2=1297399&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java Tue Mar 6 09:35:41 2012
@@ -27,10 +27,13 @@ import javax.faces.model.DataModel;
import javax.swing.tree.DefaultMutableTreeNode;
import java.util.List;
-public class AbstractUIData extends javax.faces.component.UIData {
+public abstract class AbstractUIData extends javax.faces.component.UIData {
private static final Logger LOG = LoggerFactory.getLogger(AbstractUIData.class);
+ public static final String SUFFIX_MARKED = "marked";
+ public static final String SUFFIX_EXPANDED = "expanded";
+
/**
* Only for tree model.
*/
@@ -107,9 +110,7 @@ public class AbstractUIData extends java
}
}
- public boolean isShowRoot() {
- return true;
- }
+ public abstract boolean isShowRoot();
/**
* The value describes, if the UIData renderer creates container elements to hold the row information.
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java?rev=1297399&r1=1297398&r2=1297399&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java Tue Mar 6 09:35:41 2012
@@ -51,9 +51,6 @@ public abstract class AbstractUITree ext
@Deprecated
public static final String MARKED = "marked";
- public static final String SUFFIX_MARKED = "marked";
- public static final String SUFFIX_EXPANDED = "expanded";
-
@Override
public void processValidators(FacesContext facesContext) {
final int last = hasRows() ? getFirst() + getRows() : Integer.MAX_VALUE;
Added: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeListbox.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeListbox.java?rev=1297399&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeListbox.java (added)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeListbox.java Tue Mar 6 09:35:41 2012
@@ -0,0 +1,26 @@
+package org.apache.myfaces.tobago.internal.component;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public abstract class AbstractUITreeListbox extends AbstractUITree {
+
+ @Override
+ public boolean isShowRoot() {
+ return false;
+ }
+}
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java?rev=1297399&r1=1297398&r2=1297399&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java Tue Mar 6 09:35:41 2012
@@ -32,6 +32,7 @@ import org.apache.myfaces.tobago.interna
import org.apache.myfaces.tobago.internal.taglib.declaration.HasRenderedPartially;
import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutComponent;
import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutContainer;
+import org.apache.myfaces.tobago.internal.taglib.declaration.IsShowRoot;
/**
* Render a sheet element.
@@ -50,7 +51,7 @@ import org.apache.myfaces.tobago.interna
allowedChildComponenents = "org.apache.myfaces.tobago.Reload")})
public interface SheetTagDeclaration
extends HasIdBindingAndRendered, IsGridLayoutComponent, IsGridLayoutContainer, HasMarkup, HasCurrentMarkup,
- HasRenderedPartially {
+ HasRenderedPartially, IsShowRoot {
/**
* LayoutConstraints for column layout.
* Semicolon separated list of layout tokens ('<x>*', '<x>px' or '<x>%').
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxTagDeclaration.java?rev=1297399&r1=1297398&r2=1297399&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeListboxTagDeclaration.java Tue Mar 6 09:35:41 2012
@@ -37,7 +37,7 @@ import org.apache.myfaces.tobago.interna
@BodyContentDescription(anyTagOf = "<tc:treeNode>|<tc:treeData>")
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UITreeListbox",
- uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUITree",
+ uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUITreeListbox",
rendererType = RendererTypes.TREE_LISTBOX,
allowedChildComponenents = {
"org.apache.myfaces.tobago.TreeNode",
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuTagDeclaration.java?rev=1297399&r1=1297398&r2=1297399&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeMenuTagDeclaration.java Tue Mar 6 09:35:41 2012
@@ -28,6 +28,7 @@ import org.apache.myfaces.tobago.interna
import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasMarkup;
import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutComponent;
+import org.apache.myfaces.tobago.internal.taglib.declaration.IsShowRoot;
/**
* A tree which will be displayed like a flat menu.
@@ -44,7 +45,7 @@ import org.apache.myfaces.tobago.interna
"org.apache.myfaces.tobago.TreeData"
})
public interface TreeMenuTagDeclaration
- extends HasIdBindingAndRendered, IsGridLayoutComponent, HasMarkup, HasCurrentMarkup {
+ extends HasIdBindingAndRendered, IsGridLayoutComponent, HasMarkup, HasCurrentMarkup, IsShowRoot {
/**
*
@@ -58,11 +59,4 @@ public interface TreeMenuTagDeclaration
@UIComponentTagAttribute(type = "java.lang.Object", expression = DynamicExpression.VALUE_BINDING_REQUIRED)
void setState(String state);
- /**
- * Indicates that the root node should be displayed or not.
- * Normally the root node of a menu will not be shown, because it has only technical significance.
- */
- @TagAttribute
- @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
- void setShowRoot(String showRoot);
}
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java?rev=1297399&r1=1297398&r2=1297399&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TreeTagDeclaration.java Tue Mar 6 09:35:41 2012
@@ -31,6 +31,7 @@ import org.apache.myfaces.tobago.interna
import org.apache.myfaces.tobago.internal.taglib.declaration.HasVar;
import org.apache.myfaces.tobago.internal.taglib.declaration.IsGridLayoutComponent;
import org.apache.myfaces.tobago.internal.taglib.declaration.IsRequired;
+import org.apache.myfaces.tobago.internal.taglib.declaration.IsShowRoot;
/**
* A tree with classical look.
@@ -47,7 +48,8 @@ import org.apache.myfaces.tobago.interna
"org.apache.myfaces.tobago.TreeData"
})
public interface TreeTagDeclaration
- extends HasIdBindingAndRendered, HasValue, HasVar, IsRequired, IsGridLayoutComponent, HasMarkup, HasCurrentMarkup {
+ extends HasIdBindingAndRendered, HasValue, HasVar, IsRequired, IsGridLayoutComponent, HasMarkup, HasCurrentMarkup,
+ IsShowRoot {
/**
* Flag indicating whether or not this component should be render selectable items.
@@ -71,10 +73,6 @@ public interface TreeTagDeclaration
@UIComponentTagAttribute(type = "boolean", defaultValue = "false")
void setShowRootJunction(String showRootJunction);
- @TagAttribute
- @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
- void setShowRoot(String showRoot);
-
/**
*
* <strong>ValueBindingExpression</strong> pointing to a object to save the
Added: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsShowRoot.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsShowRoot.java?rev=1297399&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsShowRoot.java (added)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/IsShowRoot.java Tue Mar 6 09:35:41 2012
@@ -0,0 +1,34 @@
+package org.apache.myfaces.tobago.internal.taglib.declaration;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+
+public interface IsShowRoot {
+
+ /**
+ * Only applicable in the case that the data model is a tree.
+ * This flag indicates that the root node should be displayed.
+ * Often in tree structures the root node is special and should not be displayed.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
+ void setShowRoot(String showRoot);
+
+}
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java?rev=1297399&r1=1297398&r2=1297399&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java Tue Mar 6 09:35:41 2012
@@ -22,6 +22,7 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.component.UITreeNode;
import org.apache.myfaces.tobago.context.Markup;
import org.apache.myfaces.tobago.context.ResourceManagerUtils;
+import org.apache.myfaces.tobago.internal.component.AbstractUIData;
import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Classes;
import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
@@ -32,7 +33,6 @@ import org.apache.myfaces.tobago.util.Co
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIData;
import javax.faces.context.FacesContext;
import java.io.IOException;
import java.util.List;
@@ -44,14 +44,13 @@ public class TreeIndentRenderer extends
final UITreeIndent indent = (UITreeIndent) component;
final UITreeNode node = ComponentUtils.findAncestor(indent, UITreeNode.class);
- final UIData data = ComponentUtils.findAncestor(indent, UIData.class);
+ final AbstractUIData data = ComponentUtils.findAncestor(indent, AbstractUIData.class);
final boolean folder = node.isFolder();
final int level = node.getLevel();
final List<Boolean> junctions = node.getJunctions();
- // todo: sheet
- final boolean showRoot = data instanceof UITree && ((UITree) data).isShowRoot();
+ final boolean showRoot = data.isShowRoot();
final boolean showJunctions = indent.isShowJunctions();
// todo: sheet
final boolean showRootJunction = data instanceof UITree && ((UITree) data).isShowRootJunction();
@@ -66,7 +65,7 @@ public class TreeIndentRenderer extends
facesContext, writer, node, showJunctions, showRootJunction, junctions, expanded, folder, level == 0);
}
- private void encodeIndent(
+ private void encodeIndent(
final FacesContext facesContext, final TobagoResponseWriter writer, final UITreeNode node,
final boolean showJunctions, final boolean showRootJunction, final boolean showRoot,
final List<Boolean> junctions)
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java?rev=1297399&r1=1297398&r2=1297399&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java Tue Mar 6 09:35:41 2012
@@ -18,6 +18,7 @@ package org.apache.myfaces.tobago.render
*/
import org.apache.myfaces.tobago.component.UITreeNode;
+import org.apache.myfaces.tobago.internal.component.AbstractUIData;
import org.apache.myfaces.tobago.internal.component.AbstractUITree;
import org.apache.myfaces.tobago.internal.util.StringUtils;
import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
@@ -58,7 +59,7 @@ public class TreeRenderer extends Layout
// expanded
String expanded = (String) facesContext.getExternalContext().getRequestParameterMap()
- .get(tree.getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + AbstractUITree.SUFFIX_EXPANDED);
+ .get(tree.getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + AbstractUIData.SUFFIX_EXPANDED);
try {
tree.setSubmittedExpanded(expanded != null ? StringUtils.parseIntegerList(expanded) : null);
} catch (NumberFormatException e) {
@@ -122,10 +123,10 @@ public class TreeRenderer extends Layout
writer.startElement(HtmlElements.INPUT, tree);
writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
- final String expandedId = clientId + ComponentUtils.SUB_SEPARATOR + AbstractUITree.SUFFIX_EXPANDED;
+ final String expandedId = clientId + ComponentUtils.SUB_SEPARATOR + AbstractUIData.SUFFIX_EXPANDED;
writer.writeNameAttribute(expandedId);
writer.writeIdAttribute(expandedId);
- writer.writeClassAttribute(Classes.create(tree, AbstractUITree.SUFFIX_EXPANDED));
+ writer.writeClassAttribute(Classes.create(tree, AbstractUIData.SUFFIX_EXPANDED));
final List<Integer> value = tree.getSubmittedExpanded();
writer.writeAttribute(HtmlAttributes.VALUE, value != null ? StringUtils.joinWithSurroundingSeparator(value) : "", false);
writer.endElement(HtmlElements.INPUT);