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 2010/06/02 16:44:05 UTC
svn commit: r950582 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/
tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/
tobago-theme/tobago-theme-scarborough/src/main/java/org/apache...
Author: lofwyr
Date: Wed Jun 2 14:44:04 2010
New Revision: 950582
URL: http://svn.apache.org/viewvc?rev=950582&view=rev
Log:
TOBAGO-77: Adding new tag <tc:toolBarSeparator> to separate item groups in the tool bar
Added:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarSeparatorTagDeclaration.java
- copied, changed from r948367, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/MenuSeparatorTagDeclaration.java
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/MenuSeparatorTagDeclaration.java
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar-fragment.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar.xhtml
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/MenuSeparatorTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/MenuSeparatorTagDeclaration.java?rev=950582&r1=950581&r2=950582&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/MenuSeparatorTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/MenuSeparatorTagDeclaration.java Wed Jun 2 14:44:04 2010
@@ -24,13 +24,8 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.internal.taglib.declaration.HasBinding;
import org.apache.myfaces.tobago.internal.taglib.declaration.IsRendered;
-/*
- * Date: 31.03.2006
- * Time: 22:05:46
- */
-
/**
- * Renders a separator.
+ * Renders a separator inside of a menu.
*/
@Tag(name = "menuSeparator", bodyContent = BodyContent.EMPTY)
@UIComponentTag(
Copied: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarSeparatorTagDeclaration.java (from r948367, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/MenuSeparatorTagDeclaration.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarSeparatorTagDeclaration.java?p2=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarSeparatorTagDeclaration.java&p1=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/MenuSeparatorTagDeclaration.java&r1=948367&r2=950582&rev=950582&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/MenuSeparatorTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarSeparatorTagDeclaration.java Wed Jun 2 14:44:04 2010
@@ -20,24 +20,17 @@ package org.apache.myfaces.tobago.intern
import org.apache.myfaces.tobago.apt.annotation.BodyContent;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
-import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasBinding;
import org.apache.myfaces.tobago.internal.taglib.declaration.IsRendered;
-/*
- * Date: 31.03.2006
- * Time: 22:05:46
- */
-
/**
- * Renders a separator.
+ * Renders a separator inside of a tool bar.
*/
-@Tag(name = "menuSeparator", bodyContent = BodyContent.EMPTY)
+@Tag(name = "toolBarSeparator", bodyContent = BodyContent.EMPTY)
@UIComponentTag(
- uiComponent = "org.apache.myfaces.tobago.component.UIMenuSeparator",
+ uiComponent = "org.apache.myfaces.tobago.component.UIToolBarSeparator",
uiComponentBaseClass = "javax.faces.component.UIOutput",
- rendererType = RendererTypes.MENU_SEPARATOR,
allowedChildComponenents = "NONE")
-public interface MenuSeparatorTagDeclaration extends IsRendered, HasBinding {
+public interface ToolBarSeparatorTagDeclaration extends IsRendered, HasBinding {
}
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar-fragment.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar-fragment.xhtml?rev=950582&r1=950581&r2=950582&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar-fragment.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar-fragment.xhtml Wed Jun 2 14:44:04 2010
@@ -32,6 +32,7 @@
</tc:menu>
</f:facet>
</tc:toolBarCommand>
+ <tc:toolBarSeparator/>
<tc:toolBarCommand label="disabled" image="pidgeon-point.jpg" disabled="true"/>
<tc:toolBarCommand label="not rendered" image="pidgeon-point.jpg" rendered="false"/>
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar.xhtml?rev=950582&r1=950581&r2=950582&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar.xhtml Wed Jun 2 14:44:04 2010
@@ -118,10 +118,11 @@
<tc:label value="Select One"/>
<f:subview id="t13">
<tc:toolBar iconSize="big" labelPosition="bottom">
- <tc:toolBarSelectOne value="a">
- <tc:selectItem itemValue="a" itemLabel="A Value"/>
- <tc:selectItem itemValue="b" itemLabel="An Alternative"/>
- </tc:toolBarSelectOne>
+ <tc:toolBarSelectOne value="a">
+ <tc:selectItem itemValue="a" itemLabel="A Value"/>
+ <tc:selectItem itemValue="b" itemLabel="An Alternative"/>
+ </tc:toolBarSelectOne>
+ <tc:toolBarSeparator/>
<tc:toolBarSelectOne value="#{selectItemModel.currency}">
<f:selectItems value="#{selectItemModel.availableCurrencies}"/>
</tc:toolBarSelectOne>
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java?rev=950582&r1=950581&r2=950582&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java Wed Jun 2 14:44:04 2010
@@ -56,45 +56,12 @@ public class ToolBarRenderer extends Too
@Override
public Measure getHeight(FacesContext facesContext, Configurable toolBar) {
- final ResourceManager rm = getResourceManager();
+ final ResourceManager resources = getResourceManager();
- final String iconSize = getIconSize((UIComponent) toolBar);
- final String labelPosition = getLabelPosition((UIComponent) toolBar);
+ Measure result = getItemHeight(facesContext, toolBar);
- final boolean showIcon = !UIToolBar.ICON_OFF.equals(iconSize);
- final boolean iconBig = UIToolBar.ICON_BIG.equals(iconSize);
- final boolean iconSmall = UIToolBar.ICON_SMALL.equals(iconSize);
- final boolean showLabelBottom = UIToolBar.LABEL_BOTTOM.equals(labelPosition);
- final boolean showLabelRight = UIToolBar.LABEL_RIGHT.equals(labelPosition);
- final boolean showLabel = showLabelBottom || showLabelRight;
-
- final Measure paddingTop = rm.getThemeMeasure(facesContext, toolBar, "custom.padding-top");
- final Measure paddingMiddle = rm.getThemeMeasure(facesContext, toolBar, "custom.padding-middle");
- final Measure paddingBottom = rm.getThemeMeasure(facesContext, toolBar, "custom.padding-bottom");
- final Measure iconHeight = iconBig
- ? rm.getThemeMeasure(facesContext, toolBar, "custom.icon-big-height")
- : rm.getThemeMeasure(facesContext, toolBar, "custom.icon-small-height");
- final Measure labelHeight = rm.getThemeMeasure(facesContext, toolBar, "custom.label-height");
-
- Measure result = paddingTop;
- if (showIcon) {
- result = result.add(iconHeight);
- if (showLabel && showLabelBottom) {
- result = result.add(paddingMiddle);
- result = result.add(labelHeight);
- }
- } else {
- if (showLabel) {
- result = result.add(labelHeight);
- } else {
- // both off: use some reasonable defaults
- result = result.add(16);
- }
- }
- result = result.add(paddingBottom);
-
- result = result.add(rm.getThemeMeasure(facesContext, toolBar, "css.border-top-width"));
- result = result.add(rm.getThemeMeasure(facesContext, toolBar, "css.border-bottom-width"));
+ result = result.add(resources.getThemeMeasure(facesContext, toolBar, "css.border-top-width"));
+ result = result.add(resources.getThemeMeasure(facesContext, toolBar, "css.border-bottom-width"));
return result;
}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java?rev=950582&r1=950581&r2=950582&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java Wed Jun 2 14:44:04 2010
@@ -25,6 +25,8 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.component.UISelectBooleanCommand;
import org.apache.myfaces.tobago.component.UISelectOneCommand;
import org.apache.myfaces.tobago.component.UIToolBar;
+import org.apache.myfaces.tobago.component.UIToolBarSeparator;
+import org.apache.myfaces.tobago.config.Configurable;
import org.apache.myfaces.tobago.context.ResourceManager;
import org.apache.myfaces.tobago.context.ResourceManagerFactory;
import org.apache.myfaces.tobago.context.ResourceManagerUtils;
@@ -81,6 +83,8 @@ public abstract class ToolBarRendererBas
for (UIComponent command : (List<UIComponent>)toolBar.getChildren()) {
if (command instanceof UICommandBase) {
width = renderToolbarCommand(context, toolBar, (UICommandBase) command, writer, width);
+ } else if (command instanceof UIToolBarSeparator) {
+ width = renderSeparator(context, toolBar, (UIToolBarSeparator) command, writer, width);
} else {
LOG.error("Illegal UIComponent class in toolbar (not a UICommandBase):" + command.getClass().getName());
}
@@ -405,6 +409,71 @@ public abstract class ToolBarRendererBas
// computation of the width of the toolBar will not be used in the moment.
}
+ private Measure renderSeparator(
+ FacesContext facesContext, UIToolBar toolBar, UIToolBarSeparator separator, TobagoResponseWriter writer,
+ Measure width)
+ throws IOException {
+ if (!separator.isRendered()) {
+ return width;
+ }
+
+ writer.startElement(HtmlConstants.SPAN, separator);
+ writer.writeClassAttribute("tobago-toolBar-item tobago-toolBar-item-disabled");
+ Style itemStyle = new Style();
+ itemStyle.setHeight(getItemHeight(facesContext, toolBar));
+ itemStyle.setWidth(Measure.valueOf(10));
+ writer.writeStyleAttribute(itemStyle);
+
+ writer.startElement(HtmlConstants.SPAN, separator);
+ writer.writeClassAttribute("tobago-toolBar-separator");
+ writer.endElement(HtmlConstants.SPAN);
+
+ writer.endElement(HtmlConstants.SPAN);
+
+ return width.add(itemStyle.getWidth()).add(2); // XXX
+ // computation of the width of the toolBar will not be used in the moment.
+ }
+
+ protected Measure getItemHeight(FacesContext facesContext, Configurable toolBar) {
+ final String iconSize = getIconSize((UIComponent) toolBar);
+ final String labelPosition = getLabelPosition((UIComponent) toolBar);
+
+ final boolean showIcon = !UIToolBar.ICON_OFF.equals(iconSize);
+ final boolean iconBig = UIToolBar.ICON_BIG.equals(iconSize);
+ final boolean iconSmall = UIToolBar.ICON_SMALL.equals(iconSize);
+ final boolean showLabelBottom = UIToolBar.LABEL_BOTTOM.equals(labelPosition);
+ final boolean showLabelRight = UIToolBar.LABEL_RIGHT.equals(labelPosition);
+ final boolean showLabel = showLabelBottom || showLabelRight;
+
+ final ResourceManager resources = getResourceManager();
+
+ final Measure paddingTop = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-top");
+ final Measure paddingMiddle = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-middle");
+ final Measure paddingBottom = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-bottom");
+ final Measure iconHeight = iconBig
+ ? resources.getThemeMeasure(facesContext, toolBar, "custom.icon-big-height")
+ : resources.getThemeMeasure(facesContext, toolBar, "custom.icon-small-height");
+ final Measure labelHeight = resources.getThemeMeasure(facesContext, toolBar, "custom.label-height");
+
+ Measure result = paddingTop;
+ if (showIcon) {
+ result = result.add(iconHeight);
+ if (showLabel && showLabelBottom) {
+ result = result.add(paddingMiddle);
+ result = result.add(labelHeight);
+ }
+ } else {
+ if (showLabel) {
+ result = result.add(labelHeight);
+ } else {
+ // both off: use some reasonable defaults
+ result = result.add(16);
+ }
+ }
+ result = result.add(paddingBottom);
+ return result;
+ }
+
private String createCommandOnClick(FacesContext facesContext, UICommandBase command) {
if (hasNoCommand(command) && command.getFacet(Facets.MENUPOPUP) != null) {
return null;
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css?rev=950582&r1=950581&r2=950582&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css Wed Jun 2 14:44:04 2010
@@ -1110,6 +1110,15 @@ span.tobago-progress {
background-color: #CCDDEE;
}
+.tobago-toolBar-separator {
+ border: 1px inset #bbccdd;
+ left: 4px;
+ width: 0;
+ top: 3px;
+ bottom: 3px;
+ position: absolute;
+}
+
/* Tree old -------------------------------------------------------------------- */
.tree-folder-label, .tree-item-label, .tree-folder-label:active,
Modified: myfaces/tobago/trunk/tobago-theme/tobago-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/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css?rev=950582&r1=950581&r2=950582&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css Wed Jun 2 14:44:04 2010
@@ -670,6 +670,10 @@ a:link.tab, a:visited.tab, a:active.tab
background-color: #DDDDDD;
}
+.tobago-toolBar-separator {
+ border: 1px solid #DDDDDD;
+}
+
/* tree ------------------------------------------------------------------- */
.tobago-treeNode-menu {