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/02/18 15:00:15 UTC
svn commit: r1569327 [4/5] - in
/myfaces/tobago/branches/tobago-3.0.x/tobago-theme: ./
tobago-theme-bootstrap/ tobago-theme-bootstrap/src/
tobago-theme-bootstrap/src/main/
tobago-theme-bootstrap/src/main/appended-resources/
tobago-theme-bootstrap/src/m...
Added: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-bootstrap/src/main/resources/org/apache/myfaces/tobago/renderkit/html/bootstrap/standard/style/bootstrap-3.1.1.min.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-bootstrap/src/main/resources/org/apache/myfaces/tobago/renderkit/html/bootstrap/standard/style/bootstrap-3.1.1.min.css?rev=1569327&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-bootstrap/src/main/resources/org/apache/myfaces/tobago/renderkit/html/bootstrap/standard/style/bootstrap-3.1.1.min.css (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-bootstrap/src/main/resources/org/apache/myfaces/tobago/renderkit/html/bootstrap/standard/style/bootstrap-3.1.1.min.css Tue Feb 18 14:00:13 2014
@@ -0,0 +1,7 @@
+/*!
+ * Bootstrap v3.1.1 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+
[... 3 lines stripped ...]
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/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/msie/style/tobago.css?rev=1569327&r1=1569326&r2=1569327&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/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/msie/style/tobago.css Tue Feb 18 14:00:13 2014
@@ -44,31 +44,8 @@ fieldset.tobago-box {
height: 23px;
}
-/* menu ---------------------------------------------------------------- */
-
-/* workaround for IE6 */
-.tobago-menu-ie6bugfix {
- position: absolute;
- display: block;
- z-index: -1;
- width: 100%;
- height: 100%;
- top: 0;
- left: 0;
- filter: mask();
-}
-
/* popup -------------------------------------------------------------- */
.tobago-popup-shield {
filter: alpha( opacity = 40 );
}
-
-.tobago-popup-ie6bugfix {
- position: absolute;
- width: 100%;
- height: 100%;
- top: 0;
- left: 0;
- filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);
-}
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=1569327&r1=1569326&r2=1569327&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 Tue Feb 18 14:00:13 2014
@@ -57,8 +57,11 @@ fieldset.tobago-box {
}
.tobago-box-content {
+ padding: 5px;
+ /* XXX TOBAGO3
position: absolute;
overflow: hidden;
+ */
}
.tobago-box-toolbarOuter {
@@ -319,6 +322,7 @@ span.tobago-calendar-header {
/* gridLayout -------------------------------------------------------------- */
+/* XXX TOBAGO3
.tobago-gridLayout {
border-spacing: 0;
padding: 0;
@@ -343,6 +347,7 @@ div.tobago-gridLayout-first-row {
div.tobago-gridLayout-first-column {
padding-left: 0;
}
+*/
/* in ---------------------------------------------------------------------- */
@@ -420,11 +425,13 @@ div.tobago-gridLayout-first-column {
.tobago-label {
height: 19px;
+ width: 144px;
padding: 3px 2px 3px 2px;
margin: 0;
border: 0 solid transparent;
white-space: nowrap;
vertical-align: top;
+ display: inline-block;
}
.tobago-label-markup-disabled {
@@ -523,7 +530,8 @@ li.tobago-menu-markup-selected {
display: none;
}
-.tobago-menu {
+.tobago-menu,
+.tobago-menu-selectOne {
white-space: nowrap;
padding: 2px 3px 2px 25px;
background-repeat: no-repeat; /* prepare for images via element style */
@@ -632,9 +640,10 @@ li.tobago-menu-markup-selected {
}
.tobago-page-content {
- position: absolute;
+ /*position: absolute; XXX TOBAGO3*/
z-index: 0;
- overflow: hidden;
+ overflow: auto;
+ padding: 10px;
}
.tobago-page-content-markup-portlet {
@@ -734,13 +743,17 @@ li.tobago-menu-markup-selected {
/* progress -------------------------------------------------------------- */
.tobago-progress-value {
+ height: 20px;
background: #aabbcc;
+/* XXX TOBAGO3
position: absolute;
left: 0;
top: 0;
+*/
}
.tobago-progress {
+ height: 20px;
background: #ddeeff;
border: 2px inset #bbccdd;
}
@@ -915,7 +928,7 @@ li.tobago-menu-markup-selected {
/* separator ------------------------------------------------------------------- */
.tobago-separator {
- position: absolute;
+ /*position: absolute; XXX TOBAGO3*/
}
/* without label */
@@ -924,7 +937,7 @@ hr.tobago-separator {
border: 1px inset #ddeeff;
height: 0;
margin: 0;
- position: absolute;
+ /*position: absolute; XXX TOBAGO3*/
}
/* with label */
@@ -1049,6 +1062,7 @@ hr.tobago-separator {
.tobago-sheet-bodyTable {
table-layout: fixed;
+ width: 100%;
}
.tobago-sheet-cell {
@@ -1167,9 +1181,11 @@ a:active.tobago-sheet-pagingLink {
/* suggest ---------------------------------------------------------------------- */
+/* XXX TOBAGO3
.tobago-suggest {
position: absolute;
}
+*/
/* richTextEditor ---------------------------------------------------------- */
@@ -1243,11 +1259,6 @@ div.tobago-richTextEditor-body {
height: 12px;
}
-.tobago-tab {
- /* needed for ie */
- height: 14px;
-}
-
.tobago-tab a:link,
.tobago-tab a:visited,
.tobago-tab a:active {
@@ -1284,39 +1295,44 @@ div.tobago-richTextEditor-body {
}
.tobago-tabGroup {
- position: absolute;
+ /*position: absolute;XXX TOBAGO3*/
}
.tobago-tabGroup-header {
- position: relative;
+ /*position: relative;XXX TOBAGO3*/
font: 12px arial, helvetica, sans-serif;
- overflow: hidden;
+ overflow: auto;
+ /*overflow: hidden;XXX TOBAGO3*/
}
.tobago-tabGroup-headerInner {
border-bottom: 1px solid #ddeeff;
height: 20px;
- width: 10000px;
+ /*width: 10000px;XXX TOBAGO3*/
font: 12px arial, helvetica, sans-serif;
- overflow: visible;
+ /*overflow: visible;XXX TOBAGO3*/
}
.tobago-tabGroup-toolBar {
- position: absolute;
+ /*position: absolute;XXX TOBAGO3
right: 0;
top: 4px;
height: 16px;
width: 49px;
+*/
+ float: right;
+ position: relative;
+ bottom: 17px; /* TODO: not nice */
border-bottom: 1px solid #ddeeff;
}
.tobago-tab-content {
- position: relative;
+ /*position: relative;XXX TOBAGO3*/
border-color: #ddeeff #778899 #778899 #ddeeff;
border-width: 0 1px 1px 1px;
border-style: solid;
display: none;
- overflow: hidden;
+ /*overflow: hidden;XXX TOBAGO3*/
}
.tobago-tab-content-markup-selected {
@@ -1412,9 +1428,11 @@ div.tobago-richTextEditor-body {
background-color: white;
height: 21px;
width: 58px;
+/*XXX TOBAGO3
position: absolute;
top: 0;
left: 0;
+*/
}
.tobago-time-borderDiv-markup-seconds {
@@ -1449,7 +1467,9 @@ div.tobago-richTextEditor-body {
}
.tobago-time-incImage, .tobago-time-decImage {
+/*XXX TOBAGO3
position: absolute;
+*/
left: 63px;
cursor: pointer;
}
@@ -1468,9 +1488,7 @@ div.tobago-richTextEditor-body {
/* toolBar ----------------------------------------------------------------- */
-/* FIXME this is the same code for "toolBar", "boxToolBar" and "tabGroupToolBar"
- FIXME may be fixed after TOBAGO-900
-*/
+/* FIXME this is the same code for "toolBar", "boxToolBar" and "tabGroupToolBar"*/
.tobago-toolBar {
border: 2px groove #F6FAFF;
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java?rev=1569327&r1=1569326&r2=1569327&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java Tue Feb 18 14:00:13 2014
@@ -24,7 +24,6 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.component.UIBox;
import org.apache.myfaces.tobago.component.UIMenuBar;
-import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.renderkit.BoxRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Classes;
import org.apache.myfaces.tobago.renderkit.css.Style;
@@ -42,15 +41,14 @@ import java.io.IOException;
public class BoxRenderer extends BoxRendererBase {
/*
-
+XXX TOBAGO3 todo: rewrite the doc here
+
with shadow
<div class="tobago-box" style="width: 100px; height: 100px">
- <div class="tobago-box-border" style="width: 97px; height: 97px">
- <div class="tobago-box-header">Label</div>
- </div>
+ <div class="tobago-box-header">Label</div>
- <div style="position: absolute; top: 26px; left: 6px; width: 87px; height: 67px; background-color: blue;">
+ <div class="tobago-box-content" style="position: absolute; top: 26px; left: 6px; width: 87px; height: 67px; background-color: blue;">
Content
</div>
</div>
@@ -88,33 +86,6 @@ without shadow
private void encodeBox(final FacesContext facesContext, final TobagoResponseWriter writer, final UIBox box)
throws IOException {
- // todo: shadow = 0px means, that shadow is disabled, but it may be better, if we can set a boolean in the config.
- // todo: this is possible after fixing
- final Measure measure = getResourceManager().getThemeMeasure(facesContext, box, "shadow");
- final boolean hasShadow = measure.greaterThan(Measure.ZERO);
-
- if (hasShadow) {
- // shadow begin
-// writer.startElement(HtmlElements.DIV, box);
-// writer.writeClassAttribute(Classes.create(box, "shadow"));
-
-// final Style shadow = new Style();
-// shadow.setWidth(box.getCurrentWidth().subtract(1));
-// shadow.setHeight(box.getCurrentHeight().subtract(1));
-// writer.writeStyleAttribute(shadow);
-
- // border begin
- writer.startElement(HtmlElements.DIV, box);
- writer.writeClassAttribute(Classes.create(box, "border"));
-
- final Style border = new Style();
- border.setWidth(box.getCurrentWidth());
- border.setHeight(box.getCurrentHeight());
-// border.setWidth(box.getCurrentWidth().subtract(3));
-// border.setHeight(box.getCurrentHeight().subtract(3));
- writer.writeStyleAttribute(border);
- }
-
final UIComponent label = box.getFacet(Facets.LABEL);
writer.startElement(HtmlElements.DIV, null);
writer.writeClassAttribute(Classes.create(box, "header"));
@@ -135,26 +106,9 @@ without shadow
if (toolbar != null) {
renderToolbar(facesContext, writer, box, toolbar);
}
-
- if (hasShadow) {
- // border end
- writer.endElement(HtmlElements.DIV);
- // shadow end
-// writer.endElement(HtmlElements.DIV);
- }
writer.startElement(HtmlElements.DIV, null);
writer.writeClassAttribute(Classes.create(box, "content")); // needed to be scrollable inside of the box
- final Style style = new Style(facesContext, box);
- final Measure borderLeft = box.getBorderLeft();
- final Measure borderRight = box.getBorderRight();
- final Measure borderTop = box.getBorderTop();
- final Measure borderBottom = box.getBorderBottom();
- style.setWidth(style.getWidth().subtract(borderLeft).subtract(borderRight));
- style.setHeight(style.getHeight().subtract(borderTop).subtract(borderBottom));
- style.setLeft(borderLeft);
- style.setTop(borderTop);
- writer.writeStyleAttribute(style);
}
@Override
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=1569327&r1=1569326&r2=1569327&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 Tue Feb 18 14:00:13 2014
@@ -39,13 +39,13 @@
}
.field-focus-shadow(@color: @focusColor) {
- -webkit-box-shadow: inset 0px 0px 3px lighten(@color, 20%);
- -moz-box-shadow: inset 0px 0px 3px lighten(@color, 20%);
- -o-box-shadow: inset 0px 0px 3px lighten(@color, 20%);
- box-shadow: inset 0px 0px 3px lighten(@color, 20%);
+ -webkit-box-shadow: inset 0px 0px 2px lighten(@color, 20%), 0px 0px 3px lighten(@color, 20%);
+ -moz-box-shadow: inset 0px 0px 2px lighten(@color, 20%), 0px 0px 3px lighten(@color, 20%);
+ -o-box-shadow: inset 0px 0px 2px lighten(@color, 20%), 0px 0px 3px lighten(@color, 20%);
+ box-shadow: inset 0px 0px 2px lighten(@color, 20%), 0px 0px 3px lighten(@color, 20%);
}
-.transitionBorder(@transition: .5s linear) {
+.transitionBorder(@transition: .1s linear) {
-webkit-transition: border @transition, -webkit-box-shadow @transition;
-moz-transition: border @transition, -moz-box-shadow @transition;
-o-transition: border @transition, -o-box-shadow @transition;
@@ -61,12 +61,22 @@
/* box ----------------------------------------------------------------- */
.tobago-box {
- position: absolute;
+// position: absolute;XXX TOBAGO3
+ border: 1px solid darken(@borderColor, 10%);
+ overflow: hidden;
+/*XXX TOBAGO3
+ top: -1px;
+ left: -1px;
+*/
+ background-color: #FAFAFA;
+ .border-radius;
+ .box-shadow;
}
+/*XXX TOBAGO3
.tobago-box-border {
border: 1px solid darken(@borderColor, 10%);
- position: absolute;
+// position: absolute;
overflow: hidden;
top: -1px;
left: -1px;
@@ -74,18 +84,19 @@
.border-radius;
.box-shadow;
}
+*/
.tobago-box-header {
background: #E8E8E8 url(../image/box-header-bg.gif) repeat-x top;
height: 21px;
- border: 1px solid transparent;
+ border: 0 solid transparent;
border-bottom: 1px dotted black;
- .border-radius(3px 3px 0 0);
+// .border-radius(3px 3px 0 0);XXX TOBAGO3
font: @boldFont;
color: @textColor2;
padding: 3px 0 0 5px;
overflow: hidden;
- position: relative;
+// position: relative;XXX TOBAGO3
white-space: nowrap;
}
@@ -294,6 +305,7 @@
.tobago-label {
background-color: #E8E8E8;
height: 20px;
+ width: 120px;
.border-radius;
font: @boldFont;
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/pom.xml?rev=1569327&r1=1569326&r2=1569327&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/pom.xml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/pom.xml Tue Feb 18 14:00:13 2014
@@ -60,7 +60,7 @@
<configuration>
<target>
<concat destfile="${project.build.directory}/javascript-min/standard/script/tobago.min.js" force="no">
- <filelist dir="${basedir}/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script" files="tobago.js,tobago-calendar.js,tobago-converter.js,tobago-in.js,tobago-menu.js,tobago-overlay.js,tobago-popup.js,tobago-sheet.js,tobago-suggest.js,tobago-tree.js,tobago-utils.js" />
+ <filelist dir="${basedir}/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script" files="tobago.js,tobago-calendar.js,tobago-converter.js,tobago-in.js,tobago-layout.js,tobago-menu.js,tobago-overlay.js,tobago-popup.js,tobago-sheet.js,tobago-suggest.js,tobago-tree.js,tobago-utils.js" />
</concat>
<replaceregexp match="^.*//.*@DEV_ONLY.*$" replace="" byline="true">
<fileset dir="${project.build.directory}/javascript-min">
Added: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BootstrapLayoutRenderer.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/BootstrapLayoutRenderer.java?rev=1569327&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BootstrapLayoutRenderer.java (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BootstrapLayoutRenderer.java Tue Feb 18 14:00:13 2014
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
+
+import org.apache.myfaces.tobago.component.UIBootstrapLayout;
+import org.apache.myfaces.tobago.component.UIExtensionPanel;
+import org.apache.myfaces.tobago.component.UILabel;
+import org.apache.myfaces.tobago.internal.component.AbstractUIBootstrapLayout;
+import org.apache.myfaces.tobago.layout.LayoutContainer;
+import org.apache.myfaces.tobago.renderkit.RendererBase;
+import org.apache.myfaces.tobago.renderkit.css.Css;
+import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
+import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
+import org.apache.myfaces.tobago.renderkit.util.BootstrapCssGenerator;
+import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
+import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.io.IOException;
+import java.util.List;
+
+public class BootstrapLayoutRenderer extends RendererBase {
+
+ private static final Logger LOG = LoggerFactory.getLogger(BootstrapLayoutRenderer.class);
+
+ @Override
+ public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws IOException {
+ final AbstractUIBootstrapLayout bootstrapLayout = (AbstractUIBootstrapLayout) component;
+ final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+
+ writer.startElement(HtmlElements.DIV, bootstrapLayout);
+// writer.writeClassAttribute("row");
+ writer.writeClassAttribute("form-horizontal");
+ }
+
+ @Override
+ public void encodeChildren(final FacesContext facesContext, final UIComponent component) throws IOException {
+ final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+ final UIBootstrapLayout bootstrapLayout = (UIBootstrapLayout) component;
+ final UIComponent container = bootstrapLayout.getParent();
+ if (container instanceof LayoutContainer && !((LayoutContainer) container).isLayoutChildren()) {
+ return;
+ }
+
+ final List<UIComponent> children = container.getChildren();
+ final BootstrapCssGenerator generator = new BootstrapCssGenerator(
+ bootstrapLayout.getExtraSmall(),
+ bootstrapLayout.getSmall(),
+ bootstrapLayout.getMedium(),
+ bootstrapLayout.getLarge());
+ for (UIComponent child : children) {
+ if (child instanceof UIExtensionPanel) {
+ for (UIComponent subChild : child.getChildren()) {
+ encodeChild(facesContext, writer, generator, subChild);
+ }
+ } else {
+ encodeChild(facesContext, writer, generator, child);
+ }
+ }
+ }
+
+ private void encodeChild(
+ final FacesContext facesContext, final TobagoResponseWriter writer,
+ final BootstrapCssGenerator generator, final UIComponent child) throws IOException {
+ if (child instanceof UILabel) {
+ generator.generate(((UILabel)child).getCurrentCss());
+ RenderUtils.encode(facesContext, child);
+ } else {
+ writer.startElement(HtmlElements.DIV, null);
+ Css css = new Css();
+ generator.generate(css);
+ writer.writeClassAttribute(css.encode());
+ RenderUtils.encode(facesContext, child);
+ writer.endElement(HtmlElements.DIV);
+ }
+ generator.next();
+ }
+
+ @Override
+ public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
+ final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+ writer.endElement(HtmlElements.DIV);
+ }
+
+}
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/BoxRenderer.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/BoxRenderer.java?rev=1569327&r1=1569326&r2=1569327&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/BoxRenderer.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/BoxRenderer.java Tue Feb 18 14:00:13 2014
@@ -31,7 +31,6 @@ import org.apache.myfaces.tobago.renderk
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
-import org.apache.myfaces.tobago.util.VariableResolverUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
@@ -67,7 +66,7 @@ public class BoxRenderer extends BoxRend
HtmlRendererUtils.writeDataAttributes(facesContext, writer, box);
writer.writeStyleAttribute(style);
- if (label != null || labelString != null) {
+ if (label != null || labelString != null || toolbar != null) {
writer.startElement(HtmlElements.LEGEND, box);
writer.writeClassAttribute(Classes.create(box, "legend"));
@@ -76,23 +75,19 @@ public class BoxRenderer extends BoxRend
} else {
writer.writeText(labelString);
}
- writer.endElement(HtmlElements.LEGEND);
- }
- final Style contentStyle = new Style(facesContext, box);
- if (toolbar != null) {
- writer.startElement(HtmlElements.DIV, null);
- writer.writeClassAttribute(Classes.create(box, "toolbarOuter"));
- writer.startElement(HtmlElements.DIV, null);
- writer.writeClassAttribute(Classes.create(box, "toolbarInner"));
- toolbar.setRendererType(RendererTypes.BOX_TOOL_BAR);
- RenderUtils.encode(facesContext, toolbar);
- writer.endElement(HtmlElements.DIV);
- writer.endElement(HtmlElements.DIV);
- if (VariableResolverUtils.resolveClientProperties(facesContext).getUserAgent().isMsie()) {
-// XXX check for what is this, and delete or comment it
- contentStyle.setTop(Measure.valueOf(-10));
+ if (toolbar != null) {
+ writer.startElement(HtmlElements.DIV, null);
+ writer.writeClassAttribute(Classes.create(box, "toolbarOuter"));
+ writer.startElement(HtmlElements.DIV, null);
+ writer.writeClassAttribute(Classes.create(box, "toolbarInner"));
+ toolbar.setRendererType(RendererTypes.BOX_TOOL_BAR);
+ RenderUtils.encode(facesContext, toolbar);
+ writer.endElement(HtmlElements.DIV);
+ writer.endElement(HtmlElements.DIV);
}
+
+ writer.endElement(HtmlElements.LEGEND);
}
final UIMenuBar menuBar = getMenuBarFacet(box);
@@ -102,15 +97,6 @@ public class BoxRenderer extends BoxRend
writer.startElement(HtmlElements.DIV, box);
writer.writeClassAttribute(Classes.create(box, "content")); // needed to be scrollable inside of the box
- final Measure borderLeft = getBorderLeft(facesContext, box);
- final Measure borderRight = getBorderRight(facesContext, box);
- final Measure borderTop = getBorderTop(facesContext, box);
- final Measure borderBottom = getBorderBottom(facesContext, box);
- contentStyle.setWidth(contentStyle.getWidth().subtract(borderLeft).subtract(borderRight));
- contentStyle.setHeight(contentStyle.getHeight().subtract(borderTop).subtract(borderBottom));
- contentStyle.setLeft(borderLeft);
- contentStyle.setTop(borderTop);
- writer.writeStyleAttribute(contentStyle);
}
@Override
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/ButtonRenderer.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/ButtonRenderer.java?rev=1569327&r1=1569326&r2=1569327&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/ButtonRenderer.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/ButtonRenderer.java Tue Feb 18 14:00:13 2014
@@ -132,14 +132,19 @@ public class ButtonRenderer extends Comm
Measure width = Measure.ZERO;
final boolean image = button.getImage() != null;
if (image) {
- width = getResourceManager().getThemeMeasure(facesContext, button, "imageWidth");
+ final Measure imageWidth = getResourceManager().getThemeMeasure(facesContext, button, "imageWidth");
+ if (imageWidth != null) {
+ width = imageWidth;
+ }
}
final LabelWithAccessKey label = new LabelWithAccessKey(button);
width = width.add(RenderUtils.calculateStringWidth(facesContext, button, label.getText()));
final Measure padding = getResourceManager().getThemeMeasure(facesContext, button, "paddingWidth");
- // left padding, right padding and when an image and an text then a middle padding.
- width = width.add(padding.multiply(image && label.getText() != null ? 3 : 2));
+ if (padding != null) {
+ // left padding, right padding and when an image and an text then a middle padding.
+ width = width.add(padding.multiply(image && label.getText() != null ? 3 : 2));
+ }
return width;
}
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/DatePickerRenderer.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/DatePickerRenderer.java?rev=1569327&r1=1569326&r2=1569327&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/DatePickerRenderer.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/DatePickerRenderer.java Tue Feb 18 14:00:13 2014
@@ -103,7 +103,8 @@ public class DatePickerRenderer extends
box.getChildren().add(calendar);
// fixme: should work automatically from the layout manager
- final Measure width = getResourceManager().getThemeMeasure(facesContext, calendar, "minimumWidth");
+ final Measure width
+ = getResourceManager().getThemeMeasure(facesContext, calendar, "minimumWidth", Measure.valueOf(20));
layoutOfBox.setColumns(width.serialize());
// add time input
@@ -167,7 +168,7 @@ public class DatePickerRenderer extends
// todo: call setWidth ???
picker.getAttributes().put(
Attributes.LAYOUT_WIDTH,
- getResourceManager().getThemeMeasure(facesContext, picker, "pickerWidth").getPixel());
+ getResourceManager().getThemeMeasure(facesContext, picker, "pickerWidth", Measure.valueOf(20)).getPixel());
FacesContextUtils.addPopup(facesContext, (UIPopup) picker.getFacets().get(Facets.POPUP));
Added: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FlexLayoutRenderer.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/FlexLayoutRenderer.java?rev=1569327&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FlexLayoutRenderer.java (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FlexLayoutRenderer.java Tue Feb 18 14:00:13 2014
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
+
+import org.apache.myfaces.tobago.internal.component.AbstractUIFlexLayout;
+import org.apache.myfaces.tobago.layout.LayoutContainer;
+import org.apache.myfaces.tobago.renderkit.RendererBase;
+import org.apache.myfaces.tobago.renderkit.css.Classes;
+import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
+import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
+import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
+import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.io.IOException;
+
+public class FlexLayoutRenderer extends RendererBase {
+
+ private static final Logger LOG = LoggerFactory.getLogger(FlexLayoutRenderer.class);
+
+ @Override
+ public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws IOException {
+ final AbstractUIFlexLayout flexLayout = (AbstractUIFlexLayout) component;
+ final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+
+ writer.startElement(HtmlElements.DIV, flexLayout);
+ writer.writeClassAttribute(Classes.create(flexLayout));
+ // todo: const, utils, etc.
+ writer.writeAttribute("data-tobago-layout", "{\"columns\":[\"auto\",1]}", true);
+ }
+
+ @Override
+ public void encodeChildren(final FacesContext facesContext, final UIComponent component) throws IOException {
+ final UIComponent container = component.getParent();
+ if (container instanceof LayoutContainer && !((LayoutContainer) container).isLayoutChildren()) {
+ return;
+ }
+ RenderUtils.encodeChildren(facesContext, container);
+/*
+ final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+ final AbstractUIBootstrapLayout bootstrapLayout = (AbstractUIBootstrapLayout) component;
+ final UIComponent container = bootstrapLayout.getParent();
+ if (container instanceof LayoutContainer && !((LayoutContainer) container).isLayoutChildren()) {
+ return;
+ }
+
+ final List<UIComponent> children = container.getChildren();
+ for (UIComponent child : children) {
+ writer.startElement(HtmlElements.DIV, null);
+ writer.writeClassAttribute("col-md-4");
+ RenderUtils.encode(facesContext, child);
+ writer.endElement(HtmlElements.DIV);
+ }
+*/
+ }
+
+ @Override
+ public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
+ final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+ writer.endElement(HtmlElements.DIV);
+ }
+
+}
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/GridLayoutRenderer.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/GridLayoutRenderer.java?rev=1569327&r1=1569326&r2=1569327&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/GridLayoutRenderer.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/GridLayoutRenderer.java Tue Feb 18 14:00:13 2014
@@ -21,12 +21,31 @@ package org.apache.myfaces.tobago.render
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.config.Configurable;
-import org.apache.myfaces.tobago.layout.LayoutContainer;
+import org.apache.myfaces.tobago.internal.component.AbstractUIGridLayout;
+import org.apache.myfaces.tobago.internal.layout.BankHead;
+import org.apache.myfaces.tobago.internal.layout.Cell;
+import org.apache.myfaces.tobago.internal.layout.Grid;
+import org.apache.myfaces.tobago.internal.layout.OriginCell;
+import org.apache.myfaces.tobago.layout.AutoLayoutToken;
+import org.apache.myfaces.tobago.layout.LayoutComponent;
+import org.apache.myfaces.tobago.layout.LayoutToken;
import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.layout.Orientation;
+import org.apache.myfaces.tobago.layout.PixelLayoutToken;
+import org.apache.myfaces.tobago.layout.RelativeLayoutToken;
import org.apache.myfaces.tobago.renderkit.MarginValues;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import org.apache.myfaces.tobago.renderkit.SpacingValues;
+import org.apache.myfaces.tobago.renderkit.css.Classes;
+import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
+import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
+import org.apache.myfaces.tobago.renderkit.html.HtmlRoleValues;
+import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
+import org.apache.myfaces.tobago.util.ComponentUtils;
+import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -34,13 +53,152 @@ import java.io.IOException;
public class GridLayoutRenderer extends RendererBase implements SpacingValues, MarginValues {
+ private static final Logger LOG = LoggerFactory.getLogger(GridLayoutRenderer.class);
+
+ // todo: may use: http://www.w3.org/TR/css3-grid-layout/ (currently only IE 10 and higher)
+
+ @Override
+ public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws IOException {
+ final AbstractUIGridLayout gridLayout = (AbstractUIGridLayout) component;
+ final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+
+// writer.startElement(HtmlElements.DIV, gridLayout);
+ writer.startElement(HtmlElements.TABLE, gridLayout);
+ writer.writeAttribute(HtmlAttributes.ROLE, HtmlRoleValues.PRESENTATION.toString(), false);
+ writer.writeClassAttribute(Classes.create(gridLayout));
+
+ final StringBuilder builder = new StringBuilder();
+
+ builder.append("{\"columns\":");
+ jsonLayout(gridLayout.getGrid().getBankHeads(Orientation.HORIZONTAL), builder);
+ builder.append(",");
+
+ builder.append("\"rows\":");
+ jsonLayout(gridLayout.getGrid().getBankHeads(Orientation.VERTICAL), builder);
+ builder.append("}");
+
+ writer.writeAttribute("data-tobago-layout", builder.toString(), true);
+
+
+ writer.startElement(HtmlElements.COLGROUP, gridLayout);
+ final BankHead[] horizontalBankHeads = gridLayout.getGrid().getBankHeads(Orientation.HORIZONTAL);
+ for (BankHead horizontalBankHead : horizontalBankHeads) {
+ if (horizontalBankHead.isRendered()) {
+ writer.startElement(HtmlElements.COL, gridLayout);
+ writer.endElement(HtmlElements.COL);
+ }
+ }
+ writer.endElement(HtmlElements.COLGROUP);
+ writer.startElement(HtmlElements.TBODY, gridLayout);
+ }
+
+ private void jsonLayout(final BankHead[] bankHeads, final StringBuilder builder) {
+ builder.append("[");
+ for (int i = 0; i < bankHeads.length; i++) {
+ if (bankHeads[i].isRendered()) {
+ final LayoutToken token = bankHeads[i].getToken();
+ if (token instanceof RelativeLayoutToken) {
+ final int factor = ((RelativeLayoutToken) token).getFactor();
+ builder.append(factor);
+ } else if (token instanceof AutoLayoutToken) {
+ builder.append("\"auto\"");
+ } else if (token instanceof PixelLayoutToken) {
+ builder.append("{\"pixel\":");
+ builder.append(((PixelLayoutToken) token).getPixel());
+ builder.append("}");
+ } else {
+ LOG.warn("Not supported: " + token);
+ }
+ builder.append(',');
+ }
+ }
+ if (builder.charAt(builder.length() - 1) == ',') {
+ builder.deleteCharAt(builder.length() - 1);
+ }
+ builder.append("]");
+ }
+
@Override
public void encodeChildren(final FacesContext facesContext, final UIComponent component) throws IOException {
- final UIComponent container = component.getParent();
+ final AbstractUIGridLayout gridLayout = (AbstractUIGridLayout) component;
+/*
+ final UIComponent container = gridLayout.getParent();
if (container instanceof LayoutContainer && !((LayoutContainer) container).isLayoutChildren()) {
return;
}
RenderUtils.encodeChildren(facesContext, container);
+*/
+
+ final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+ final Grid grid = gridLayout.getGrid();
+ final BankHead[] horizontalBankHeads = grid.getBankHeads(Orientation.HORIZONTAL);
+ final BankHead[] verticalBankHeads = grid.getBankHeads(Orientation.VERTICAL);
+
+ for (int i = 0; i < verticalBankHeads.length; i++) {
+ if (verticalBankHeads[i].isRendered()) {
+ writer.startElement(HtmlElements.TR, gridLayout);
+ for (int j = 0; j < horizontalBankHeads.length; j++) {
+ if (horizontalBankHeads[j].isRendered()) {
+ final Cell cell = grid.getCell(j, i);
+ if (cell instanceof OriginCell) {
+ writer.startElement(HtmlElements.TD, gridLayout);
+ final int columnSpan = cell.getColumnSpan();
+ if (columnSpan > 1) {
+ writer.writeAttribute(HtmlAttributes.COLSPAN, columnSpan);
+ }
+ final int rowSpan = cell.getRowSpan();
+ if (rowSpan > 1) {
+ writer.writeAttribute(HtmlAttributes.ROWSPAN, rowSpan);
+ }
+
+
+ final LayoutComponent element = cell.getComponent();
+ StringBuilder builder = new StringBuilder();
+ builder.append("{");
+ final Measure width = element.getWidth();
+ if (width != null) {
+ builder.append("\"width\":");
+ builder.append("{\"pixel\":");
+ builder.append(width.getPixel());
+ builder.append("}");
+ builder.append(",");
+ }
+ final Measure height = element.getHeight();
+ if (height != null) {
+ builder.append("\"height\":");
+ builder.append("{\"pixel\":");
+ builder.append(height.getPixel());
+ builder.append("}");
+ builder.append(",");
+ }
+ if (builder.length() > 1) {
+ builder.deleteCharAt(builder.length() - 1);
+ }
+ // todo: add more attributes
+ builder.append("}");
+
+ final UIComponent child = (UIComponent) element;
+ if (builder.length() > 2) { // empty is not need to render
+ ComponentUtils.putDataAttribute(child, "tobago-layout", builder.toString());
+ }
+ RenderUtils.encode(facesContext, child);
+
+ writer.endElement(HtmlElements.TD);
+ }
+ }
+ }
+ writer.endElement(HtmlElements.TR);
+ }
+ }
+ }
+
+ @Override
+ public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
+ final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+
+ writer.endElement(HtmlElements.TBODY);
+ writer.endElement(HtmlElements.TABLE);
+// writer.endElement(HtmlElements.DIV);
}
public Measure getColumnSpacing(final FacesContext facesContext, final Configurable component) {
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/LabelRenderer.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/LabelRenderer.java?rev=1569327&r1=1569326&r2=1569327&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/LabelRenderer.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/LabelRenderer.java Tue Feb 18 14:00:13 2014
@@ -83,7 +83,7 @@ public class LabelRenderer extends Layou
writer.endElement(HtmlElements.LABEL);
}
- /** Encodes the text inside of the label.
+ /** Encodes the text inside of the label.
* Can be overwritten in other themes.
*/
protected void encodeTextContent(
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/MenuCommandRenderer.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/MenuCommandRenderer.java?rev=1569327&r1=1569326&r2=1569327&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/MenuCommandRenderer.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/MenuCommandRenderer.java Tue Feb 18 14:00:13 2014
@@ -22,6 +22,7 @@ package org.apache.myfaces.tobago.render
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
+import org.apache.myfaces.tobago.component.UIMenu;
import org.apache.myfaces.tobago.component.UIMenuCommand;
import org.apache.myfaces.tobago.component.UISelectBooleanCheckbox;
import org.apache.myfaces.tobago.context.Markup;
@@ -64,26 +65,27 @@ public class MenuCommandRenderer extends
@Override
public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws IOException {
- final UIMenuCommand menu = (UIMenuCommand) component;
+ final UIMenuCommand command = (UIMenuCommand) component;
+ final UIMenu menu = ComponentUtils.findAncestor(component, UIMenu.class);
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
- final boolean disabled = menu.isDisabled();
- final boolean firstLevel = RendererTypes.MENU_BAR.equals(menu.getParent().getRendererType());
- final LabelWithAccessKey label = new LabelWithAccessKey(menu);
+ final boolean disabled = command.isDisabled();
+ final boolean firstLevel = RendererTypes.MENU_BAR.equals(command.getParent().getRendererType());
+ final LabelWithAccessKey label = new LabelWithAccessKey(command);
- if (menu.getFacet(Facets.CHECKBOX) != null) {
+ if (command.getFacet(Facets.CHECKBOX) != null) {
// checkbox menu
- final UISelectBooleanCheckbox checkbox = (UISelectBooleanCheckbox) menu.getFacet(Facets.CHECKBOX);
+ final UISelectBooleanCheckbox checkbox = (UISelectBooleanCheckbox) command.getFacet(Facets.CHECKBOX);
final boolean checked = ComponentUtils.getBooleanAttribute(checkbox, Attributes.VALUE);
final String image = checked ? "image/MenuCheckmark.gif" : null;
final String hiddenId = checkbox.getClientId(facesContext);
final CommandMap map = new CommandMap(new Command());
- encodeItem(facesContext, writer, menu, label, map, disabled, firstLevel, image, null, "selectBoolean");
+ encodeItem(facesContext, writer, command, menu, label, map, disabled, firstLevel, image, null, "selectBoolean");
encodeHidden(writer, hiddenId, checked);
- } else if (menu.getFacet(Facets.RADIO) != null) {
+ } else if (command.getFacet(Facets.RADIO) != null) {
// radio menu
- final String clientId = menu.getClientId(facesContext);
- final UISelectOne radio = (UISelectOne) menu.getFacet(Facets.RADIO);
+ final String clientId = command.getClientId(facesContext);
+ final UISelectOne radio = (UISelectOne) command.getFacet(Facets.RADIO);
final List<SelectItem> items = RenderUtils.getSelectItems(radio);
final String hiddenId = radio.getClientId(facesContext);
for (final SelectItem item : items) {
@@ -101,17 +103,17 @@ public class MenuCommandRenderer extends
} else {
LOG.warn("Menu item has label=null where clientId=" + clientId);
}
- final String formattedValue = RenderUtils.getFormattedValue(facesContext, radio, item.getValue());
+ final String formatted = RenderUtils.getFormattedValue(facesContext, radio, item.getValue());
final CommandMap map = new CommandMap(
new Command(clientId, null, null, null, null, null, null, null, null, null));
- encodeItem(facesContext, writer, null, label, map, disabled, firstLevel, image, formattedValue, "selectOne");
+ encodeItem(facesContext, writer, null, menu, label, map, disabled, firstLevel, image, formatted, "selectOne");
}
encodeHidden(writer, hiddenId, getCurrentValue(facesContext, radio));
} else {
// normal menu command
- final String image = menu.getImage();
- final CommandMap map = new CommandMap(new Command(facesContext, menu));
- encodeItem(facesContext, writer, menu, label, map, disabled, firstLevel, image, null, null);
+ final String image = command.getImage();
+ final CommandMap map = new CommandMap(new Command(facesContext, command));
+ encodeItem(facesContext, writer, command, menu, label, map, disabled, firstLevel, image, null, null);
}
}
@@ -127,8 +129,8 @@ public class MenuCommandRenderer extends
}
private void encodeItem(
- final FacesContext facesContext, final TobagoResponseWriter writer, final UIMenuCommand component,
- final LabelWithAccessKey label,
+ final FacesContext facesContext, final TobagoResponseWriter writer,
+ final UIMenuCommand component, final UIMenu menu, final LabelWithAccessKey label,
final CommandMap map, final boolean disabled, final boolean firstLevel, final String image, final String value,
final String sub)
throws IOException {
@@ -144,10 +146,11 @@ public class MenuCommandRenderer extends
markup = Markup.TOP.add(markup);
}
}
- // todo: solve workaround
- String css = Classes.createWorkaround("menu", markup).getStringValue();
+ final Classes css;
if (sub != null) {
- css += " tobago-menu-" + sub;
+ css = Classes.create(menu, sub, markup);
+ } else {
+ css = Classes.create(menu, markup);
}
writer.writeClassAttribute(css);
if (!disabled) {
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/PageRenderer.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/PageRenderer.java?rev=1569327&r1=1569326&r2=1569327&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/PageRenderer.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/PageRenderer.java Tue Feb 18 14:00:13 2014
@@ -507,9 +507,7 @@ public class PageRenderer extends PageRe
writer.startElement(HtmlElements.IMG, null);
writer.writeClassAttribute(Classes.create(page, "overlayErrorPreloadedImage"));
- final String error = ClientProperties.getInstance(facesContext).getUserAgent().isMsie6()
- ? ResourceManagerUtils.getImageWithPath(facesContext, "image/remove.gif") // XXX why png doesn't work in ie6?
- : ResourceManagerUtils.getImageWithPath(facesContext, "image/dialog-error.png");
+ final String error = ResourceManagerUtils.getImageWithPath(facesContext, "image/dialog-error.png");
writer.writeAttribute(HtmlAttributes.SRC, error, false);
writer.endElement(HtmlElements.IMG);
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/SelectManyCheckboxRenderer.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/SelectManyCheckboxRenderer.java?rev=1569327&r1=1569326&r2=1569327&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/SelectManyCheckboxRenderer.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/SelectManyCheckboxRenderer.java Tue Feb 18 14:00:13 2014
@@ -117,7 +117,10 @@ public class SelectManyCheckboxRenderer
@Override
public Measure getHeight(final FacesContext facesContext, final Configurable component) {
final UISelectManyCheckbox select = (UISelectManyCheckbox) component;
- final Measure heightOfOne = super.getHeight(facesContext, component);
+ Measure heightOfOne = super.getHeight(facesContext, component);
+ if (heightOfOne == null) {
+ heightOfOne = Measure.valueOf(20);
+ }
if (select.isInline()) {
return heightOfOne;
} else {
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/SelectOneRadioRenderer.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/SelectOneRadioRenderer.java?rev=1569327&r1=1569326&r2=1569327&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/SelectOneRadioRenderer.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/SelectOneRadioRenderer.java Tue Feb 18 14:00:13 2014
@@ -117,7 +117,10 @@ public class SelectOneRadioRenderer exte
@Override
public Measure getHeight(final FacesContext facesContext, final Configurable component) {
final UISelectOneRadio select = (UISelectOneRadio) component;
- final Measure heightOfOne = super.getHeight(facesContext, component);
+ Measure heightOfOne = super.getHeight(facesContext, component);
+ if (heightOfOne == null) {
+ heightOfOne = Measure.valueOf(20);
+ }
if (select.isInline()) {
return heightOfOne;
} else {
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/SheetRenderer.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/SheetRenderer.java?rev=1569327&r1=1569326&r2=1569327&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/SheetRenderer.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/SheetRenderer.java Tue Feb 18 14:00:13 2014
@@ -34,7 +34,6 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.component.UISheet;
import org.apache.myfaces.tobago.component.UIToolBar;
import org.apache.myfaces.tobago.config.Configurable;
-import org.apache.myfaces.tobago.context.ClientProperties;
import org.apache.myfaces.tobago.context.Markup;
import org.apache.myfaces.tobago.context.ResourceManager;
import org.apache.myfaces.tobago.context.ResourceManagerUtils;
@@ -53,6 +52,7 @@ import org.apache.myfaces.tobago.interna
import org.apache.myfaces.tobago.internal.util.StringUtils;
import org.apache.myfaces.tobago.layout.Display;
import org.apache.myfaces.tobago.layout.LayoutBase;
+import org.apache.myfaces.tobago.layout.LayoutManager;
import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.layout.TextAlign;
import org.apache.myfaces.tobago.model.ExpandedState;
@@ -82,7 +82,6 @@ import javax.el.ValueExpression;
import javax.faces.application.Application;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
-import javax.faces.component.UISelectOne;
import javax.faces.context.FacesContext;
import java.io.IOException;
import java.text.MessageFormat;
@@ -227,57 +226,23 @@ public class SheetRenderer extends Layou
}
final boolean showHeader = sheet.isShowHeader();
- final boolean ie6SelectOneFix = showHeader
- && ClientProperties.getInstance(facesContext).getUserAgent().isMsie6()
- && ComponentUtils.findDescendant(sheet, UISelectOne.class) != null;
// BEGIN RENDER BODY CONTENT
- final Style bodyStyle = new Style();
-/*
- bodyStyle.setPosition(Position.RELATIVE);
-*/
- Measure tableBodyWidth = sheet.getCurrentWidth().subtractNotNegative(getContentBorder(facesContext, sheet));
- bodyStyle.setWidth(tableBodyWidth);
- if (sheet.isPagingVisible()) {
- sheetHeight = sheetHeight.subtract(footerHeight);
- }
- if (ie6SelectOneFix) {
- bodyStyle.setTop(headerHeight);
- }
- if (showHeader) {
- sheetHeight = sheetHeight.subtract(headerHeight);
- }
- bodyStyle.setHeight(sheetHeight);
if (showHeader) {
renderColumnHeaders(
- facesContext, sheet, writer, resourceManager, contextPath, sheetId, renderedColumnList, tableBodyWidth);
+ facesContext, sheet, writer, resourceManager, contextPath, sheetId, renderedColumnList/*, tableBodyWidth*/);
}
writer.startElement(HtmlElements.DIV, null);
writer.writeIdAttribute(sheetId + ComponentUtils.SUB_SEPARATOR + "data_div");
writer.writeClassAttribute(Classes.create(sheet, "body"));
-/*
- bodyStyle.setPaddingTop(ie6SelectOneFix ? Measure.ZERO : headerHeight);
-*/
-
- writer.writeStyleAttribute(bodyStyle);
- bodyStyle.setHeight(null);
- bodyStyle.setTop(null);
- final Style sheetBodyStyle = new Style(bodyStyle);
- // is null, in AJAX case.
- if (sheet.getNeedVerticalScrollbar() == Boolean.TRUE) {
- tableBodyWidth = tableBodyWidth.subtractNotNegative(getVerticalScrollbarWeight(facesContext, sheet));
- }
- sheetBodyStyle.setWidth(tableBodyWidth);
-
writer.startElement(HtmlElements.TABLE, null);
writer.writeAttribute(HtmlAttributes.CELLSPACING, "0", false);
writer.writeAttribute(HtmlAttributes.CELLPADDING, "0", false);
writer.writeAttribute(HtmlAttributes.SUMMARY, "", false);
writer.writeClassAttribute(Classes.create(sheet, "bodyTable"));
- writer.writeStyleAttribute(sheetBodyStyle);
if (columnWidths != null) {
writer.startElement(HtmlElements.COLGROUP, null);
@@ -434,10 +399,12 @@ public class SheetRenderer extends Layou
columnIndex++;
writer.startElement(HtmlElements.TD, null);
writer.startElement(HtmlElements.DIV, null);
- final Integer divWidth = sheet.getWidthList().get(columnIndex);
- final Style divStyle = new Style();
- divStyle.setWidth(Measure.valueOf(divWidth));
- writer.writeStyleAttribute(divStyle);
+ if (columnWidths != null) {
+ final Integer divWidth = columnWidths.get(columnIndex);
+ final Style divStyle = new Style();
+ divStyle.setWidth(Measure.valueOf(divWidth));
+ writer.writeStyleAttribute(divStyle);
+ }
writer.endElement(HtmlElements.DIV);
writer.endElement(HtmlElements.TD);
}
@@ -458,9 +425,6 @@ public class SheetRenderer extends Layou
if (sheet.isPagingVisible()) {
final Style footerStyle = new Style();
footerStyle.setWidth(sheet.getCurrentWidth());
- if (ie6SelectOneFix) {
- footerStyle.setTop(headerHeight);
- }
writer.startElement(HtmlElements.DIV, sheet);
writer.writeClassAttribute(Classes.create(sheet, "footer"));
writer.writeStyleAttribute(footerStyle);
@@ -629,17 +593,17 @@ public class SheetRenderer extends Layou
private Measure getHeaderHeight(final FacesContext facesContext, final UISheet sheet) {
final int rows = sheet.getHeaderGrid() != null ? sheet.getHeaderGrid().getRowCount() : 0;
return sheet.isShowHeader()
- ? getResourceManager().getThemeMeasure(facesContext, sheet, "headerHeight").multiply(rows)
+ ? getResourceManager().getThemeMeasure(facesContext, sheet, "headerHeight", Measure.valueOf(20)).multiply(rows)
: Measure.ZERO;
}
private Measure getRowHeight(final FacesContext facesContext, final UISheet sheet) {
- return getResourceManager().getThemeMeasure(facesContext, sheet, "rowHeight");
+ return getResourceManager().getThemeMeasure(facesContext, sheet, "rowHeight", Measure.valueOf(20));
}
private Measure getFooterHeight(final FacesContext facesContext, final UISheet sheet) {
return sheet.isPagingVisible()
- ? getResourceManager().getThemeMeasure(facesContext, sheet, "footerHeight")
+ ? getResourceManager().getThemeMeasure(facesContext, sheet, "footerHeight", Measure.valueOf(20))
: Measure.ZERO;
}
@@ -721,8 +685,8 @@ public class SheetRenderer extends Layou
private void renderColumnHeaders(
final FacesContext facesContext, final UISheet sheet, final TobagoResponseWriter writer,
final ResourceManager resourceManager,
- final String contextPath, final String sheetId, final List<AbstractUIColumn> renderedColumnList,
- final Measure headerWidth)
+ final String contextPath, final String sheetId, final List<AbstractUIColumn> renderedColumnList/*,
+ final Measure headerWidth*/)
throws IOException {
final Grid grid = sheet.getHeaderGrid();
@@ -907,7 +871,13 @@ public class SheetRenderer extends Layou
}
private boolean needVerticalScrollbar(final FacesContext facesContext, final UISheet sheet) {
- return ((AbstractUISheetLayout) sheet.getLayoutManager()).needVerticalScrollbar(facesContext, sheet);
+ final LayoutManager layoutManager = sheet.getLayoutManager();
+ if (layoutManager instanceof AbstractUISheetLayout) {
+ return ((AbstractUISheetLayout) layoutManager).needVerticalScrollbar(facesContext, sheet);
+ } else {
+ LOG.error("Sheet must use a sheet layout, but found: " + layoutManager.getClass().getName());
+ return true;
+ }
}
private void encodeResizing(final TobagoResponseWriter writer, final AbstractUISheet sheet, final int columnIndex)
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/TabGroupRenderer.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/TabGroupRenderer.java?rev=1569327&r1=1569326&r2=1569327&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/TabGroupRenderer.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/TabGroupRenderer.java Tue Feb 18 14:00:13 2014
@@ -32,11 +32,9 @@ import org.apache.myfaces.tobago.context
import org.apache.myfaces.tobago.event.TabChangeEvent;
import org.apache.myfaces.tobago.internal.component.AbstractUIPanelBase;
import org.apache.myfaces.tobago.internal.util.AccessKeyMap;
-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.Position;
import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
@@ -170,16 +168,8 @@ public class TabGroupRenderer extends La
final int activeIndex)
throws IOException {
- final Measure width = tabGroup.getCurrentWidth();
- final Measure headerHeight = getResourceManager().getThemeMeasure(facesContext, tabGroup, "headerHeight");
- final Measure toolBarWidth = getResourceManager().getThemeMeasure(facesContext, tabGroup, "toolBarWidth");
- final Style header = new Style();
- header.setPosition(Position.RELATIVE);
- header.setWidth(width.subtractNotNegative(toolBarWidth));
- header.setHeight(headerHeight);
writer.startElement(HtmlElements.DIV, tabGroup);
writer.writeClassAttribute(Classes.create(tabGroup, "header"));
- writer.writeStyleAttribute(header);
writer.startElement(HtmlElements.DIV, tabGroup);
writer.writeClassAttribute(Classes.create(tabGroup, "headerInner"));
@@ -235,9 +225,6 @@ public class TabGroupRenderer extends La
index++;
}
writer.endElement(HtmlElements.DIV);
- final Style body = new Style();
- body.setWidth(width);
- body.setHeight(tabGroup.getCurrentHeight().subtract(headerHeight));
writer.endElement(HtmlElements.DIV);
if (tabGroup.isShowNavigationBar()) {
final UIToolBar toolBar = createToolBar(facesContext, tabGroup);
@@ -327,14 +314,6 @@ public class TabGroupRenderer extends La
writer.writeClassAttribute(Classes.create(tab, "content"));
writer.writeIdAttribute(tab.getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "content");
- final Style style = new Style(facesContext, tab);
- final Measure borderLeft = tab.getBorderLeft();
- final Measure borderRight = tab.getBorderRight();
- final Measure borderTop = tab.getBorderTop();
- final Measure borderBottom = tab.getBorderBottom();
- style.setWidth(style.getWidth().subtract(borderLeft).subtract(borderRight));
- style.setHeight(style.getHeight().subtract(borderTop).subtract(borderBottom));
- writer.writeStyleAttribute(style);
writer.writeAttribute(HtmlAttributes.TABGROUPINDEX, index);
RenderUtils.encodeChildren(facesContext, tab);
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=1569327&r1=1569326&r2=1569327&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 Tue Feb 18 14:00:13 2014
@@ -134,7 +134,7 @@ public abstract class ToolBarRendererBas
if (radio != null) {
writer.startElement(HtmlElements.SPAN, radio);
- writer.writeClassAttribute(Classes.createWorkaround("toolBar", "selectOne", null));
+ writer.writeClassAttribute(Classes.create(toolBar, "selectOne"));
final Object value = radio.getValue();
String currentValue = "";
@@ -204,7 +204,7 @@ public abstract class ToolBarRendererBas
final String clientId = checkbox.getClientId(facesContext);
writer.startElement(HtmlElements.SPAN, checkbox);
- writer.writeClassAttribute(Classes.createWorkaround("toolBar", "selectBoolean", null));
+ writer.writeClassAttribute(Classes.create(toolBar, "selectBoolean"));
final CommandMap map = new CommandMap(new Command());
width = renderToolbarButton(facesContext, toolBar, command, writer, checked, width, map, null);
@@ -249,16 +249,26 @@ 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");
- final Measure paddingMiddle = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-middle");
- final Measure paddingBottom = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-bottom");
- final Measure paddingLeft = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-left");
- final Measure paddingCenter = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-center");
- final Measure paddingRight = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-right");
- final Measure iconBigHeight = resources.getThemeMeasure(facesContext, toolBar, "custom.icon-big-height");
- final Measure iconSmallHeight = resources.getThemeMeasure(facesContext, toolBar, "custom.icon-small-height");
- final Measure iconBigWidth = resources.getThemeMeasure(facesContext, toolBar, "custom.icon-big-width");
- final Measure iconSmallWidth = resources.getThemeMeasure(facesContext, toolBar, "custom.icon-small-width");
+ 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;
@@ -487,13 +497,17 @@ public abstract class ToolBarRendererBas
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 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")
- : resources.getThemeMeasure(facesContext, toolBar, "custom.icon-small-height");
- final Measure labelHeight = resources.getThemeMeasure(facesContext, toolBar, "custom.label-height");
+ ? 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) {
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/TreeMenuCommandRenderer.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/TreeMenuCommandRenderer.java?rev=1569327&r1=1569326&r2=1569327&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/TreeMenuCommandRenderer.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/TreeMenuCommandRenderer.java Tue Feb 18 14:00:13 2014
@@ -39,7 +39,7 @@ public class TreeMenuCommandRenderer ext
// final boolean folder = parent.isFolder();
final Style style = new Style();
- Measure paddingLeft = getResourceManager().getThemeMeasure(facesContext, node, "custom.padding-left");
+ Measure paddingLeft = getResourceManager().getThemeMeasure(facesContext, node, "custom.padding-left", Measure.ZERO);
paddingLeft = paddingLeft.multiply(level);
style.setPaddingLeft(paddingLeft);
/*
Added: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/BootstrapCssGenerator.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/util/BootstrapCssGenerator.java?rev=1569327&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/BootstrapCssGenerator.java (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/BootstrapCssGenerator.java Tue Feb 18 14:00:13 2014
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.renderkit.util;
+
+import org.apache.myfaces.tobago.layout.BootstrapPartition;
+import org.apache.myfaces.tobago.renderkit.css.Css;
+
+public class BootstrapCssGenerator {
+
+ private BootstrapPartition extraSmall;
+ private BootstrapPartition small;
+ private BootstrapPartition medium;
+ private BootstrapPartition large;
+
+ private int index = 0;
+
+ public BootstrapCssGenerator(
+ final BootstrapPartition extraSmall, final BootstrapPartition small, final BootstrapPartition medium,
+ final BootstrapPartition large) {
+ this.extraSmall = extraSmall;
+ this.small = small;
+ this.medium = medium;
+ this.large = large;
+ }
+
+ public void reset() {
+ index = 0;
+ }
+
+ public void next() {
+ index++;
+ }
+
+ public void generate(final Css css) {
+ generate(css, extraSmall, "col-xs-");
+ generate(css, small, "col-sm-");
+ generate(css, medium, "col-md-");
+ generate(css, large, "col-lg-");
+ }
+
+ private void generate(final Css css, final BootstrapPartition partition, final String prefix) {
+ if (partition != null) {
+ css.add(prefix + partition.getPart(index % partition.getSize()));
+ }
+ }
+}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.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/util/RenderUtils.java?rev=1569327&r1=1569326&r2=1569327&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java Tue Feb 18 14:00:13 2014
@@ -208,7 +208,7 @@ public class RenderUtils {
final String fontWidths = ResourceManagerUtils.getProperty(facesContext, "tobago", type);
for (final char c : text.toCharArray()) {
- if (c >= 32 && c < 128) { // "normal" char in precomputed range
+ if (fontWidths != null && c >= 32 && c < 128) { // "normal" char in precomputed range
final int begin = (c - 32) * 2;
width += Integer.parseInt(fontWidths.substring(begin, begin + 2), 16);
} else {
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml?rev=1569327&r1=1569326&r2=1569327&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml Tue Feb 18 14:00:13 2014
@@ -390,6 +390,7 @@
<script name="script/tobago-calendar.js"/>
<script name="script/tobago-converter.js"/>
<script name="script/tobago-in.js"/>
+ <script name="script/tobago-layout.js"/>
<script name="script/tobago-menu.js"/>
<script name="script/tobago-overlay.js"/>
<script name="script/tobago-popup.js"/>
Added: 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-layout.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-layout.js?rev=1569327&view=auto
==============================================================================
--- 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-layout.js (added)
+++ 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-layout.js Tue Feb 18 14:00:13 2014
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function init(table) {
+
+ var elements = table.children("tbody").children("tr").children("td").children();
+ elements.each(function () {
+ var element = jQuery(this);
+ var data = element.data("tobago-layout");
+ if (data !== undefined) {
+ var width = data.width;
+ if (width == null && element.prop("tagName") == "img") {
+ width = element.outerWidth();
+ }
+ if (width != null) {
+ element.css("width", width + "px");
+ }
+
+ var height = data.height;
+ if (height == null && element.prop("tagName") == "img") {
+ height = element.outerHeight();
+ }
+ if (height != null) {
+ element.css("height", height + "px");
+ }
+ }
+ });
+}
+
+function layout(table, horizontal) {
+ var cells;
+ var banks;
+ var tokens;
+ var css;
+ var desired;
+
+ if (horizontal) {
+// cells = table.find("tr:first>td");
+ banks = table.children("colgroup").children("col");
+ tokens = table.data("tobago-layout").columns;
+ css = "width";
+ desired = table.outerWidth();
+// desired = table.parent().data("tobago-style").width.replace("px", ""); // todo: data("tobago-layout") wohl doch nicht so gut...? der wert wurde ja schon berechnet...
+ } else {
+// cells = table.find("tr");
+ banks = table.children("tbody").children("tr");
+ tokens = table.data("tobago-layout").rows;
+ css = "height";
+ desired = table.outerHeight();
+// desired = table.parent().data("tobago-style").height.replace("px", ""); // todo: data("tobago-layout")
+ }
+
+ if (tokens) {
+ table.css(css, "0px");
+ var i;
+ var cell;
+ var sumRelative = 0;
+ var sumUsed = 0;
+ for (i = 0; i < tokens.length; i++) {
+// cell = cells.eq(i);
+ cell = banks.eq(i);
+ switch (typeof tokens[i]) {
+ case "number":
+ // a relative value
+ sumRelative += tokens[i];
+ break;
+ case "string":
+ // a string, currently only "auto" is supported
+ if ("auto" == tokens[i]) {
+ // nothing to do
+ sumUsed += horizontal ? cell.outerWidth() : cell.outerHeight();
+ } else {
+ LOG.warn("currently only 'auto' is supported, but found: '" + tokens[i] + "'"); // @DEV_ONLY
+ }
+ break;
+ case "object":
+ if (tokens[i].pixel) {
+ setLength(table, banks, i, css, tokens[i].pixel + "px");
+ sumUsed += tokens[i].pixel;
+ } else {
+ LOG.warn("can't find pixel in object: '" + tokens[i] + "'"); // @DEV_ONLY
+ }
+ break;
+ default:
+ LOG.warn("unsupported type of: '" + tokens[i] + "'"); // @DEV_ONLY
+ break;
+ }
+ }
+
+ table.css(css, "");
+ var rest = desired - sumUsed;
+ if (rest > 0 && sumRelative > 0) {
+ for (i = 0; i < tokens.length; i++) {
+ if (typeof tokens[i] == "number") {
+ setLength(table, banks, i, css, rest * tokens[i] / sumRelative + "px");
+ }
+ }
+ }
+ }
+}
+
+function setLength(table, banks, i, css, length) {
+ banks.eq(i).css(css, length);
+ /*
+ if (css == "width") {
+ var trs = table.children("tbody").children("tr");
+ trs.each(function () {
+ jQuery(this).children("td").eq(i).children().css(css, length);
+ });
+ } else {
+ var tr = table.children("tbody").children("tr").eq(i);
+ tr.children("td").children().css(css, length);
+ }
+ */
+}
+
+function layoutFlex(container, horizontal) {
+ var cells;
+ var banks;
+ var tokens;
+ var css;
+
+ if (horizontal) {
+ banks = container.children();
+ tokens = container.data("tobago-layout").columns;
+ css = "width";
+ } else {
+ banks = container.children();
+ tokens = container.data("tobago-layout").rows;
+ css = "height";
+ }
+
+ if (tokens) {
+ var i;
+ var cell;
+ for (i = 0; i < tokens.length; i++) {
+ cell = banks.eq(i);
+ switch (typeof tokens[i]) {
+ case "number":
+ // a relative value
+ // todo: check for "any other" (non-layout) elements
+ container.children().eq(i).css("flex", tokens[i] + " 0 0"); // todo: modernizr
+ break;
+ case "string":
+ // a string, currently only "auto" is supported
+ break;
+ case "object":
+ if (tokens[i].pixel) {
+ setLength(table, banks, i, css, tokens[i].pixel + "px");
+ } else {
+ LOG.warn("can't find pixel in object: '" + tokens[i] + "'"); // @DEV_ONLY
+ }
+ break;
+ default:
+ LOG.warn("unsupported type of: '" + tokens[i] + "'"); // @DEV_ONLY
+ break;
+ }
+ }
+ }
+}
+
+jQuery(document).ready(function () {
+ var gridLayouts = jQuery(".tobago-gridLayout");
+
+ gridLayouts.each(function () {
+ var table = jQuery(this);
+ init(table);
+ });
+
+ gridLayouts.each(function () {
+ var table = jQuery(this);
+ layout(table, true);
+ layout(table, false);
+ });
+
+ //////////////////////////////////////////////
+
+ // the flex stuff.
+
+ var flexLayouts = jQuery(".tobago-flexLayout");
+
+ flexLayouts.each(function () {
+ var container = jQuery(this);
+ layoutFlex(container, true);
+ });
+
+});
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=1569327&r1=1569326&r2=1569327&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 Tue Feb 18 14:00:13 2014
@@ -1015,10 +1015,12 @@ var Tobago = {
initCss: function(elements) {
// element styles
+/*
Tobago.Utils.selectWidthJQuery(elements, "[data-tobago-style]").each(function () {
var element = jQuery(this);
element.css(element.data("tobago-style"));
});
+*/
},
preventFrameAttacks: function() {