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 2006/10/16 10:45:32 UTC
svn commit: r464417 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/
core/src/main/java/org/apache/myfaces/tobago/taglib/component/
theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/t...
Author: lofwyr
Date: Mon Oct 16 01:45:28 2006
New Revision: 464417
URL: http://svn.apache.org/viewvc?view=rev&rev=464417
Log:
Working on TOBAGO-158
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTag.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTagDeclaration.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js
myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java?view=diff&rev=464417&r1=464416&r2=464417
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java Mon Oct 16 01:45:28 2006
@@ -85,6 +85,7 @@
public static final String ATTR_METHOD = "method";
public static final String ATTR_MIN = "min";
public static final String ATTR_MINIMUM_SIZE = "minimunSize";
+ public static final String ATTR_MODE = "mode";
public static final String ATTR_MUTABLE = "mutable";
public static final String ATTR_NAME = "name";
public static final String ATTR_NAME_REFERENCE = "nameReference";
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTag.java?view=diff&rev=464417&r1=464416&r2=464417
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTag.java Mon Oct 16 01:45:28 2006
@@ -28,6 +28,7 @@
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 static org.apache.myfaces.tobago.TobagoConstants.ATTR_MODE;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.component.UITree;
@@ -56,6 +57,8 @@
private String actionListener;
+ private String mode;
+
public String getComponentType() {
return UITree.COMPONENT_TYPE;
}
@@ -79,6 +82,7 @@
ComponentUtil.setStringProperty(component, ATTR_DISABLED_REFERENCE, disabledReference);
ComponentUtil.setBooleanProperty(component, ATTR_REQUIRED, required);
ComponentUtil.setActionListener((ActionSource) component, actionListener);
+ ComponentUtil.setStringProperty(component, ATTR_MODE, mode);
}
public void release() {
@@ -96,6 +100,7 @@
disabledReference = null;
required = null;
actionListener = null;
+ mode = null;
}
public String getValue() {
@@ -199,5 +204,13 @@
public void setRequired(String required) {
this.required = required;
+ }
+
+ public String getMode() {
+ return mode;
+ }
+
+ public void setMode(String mode) {
+ this.mode = mode;
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTagDeclaration.java?view=diff&rev=464417&r1=464416&r2=464417
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTagDeclaration.java Mon Oct 16 01:45:28 2006
@@ -118,4 +118,13 @@
@TagAttribute
@UIComponentTagAttribute()
void setDisabledReference(String id);
+
+ /**
+ * Display option: Normal tree or menu.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(defaultValue = "tree",
+ allowedValues = {"tree", "menu"})
+ void setMode(String mode);
+
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java?view=diff&rev=464417&r1=464416&r2=464417
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java Mon Oct 16 01:45:28 2006
@@ -33,6 +33,7 @@
import org.apache.myfaces.tobago.component.UITreeNode;
import org.apache.myfaces.tobago.model.TreeState;
import org.apache.myfaces.tobago.renderkit.RendererBase;
+import org.apache.myfaces.tobago.TobagoConstants;
import javax.faces.component.NamingContainer;
import javax.faces.component.UICommand;
@@ -198,6 +199,11 @@
// id
writer.writeText(clientId, null);
+ writer.writeText("','", null);
+
+ // mode // todo: define getter+setter in UI
+// writer.writeText("menu", null); // FIXME
+ writer.writeText("tree", null); // FIXME
writer.writeText("',", null);
// is folder
@@ -277,8 +283,24 @@
writer.writeText(",", null);
// parent
- writer.writeText(jsParentClientId != null ? jsParentClientId : "null", null);
- writer.writeText(");\n", null);
+ if (jsParentClientId != null) {
+ writer.writeText(jsParentClientId, null);
+ } else {
+ writer.writeText("null", null);
+ }
+ writer.writeText(",", null);
+
+ // icon (not implemented)
+ writer.writeText("null", null);
+ writer.writeText(",", null);
+
+ // open folder icon (not implemented)
+ writer.writeText("null", null);
+ writer.writeText(", '", null);
+
+ // width
+ writer.writeText("300", null);
+ writer.writeText("');\n", null);
/*
if (jsParentClientId != null) { // if not the root node
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js?view=diff&rev=464417&r1=464416&r2=464417
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js Mon Oct 16 01:45:28 2006
@@ -290,15 +290,16 @@
}
};
-function TreeNode(label, id, isFolder,
+function TreeNode(label, id, mode, isFolder,
hideIcons, hideJunctions, hideRootJunction,
hideRoot, treeHiddenId, selectable, mutable,
formId, selected, marked,
expanded, required, disabled, treeResources,
- action, parent, icon, openIcon) {
+ action, parent, icon, openIcon, width) {
this.label = label;
this.id = id;
Tobago.treeNodes[id] = this;
+ this.mode = mode
this.isFolder = isFolder
this.hideIcons = hideIcons || false;
this.hideJunctions = hideJunctions || false;
@@ -319,7 +320,8 @@
|| treeResources.getImage("foldericon.gif");
this.openIcon = openIcon
|| treeResources.getImage("openfoldericon.gif");
- this.childNodes = [];
+ this.width = width;
+ this.childNodes = [];
// FIXME: page:form
this.onclick
= mutable
@@ -356,7 +358,8 @@
var str = '';
if (! this.hideRoot || depth > 0) {
- str += '<div id="' + this.id + '" class="tree-item">';
+ str += '<div id="' + this.id + '" class="tree-item" '
+ + 'style="width: ' + this.width + '">';// fixme null pointer
str += this.indent(depth, last);
if (!( this.hideJunctions
|| this.hideRootJunction && depth == 0
@@ -404,14 +407,14 @@
if (this.selectable.match(/LeafOnly$/) && this.isFolder) {
markIcon = this.treeResources.getImage("1x1.gif");
} else {
- if (selected) {
+ if (this.selected) {
markIcon = this.treeResources.getImage("checked" + (this.disabled ? "Disabled" : "") + ".gif");
} else {
markIcon = this.treeResources.getImage("unchecked" + (this.disabled ? "Disabled" : "") + ".gif");
}
if (!this.disabled) {
markIconOnClickFunction
- = 'onclick="toggleSelect(this.parentNode, \'' + treeHiddenId
+ = 'onclick="toggleSelect(this.parentNode, \'' + this.treeHiddenId
+ '\', \'' + this.treeResources.getImage("unchecked.gif")
+ '\', \'' + this.treeResources.getImage("checked.gif")
+ '\')"';
@@ -440,6 +443,17 @@
}
str += '>'
+ this.label + '</a>';
+ }
+ if (this.mode == "menu") {
+ if (this.isFolder) {
+ str += '<img class="tobago-tree-menu-icon" '
+ + 'src="' + (this.expanded ? this.openIcon : this.icon) + ' " '
+ + 'onclick="toggle(this.parentNode, \'' + this.treeHiddenId
+ + '\', \'' + this.treeResources.getImage("openfoldericon.gif")
+ + '\', \'' + this.treeResources.getImage("foldericon.gif")
+ + '\')"'
+ + ' alt="">';
+ }
}
str += '</div>';
}
Modified: myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css?view=diff&rev=464417&r1=464416&r2=464417
==============================================================================
--- myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css (original)
+++ myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css Mon Oct 16 01:45:28 2006
@@ -221,6 +221,11 @@
height: 16px;
}
+.tobago-tree-menu-icon {
+ width: 16px;
+ height: 16px;
+ float: right;
+}
/* ----------------------------------------------------------------------------
* New Tobago Style definitions: