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 2014/09/04 11:36:28 UTC
svn commit: r1622433 - in /myfaces/tobago/branches/tobago-3.0.x:
tobago-example/tobago-example-test/src/main/webapp/test/toolBar/
tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standa...
Author: lofwyr
Date: Thu Sep 4 09:36:28 2014
New Revision: 1622433
URL: http://svn.apache.org/r1622433
Log:
TOBAGO-1358: Using CSS box-sizing: border-box instead of content-box
Modified:
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/toolBar/toolBar.xhtml
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/tobago.css
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/tobago.css
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/toolBar/toolBar.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/toolBar/toolBar.xhtml?rev=1622433&r1=1622432&r2=1622433&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/toolBar/toolBar.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/toolBar/toolBar.xhtml Thu Sep 4 09:36:28 2014
@@ -45,7 +45,7 @@
</tc:toolBar>
</f:subview>
- <tc:label value="Right"/>
+ <tc:label value="orientation=right"/>
<f:subview id="t1">
<tc:toolBar orientation="right">
<ui:include src="toolBar-fragment.xhtml"/>
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/tobago.css?rev=1622433&r1=1622432&r2=1622433&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/tobago.css (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/tobago.css Thu Sep 4 09:36:28 2014
@@ -46,7 +46,7 @@
border-color: #FECB66;
}
-.tobago-boxToolBar-item-markup-hover {
+.tobago-boxToolBar-item:hover {
border-color: #FECB66;
}
@@ -54,7 +54,7 @@
background-color: #FFEECF;
}
-.tobago-boxToolBar-button-markup-hover {
+.tobago-boxToolBar-button:hover {
background-color: #FADC9F;
}
@@ -180,7 +180,7 @@ li.tobago-menu-markup-selected {
border-color: #FECB66;
}
-.tobago-tabGroupToolBar-item-markup-hover {
+.tobago-tabGroupToolBar-item:hover {
border-color: #FECB66;
}
@@ -188,7 +188,7 @@ li.tobago-menu-markup-selected {
background-color: #FFEECF;
}
-.tobago-tabGroupToolBar-button-markup-hover {
+.tobago-tabGroupToolBar-button:hover {
background-color: #FADC9F;
}
@@ -202,7 +202,7 @@ li.tobago-menu-markup-selected {
border-color: #FECB66;
}
-.tobago-toolBar-item-markup-hover {
+.tobago-toolBar-item:hover {
border-color: #FECB66;
}
@@ -210,6 +210,6 @@ li.tobago-menu-markup-selected {
background-color: #FFEECF;
}
-.tobago-toolBar-button-markup-hover {
+.tobago-toolBar-button:hover {
background-color: #FADC9F;
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/tobago.css?rev=1622433&r1=1622432&r2=1622433&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/tobago.css (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/tobago.css Thu Sep 4 09:36:28 2014
@@ -46,7 +46,7 @@
border-color: #FF9900;
}
-.tobago-boxToolBar-item-markup-hover {
+.tobago-boxToolBar-item:hover {
border-color: #3366CC;
}
@@ -54,7 +54,7 @@
background-color: #FFCC66;
}
-.tobago-boxToolBar-button-markup-hover {
+.tobago-boxToolBar-button:hover {
background-color: #FAB54D;
}
@@ -308,7 +308,7 @@ li.tobago-menu-markup-selected {
border-color: #FF9900;
}
-.tobago-tabGroupToolBar-item-markup-hover {
+.tobago-tabGroupToolBar-item:hover {
border-color: #3366CC;
}
@@ -316,7 +316,7 @@ li.tobago-menu-markup-selected {
background-color: #FFCC66;
}
-.tobago-tabGroupToolBar-button-markup-hover {
+.tobago-tabGroupToolBar-button:hover {
background-color: #FAB54D;
}
@@ -385,7 +385,7 @@ input.tobago-time-markup-error, .tobago-
border-color: #FF9900;
}
-.tobago-toolBar-item-markup-hover {
+.tobago-toolBar-item:hover {
border-color: #3366CC;
}
@@ -393,7 +393,7 @@ input.tobago-time-markup-error, .tobago-
background-color: #FFCC66;
}
-.tobago-toolBar-button-markup-hover {
+.tobago-toolBar-button:hover {
background-color: #FAB54D;
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties?rev=1622433&r1=1622432&r2=1622433&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties Thu Sep 4 09:36:28 2014
@@ -210,46 +210,5 @@ Time[timepicker].css.padding-top=2
Time[timepicker].css.padding-right=2
Time[timepicker].css.padding-bottom=2
-ToolBar.fontWidth=8
-ToolBar.custom.icon-big-width=32
-ToolBar.custom.icon-big-height=32
-ToolBar.custom.icon-small-width=16
-ToolBar.custom.icon-small-height=16
-ToolBar.custom.opener-width=11
-ToolBar.custom.opener-height=6
-ToolBar.custom.padding-top=3
-ToolBar.custom.padding-middle=3
-ToolBar.custom.padding-bottom=3
-ToolBar.custom.padding-left=3
-ToolBar.custom.padding-center=3
-ToolBar.custom.padding-right=3
-ToolBar.custom.label-height=14
-
-BoxToolBar.height=21
-BoxToolBar.fontWidth=8
-BoxToolBar.custom.icon-small-width=16
-BoxToolBar.custom.icon-small-height=16
-BoxToolBar.custom.opener-width=11
-BoxToolBar.custom.opener-height=6
-BoxToolBar.custom.padding-top=2
-BoxToolBar.custom.padding-bottom=1
-BoxToolBar.custom.padding-left=3
-BoxToolBar.custom.padding-center=3
-BoxToolBar.custom.padding-right=3
-BoxToolBar.custom.label-height=14
-
-TabGroupToolBar.height=19
-TabGroupToolBar.fontWidth=8
-TabGroupToolBar.custom.icon-small-width=16
-TabGroupToolBar.custom.icon-small-height=16
-TabGroupToolBar.custom.opener-width=11
-TabGroupToolBar.custom.opener-height=6
-TabGroupToolBar.custom.padding-top=0
-TabGroupToolBar.custom.padding-bottom=0
-TabGroupToolBar.custom.padding-left=0
-TabGroupToolBar.custom.padding-center=0
-TabGroupToolBar.custom.padding-right=0
-TabGroupToolBar.custom.label-height=14
-
TreeMenuCommand.custom.padding-left=20
TreeMenuLabel.custom.padding-left=20
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css?rev=1622433&r1=1622432&r2=1622433&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css Thu Sep 4 09:36:28 2014
@@ -136,7 +136,7 @@ fieldset.tobago-box {
background-color: #CCDDEE;
}
-.tobago-boxToolBar-button-markup-hover {
+.tobago-boxToolBar-button:hover {
background-color: #CCDDEE;
}
@@ -1336,7 +1336,7 @@ a:active.tobago-sheet-pagingLink {
background-color: #EEEEEE;
}
-.tobago-tabGroupToolBar-button-markup-hover {
+.tobago-tabGroupToolBar-button:hover {
background-color: #DDDDDD;
}
@@ -1480,13 +1480,11 @@ input.tobago-time-markup-error, input.to
.tobago-toolBar {
border: 2px groove #F6FAFF;
- position: relative;
overflow: hidden;
white-space: nowrap;
}
.tobago-toolBar-item {
- position: relative;
display: inline-block;
border-width: 0;
border-style: solid;
@@ -1494,6 +1492,8 @@ input.tobago-time-markup-error, input.to
left: 0;
top: 0;
cursor: pointer;
+ text-align: center;
+ vertical-align: middle;
}
.tobago-toolBar-item-markup-disabled {
@@ -1501,28 +1501,44 @@ input.tobago-time-markup-error, input.to
}
.tobago-toolBar-button, .tobago-toolBar-menu {
- position: absolute;
border-width: 0;
padding: 0;
margin: 0;
background-color: transparent;
+ display: inline-block;
}
-.tobago-toolBar-item img {
- position: absolute;
+.tobago-toolBar-image16 {
+ width: 16px;
+ height: 16px;
+ vertical-align: middle;
}
-.tobago-toolBar-label {
- position: absolute;
+.tobago-toolBar-image32 {
+ width: 32px;
+ height: 32px;
+ vertical-align: middle;
+}
+
+.tobago-toolBar-labelVertical {
font: bold 12px arial,helvetica,sans-serif;
white-space: nowrap;
+ display: block;
+ vertical-align: middle;
+}
+
+.tobago-toolBar-labelHorizontal {
+ font: bold 12px arial,helvetica,sans-serif;
+ white-space: nowrap;
+ display: inline;
+ vertical-align: middle;
}
.tobago-toolBar-button-markup-selected {
background-color: #CCDDEE;
}
-.tobago-toolBar-button-markup-hover {
+.tobago-toolBar-button:hover {
background-color: #CCDDEE;
}
@@ -1532,7 +1548,6 @@ input.tobago-time-markup-error, input.to
width: 0;
top: 3px;
bottom: 3px;
- position: absolute;
}
/* tree ------------------------------------------------------------------- */
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less?rev=1622433&r1=1622432&r2=1622433&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less Thu Sep 4 09:36:28 2014
@@ -130,7 +130,7 @@
margin: 0;
}
-.tobago-boxToolBar-item-markup-hover {
+.tobago-boxToolBar-item:hover {
border-width: 0 1px;
border-color: darken(@borderColor, 10%);
margin: 0;
@@ -144,7 +144,7 @@
background-color: #EEEEEE;
}
-.tobago-boxToolBar-button-markup-hover {
+.tobago-boxToolBar-button:hover {
background-color: #DDDDDD;
}
@@ -807,7 +807,7 @@ div.tobago-tabGroup-toolBar {
margin: 0;
}
-.tobago-tabGroupToolBar-item-markup-hover {
+.tobago-tabGroupToolBar-item:hover {
border-width: 0 1px;
border-color: darken(@borderColor, 10%);
margin: 0;
@@ -821,7 +821,7 @@ div.tobago-tabGroup-toolBar {
background-color: #EEEEEE;
}
-.tobago-tabGroupToolBar-button-markup-hover {
+.tobago-tabGroupToolBar-button:hover {
background-color: #DDDDDD;
}
@@ -962,7 +962,7 @@ input.tobago-time-markup-error, input.to
margin: 0;
}
-.tobago-toolBar-item-markup-hover {
+.tobago-toolBar-item:hover {
border-width: 0 1px;
border-color: darken(@borderColor, 10%);
margin: 0;
@@ -976,7 +976,7 @@ input.tobago-time-markup-error, input.to
background-color: #EEEEEE;
}
-.tobago-toolBar-button-markup-hover {
+.tobago-toolBar-button:hover {
background-color: #DDDDDD;
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRenderer.java?rev=1622433&r1=1622432&r2=1622433&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRenderer.java Thu Sep 4 09:36:28 2014
@@ -20,8 +20,6 @@
package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
import org.apache.myfaces.tobago.component.UIToolBar;
-import org.apache.myfaces.tobago.config.Configurable;
-import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.layout.TextAlign;
import org.apache.myfaces.tobago.renderkit.css.Classes;
import org.apache.myfaces.tobago.renderkit.css.Style;
@@ -55,9 +53,4 @@ public class ToolBarRenderer extends Too
super.encodeEnd(facesContext, toolBar);
writer.endElement(HtmlElements.DIV);
}
-
- @Override
- public Measure getHeight(final FacesContext facesContext, final Configurable toolBar) {
- return getItemHeight(facesContext, toolBar);
- }
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java?rev=1622433&r1=1622432&r2=1622433&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java Thu Sep 4 09:36:28 2014
@@ -27,19 +27,14 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.component.UIMenuSelectOne;
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.Markup;
-import org.apache.myfaces.tobago.context.ResourceManager;
import org.apache.myfaces.tobago.context.ResourceManagerUtils;
import org.apache.myfaces.tobago.internal.component.AbstractUICommand;
import org.apache.myfaces.tobago.internal.component.AbstractUIMenu;
import org.apache.myfaces.tobago.internal.util.ObjectUtils;
-import org.apache.myfaces.tobago.internal.util.StringUtils;
-import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Classes;
-import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.Command;
import org.apache.myfaces.tobago.renderkit.html.CommandMap;
import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
@@ -85,43 +80,42 @@ public abstract class ToolBarRendererBas
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(context);
- Measure width = Measure.valueOf(-1);
for (final UIComponent command : toolBar.getChildren()) {
if (command instanceof AbstractUICommand) {
- width = renderToolbarCommand(context, toolBar, (AbstractUICommand) command, writer, width);
+ renderToolbarCommand(context, toolBar, (AbstractUICommand) command, writer);
} else if (command instanceof UIToolBarSeparator) {
- width = renderSeparator(context, toolBar, (UIToolBarSeparator) command, writer, width);
+ renderSeparator(context, toolBar, (UIToolBarSeparator) command, writer);
} else {
LOG.error("Illegal UIComponent class in toolbar (not a AbstractUICommand):" + command.getClass().getName());
}
}
}
- private Measure renderToolbarCommand(
+ private void renderToolbarCommand(
final FacesContext facesContext, final UIToolBar toolBar, final AbstractUICommand command,
- final TobagoResponseWriter writer, final Measure width) throws IOException {
+ final TobagoResponseWriter writer) throws IOException {
if (command instanceof SelectBooleanCommand) {
- return renderSelectBoolean(facesContext, toolBar, command, writer, width);
+ renderSelectBoolean(facesContext, toolBar, command, writer);
} else if (command instanceof SelectOneCommand) {
- return renderSelectOne(facesContext, toolBar, command, writer, width);
+ renderSelectOne(facesContext, toolBar, command, writer);
} else {
if (command.getFacet(Facets.RADIO) != null) {
- return renderSelectOne(facesContext, toolBar, command, writer, width);
+ renderSelectOne(facesContext, toolBar, command, writer);
} else if (command.getFacet(Facets.CHECKBOX) != null) {
- return renderSelectBoolean(facesContext, toolBar, command, writer, width);
+ renderSelectBoolean(facesContext, toolBar, command, writer);
} else {
final CommandMap map = new CommandMap(new Command(facesContext, command));
- return renderToolbarButton(
- facesContext, toolBar, command, writer, false, width, map, null);
+ renderToolbarButton(
+ facesContext, toolBar, command, writer, false, map, null);
}
}
}
// todo: remove component creation in renderer, for JSF 2.0
// todo: One solution is to make <tx:toolBarSelectOne> instead of <tc:toolBarSelectOne>
- private Measure renderSelectOne(
+ private void renderSelectOne(
final FacesContext facesContext, final UIToolBar toolBar, final AbstractUICommand command,
- final TobagoResponseWriter writer, Measure width) throws IOException {
+ final TobagoResponseWriter writer) throws IOException {
final List<SelectItem> items;
@@ -174,8 +168,8 @@ public abstract class ToolBarRendererBas
}
final CommandMap map = new CommandMap(new Command());
- width = renderToolbarButton(
- facesContext, toolBar, command, writer, checked, width, map, formattedValue);
+ renderToolbarButton(
+ facesContext, toolBar, command, writer, checked, map, formattedValue);
}
writer.startElement(HtmlElements.INPUT, null);
@@ -185,15 +179,14 @@ public abstract class ToolBarRendererBas
writer.endElement(HtmlElements.INPUT);
writer.endElement(HtmlElements.SPAN);
}
- return width;
}
// todo: remove component creation in renderer, for JSF 2.0
// todo: One solution is to make <tx:toolBarCheck> instead of <tc:toolBarCheck>
// may be renamed to toolBarSelectBoolean?
- private Measure renderSelectBoolean(
+ private void renderSelectBoolean(
final FacesContext facesContext, final UIToolBar toolBar, final AbstractUICommand command,
- final TobagoResponseWriter writer, Measure width) throws IOException {
+ final TobagoResponseWriter writer) throws IOException {
UIComponent checkbox = command.getFacet(Facets.CHECKBOX);
if (checkbox == null) {
@@ -206,7 +199,7 @@ public abstract class ToolBarRendererBas
writer.startElement(HtmlElements.SPAN, checkbox);
writer.writeClassAttribute(Classes.create(toolBar, "selectBoolean"));
final CommandMap map = new CommandMap(new Command());
- width = renderToolbarButton(facesContext, toolBar, command, writer, checked, width, map, null);
+ renderToolbarButton(facesContext, toolBar, command, writer, checked, map, null);
writer.startElement(HtmlElements.INPUT, null);
writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
@@ -214,17 +207,15 @@ public abstract class ToolBarRendererBas
writer.writeAttribute(HtmlAttributes.VALUE, Boolean.toString(checked), false);
writer.endElement(HtmlElements.INPUT);
writer.endElement(HtmlElements.SPAN);
-
- return width;
}
- private Measure renderToolbarButton(
+ private void renderToolbarButton(
final FacesContext facesContext, final UIToolBar toolBar, final AbstractUICommand command,
final TobagoResponseWriter writer,
- final boolean selected, final Measure width, final CommandMap map, final String value)
+ final boolean selected, final CommandMap map, final String value)
throws IOException {
if (!command.isRendered()) {
- return width;
+ return;
}
final boolean disabled = ComponentUtils.getBooleanAttribute(command, Attributes.DISABLED);
@@ -232,13 +223,15 @@ public abstract class ToolBarRendererBas
? new LabelWithAccessKey((SupportsAccessKey) command)
: new LabelWithAccessKey(command.getLabel());
final AbstractUIMenu dropDownMenu = FacetUtils.getDropDownMenu(command);
- final ResourceManager resources = getResourceManager();
+// final ResourceManager resources = getResourceManager();
final String labelPosition = getLabelPosition(command.getParent());
final String iconSize = getIconSize(command.getParent());
- final String iconName = (String) command.getAttributes().get(Attributes.IMAGE);
- final boolean lackImage = iconName == null;
- final String image = lackImage ? null : getImage(facesContext, iconName, iconSize, disabled, selected);
+ String iconName = (String) command.getAttributes().get(Attributes.IMAGE);
+ if (iconName == null) {
+ iconName = "image/blank";
+ }
+ final String image = getImage(facesContext, iconName, iconSize, disabled, selected);
final boolean showIcon = !UIToolBar.ICON_OFF.equals(iconSize);
final boolean iconBig = UIToolBar.ICON_BIG.equals(iconSize);
@@ -250,131 +243,6 @@ public abstract class ToolBarRendererBas
// two separate buttons for the command and the sub menu
final boolean separateButtons = hasAnyCommand(command) && showDropDownMenu;
- final Measure paddingTop
- = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-top", Measure.ZERO);
- final Measure paddingMiddle
- = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-middle", Measure.ZERO);
- final Measure paddingBottom
- = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-bottom", Measure.ZERO);
- final Measure paddingLeft
- = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-left", Measure.ZERO);
- final Measure paddingCenter
- = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-center", Measure.ZERO);
- final Measure paddingRight
- = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-right", Measure.ZERO);
- final Measure iconBigHeight
- = resources.getThemeMeasure(facesContext, toolBar, "custom.icon-big-height", Measure.valueOf(20));
- final Measure iconSmallHeight
- = resources.getThemeMeasure(facesContext, toolBar, "custom.icon-small-height", Measure.valueOf(20));
- final Measure iconBigWidth
- = resources.getThemeMeasure(facesContext, toolBar, "custom.icon-big-width", Measure.valueOf(20));
- final Measure iconSmallWidth
- = resources.getThemeMeasure(facesContext, toolBar, "custom.icon-small-width", Measure.valueOf(20));
-
- // label style
- final Style labelStyle;
- if (showLabel) {
- labelStyle = new Style();
- labelStyle.setLeft(paddingLeft);
- labelStyle.setTop(paddingTop);
- labelStyle.setWidth(RenderUtils.calculateStringWidth(facesContext, toolBar, label.getLabel()));
- labelStyle.setHeight(resources.getThemeMeasure(facesContext, toolBar, "custom.label-height"));
- } else {
- labelStyle = null;
- }
-
- // button style
- final Style buttonStyle = new Style();
- buttonStyle.setLeft(Measure.ZERO);
- buttonStyle.setTop(Measure.ZERO);
- buttonStyle.setWidth(paddingLeft.add(paddingRight));
- buttonStyle.setHeight(paddingBottom.add(paddingTop));
-
- // icon style
- final Style iconStyle;
-
- if (showIcon) {
- iconStyle = new Style();
- iconStyle.setLeft(paddingLeft);
- iconStyle.setTop(paddingTop);
- iconStyle.setHeight(iconBig ? iconBigHeight : iconSmallHeight);
- if (lackImage && showLabelRight && StringUtils.isNotBlank(label.getLabel())) {
- iconStyle.setWidth(Measure.valueOf(1));
- } else {
- iconStyle.setWidth(iconBig ? iconBigWidth : iconSmallWidth);
- }
- if (showLabelBottom) {
- labelStyle.setTop(labelStyle.getTop().add(iconStyle.getHeight()).add(paddingMiddle));
- if (labelStyle.getWidth().lessThan(iconStyle.getWidth())) {
- // label smaller than icon
- labelStyle.setLeft(labelStyle.getLeft().add(iconStyle.getWidth().subtract(labelStyle.getWidth()).divide(2)));
- buttonStyle.setWidth(buttonStyle.getWidth().add(iconStyle.getWidth()));
- } else {
- // label bigger than icon
- iconStyle.setLeft(iconStyle.getLeft().add(labelStyle.getWidth().subtract(iconStyle.getWidth()).divide(2)));
- buttonStyle.setWidth(buttonStyle.getWidth().add(labelStyle.getWidth()));
- }
- buttonStyle.setHeight(
- buttonStyle.getHeight().add(iconStyle.getHeight()).add(paddingMiddle).add(labelStyle.getHeight()));
- } else if (showLabelRight) {
- labelStyle.setTop(labelStyle.getTop().add(iconStyle.getHeight().subtract(labelStyle.getHeight()).divide(2)));
- labelStyle.setLeft(labelStyle.getLeft().add(iconStyle.getWidth()).add(paddingCenter));
- buttonStyle.setWidth(
- buttonStyle.getWidth().add(iconStyle.getWidth()).add(paddingCenter).add(labelStyle.getWidth()));
- buttonStyle.setHeight(buttonStyle.getHeight().add(iconStyle.getHeight()));
- } else {
- buttonStyle.setWidth(buttonStyle.getWidth().add(iconStyle.getWidth()));
- buttonStyle.setHeight(buttonStyle.getHeight().add(iconStyle.getHeight()));
- }
- } else {
- iconStyle = null;
- if (showLabel) {
- // only label
- buttonStyle.setWidth(buttonStyle.getWidth().add(labelStyle.getWidth()));
- if (StringUtils.isBlank(label.getLabel())) {
- buttonStyle.setWidth(buttonStyle.getWidth().add(iconSmallWidth));
- }
- buttonStyle.setHeight(buttonStyle.getHeight().add(labelStyle.getHeight()));
- } else {
- // both off: use some reasonable defaults
- buttonStyle.setWidth(buttonStyle.getWidth().add(iconSmallWidth));
- buttonStyle.setHeight(buttonStyle.getHeight().add(iconSmallWidth));
- }
- }
-
- // opener style (for menu popup)
- final Style openerStyle = new Style();
- openerStyle.setWidth(resources.getThemeMeasure(facesContext, toolBar, "custom.opener-width"));
- openerStyle.setHeight(resources.getThemeMeasure(facesContext, toolBar, "custom.opener-height"));
-
- final Style menuStyle = new Style();
- menuStyle.setLeft(buttonStyle.getWidth());
- menuStyle.setTop(Measure.ZERO);
- menuStyle.setWidth(paddingLeft.add(openerStyle.getWidth()).add(paddingRight));
- menuStyle.setHeight(buttonStyle.getHeight());
-
- // opener style (for menu popup)
- openerStyle.setLeft(menuStyle.getWidth().subtract(openerStyle.getWidth()).divide(2));
- openerStyle.setTop(menuStyle.getHeight().subtract(openerStyle.getHeight()).divide(2));
-
- // item style
- final Style itemStyle = new Style();
- itemStyle.setWidth(
- showDropDownMenu ? buttonStyle.getWidth().add(menuStyle.getWidth()) : buttonStyle.getWidth());
- itemStyle.setHeight(buttonStyle.getHeight());
-
- // XXX hack
- if (showDropDownMenu && lackImage && !showLabel) {
- itemStyle.setWidth(openerStyle.getWidth());
- buttonStyle.setWidth(openerStyle.getWidth());
- }
-
- // change values when only have one button
- if (showDropDownMenu && !separateButtons && (!lackImage || StringUtils.isNotBlank(label.getLabel()))) {
- openerStyle.setLeft(openerStyle.getLeft().add(buttonStyle.getWidth()));
- buttonStyle.setWidth(buttonStyle.getWidth().add(menuStyle.getWidth()));
- }
-
// start rendering
writer.startElement(HtmlElements.SPAN, command);
Markup itemMarkup = Markup.NULL;
@@ -389,7 +257,6 @@ public abstract class ToolBarRendererBas
if (title != null) {
writer.writeAttribute(HtmlAttributes.TITLE, title, true);
}
- writer.writeStyleAttribute(itemStyle);
writer.startElement(HtmlElements.SPAN, command);
if (separateButtons || !showDropDownMenu) {
@@ -397,7 +264,6 @@ public abstract class ToolBarRendererBas
} else {
writer.writeClassAttribute(Classes.create(toolBar, "menu"));
}
- writer.writeStyleAttribute(buttonStyle);
if (!toolBar.isTransient()) {
writer.writeIdAttribute(command.getClientId(facesContext));
}
@@ -410,33 +276,29 @@ public abstract class ToolBarRendererBas
}
// render icon
- if (showIcon && iconName != null) {
+ if (showIcon) {
writer.startElement(HtmlElements.IMG, command);
- writer.writeAttribute(HtmlAttributes.SRC, image, false);
- // todo in Tobago 3.0: remove "Hover" and replace with CSS filter
- final int dot = ResourceManagerUtils.indexOfExtension(iconName);
- final String imageHover;
- if (dot != -1) {
- imageHover = ResourceManagerUtils.getImageOrDisabledImageWithPath(
- facesContext, iconName.substring(0, dot) + "Hover" + iconName.substring(dot), disabled, true);
+ if (iconBig) {
+ writer.writeClassAttribute(Classes.create(toolBar, "image32"));
} else {
- imageHover = ResourceManagerUtils.getImageOrDisabledImage(facesContext, iconName + "Hover", disabled, true);
- }
- if (imageHover != null) {
- writer.writeAttribute(DataAttributes.SRC_DEFAULT, image, false);
- writer.writeAttribute(DataAttributes.SRC_HOVER, imageHover, false);
+ writer.writeClassAttribute(Classes.create(toolBar, "image16"));
}
+ writer.writeAttribute(HtmlAttributes.SRC, image, false);
writer.writeAttribute(HtmlAttributes.ALT, label.getLabel(), true);
- writer.writeStyleAttribute(iconStyle);
writer.endElement(HtmlElements.IMG);
}
// render label
if (showLabel) {
writer.startElement(HtmlElements.SPAN, command);
- writer.writeClassAttribute(Classes.create(toolBar, "label"));
- writer.writeStyleAttribute(labelStyle);
+ if (showLabelRight) {
+ writer.writeClassAttribute(Classes.create(toolBar, "labelHorizontal"));
+ } else {
+ writer.writeClassAttribute(Classes.create(toolBar, "labelVertical"));
+ }
if (label.getLabel() != null) {
HtmlRendererUtils.writeLabelWithAccessKey(writer, label);
+ } else {
+ writer.writeText("Â "); // this is a non-breaking-space
}
writer.endElement(HtmlElements.SPAN);
}
@@ -446,7 +308,6 @@ public abstract class ToolBarRendererBas
writer.startElement(HtmlElements.SPAN, command);
writer.writeClassAttribute(Classes.create(toolBar, "menu"));
- writer.writeStyleAttribute(menuStyle);
// todo: span has not type: use data-tobago-type here (TOBAGO-1004)
writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.BUTTON, false);
}
@@ -459,84 +320,29 @@ public abstract class ToolBarRendererBas
final String menuImage
= ResourceManagerUtils.getImageOrDisabledImage(facesContext, "image/toolbarButtonMenu", dropDownDisabled);
writer.writeAttribute(HtmlAttributes.SRC, menuImage, false);
- writer.writeStyleAttribute(openerStyle);
writer.endElement(HtmlElements.IMG);
renderDropDownMenu(facesContext, writer, dropDownMenu);
}
writer.endElement(HtmlElements.SPAN);
writer.endElement(HtmlElements.SPAN);
-
- return width.add(itemStyle.getWidth()).add(2); // XXX
- // computation of the width of the toolBar will not be used in the moment.
}
- private Measure renderSeparator(
+ private void renderSeparator(
final FacesContext facesContext, final UIToolBar toolBar, final UIToolBarSeparator separator,
- final TobagoResponseWriter writer, final Measure width)
+ final TobagoResponseWriter writer)
throws IOException {
if (!separator.isRendered()) {
- return width;
+ return;
}
writer.startElement(HtmlElements.SPAN, separator);
writer.writeClassAttribute(Classes.create(toolBar, "item", Markup.DISABLED));
- final Style itemStyle = new Style();
- itemStyle.setHeight(getItemHeight(facesContext, toolBar));
- itemStyle.setWidth(Measure.valueOf(10));
- writer.writeStyleAttribute(itemStyle);
writer.startElement(HtmlElements.SPAN, separator);
writer.writeClassAttribute(Classes.create(toolBar, "separator"));
writer.endElement(HtmlElements.SPAN);
writer.endElement(HtmlElements.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(final FacesContext facesContext, final 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", Measure.ZERO);
- final Measure paddingMiddle
- = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-middle", Measure.ZERO);
- final Measure paddingBottom
- = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-bottom", Measure.ZERO);
- final Measure iconHeight = iconBig
- ? resources.getThemeMeasure(facesContext, toolBar, "custom.icon-big-height", Measure.valueOf(20))
- : resources.getThemeMeasure(facesContext, toolBar, "custom.icon-small-height", Measure.valueOf(20));
- final Measure labelHeight
- = resources.getThemeMeasure(facesContext, toolBar, "custom.label-height", Measure.valueOf(20));
-
- 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 boolean hasAnyCommand(final AbstractUICommand command) {
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1622433&r1=1622432&r2=1622433&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Thu Sep 4 09:36:28 2014
@@ -2284,69 +2284,6 @@ Tobago.ToolBar = {};
*/
Tobago.ToolBar.init = function(elements) {
- // doing the same for 3 renderer names
- // XXX put this in a loop (the first try doesn't work, because we can't use local variables in a anonymous function)
-
- Tobago.Utils.selectWidthJQuery(elements, ".tobago-toolBar").find('.tobago-toolBar-item')
- .not('.tobago-toolBar-item-markup-disabled')
- .hover(function() {
- jQuery(this).toggleClass('tobago-toolBar-item-markup-hover');
- })
- .children('.tobago-toolBar-button, .tobago-toolBar-menu')
- .mouseenter(function() {
- jQuery(this)
- .addClass('tobago-toolBar-button-markup-hover').children('img')
- .each(function() {
- // set the src to the hover src url.
- var hover = jQuery(this).data('tobago-src-hover');
- if (hover) {
- jQuery(this).attr('src', hover);
- }
- });
- })
- .mouseleave(function() {
- jQuery(this)
- .removeClass('tobago-toolBar-button-markup-hover')
- .children('img')
- .each(function() {
- // restore the original/normal src url.
- var normal = jQuery(this).data('tobago-src-default');
- if (normal) {
- jQuery(this).attr('src', normal);
- }
- });
- });
-
- Tobago.Utils.selectWidthJQuery(elements, ".tobago-box-headerToolBar").find('.tobago-boxToolBar-item')
- .not('.tobago-boxToolBar-item-markup-disabled')
- .hover(function() {
- jQuery(this).toggleClass('tobago-boxToolBar-item-markup-hover');
- })
- .children('.tobago-boxToolBar-button, .tobago-boxToolBar-menu')
- .mouseenter(function() {
- jQuery(this)
- .addClass('tobago-boxToolBar-button-markup-hover').children('img')
- .each(function() {
- // set the src to the hover src url.
- var hover = jQuery(this).data('tobago-src-hover');
- if (hover) {
- jQuery(this).attr('src', hover);
- }
- });
- })
- .mouseleave(function() {
- jQuery(this)
- .removeClass('tobago-boxToolBar-button-markup-hover')
- .children('img')
- .each(function() {
- // restore the original/normal src url.
- var normal = jQuery(this).data('tobago-src-default');
- if (normal) {
- jQuery(this).attr('src', normal);
- }
- });
- });
-
Tobago.Utils.selectWidthJQuery(elements, ".tobago-tabGroup-toolBar")
.find(".tobago-menu[data-tobago-index]").each(function () {
var menu = jQuery(this);
@@ -2360,36 +2297,6 @@ Tobago.ToolBar.init = function(elements)
})
});
- Tobago.Utils.selectWidthJQuery(elements, ".tobago-tabGroup-toolBar").find('.tobago-tabGroupToolBar-item')
- .not('.tobago-tabGroupToolBar-item-markup-disabled')
- .hover(function() {
- jQuery(this).toggleClass('tobago-tabGroupToolBar-item-markup-hover');
- })
- .children('.tobago-tabGroupToolBar-button, .tobago-tabGroupToolBar-menu')
- .mouseenter(function() {
- jQuery(this)
- .addClass('tobago-tabGroupToolBar-button-markup-hover').children('img')
- .each(function() {
- // set the src to the hover src url.
- var hover = jQuery(this).data('tobago-src-hover');
- if (hover) {
- jQuery(this).attr('src', hover);
- }
- });
- })
- .mouseleave(function() {
- jQuery(this)
- .removeClass('tobago-tabGroupToolBar-button-markup-hover')
- .children('img')
- .each(function() {
- // restore the original/normal src url.
- var normal = jQuery(this).data('tobago-src-default');
- if (normal) {
- jQuery(this).attr('src', normal);
- }
- });
- });
-
Tobago.Utils.selectWidthJQuery(elements, ".tobago-toolBar-selectOne").find(".tobago-toolBar-button")
.click(function () {
var button = jQuery(this);
@@ -2405,22 +2312,6 @@ Tobago.ToolBar.init = function(elements)
});
};
-/**
- * @deprecated since 2.0.0, use class tobago-toolBar-selectBoolean
- */
-Tobago.ToolBar.checkToggle = function(id) {
- var element = document.getElementById(id);
- element.value = 'true' == element.value ? 'false' : 'true';
-};
-
-/**
- * @deprecated since 2.0.0, use class tobago-toolBar-selectOne
- */
-Tobago.ToolBar.setRadioValue = function(id, value) {
- var element = document.getElementById(id);
- element.value = value;
-};
-
Tobago.registerListener(Tobago.ToolBar.init, Tobago.Phase.DOCUMENT_READY);
Tobago.registerListener(Tobago.ToolBar.init, Tobago.Phase.AFTER_UPDATE);