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 17:51:50 UTC
svn commit: r464525 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/component/
theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
theme/scarborough/src/main/resources/org/apache/m...
Author: lofwyr
Date: Mon Oct 16 08:51:47 2006
New Revision: 464525
URL: http://svn.apache.org/viewvc?view=rev&rev=464525
Log:
Working on TOBAGO-158
navigation menu style for the tree
Added:
myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/treeMenuClose.gif (with props)
myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/treeMenuOpen.gif (with props)
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITree.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/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.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
myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/tree.jsp
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITree.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITree.java?view=diff&rev=464525&r1=464524&r2=464525
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITree.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITree.java Mon Oct 16 08:51:47 2006
@@ -21,6 +21,7 @@
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;
@@ -100,6 +101,8 @@
private boolean showRootJunction = true;
private boolean showRootJunctionSet = false;
+ private String mode;
+
public UITree() {
treeCommands = new Command[]{
new Command(COMMAND_NEW),
@@ -134,6 +137,22 @@
}
+ public String getMode() {
+ if (mode != null) {
+ return mode;
+ }
+ ValueBinding vb = getValueBinding(ATTR_MODE);
+ if (vb != null) {
+ return (String) vb.getValue(getFacesContext());
+ } else {
+ return "tree";
+ }
+ }
+
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+
public MethodBinding getActionListener() {
return actionListenerBinding;
}
@@ -336,13 +355,14 @@
}
public Object saveState(FacesContext context) {
- Object[] state = new Object[6];
+ Object[] state = new Object[7];
state[0] = super.saveState(context);
state[1] = saveAttachedState(context, actionListenerBinding);
state[2] = showJunctionsSet ? showJunctions : null;
state[3] = showIconsSet ? showIcons : null;
state[4] = showRootSet ? showRoot : null;
state[5] = showRootJunctionSet ? showRootJunction : null;
+ state[6] = mode;
return state;
}
@@ -366,6 +386,7 @@
showRootJunction = (Boolean) values[5];
showRootJunctionSet = true;
}
+ mode = (String) values[6];
}
public Command[] getCommands() {
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=464525&r1=464524&r2=464525
==============================================================================
--- 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 08:51:47 2006
@@ -33,7 +33,6 @@
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;
@@ -201,9 +200,7 @@
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(root.getMode(), null);
writer.writeText("',", null);
// is folder
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java?view=diff&rev=464525&r1=464524&r2=464525
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java Mon Oct 16 08:51:47 2006
@@ -66,6 +66,8 @@
"Lplus.gif",
"Tplus.gif",
"Rplus.gif",
+ "treeMenuOpen.gif",
+ "treeMenuClose.gif",
};
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=464525&r1=464524&r2=464525
==============================================================================
--- 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 08:51:47 2006
@@ -358,9 +358,21 @@
var str = '';
if (! this.hideRoot || depth > 0) {
- str += '<div id="' + this.id + '" class="tree-item" '
- + 'style="width: ' + this.width + '">';// fixme null pointer
+ str += '<div id="' + this.id + '" class="' + (this.mode == 'menu' ? 'tree-menu-item' : 'tree-item') + '" '
+ + 'style="width: ' + this.width + '";>';// fixme null pointer
str += this.indent(depth, last);
+ if (this.mode == "menu") {
+ if (this.isFolder) {
+ // FIXME: change the icons when klick on the icon
+ str += '<img class="tobago-tree-menu-icon" '
+ + 'src="' + (this.expanded ? this.treeResources.getImage("treeMenuOpen.gif") : this.treeResources.getImage("treeMenuClose.gif")) + ' " '
+ + 'onclick="toggle(this.parentNode, \'' + this.treeHiddenId
+ + '\', \'' + this.treeResources.getImage("treeMenuOpen.gif")
+ + '\', \'' + this.treeResources.getImage("treeMenuClose.gif")
+ + '\')"'
+ + ' alt="">';
+ }
+ }
if (!( this.hideJunctions
|| this.hideRootJunction && depth == 0
|| this.hideRootJunction && this.hideRoot && depth == 1)) {
@@ -443,17 +455,6 @@
}
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>';
}
Added: myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/treeMenuClose.gif
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/treeMenuClose.gif?view=auto&rev=464525
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/treeMenuClose.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/treeMenuOpen.gif
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/treeMenuOpen.gif?view=auto&rev=464525
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/treeMenuOpen.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
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=464525&r1=464524&r2=464525
==============================================================================
--- 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 08:51:47 2006
@@ -158,11 +158,24 @@
}
.tree-item {
- padding: 0px;
+ padding: 0px;
margin: 0px;
font: icon;
color: #000000;
white-space: nowrap;
+ width: 200px; /* default */
+ height: 16px;
+}
+
+.tree-menu-item {
+ border: 1px solid #CCCCCC;
+ padding: 0px;
+ margin: 0px;
+ font: icon;
+ color: #000000;
+ white-space: nowrap;
+ width: 200px; /* default */
+ height: 16px;
}
.tree-item-label {
@@ -212,13 +225,15 @@
}
.tree-icon {
- width: 16px;
- height: 16px;
+ width: 16px;
+ height: 16px;
+ float: left;
}
.tree-junction {
width: 19px;
height: 16px;
+ float: left;
}
.tobago-tree-menu-icon {
Modified: myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/tree.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/tree.jsp?view=diff&rev=464525&r1=464524&r2=464525
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/tree.jsp (original)
+++ myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/tree.jsp Mon Oct 16 08:51:47 2006
@@ -76,6 +76,7 @@
showJunctions="false"
showRootJunction="false"
showRoot="false"
+ mode="menu"
/>
<tc:cell/>