1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.myfaces.custom.fisheye;
20
21 import java.util.Iterator;
22
23 import javax.faces.component.UIComponent;
24 import javax.faces.component.UIData;
25 import javax.faces.context.FacesContext;
26 import javax.faces.el.ValueBinding;
27
28 /**
29 * Provide a FishEye toolbar component from the DOJO toolkit
30 * <p>
31 * A navigation menu/toolbar with a nice mouse-over effect,
32 * similar to the Mac OS X Dock. It is actually a JSF
33 * implementation of the Fisheye List widget from the
34 * <a href="http://dojotoolkit.org/">Dojo Toolkit</a>.
35 * </p>
36 * <p>
37 * The component makes use of the Tomahawk navigation framework,
38 * so the menu items can be added using t:navigationMenuItem
39 * child components.
40 * </p>
41 *
42 * @see <a href="http://dojotoolkit.org/">http://dojotoolkit.org/</a>
43 *
44 * @JSFComponent
45 * name = "s:fishEyeNavigationMenu"
46 * class = "org.apache.myfaces.custom.fisheye.HtmlFishEyeNavigationMenu"
47 * tagClass = "org.apache.myfaces.custom.fisheye.HtmlFishEyeNavigationMenuTag"
48 *
49 * @author Jurgen Lust (latest modification by $Author: lu4242 $)
50 * @version $Revision: 673223 $ $Date: 2008-07-01 17:36:51 -0500 (Tue, 01 Jul 2008) $
51 */
52 public abstract class AbstractHtmlFishEyeNavigationMenu extends UIData
53 {
54 public static final String COMPONENT_TYPE = "org.apache.myfaces.FishEyeList";
55 private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.FishEyeList";
56
57 public static final String EDGE_BOTTOM = "bottom";
58 public static final String EDGE_CENTER = "center";
59 public static final String EDGE_LEFT = "left";
60 public static final String EDGE_RIGHT = "right";
61 public static final String EDGE_TOP = "top";
62 public static final String HORIZONTAL_ORIENTATION = "horizontal";
63 public static final String VERTICAL_ORIENTATION = "vertical";
64 private static final String NODE_STAMP_FACET_NAME = "nodeStamp";
65
66 public void processDecodes(FacesContext context) {
67 super.processDecodes(context);
68 int first = getFirst();
69 int rows = getRows();
70 int last;
71 if (rows == 0)
72 {
73 last = getRowCount();
74 }
75 else
76 {
77 last = first + rows;
78 }
79 for (int rowIndex = first; last==-1 || rowIndex < last; rowIndex++)
80 {
81 setRowIndex(rowIndex);
82
83 //scrolled past the last row
84 if (!isRowAvailable())
85 break;
86
87 for (Iterator it = getChildren().iterator(); it.hasNext();)
88 {
89 UIComponent child = (UIComponent) it.next();
90 if (child instanceof FishEyeCommandLink)
91 {
92 if (!child.isRendered())
93 {
94 //Column is not visible
95 continue;
96 }
97 child.processDecodes(context);
98 }
99 }
100 }
101 }
102
103 public void setValueBinding(String string, ValueBinding valueBinding) {
104 super.setValueBinding(string, valueBinding); //To change body of overridden methods use File | Settings | File Templates.
105 }
106
107 /**
108 * @JSFProperty
109 */
110 public abstract Integer getVisibleWindow();
111
112 /**
113 * @JSFFacet
114 */
115 public UIComponent getNodeStamp()
116 {
117 return (UIComponent) getFacets().get(NODE_STAMP_FACET_NAME);
118 }
119
120 /**
121 * @JSFProperty
122 */
123 public abstract String getAttachEdge();
124
125 /**
126 * @JSFProperty
127 */
128 public abstract Boolean getConservativeTrigger();
129
130 /**
131 * @JSFProperty
132 */
133 public abstract Integer getEffectUnits();
134
135 /**
136 * @JSFProperty
137 */
138 public abstract Integer getItemHeight();
139
140 /**
141 * @JSFProperty
142 */
143 public abstract Integer getItemMaxHeight();
144
145 /**
146 * @JSFProperty
147 */
148 public abstract Integer getItemMaxWidth();
149
150 /**
151 * @JSFProperty
152 */
153 public abstract Integer getItemPadding();
154
155 /**
156 * @JSFProperty
157 */
158 public abstract Integer getItemWidth();
159
160 /**
161 * @JSFProperty
162 */
163 public abstract String getLabelEdge();
164
165 /**
166 * @JSFProperty
167 */
168 public abstract String getOrientation();
169
170 public boolean getRendersChildren()
171 {
172 return true;
173 }
174
175 }