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/10/16 22:03:01 UTC
svn commit: r585242 - in /myfaces/tobago/trunk:
example/sandbox/src/main/webapp/
sandbox/src/main/java/org/apache/myfaces/tobago/component/
sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
sandbox/src/main/java/o...
Author: lofwyr
Date: Tue Oct 16 13:03:00 2007
New Revision: 585242
URL: http://svn.apache.org/viewvc?rev=585242&view=rev
Log:
TOBAGO-377: Improved Tree
* add image attibute for custom icons
* add addedum facet for custom ui components inside of nodes
* Clean up
Modified:
myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree-normal.jsp
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/component/UITreeData.java
myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UITreeNode.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/TreeNodeTag.java
myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/TreeNodeTagDeclaration.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/example/sandbox/src/main/webapp/tree-normal.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree-normal.jsp?rev=585242&r1=585241&r2=585242&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree-normal.jsp (original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree-normal.jsp Tue Oct 16 13:03:00 2007
@@ -28,7 +28,8 @@
<tc:gridLayout margin="10px" rows="600px;*"/>
</f:facet>
- <tcs:tree state="#{controller.state}" id="tree"
+ <%--state="#{controller.state}" --%>
+ <tcs:tree id="tree"
showIcons="true"
showJunctions="true"
showRootJunction="true"
@@ -43,9 +44,14 @@
tip="#{node.userObject.tip}"
action="#{node.userObject.action}"
disabled="#{node.userObject.disabled}"
- value="#{node}"/>
+ value="#{node}"
+ image="feather.png"/>
</tcs:treeData>
- <tcs:treeNode label="2 Action 1" action="#{controller.action1}" id="action1"/>
+ <tcs:treeNode label="2 Action 1" action="#{controller.action1}" id="action1">
+ <f:facet name="addendum">
+ <tc:out value="(Addendum)" />
+ </f:facet>
+ </tcs:treeNode>
<tcs:treeNode label="3 Action 2" action="#{controller.action2}" id="action2"/>
<tcs:treeNode label="4 Action 3" action="#{controller.action3}" id="action3">
<tcs:treeNode label="4.1 On Click 1" onclick="alert('On Click 1');" id="click1"/>
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?rev=585242&r1=585241&r2=585242&view=diff
==============================================================================
--- 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 Tue Oct 16 13:03:00 2007
@@ -23,10 +23,7 @@
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 org.apache.myfaces.tobago.model.MixedTreeModel;
-import org.apache.myfaces.tobago.model.TreeState;
-import org.apache.myfaces.tobago.util.MessageFactory;
import javax.faces.application.FacesMessage;
import javax.faces.component.NamingContainer;
@@ -36,12 +33,10 @@
import javax.faces.el.ValueBinding;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
-import javax.swing.tree.DefaultMutableTreeNode;
import java.io.IOException;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-import java.util.Set;
public class UITree extends UIInput implements NamingContainer {
@@ -57,8 +52,6 @@
public static final String FACET_TREE_NODE_COMMAND = "treeNodeCommand";
public static final String PARAMETER_TREE_NODE_ID = "treeNodeId";
- private TreeState treeState;
-
private boolean showJunctions = true;
private boolean showJunctionsSet = false;
private boolean showIcons = true;
@@ -152,6 +145,9 @@
}
public void validate(FacesContext context) {
+
+// todo: validate must be written new, without TreeState
+/*
if (isRequired() && getState().getSelection().size() == 0) {
setValid(false);
FacesMessage facesMessage = MessageFactory.createFacesMessage(context,
@@ -173,7 +169,7 @@
}
}
}
-
+*/
// call all validators
if (getValidators() != null) {
for (Validator validator : getValidators()) {
@@ -229,22 +225,6 @@
showRootJunctionSet = true;
}
mode = (String) values[5];
- }
-
- public TreeState getState() {
- if (treeState != null) {
- return treeState;
- }
- ValueBinding valueBinding = getValueBinding(ATTR_STATE);
- if (valueBinding != null) {
- return (TreeState) valueBinding.getValue(getFacesContext());
- } else {
- return null;
- }
- }
-
- public void setState(TreeState state) {
- this.treeState = state;
}
public boolean isShowJunctions() {
Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UITreeData.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UITreeData.java?rev=585242&r1=585241&r2=585242&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UITreeData.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UITreeData.java Tue Oct 16 13:03:00 2007
@@ -31,6 +31,8 @@
import javax.faces.event.PhaseId;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
public class UITreeData extends javax.faces.component.UIInput
implements NamingContainer, TreeModelBuilder {
@@ -57,6 +59,8 @@
// super.processDecodes(facesContext);
// }
+ // Holds for each node the states of the child components of this UITreeData.
+ private Map<String, Object> pathStates = new HashMap<String, Object>();
@Override
public void processDecodes(FacesContext facesContext) {
@@ -87,11 +91,17 @@
return; // nothing to do, if already set.
}
- // reset the client id (see spec 3.1.6)
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
UITreeNode template = getTemplateComponent();
+ pathStates.put(this.pathIndex, template.saveState(facesContext));
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("save " + this.pathIndex + " ex=" + template.isExpanded());
+ }
+
+ // reset the client id (see spec 3.1.6)
template.setId(template.getId());
- FacesContext facesContext = FacesContext.getCurrentInstance();
this.pathIndex = pathIndex;
if (pathIndex != null) {
currentNode = treeModel.getNode(pathIndex);
@@ -100,11 +110,20 @@
currentNodeId = pathIndex;
currentParentNodeId = treeModel.getParentPathIndex(pathIndex);
} else {
- facesContext.getExternalContext().getRequestMap().remove(var);
+ FacesContext.getCurrentInstance().getExternalContext().getRequestMap().remove(var);
currentNode = null;
currentNodeId = null;
currentParentNodeId = null;
}
+
+ Object state = pathStates.get(this.pathIndex);
+ if (state != null) {
+ template.restoreState(facesContext, state);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("restore " + this.pathIndex + " ex=" + template.isExpanded());
+ }
+ }
+
}
public void buildBegin(MixedTreeModel model) {
@@ -127,8 +146,7 @@
}
@Override
- public void encodeChildren(FacesContext context)
- throws IOException {
+ public void encodeChildren(FacesContext context) throws IOException {
}
@Override
@@ -303,5 +321,4 @@
return pathIndex;
}
}
-
}
Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UITreeNode.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UITreeNode.java?rev=585242&r1=585241&r2=585242&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UITreeNode.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/component/UITreeNode.java Tue Oct 16 13:03:00 2007
@@ -21,9 +21,10 @@
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.model.MixedTreeModel;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.faces.context.FacesContext;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.swing.tree.DefaultMutableTreeNode;
public class UITreeNode extends UICommand implements SupportsMarkup, TreeModelBuilder {
@@ -33,6 +34,12 @@
private String[] markup;
+ private Boolean marked;
+ private static final boolean DEFAULT_MARKED = false;
+
+ private Boolean expanded;
+ private static final boolean DEFAULT_EXPANDED = false;
+
public String[] getMarkup() {
if (markup != null) {
return markup;
@@ -107,14 +114,44 @@
Object[] values = (Object[]) state;
super.restoreState(context, values[0]);
markup = (String[]) values[1];
+ marked = (Boolean) values[2];
+ expanded = (Boolean) values[3];
}
@Override
public Object saveState(FacesContext context) {
- Object[] values = new Object[2];
+ Object[] values = new Object[4];
values[0] = super.saveState(context);
values[1] = markup;
+ values[2] = marked;
+ values[3] = expanded;
return values;
+ }
+
+ public void setMarked(boolean marked) {
+ this.marked = marked;
+ }
+
+ public boolean isMarked() {
+ if (marked != null) {
+ return marked;
+ }
+ ValueBinding valueBinding = getValueBinding("marked");
+ Boolean value = valueBinding != null ? (Boolean) valueBinding.getValue(getFacesContext()) : null;
+ return value != null ? value : DEFAULT_MARKED;
+ }
+
+ public void setExpanded(boolean expanded) {
+ this.expanded = expanded;
+ }
+
+ public boolean isExpanded() {
+ if (expanded != null) {
+ return expanded;
+ }
+ ValueBinding valueBinding = getValueBinding("expanded");
+ Boolean value = valueBinding != null ? (Boolean) valueBinding.getValue(getFacesContext()) : null;
+ return value != null ? value : DEFAULT_EXPANDED;
}
}
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?rev=585242&r1=585241&r2=585242&view=diff
==============================================================================
--- 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 Tue Oct 16 13:03:00 2007
@@ -25,7 +25,6 @@
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_EXPANDED;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
@@ -34,8 +33,8 @@
import org.apache.myfaces.tobago.component.UITreeNode;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.model.MixedTreeModel;
-import org.apache.myfaces.tobago.model.TreeState;
import org.apache.myfaces.tobago.renderkit.CommandRendererBase;
+import org.apache.myfaces.tobago.renderkit.RenderUtil;
import org.apache.myfaces.tobago.renderkit.html.CommandRendererHelper;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -51,7 +50,6 @@
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.IOException;
import java.util.List;
@@ -72,7 +70,6 @@
UITreeNode node = (UITreeNode) component;
UITree tree = node.findTree();
- TreeState state = tree.getState();
String treeId = tree.getClientId(facesContext);
String nodeStateId = node.nodeStateId(facesContext);
Map requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
@@ -80,24 +77,16 @@
// expand state
boolean expanded = Boolean.parseBoolean((String) requestParameterMap.get(id + "-expanded"));
+ node.setExpanded(expanded);
-// String expandState = (String) requestParameterMap.get(treeId);
-// String searchString = ";" + nodeStateId + ";";
-// if (StringUtils.contains(expandState, searchString)) {
-// if (expanded) {
-// state.addExpandState((DefaultMutableTreeNode) node.getValue());
- ValueBinding binding = node.getValueBinding(ATTR_EXPANDED);
- if (binding != null) {
- binding.setValue(facesContext, expanded);
- }
-// }
-
+ // select
String searchString;
if (TreeRenderer.isSelectable(tree)) { // selection
String selected = (String) requestParameterMap.get(treeId + UITree.SELECT_STATE);
searchString = ";" + nodeStateId + ";";
if (StringUtils.contains(selected, searchString)) {
- state.addSelection((DefaultMutableTreeNode) node.getValue());
+ // TODO: add selection to Component
+ //state.addSelection((DefaultMutableTreeNode) node.getValue());
}
}
@@ -105,10 +94,9 @@
String marked = (String) requestParameterMap.get(treeId + UITree.MARKER);
if (marked != null) {
searchString = treeId + NamingContainer.SEPARATOR_CHAR + nodeStateId;
-
- if (marked.equals(searchString)) {
- state.setMarker((DefaultMutableTreeNode) node.getValue());
- }
+ node.setMarked(marked.equals(searchString));
+ } else {
+ LOG.warn("This log message is help clarifying the occurence of this else case.");
}
}
@@ -123,16 +111,15 @@
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
- TreeState treeState = root.getState();
String treeId = root.getClientId(facesContext);
DefaultMutableTreeNode modelNode = (DefaultMutableTreeNode) node.getValue();
boolean isFolder = mixedModel.isFolder();
- boolean marked = treeState.isMarked(modelNode);
+ boolean marked = node.isMarked();
String id = node.getClientId(facesContext);
- boolean expanded = ComponentUtil.getBooleanAttribute(node, ATTR_EXPANDED);
+ boolean expanded = node.isExpanded();
boolean menuMode = root.getMode().equals("menu");
boolean showIcons = root.isShowIcons();
@@ -143,6 +130,7 @@
boolean isRoot = mixedModel.isRoot();
boolean hasNextSibling = mixedModel.hasCurrentNodeNextSibling();
List<Boolean> junctions = mixedModel.getJunctions();
+ String image = ComponentUtil.getStringAttribute(node, "image");
if (!showRoot && junctions.size() > 0) {
junctions.remove(0);
@@ -193,12 +181,17 @@
encodeIndent(facesContext, writer, menuMode, junctions);
encodeTreeJunction(facesContext, writer, id, treeId, showJunctions, showRootJunction, showRoot, expanded,
- isFolder, depth, hasNextSibling);
+ isFolder, depth, hasNextSibling, image);
- encodeTreeIcons(facesContext, writer, id, treeId, showIcons, expanded, isFolder);
+ encodeTreeIcons(facesContext, writer, id, treeId, showIcons, expanded, isFolder, image);
encodeLabel(writer, helper, node, marked, treeId);
+ UIComponent facet = node.getFacet("addendum");
+ if (facet != null) {
+ RenderUtil.encode(facesContext, facet);
+ }
+
writer.endElement(DIV);
}
@@ -268,7 +261,7 @@
private void encodeTreeJunction(
FacesContext facesContext, TobagoResponseWriter writer, String id, String treeId,
boolean showJunctions, boolean showRootJunction, boolean showRoot,
- boolean expanded, boolean isFolder, int depth, boolean hasNextSibling) throws IOException {
+ boolean expanded, boolean isFolder, int depth, boolean hasNextSibling, String image) throws IOException {
if (!(!showJunctions
|| !showRootJunction && depth == 0
|| !showRootJunction && !showRoot && depth == 1)) {
@@ -290,8 +283,7 @@
String src = ResourceManagerUtil.getImageWithPath(facesContext, "image/" + gif);
writer.writeAttribute("src", src, true); // xxx is escaping required
if (isFolder) {
- writer.writeAttribute("onclick",
- createOnclickForToggle(facesContext, treeId), true); // xxx is escaping required
+ writer.writeAttribute("onclick", createOnclickForToggle(facesContext, treeId, image), true); // xxx is escaping required
}
writer.writeAttribute("alt", "", false);
// } else if (( !this.hideRoot && depth >0 ) || (this.hideRoot && depth > 1)) {
@@ -304,7 +296,7 @@
private void encodeTreeIcons(
FacesContext facesContext, TobagoResponseWriter writer, String id, String treeId,
- boolean showIcons, boolean expanded, boolean isFolder)
+ boolean showIcons, boolean expanded, boolean isFolder, String image)
throws IOException {
if (showIcons) {
@@ -312,25 +304,29 @@
writer.writeClassAttribute("tree-icon");
writer.writeIdAttribute(id + "-icon");
- String gif = isFolder
- ? (expanded ? "openfoldericon.gif" : "foldericon.gif")
- : "new.gif";
-
- String src = ResourceManagerUtil.getImageWithPath(facesContext, "image/" + gif);
+ if (image == null) {
+ image = "image/" + (isFolder ? (expanded ? "openfoldericon.gif" : "foldericon.gif") : "new.gif");
+ }
+ String src = ResourceManagerUtil.getImageWithPath(facesContext, image);
writer.writeAttribute("src", src, true); // xxx is escaping required
if (isFolder) {
writer.writeAttribute("onclick",
- createOnclickForToggle(facesContext, treeId), true); // xxx is escaping required
+ createOnclickForToggle(facesContext, treeId, image), true); // xxx is escaping required
}
writer.writeAttribute("alt", "", false);
writer.endElement(IMG);
}
}
- private String createOnclickForToggle(FacesContext facesContext, String treeId) {
+ private String createOnclickForToggle(FacesContext facesContext, String treeId, String image) {
+ String openImage = image;
+ if (image == null) {
+ openImage = "image/openfoldericon.gif";
+ image = "image/foldericon.gif";
+ }
return "tobagoTreeNodeToggle(this.parentNode, '" + treeId + "', '"
- + ResourceManagerUtil.getImageWithPath(facesContext, "image/openfoldericon.gif") + "', '"
- + ResourceManagerUtil.getImageWithPath(facesContext, "image/foldericon.gif") + "', null, null)";
+ + ResourceManagerUtil.getImageWithPath(facesContext, openImage) + "', '"
+ + ResourceManagerUtil.getImageWithPath(facesContext, image) + "', null, 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?rev=585242&r1=585241&r2=585242&view=diff
==============================================================================
--- 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 Tue Oct 16 13:03:00 2007
@@ -26,7 +26,6 @@
import org.apache.myfaces.tobago.component.UITree;
import org.apache.myfaces.tobago.component.UITreeNode;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
-import org.apache.myfaces.tobago.model.TreeState;
import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
import org.apache.myfaces.tobago.renderkit.RenderUtil;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
@@ -76,16 +75,6 @@
}
UITree tree = (UITree) component;
- TreeState state = tree.getState();
-
- if (state != null) {
- if ("Tree".equals(tree.getRendererType())) {
- state.clearExpandState();
- }
- if (isSelectable(tree)) {
- state.clearSelection();
- }
- }
tree.setValid(true);
}
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?rev=585242&r1=585241&r2=585242&view=diff
==============================================================================
--- 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 Tue Oct 16 13:03:00 2007
@@ -18,8 +18,10 @@
*/
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_EXPANDED;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMAGE;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MARKED;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TARGET;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VALUE;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.component.UITreeNode;
@@ -34,6 +36,8 @@
private String tip;
private String target;
private String expanded;
+ private String marked;
+ private String image;
@Override
public String getComponentType() {
@@ -49,6 +53,8 @@
ComponentUtil.setStringProperty(component, ATTR_TIP, tip);
ComponentUtil.setStringProperty(component, ATTR_TARGET, target);
ComponentUtil.setBooleanProperty(component, ATTR_EXPANDED, expanded);
+ ComponentUtil.setBooleanProperty(component, ATTR_MARKED, marked);
+ ComponentUtil.setStringProperty(component, ATTR_IMAGE, image);
}
@Override
@@ -59,6 +65,8 @@
tip = null;
target = null;
expanded = null;
+ marked = null;
+ image = null;
}
public String getValue() {
@@ -91,5 +99,21 @@
public void setExpanded(String expanded) {
this.expanded = expanded;
+ }
+
+ public String getMarked() {
+ return marked;
+ }
+
+ public void setMarked(String marked) {
+ this.marked = marked;
+ }
+
+ public String getImage() {
+ return image;
+ }
+
+ public void setImage(String image) {
+ this.image = image;
}
}
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?rev=585242&r1=585241&r2=585242&view=diff
==============================================================================
--- 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 Tue Oct 16 13:03:00 2007
@@ -18,12 +18,14 @@
*/
import org.apache.myfaces.tobago.apt.annotation.BodyContentDescription;
+import org.apache.myfaces.tobago.apt.annotation.Facet;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.taglib.component.AbstractCommandTagDeclaration;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
+import org.apache.myfaces.tobago.taglib.decl.HasImage;
import org.apache.myfaces.tobago.taglib.decl.HasLabel;
import org.apache.myfaces.tobago.taglib.decl.HasMarkup;
import org.apache.myfaces.tobago.taglib.decl.HasTarget;
@@ -39,10 +41,12 @@
@BodyContentDescription(anyTagOf = "<tcs:treeNode>* <tcs:treeData>*")
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UITreeNode",
- rendererType = "TreeNode")
+ rendererType = "TreeNode",
+ facets = {
+ @Facet(name="addendum", description = "Displays an additional component to a node.")})
public interface TreeNodeTagDeclaration
extends HasIdBindingAndRendered, HasLabel, HasValue, HasMarkup, AbstractCommandTagDeclaration, HasTip, HasTarget,
- IsDisabled {
+ HasImage, IsDisabled {
/**
* Flag indicating if the subnodes are to be displayed.
@@ -50,4 +54,11 @@
@TagAttribute(type = String.class)
@UIComponentTagAttribute(type = "java.lang.Boolean")
void setExpanded(String expanded);
+
+ /**
+ * Flag indicating if the node is marked, and should be displayed in a special way.
+ */
+ @TagAttribute(type = String.class)
+ @UIComponentTagAttribute(type = "java.lang.Boolean")
+ void setMarked(String marked);
}
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?rev=585242&r1=585241&r2=585242&view=diff
==============================================================================
--- 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 Tue Oct 16 13:03:00 2007
@@ -24,7 +24,6 @@
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_VALUE;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.component.UITree;
@@ -35,7 +34,6 @@
public class TreeTag extends TobagoTag implements TreeTagDeclaration {
private String value;
- private String state;
private String showJunctions;
private String showIcons;
@@ -58,7 +56,6 @@
super.setProperties(component);
ComponentUtil.setStringProperty(component, ATTR_VALUE, value);
- ComponentUtil.setValueBinding(component, ATTR_STATE, state);
ComponentUtil.setBooleanProperty(component, ATTR_SHOW_JUNCTIONS, showJunctions);
ComponentUtil.setBooleanProperty(component, ATTR_SHOW_ICONS, showIcons);
@@ -75,7 +72,6 @@
public void release() {
super.release();
value = null;
- state = null;
showJunctions = null;
showIcons = null;
showRoot = null;
@@ -91,14 +87,6 @@
public void setValue(String value) {
this.value = value;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
}
public String getShowIcons() {
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?rev=585242&r1=585241&r2=585242&view=diff
==============================================================================
--- 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 Tue Oct 16 13:03:00 2007
@@ -24,7 +24,6 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.taglib.component.TobagoTagDeclaration;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
-import org.apache.myfaces.tobago.taglib.decl.HasState;
import org.apache.myfaces.tobago.taglib.decl.HasTreeNodeValue;
import org.apache.myfaces.tobago.taglib.decl.IsRequired;
@@ -39,7 +38,7 @@
uiComponent = "org.apache.myfaces.tobago.component.UITree",
rendererType = "Tree")
public interface TreeTagDeclaration
- extends TobagoTagDeclaration, HasIdBindingAndRendered, HasTreeNodeValue, HasState, IsRequired {
+ extends TobagoTagDeclaration, HasIdBindingAndRendered, HasTreeNodeValue, IsRequired {
/**
* Flag indicating whether or not this component should be render selectable items.