You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/12/13 14:05:39 UTC
svn commit: r1045104 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/
tobago-example/tobago-example-test/src/main/webapp/tc/gridLayou...
Author: lofwyr
Date: Mon Dec 13 13:05:38 2010
New Revision: 1045104
URL: http://svn.apache.org/viewvc?rev=1045104&view=rev
Log:
TOBAGO-889: Make TabGroup work with new LayoutManager
- simplify HTML code for tabGroup
- replace "__" with "::" as id separator, to be standard complient
Added:
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tabGroup/client.xhtml
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie_6_0/style/
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie_6_0/style/style.css
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroupLayout.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/gridLayout/tabGroup-auto.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/gridLayout/tabGroup-relative.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tabGroup/simple.xhtml
myfaces/tobago/trunk/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/style.css
myfaces/tobago/trunk/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/style.css
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/TabGroupRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tabgroup.js
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroupLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroupLayout.java?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroupLayout.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroupLayout.java Mon Dec 13 13:05:38 2010
@@ -20,7 +20,6 @@ package org.apache.myfaces.tobago.intern
import org.apache.myfaces.tobago.internal.layout.Interval;
import org.apache.myfaces.tobago.internal.layout.IntervalList;
import org.apache.myfaces.tobago.internal.layout.LayoutUtils;
-import org.apache.myfaces.tobago.layout.Display;
import org.apache.myfaces.tobago.layout.LayoutComponent;
import org.apache.myfaces.tobago.layout.LayoutContainer;
import org.apache.myfaces.tobago.layout.LayoutManager;
@@ -75,6 +74,7 @@ public abstract class AbstractUITabGroup
}
}
+/*
if (intervals.size() >= 1) {
intervals.evaluate();
Measure size = intervals.getCurrent();
@@ -82,6 +82,7 @@ public abstract class AbstractUITabGroup
size = size.add(LayoutUtils.getBorderEnd(orientation, getLayoutContainer()));
LayoutUtils.setCurrentSize(orientation, getLayoutContainer(), size);
}
+*/
}
public void mainProcessing(Orientation orientation) {
@@ -93,15 +94,10 @@ public abstract class AbstractUITabGroup
LayoutContainer container = getLayoutContainer();
Measure available = LayoutUtils.getCurrentSize(orientation, container);
if (available != null) {
- available = available.subtractNotNegative(LayoutUtils.getBorderBegin(orientation, container));
- available = available.subtractNotNegative(LayoutUtils.getBorderEnd(orientation, container));
for (LayoutComponent component : getLayoutContainer().getComponents()) {
-
- component.setDisplay(Display.BLOCK); // TODO: use CSS via classes and style.css
LayoutUtils.setCurrentSize(orientation, component, available);
-
// call sub layout manager
if (component instanceof LayoutContainer) {
((LayoutContainer) component).getLayoutManager().mainProcessing(orientation);
@@ -116,19 +112,7 @@ public abstract class AbstractUITabGroup
public void postProcessing(Orientation orientation) {
// set positions to all sub-layout-managers
-
for (LayoutComponent component : getLayoutContainer().getComponents()) {
-
- component.setDisplay(Display.BLOCK); // TODO: use CSS via classes and style.css
-
- // compute the position of the cell
- Measure position = LayoutUtils.getBorderBegin(orientation, getLayoutContainer());
- if (orientation == Orientation.HORIZONTAL) {
- component.setLeft(position);
- } else {
- component.setTop(position);
- }
-
// call sub layout manager
if (component instanceof LayoutContainer) {
((LayoutContainer) component).getLayoutManager().postProcessing(orientation);
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java Mon Dec 13 13:05:38 2010
@@ -92,5 +92,13 @@ public final class HtmlAttributes {
* Alternate to the src attribute, icon open and close.
*/
public static final String SRCOPEN = "srcopen";
+ /**
+ * The index of the tab inside the tab group.
+ */
+ public static final String TABGROUPINDEX = "tabgroupindex";
+ /**
+ * The mode of the tab switch: client, reloadTab, reloadPage.
+ */
+ public static final String SWITCHTYPE = "switchtype";
}
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/gridLayout/tabGroup-auto.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/gridLayout/tabGroup-auto.xhtml?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/gridLayout/tabGroup-auto.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/gridLayout/tabGroup-auto.xhtml Mon Dec 13 13:05:38 2010
@@ -59,7 +59,7 @@
<tc:script onload="checkLayout('page:rows:a-2', 5, 79, 100, 50);"/>
<!--click the tab to display the elements, they can only be measured if they are not hidden.-->
- <tc:script onload="document.getElementById('page:tabGroup__1__1').onclick();"/>
+ <tc:script onload="jQuery('#page\\:tabGroup').find('.tobago-tab[tabgroupindex=1]').click();"/>
<tc:script onload="checkLayout('page:columns:a-3', 5, 24, 100, 50);"/>
<tc:script onload="checkLayout('page:columns:a-4', 110, 24, 100, 50);"/>
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/gridLayout/tabGroup-relative.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/gridLayout/tabGroup-relative.xhtml?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/gridLayout/tabGroup-relative.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/gridLayout/tabGroup-relative.xhtml Mon Dec 13 13:05:38 2010
@@ -44,11 +44,11 @@
<tc:script file="script/test-utils.js"/>
- <tc:script onload="checkLayout('page:rows:a-1', 5, 24, 587, 132);"/>
- <tc:script onload="checkLayout('page:rows:a-2', 5, 161, 587, 132);"/>
+ <tc:script onload="checkLayout('page:rows:a-1', 6, 26, 588, 131);"/>
+ <tc:script onload="checkLayout('page:rows:a-2', 6, 158, 588, 132);"/>
<!--click the tab to display the elements, they can only be measured if they are not hidden.-->
- <tc:script onload="document.getElementById('page:tabGroup__1__1').onclick();"/>
+ <tc:script onload="jQuery('#page\\:tabGroup').find('.tobago-tab[tabgroupindex=1]').click();"/>
<tc:script onload="checkLayout('page:columns:a-3', 5, 24, 291, 269);"/>
<tc:script onload="checkLayout('page:columns:a-4', 301, 24, 291, 269);"/>
Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tabGroup/client.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tabGroup/client.xhtml?rev=1045104&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tabGroup/client.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tabGroup/client.xhtml Mon Dec 13 13:05:38 2010
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+
+<f:view
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:tx="http://myfaces.apache.org/tobago/extension"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+ <tc:page>
+ <tc:gridLayoutConstraint width="600px" height="300px"/>
+
+ <tc:box label="la">
+
+ <tc:tabGroup switchType="client">
+ <tc:gridLayoutConstraint height="350px"/>
+ <tc:tab label="Tab 0">
+ <tc:textarea readonly="true" value="#{reload.counter}"/>
+ </tc:tab>
+ <tc:tab label="Tab 1 (disabled)" disabled="true">
+ <tc:textarea value="Tab 1" />
+ </tc:tab>
+ <tc:tab label="Tab 2 (not rendered)" rendered="false">
+ <tc:textarea value="Tab 2" />
+ </tc:tab>
+ <tc:tab label="Tab 3 (error)" markup="error">
+ <tc:textarea value="Tab 3"/>
+ </tc:tab>
+<!--
+ <tc:tab label="Tab 4">
+ <tc:textarea value="Tab 4" />
+ </tc:tab>
+-->
+ </tc:tabGroup>
+
+ </tc:box>
+
+ <tc:button onclick="$('.tobago-tabGroup').hide()" label="hide"/>
+ <tc:button onclick="$('.tobago-tabGroup').show()" label="show"/>
+
+ </tc:page>
+</f:view>
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tabGroup/simple.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tabGroup/simple.xhtml?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tabGroup/simple.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tabGroup/simple.xhtml Mon Dec 13 13:05:38 2010
@@ -23,14 +23,12 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<tc:page>
- <f:facet name="layout">
- <tc:gridLayout/>
- </f:facet>
<tc:gridLayoutConstraint width="600px" height="300px"/>
- <tc:tabGroup>
+ <tc:tabGroup switchType="client">
+ <tc:gridLayoutConstraint paddingTop="25px"/>
<tc:tab label="Tab 0">
- <tc:textarea />
+ <tc:textarea readonly="true" value="#{reload.counter}"/>
</tc:tab>
<tc:tab label="Tab 1">
<f:facet name="layout">
@@ -40,6 +38,16 @@
<tc:textarea />
<tc:textarea />
</tc:tab>
+ <tc:tab label="Tab 2">
+ <tc:textarea />
+ </tc:tab>
+ <tc:tab label="Tab 3">
+ <tc:textarea />
+ </tc:tab>
+ <tc:tab label="Tab 4">
+ <tc:textarea />
+ </tc:tab>
</tc:tabGroup>
+
</tc:page>
</f:view>
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/style.css?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/style.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/style.css Mon Dec 13 13:05:38 2010
@@ -145,31 +145,31 @@ li.tobago-menu-markup-selected {
/* tab ---------------------------------------------------------------------- */
-.tobago-tab-link {
+.tobago-tab {
+ background: #FFEECF;
+ border-color: #FECB66;
color: #660000;
}
-div.tobago-tab-outer {
+.tobago-tab-content {
border-color: #FECB66;
- background: #FADC9F repeat-x top;
-}
-
-div.tobago-tab-inner {
- color: #FECB66;
+ background: #FAFAFA;
}
-div.tobago-tabGroup-fulfill {
- border-color: #FECB66;
+.tobago-tab-markup-disabled,
+.tobago-tab-markup-disabled a:link,
+.tobago-tab-markup-disabled a:visited,
+.tobago-tab-markup-disabled a:active {
+ background: #808080 repeat-x top;
+ color: #e6e6e6;
}
-.tobago-tab-content {
- border-color: #FECB66;
- background: #FFEECF;
+.tobago-tabGroup-headerInner {
+ border-bottom-color: #FECB66;
}
-.tobago-tab-shadow {
- background: #FECB66;
- border-color: #FECB66;
+.tobago-tabGroup-toolBar {
+ border-bottom-color: #FECB66;
}
/* tabGroupToolBar ----------------------------------------------------------------- */
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/style.css?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/style.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/style.css Mon Dec 13 13:05:38 2010
@@ -260,45 +260,37 @@ img.tobago-progress-color2 {
/* tab ---------------------------------------------------------------------- */
-.tobago-tab-link {
- font: bold 12px Arial, Helvetica, sans-serif;
+.tobago-tab {
+ background: #6699FF repeat-x top;
+ border-color: #3366CC;
color: #D6EBFF;
}
-div.tobago-tab-outer {
+.tobago-tab-content {
border-color: #3366CC;
- background: #6699FF repeat-x top;
-}
-
-div.tobago-tab-outer-markup-selected {
- padding: 0.2ex 0.2em;
+ background: #FAFAFA;
}
-div.tobago-tab-inner {
- font: bold 12px arial, helvetica, sans-serif;
- color: #3366CC;
+.tobago-tab a:link,
+.tobago-tab a:visited,
+.tobago-tab a:active {
+ color: #D6EBFF;
}
-div.tobago-tabGroup-fulfill {
- border-color: #3366CC;
- margin: 1px;
- margin-bottom:0px;
- margin-top:0px;
- margin-left:0px;
+.tobago-tab-markup-disabled,
+.tobago-tab-markup-disabled a:link,
+.tobago-tab-markup-disabled a:visited,
+.tobago-tab-markup-disabled a:active {
+ background: #808080 repeat-x top;
+ color: #e6e6e6;
}
-.tobago-tab-content {
- border: 1px solid #3366CC;
- border-top: 0px solid transparent;
- padding: 14px 10px 12px 13px;
- background: #FFFFFF;
+.tobago-tabGroup-headerInner {
+ border-bottom-color: #3366CC;
}
-.tobago-tab-shadow {
- background: #FFFFFF;
- border: 0px solid #FFFFFF;
- border-top: 0px solid transparent;
- border-left: 0px solid transparent;
+.tobago-tabGroup-toolBar {
+ border-bottom-color: #3366CC;
}
/* toolBar ----------------------------------------------------------------- */
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java Mon Dec 13 13:05:38 2010
@@ -17,10 +17,8 @@ package org.apache.myfaces.tobago.render
* limitations under the License.
*/
-import org.apache.commons.lang.ArrayUtils;
import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.util.CreateComponentUtils;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.component.UICommand;
@@ -30,24 +28,23 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.component.UITabGroup;
import org.apache.myfaces.tobago.component.UIToolBar;
import org.apache.myfaces.tobago.context.Markup;
-import org.apache.myfaces.tobago.context.ResourceManagerUtils;
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.Display;
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.Overflow;
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;
+import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
import org.apache.myfaces.tobago.renderkit.util.JQueryUtils;
import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
import org.apache.myfaces.tobago.util.ComponentUtils;
+import org.apache.myfaces.tobago.util.CreateComponentUtils;
import org.apache.myfaces.tobago.util.FacetUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import org.slf4j.Logger;
@@ -57,7 +54,6 @@ import javax.faces.application.Applicati
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -65,7 +61,7 @@ public class TabGroupRenderer extends La
private static final Logger LOG = LoggerFactory.getLogger(TabGroupRenderer.class);
- public static final String ACTIVE_INDEX_POSTFIX = "__activeIndex";
+ public static final String ACTIVE_INDEX_POSTFIX = ComponentUtils.SUB_SEPARATOR + "activeIndex";
@Override
public void decode(FacesContext facesContext, UIComponent component) {
@@ -100,103 +96,33 @@ public class TabGroupRenderer extends La
final String hiddenId = clientId + TabGroupRenderer.ACTIVE_INDEX_POSTFIX;
final String switchType = tabGroup.getSwitchType();
TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
- writer.startElement(HtmlElements.DIV, null);
- writer.writeComment("empty div fix problem with mozilla and fieldset");
- writer.endElement(HtmlElements.DIV);
writer.startElement(HtmlElements.DIV, null);
writer.writeIdAttribute(clientId);
writer.writeClassAttribute(Classes.create(tabGroup));
-
+ writer.writeStyleAttribute(new Style(facesContext, tabGroup));
+ writer.writeAttribute(HtmlAttributes.SWITCHTYPE, switchType, false);
writer.startElement(HtmlElements.INPUT, null);
- writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
- writer.writeAttribute(HtmlAttributes.VALUE, Integer.toString(activeIndex), false);
+ writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
+ writer.writeAttribute(HtmlAttributes.VALUE, activeIndex);
writer.writeNameAttribute(hiddenId);
writer.writeIdAttribute(hiddenId);
writer.endElement(HtmlElements.INPUT);
- String image1x1 = ResourceManagerUtils.getImageWithPath(facesContext, "image/1x1.gif");
-
- TabList tabList = getTabList(facesContext, tabGroup);
+ encodeHeader(facesContext, writer, tabGroup, activeIndex);
- // if a outer uiPage is present, the virtual tab will go over all
- // tabs and render it as they are selected, and it will
- // selected with stylesheet.
- int virtualTab = 0;
- Measure currentWidth = Measure.ZERO;
-
- Measure toolBarContentWidth = getResourceManager().getThemeMeasure(facesContext, tabGroup, "toolBarWidth");
- Measure toolBarExtra = getResourceManager().getThemeMeasure(facesContext, tabGroup, "toolBarExtra");
- Measure toolBarWidth = toolBarContentWidth.add(toolBarExtra);
+ int index = 0;
for (UIComponent tab : (List<UIComponent>) tabGroup.getChildren()) {
- if (tab instanceof AbstractUIPanelBase) {
+ if (tab instanceof UITab) {
if (tab.isRendered()) {
- currentWidth = currentWidth.add(tabList.getWidthList().get(virtualTab));
- if (UITabGroup.SWITCH_TYPE_CLIENT.equals(switchType) || virtualTab == activeIndex) {
- if (virtualTab != activeIndex) {
- tabGroup.setDisplay(Display.NONE);
- } else {
- tabGroup.setDisplay(null);
- }
-
- renderTabGroupView(facesContext, writer, tabGroup, virtualTab,
- switchType, image1x1, toolBarWidth, toolBarContentWidth, currentWidth, tabList);
-
- if (UITabGroup.SWITCH_TYPE_RELOAD_TAB.equals(switchType)) {
- final String[] cmds = {
- "new Tobago.TabGroup(",
- " '" + clientId + "', ",
- " '" + activeIndex + "', ",
- " '" + tabGroup.getChildCount() + "', ",
- " " + HtmlRendererUtils.getRenderedPartiallyJavascriptArray(facesContext, tabGroup, tabGroup) + ");"
- };
- HtmlRendererUtils.writeScriptLoader(facesContext, ArrayUtils.EMPTY_STRING_ARRAY, cmds);
- }
- }
- }
- virtualTab++;
- }
- }
- writer.endElement(HtmlElements.DIV);
- }
-
- private Measure getCurrentWidth(TabList tabs, int tabIndex) {
- Measure currentWidth = Measure.ZERO;
- for (int i = 0; i <= tabIndex; i++) {
- currentWidth = currentWidth.add(tabs.getWidthList().get(i));
- }
- return currentWidth;
- }
-
- private TabList getTabList(FacesContext facesContext, UITabGroup component) {
- TabList tabs = new TabList();
- int index = 0;
- // todo: use Measure instead of int
- int tabLabelExtraWidth
- = getResourceManager().getThemeMeasure(facesContext, component, "tabLabelExtraWidth").getPixel();
-
- boolean first = true;
- for (UIComponent child : (List<UIComponent>) component.getChildren()) {
- if (child instanceof UITab) {
- UITab tab = (UITab) child;
- if (tab.isRendered()) {
- LabelWithAccessKey label = new LabelWithAccessKey(tab);
- String text = label.getText() != null ? label.getText() : Integer.toString(index + 1);
- tabs.getWidthList().add(
- RenderUtils.calculateStringWidth2(facesContext, component, text).add(tabLabelExtraWidth));
- if (first) {
- tabs.firstIndex = index;
- first = false;
- }
- tabs.lastIndex = index;
- } else {
- tabs.getWidthList().add(Measure.ZERO);
+ encodeContent(writer, facesContext, (UITab) tab, index);
}
index++;
}
}
- return tabs;
+
+ writer.endElement(HtmlElements.DIV);
}
private int ensureRenderedActiveIndex(FacesContext context, UITabGroup tabGroup) {
@@ -210,7 +136,7 @@ public class TabGroupRenderer extends La
if (index == activeIndex) {
if (tab.isRendered()) {
return index;
- } else if (closestRenderedTabIndex > -1) {
+ } else if (closestRenderedTabIndex > -1) {
break;
}
}
@@ -234,110 +160,51 @@ public class TabGroupRenderer extends La
return closestRenderedTabIndex;
}
- private void renderTabGroupView(
- FacesContext facesContext, TobagoResponseWriter writer, UITabGroup tabGroup,
- int virtualTab, String switchType, String image1x1, Measure toolbarWidth, Measure toolBarContentWidth,
- Measure currentWidth, TabList tabList) throws IOException {
- writer.startElement(HtmlElements.DIV, tabGroup);
- final String clientId = tabGroup.getClientId(facesContext);
- writer.writeIdAttribute(clientId + "__" + virtualTab);
- Style style = new Style(facesContext, tabGroup);
- writer.writeStyleAttribute(style);
+ private void encodeHeader(
+ FacesContext facesContext, TobagoResponseWriter writer, UITabGroup tabGroup, int activeIndex)
+ throws IOException {
Measure width = tabGroup.getCurrentWidth();
Measure headerHeight = getResourceManager().getThemeMeasure(facesContext, tabGroup, "headerHeight");
+ Measure toolBarWidth = getResourceManager().getThemeMeasure(facesContext, tabGroup, "toolBarWidth");
Style header = new Style();
header.setPosition(Position.RELATIVE);
- header.setWidth(width);
+ header.setWidth(width.subtractNotNegative(toolBarWidth));
header.setHeight(headerHeight);
- writer.writeStyleAttribute(header);
writer.startElement(HtmlElements.DIV, tabGroup);
+ writer.writeClassAttribute(Classes.create(tabGroup, "header"));
writer.writeStyleAttribute(header);
writer.startElement(HtmlElements.DIV, tabGroup);
- Style map = new Style();
- if (currentWidth.greaterThan(width)) {
- map.setWidth(currentWidth);
- map.setLeft(width.subtract(toolbarWidth).subtract(currentWidth));
- } else if (tabGroup.isShowNavigationBar()) {
- map.setWidth(width.subtract(toolbarWidth));
- } else {
- map.setWidth(width);
- }
- map.setOverflow(Overflow.HIDDEN);
- map.setPosition(Position.ABSOLUTE);
- map.setHeight(headerHeight);
- writer.writeStyleAttribute(map);
- int sumWidth = 0;
- for (int i = 0; i < tabGroup.getChildren().size(); i++) {
- UIComponent child = (UIComponent) tabGroup.getChildren().get(i);
- if (child instanceof UITab) {
- UITab tab = (UITab) child;
- if (tab.isRendered()) {
- sumWidth += tabList.getWidthList().get(i).getPixel();
- }
- }
- }
- writer.startElement(HtmlElements.DIV, tabGroup);
- Measure sumWidthMeasure = Measure.valueOf(sumWidth);
- if (sumWidthMeasure.greaterThan(map.getWidth())) {
- header.setWidth(sumWidthMeasure);
- } else {
- header.setWidth(map.getWidth());
- }
- writer.writeStyleAttribute(header);
- writer.writeClassAttribute(Classes.create(tabGroup, "header"));
-
- UITab activeTab = null;
+ writer.writeClassAttribute(Classes.create(tabGroup, "headerInner"));
int index = 0;
for (UIComponent child : (List<UIComponent>) tabGroup.getChildren()) {
if (child instanceof UITab) {
UITab tab = (UITab) child;
if (tab.isRendered()) {
- String onclick;
- if (UITabGroup.SWITCH_TYPE_RELOAD_TAB.equals(switchType)) {
- onclick = null;
- } else {
- onclick = "tobago_switchTab('"+ switchType + "','" + clientId + "'," + index + ','
- + tabGroup.getChildCount() + ')';
- }
-
LabelWithAccessKey label = new LabelWithAccessKey(tab);
- if (virtualTab == index) {
+ if (activeIndex == index) {
tab.setCurrentMarkup(tab.getCurrentMarkup().add(Markup.SELECTED));
- activeTab = tab;
} else {
tab.setCurrentMarkup(tab.getCurrentMarkup().remove(Markup.SELECTED));
}
- Style labelStyle = new Style();
- int borderWidth = 1;
- labelStyle.setWidth(tabList.getWidthList().get(index).subtract(borderWidth * 2));
-
- //labelStyle.setDisplay(Display.INLINE_BLOCK);
-
- writer.startElement(HtmlElements.SPAN, tab);
- writer.writeStyleAttribute(labelStyle);
-
- writer.writeClassAttribute(Classes.create(tab, "outer"));
- writer.startElement(HtmlElements.SPAN, tab);
-
- writer.writeClassAttribute(Classes.create(tab, "inner"));
-
- writer.startElement(HtmlElements.SPAN, tab);
- String tabId = clientId + "__" + virtualTab + "__" + index;
- writer.writeIdAttribute(tabId);
-
- writer.writeClassAttribute(Classes.create(tab, "link"));
- if (!tab.isDisabled() && onclick != null) {
- writer.writeAttribute(HtmlAttributes.ONCLICK, onclick, true);
+ writer.startElement(HtmlElements.DIV, tab);
+ writer.writeClassAttribute(Classes.create(tab));
+ writer.writeAttribute(HtmlAttributes.TABGROUPINDEX, index);
+
+ writer.startElement(HtmlElements.A, tab);
+ if (!tab.isDisabled()) {
+ writer.writeAttribute(HtmlAttributes.HREF, "#", false);
}
+ final String tabId = tab.getClientId(facesContext);
+ writer.writeIdAttribute(tabId);
if (label.getText() != null) {
HtmlRendererUtils.writeLabelWithAccessKey(writer, label);
} else {
writer.writeText(Integer.toString(index + 1));
}
- writer.endElement(HtmlElements.SPAN);
+ writer.endElement(HtmlElements.A);
if (label.getAccessKey() != null) {
if (LOG.isWarnEnabled()
@@ -346,97 +213,37 @@ public class TabGroupRenderer extends La
}
HtmlRendererUtils.addClickAcceleratorKey(facesContext, tabId, label.getAccessKey());
}
- writer.endElement(HtmlElements.SPAN);
- writer.endElement(HtmlElements.SPAN);
-
- // tool bar
- /*UIMenuCommand menuItem = (UIMenuCommand) application.createComponent(UIMenuCommand.COMPONENT_TYPE);
- menuItem.setId(tabGroup.getId() + "__" + virtualTab + "__" + index + "__" + "menu");
- menuItem.setRendererType("MenuCommand");
- if (onclick != null) {
- menuItem.getAttributes().put(ONCLICK, onclick);
- } else {
- menuItem.getAttributes().put(ONCLICK, "javascript:false");
- }
- Object label2 = tab.getAttributes().get(LABEL);
- if (label2 != null) {
- menuItem.getAttributes().put(LABEL, label2);
- }
- menu.getChildren().add(menuItem);*/
-
+ writer.endElement(HtmlElements.DIV);
}
}
index++;
}
- //TODO
- //writer.startElement(HtmlElements.TD, null);
- //writer.writeAttribute(HtmlAttributes.WIDTH, "100%", false);
-
- /*writer.startElement(HtmlElements.TD, tabGroup);
- if (currentWidth.greaterThan(width)) {
- writer.writeAttribute(HtmlAttributes.WIDTH, toolbarWidth.toString(), false);
- } else {
- writer.writeAttribute(HtmlAttributes.WIDTH, width.subtract(currentWidth).toString(), false);
- }*/
-
- Style styleTabFulFill = new Style();
- styleTabFulFill.setWidth(width.subtract(sumWidth).subtract(toolbarWidth));
-
- writer.startElement(HtmlElements.SPAN, tabGroup);
- writer.writeClassAttribute(Classes.create(tabGroup, "fulfill"));
- writer.writeStyleAttribute(styleTabFulFill);
-
- writer.endElement(HtmlElements.SPAN);
-
- writer.endElement(HtmlElements.DIV);
writer.endElement(HtmlElements.DIV);
-
- if (tabGroup.isShowNavigationBar()) {
- UIToolBar toolBar = createToolBar(facesContext, tabGroup, virtualTab, switchType, tabList);
- renderToolBar(facesContext, writer, tabGroup, toolBar, width.subtract(toolbarWidth), toolBarContentWidth);
- }
-
Style body = new Style();
- body.setPosition(Position.RELATIVE);
body.setWidth(width);
body.setHeight(tabGroup.getCurrentHeight().subtract(headerHeight));
writer.endElement(HtmlElements.DIV);
- encodeContent(writer, facesContext, activeTab, body);
- writer.endElement(HtmlElements.DIV);
+ if (tabGroup.isShowNavigationBar()) {
+ UIToolBar toolBar = createToolBar(facesContext, tabGroup/*, activeIndex, switchType, tabList*/);
+ renderToolBar(facesContext, writer, tabGroup, toolBar/*, width.subtract(toolBarWidth), toolBarWidth*/);
+ }
}
- private UIToolBar createToolBar(
- FacesContext facesContext, UITabGroup tabGroup, int virtualTab, String switchType, TabList tabList) {
+ private UIToolBar createToolBar(FacesContext facesContext, UITabGroup tabGroup) {
final String clientId = tabGroup.getClientId(facesContext);
Application application = facesContext.getApplication();
- final String clickParameters = "('" + switchType + "','" + clientId + "'," + tabGroup.getChildCount() + ')';
- // left
+ // previous
UICommand previous = (UICommand) application.createComponent(UICommand.COMPONENT_TYPE);
- previous.setId(tabGroup.getId() + "__" + virtualTab + "__" + "previous");
previous.setRendererType(null);
previous.getAttributes().put(Attributes.IMAGE, "image/tabPrev.gif");
- if (tabList.isFirst(virtualTab)) {
- previous.setDisabled(true);
- }
- if (!UITabGroup.SWITCH_TYPE_RELOAD_TAB.equals(switchType)) {
- previous.setOnclick("tobago_previousTab" + clickParameters);
- } else {
- previous.setOnclick("javascript:false");
- }
- // right
+ previous.setOnclick("/**/"); // XXX avoid submit
+ // next
UICommand next = (UICommand) application.createComponent(UICommand.COMPONENT_TYPE);
- next.setId(tabGroup.getId() + "__" + virtualTab + "__" + "next");
next.setRendererType(null);
next.getAttributes().put(Attributes.IMAGE, "image/tabNext.gif");
- if (tabList.isLast(virtualTab)) {
- next.setDisabled(true);
- }
- if (!UITabGroup.SWITCH_TYPE_RELOAD_TAB.equals(switchType)) {
- next.setOnclick("tobago_nextTab" + clickParameters);
- } else {
- next.setOnclick("javascript:false");
- }
+ next.setOnclick("/**/"); // XXX avoid submit
+
// all: sub menu to select any tab directly
UICommand all = (UICommand) CreateComponentUtils.createComponent(
facesContext, UICommand.COMPONENT_TYPE, null, "all");
@@ -452,13 +259,18 @@ public class TabGroupRenderer extends La
facesContext, UIMenuCommand.COMPONENT_TYPE, RendererTypes.MENU_COMMAND, "entry-" + index);
LabelWithAccessKey label = new LabelWithAccessKey(tab);
entry.setLabel(label.getText());
- String tabId = clientId + "__" + virtualTab + "__" + index;
- entry.setOnclick(JQueryUtils.selectId(tabId) + ".click();"
- + "if (event.stopPropagation === undefined) { "
- + " event.cancelBubble = true; " // IE
- + "} else { "
- + " event.stopPropagation(); " // other
- + "}"); // todo: register a onclick handler with jQuery
+ if (tab.isDisabled()) {
+ entry.setDisabled(true);
+ } else {
+ entry.setOnclick(JQueryUtils.selectId(clientId)
+ + ".find('.tobago-tab[tabgroupindex=" + index + "]')"
+ + ".click();"
+ + "if (event.stopPropagation === undefined) { "
+ + " event.cancelBubble = true; " // IE
+ + "} else { "
+ + " event.stopPropagation(); " // other
+ + "}"); // todo: register a onclick handler with jQuery
+ }
menu.getChildren().add(entry);
}
index++;
@@ -474,59 +286,38 @@ public class TabGroupRenderer extends La
tabGroup.getFacets().put(Facets.TOOL_BAR, toolBar);
return toolBar;
}
-
+
private void renderToolBar(
- FacesContext facesContext, TobagoResponseWriter writer, UITabGroup tabGroup, UIToolBar toolBar,
- Measure left, Measure width)
+ FacesContext facesContext, TobagoResponseWriter writer, UITabGroup tabGroup, UIToolBar toolBar)
throws IOException {
writer.startElement(HtmlElements.DIV, null);
- Style style = new Style();
- style.setWidth(width);
- style.setLeft(left);
- writer.writeStyleAttribute(style);
writer.writeClassAttribute(Classes.create(tabGroup, "toolBar"));
RenderUtils.encode(facesContext, toolBar);
writer.endElement(HtmlElements.DIV);
}
- protected void encodeContent(TobagoResponseWriter writer, FacesContext facesContext, UITab activeTab, Style body)
+ protected void encodeContent(TobagoResponseWriter writer, FacesContext facesContext, UITab tab, int index)
throws IOException {
- writer.startElement(HtmlElements.DIV, null);
- writer.writeClassAttribute(Classes.create(activeTab, "content"));
-
- if (body != null) {
- Style body2 = new Style(body);
- // TODO get
- body2.setHeight(body.getHeight().subtract(22));
- body2.setWidth(body.getWidth().subtract(22));
- //body2.setOverflow(Overflow.AUTO);
- writer.writeStyleAttribute(body2);
+ if (tab.isDisabled()) {
+ return;
}
- writer.flush();
- RenderUtils.encodeChildren(facesContext, activeTab);
-
- writer.endElement(HtmlElements.DIV);
- }
-
-
- private static class TabList {
- private List<Measure> widthList = new ArrayList<Measure>();
- private int firstIndex;
- private int lastIndex;
+ writer.startElement(HtmlElements.DIV, null);
+ writer.writeClassAttribute(Classes.create(tab, "content"));
- public List<Measure> getWidthList() {
- return widthList;
- }
+ 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);
- public boolean isFirst(int index) {
- return firstIndex == index;
- }
+ RenderUtils.encodeChildren(facesContext, tab);
- public boolean isLast(int index) {
- return lastIndex == index;
- }
+ writer.endElement(HtmlElements.DIV);
}
}
-
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java Mon Dec 13 13:05:38 2010
@@ -358,6 +358,12 @@ public abstract class ToolBarRendererBas
dropDownMenu != null ? buttonStyle.getWidth().add(menuStyle.getWidth()) : buttonStyle.getWidth());
itemStyle.setHeight(buttonStyle.getHeight());
+ // XXX hack
+ if (dropDownMenu != null && lackImage && !showLabel) {
+ itemStyle.setWidth(openerStyle.getWidth());
+ buttonStyle.setWidth(openerStyle.getWidth());
+ }
+
// change values when only have one button
if (dropDownMenu != null && !separateButtons && (!lackImage || StringUtils.isNotBlank(label.getText()))) {
openerStyle.setLeft(openerStyle.getLeft().add(buttonStyle.getWidth()));
Added: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie_6_0/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie_6_0/style/style.css?rev=1045104&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie_6_0/style/style.css (added)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie_6_0/style/style.css Mon Dec 13 13:05:38 2010
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+/*
+ * theme: scarborough
+ * agent: msie_6_0
+ */
+
+/* tab/tabGroup -------------------------------------------------------------- */
+
+.tobago-tab {
+ padding-bottom: 0;
+}
+
+.tobago-tab-markup-selected {
+ padding-bottom: 4px;
+}
+
+.tobago-tabGroup-headerInner {
+ overflow-y: hidden;
+}
+
Modified: myfaces/tobago/trunk/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/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties Mon Dec 13 13:05:38 2010
@@ -173,8 +173,8 @@ Tab.paddingBottom=5
TabGroup.fontWidth=8
TabGroup.headerHeight=24
TabGroup.tabLabelExtraWidth=20
-TabGroup.toolBarWidth=48
-TabGroup.toolBarExtra=2
+TabGroup.toolBarWidth=49
+#TabGroup.toolBarExtra=2
TabGroup.borderLeft=1
TabGroup.borderTop=0
TabGroup.borderRight=2
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css Mon Dec 13 13:05:38 2010
@@ -1007,69 +1007,98 @@ div.tobago-richTextEditor-body {
/* tab ------------------------------------------------------------------ */
-.tobago-tab-link {
- font-family: arial, helvetica, sans-serif; /* font-size: 14px; */
- color: #000000;
+.tobago-tab {
+ border: 1px solid #ddeeff;
+ border-right-color: #778899;
+ padding: 2px 6px 1px 6px;
+ margin-top: 2px;
+ margin-right: 2px;
+ vertical-align: top;
+ float: left;
cursor: pointer;
- white-space: nowrap;
+}
+
+.tobago-tab img {
+ height: 12px;
}
.tobago-tab {
- display: inline-block;
- height: 100%;
+ /* needed for ie */
+ height: 14px;
}
-.tobago-tabGroup-header {
- position: relative;
+.tobago-tab a:link,
+.tobago-tab a:visited,
+.tobago-tab a:active {
+ color: #000000;
+ text-decoration: none;
}
-.tobago-tab-outer {
- border-color: #ddeeff #778899 #ddeeff #ddeeff;
- border-width: 1px 1px 1px 1px;
- border-style: solid;
- position: relative;
- display: inline-block;
- vertical-align: bottom;
- text-align: center;
+.tobago-tab-markup-selected {
+ border-bottom-width: 0;
+ font-weight: bold;
+ margin-top: 0;
+ padding-bottom: 4px;
}
-.tobago-tab-outer-markup-selected {
- border-width: 1px 1px 0 1px;
- padding: 0 0 0 0;
- height: 18px;
+.tobago-tab-markup-disabled,
+.tobago-tab-markup-disabled a:link,
+.tobago-tab-markup-disabled a:visited,
+.tobago-tab-markup-disabled a:active {
+ color: #778899;
}
-.tobago-tab-inner {
- margin: 0 1px;
- white-space: nowrap;
+.tobago-tab-markup-error,
+.tobago-tab-markup-error a:link,
+.tobago-tab-markup-error a:visited,
+.tobago-tab-markup-error a:active {
+ color: #FF0000;
}
-.tobago-tabGroup-fulfill {
- border-color: #ddeeff;
- border-width: 0 0 1px 0;
- display: inline-block;
- border-style: solid;
- vertical-align:bottom;
+.tobago-tab-markup-error span {
+ background-image: url("org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/dialog-error.png");
+ background-repeat: no-repeat;
+ background-position: left center;
+ padding-left: 13px;
+}
+
+.tobago-tabGroup {
+ position: absolute;
+}
+
+.tobago-tabGroup-header {
+ position: relative;
+ font: 12px arial, helvetica, sans-serif;
+ overflow: hidden;
+}
+
+.tobago-tabGroup-headerInner {
+ border-bottom: 1px solid #ddeeff;
+ height: 20px;
+ width: 10000px;
+ font: 12px arial, helvetica, sans-serif;
+ overflow: visible;
+}
+
+.tobago-tabGroup-toolBar {
+ position: absolute;
+ right: 0;
+ top: 4px;
+ height: 16px;
+ width: 49px;
+ border-bottom: 1px solid #ddeeff;
}
.tobago-tab-content {
+ position: relative;
border-color: #ddeeff #778899 #778899 #ddeeff;
border-width: 0 1px 1px 1px;
border-style: solid;
- padding: 11px 11px;
+ display: none;
}
-div.tobago-tabGroup-toolBar {
- border-color: #DDEEFF;
- border-style: solid;
- border-width: 1px;
- height: 16px;
- bottom: 0;
-/* width: 59px; */
- margin-right: 0;
- position: absolute;
- overflow: hidden;
- white-space: nowrap;
+.tobago-tab-content-markup-selected {
+ display: block;
}
/* tabGroupToolBar ----------------------------------------------------------------- */
@@ -1078,62 +1107,45 @@ div.tobago-tabGroup-toolBar {
FIXME may be fixed after TOBAGO-900
*/
-.tobago-toolBar {
- border: 2px groove #F6FAFF;
- position: relative;
- overflow: hidden;
- white-space: nowrap;
+.tobago-tabGroupToolBar {
+ border: 1px solid #000000;
+ background-color: #FFFFFF;
}
-
-.tobago-toolBar-item {
+.tobago-tabGroupToolBar-item {
position: relative;
- display: inline-block;
+ display: block;
+ float: left;
border-width: 0;
border-style: solid;
- margin: 0;
- left: 0;
+ margin: 0 1px;
+ left: -1px;
top: 0;
- cursor: pointer;
}
-
-.tobago-toolBar-item-markup-disabled {
- color: #778899;
- cursor: default;
-}
-
-.tobago-toolBar-button, .tobago-toolBar-menu {
- position: absolute;
- border-width: 0;
- padding: 0;
+.tobago-tabGroupToolBar-item-markup-selected {
+ border-width: 0 1px;
+ border-color: #aaaaaa;
margin: 0;
- background-color: transparent;
}
-.tobago-toolBar-item img {
- position: absolute;
+.tobago-tabGroupToolBar-item-markup-disabled {
+ color: #808080;
}
-.tobago-toolBar-label {
- position: absolute;
- font: bold 12px arial,helvetica,sans-serif;
- white-space: nowrap;
+.tobago-tabGroupToolBar-button {
+ position: relative;
+ display: block;
}
-.tobago-toolBar-button-markup-selected {
- background-color: #CCDDEE;
+.tobago-tabGroupToolBar-button-markup-selected {
+ background-color: #EEEEEE;
}
-.tobago-toolBar-button-markup-hover {
- background-color: #CCDDEE;
+.tobago-tabGroupToolBar-button-markup-hover {
+ background-color: #DDDDDD;
}
-.tobago-toolBar-separator {
- border: 1px inset #bbccdd;
- left: 4px;
- width: 0;
- top: 3px;
- bottom: 3px;
- position: absolute;
+.tobago-tabGroupToolBar-separator {
+ border: 1px solid #DDDDDD;
}
/* textarea ---------------------------------------------------------------- */
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/TabGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/TabGroupRenderer.java?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/TabGroupRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/TabGroupRenderer.java Mon Dec 13 13:05:38 2010
@@ -17,20 +17,11 @@ package org.apache.myfaces.tobago.render
* limitations under the License.
*/
-import org.apache.myfaces.tobago.component.UITab;
-import org.apache.myfaces.tobago.renderkit.css.Classes;
-import org.apache.myfaces.tobago.renderkit.css.Overflow;
-import org.apache.myfaces.tobago.renderkit.css.Style;
-import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
-import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
-import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
-
-import javax.faces.context.FacesContext;
-import java.io.IOException;
-
+/*
public class TabGroupRenderer
extends org.apache.myfaces.tobago.renderkit.html.scarborough.standard.tag.TabGroupRenderer {
+ TODO: not implemented in Tobago 1.5: the shadow may be set by jQuery in Tobago 1.5?
@Override
protected void encodeContent(
TobagoResponseWriter writer, FacesContext facesContext, UITab activeTab, Style body)
@@ -66,3 +57,4 @@ public class TabGroupRenderer
writer.endElement(HtmlElements.DIV);
}
}
+*/
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties Mon Dec 13 13:05:38 2010
@@ -51,6 +51,8 @@ Date.css.padding-top=2
Date.css.padding-right=2
Date.css.padding-bottom=2
+DatePicker.calendarPopupWidth=200
+DatePicker.calendarPopupHeight=200
DatePicker.fixedWidth=20
In.minimumHeight=20
@@ -95,19 +97,21 @@ Sheet.cellPaddingWidth=4
Sheet.borderLeft=1
Sheet.borderRight=1
-Tab.borderLeft=0
-Tab.borderTop=0
-Tab.borderRight=0
-Tab.borderBottom=0
-
-TabGroup.headerHeight=19
+TabGroup.headerHeight=21
TabGroup.tabLabelExtraWidth=20
-TabGroup.toolBarWidth=48
-TabGroup.toolBarExtra=2
-TabGroup.borderLeft=1
-TabGroup.borderTop=19
-TabGroup.borderRight=2
-TabGroup.borderBottom=2
+#TabGroup.toolBarWidth=48
+#TabGroup.toolBarExtra=2
+Tab.borderLeft=1
+Tab.borderTop=21
+Tab.borderRight=1
+Tab.borderBottom=1
+Tab.paddingLeft=5
+Tab.paddingTop=5
+Tab.paddingRight=5
+Tab.paddingBottom=5
+# shadow=1 activates the shadow
+# todo TabGroup.shadow=1
+# XXX with shadow add +1 to borderRight and borderBottom
Textarea.minimumHeight=33
Textarea.css.border-left-width=1
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css Mon Dec 13 13:05:38 2010
@@ -506,6 +506,44 @@ hr.tobago-separator, .tobago-separator-s
/* tab ---------------------------------------------------------------------- */
+.tobago-tab {
+ background-color: #E2E2E2;
+ border-color: #000000;
+}
+
+.tobago-tab-markup-selected {
+ color: #660000;
+ background: url("../image/box-header-bg.gif") repeat-x scroll center top #E8E8E8;
+}
+
+.tobago-tab-content {
+ border: 1px solid #000000;
+ border-top: 0 solid transparent;
+ background: #FAFAFA;
+}
+
+.tobago-tab-markup-disabled,
+.tobago-tab-markup-disabled a:link,
+.tobago-tab-markup-disabled a:visited,
+.tobago-tab-markup-disabled a:active {
+ color: #808080;
+}
+
+.tobago-tab-markup-selected a:link,
+.tobago-tab-markup-selected a:visited,
+.tobago-tab-markup-selected a:active {
+ color: #660000;
+}
+
+.tobago-tabGroup-headerInner {
+ border-bottom-color: #000000;
+}
+
+.tobago-tabGroup-toolBar {
+ border-bottom-color: #000000;
+}
+
+/*
.tobago-tab-link {
font: 12px Arial, Helvetica, sans-serif;
color: #660000;
@@ -552,13 +590,6 @@ span.tobago-tabGroup-fulfill {
vertical-align: bottom;
}
-.tobago-tab-content {
- border: 1px solid #000000;
- border-top: 0 solid transparent;
- padding: 10px 10px 10px 10px;
- background: #FAFAFA;
-}
-
.tobago-tab-shadow {
background: #B4B4B4;
border: 1px solid #B4B4B4;
@@ -569,10 +600,11 @@ span.tobago-tabGroup-fulfill {
div.tobago-tabGroup-toolBar {
border-color: #000000;
}
+*/
/* tabGroupToolBar ----------------------------------------------------------------- */
-.tobago-tabGroupToolBar {
+/*.tobago-tabGroupToolBar {
border: 1px solid #000000;
background-color: #FFFFFF;
}
@@ -592,9 +624,11 @@ div.tobago-tabGroup-toolBar {
}
.tobago-tabGroupToolBar-item-markup-hover {
+*//*
border-width: 0 1px;
border-color: #000000;
margin: 0;
+*//*
}
.tobago-tabGroupToolBar-item-markup-disabled {
@@ -611,7 +645,7 @@ div.tobago-tabGroup-toolBar {
.tobago-tabGroupToolBar-separator {
border: 1px solid #DDDDDD;
-}
+}*/
/* textarea ---------------------------------------------------------------- */
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml Mon Dec 13 13:05:38 2010
@@ -233,6 +233,10 @@
<supported-markup>
<markup>disabled</markup>
<markup>selected</markup>
+ <markup>fatal</markup>
+ <markup>error</markup>
+ <markup>warn</markup>
+ <markup>info</markup>
</supported-markup>
</renderer>
<renderer>
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tabgroup.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tabgroup.js?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tabgroup.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tabgroup.js Mon Dec 13 13:05:38 2010
@@ -15,311 +15,79 @@
* limitations under the License.
*/
+function tobago_initTab(elements) {
-Tobago.TabGroup = function(tabGroupId, activeIndex, size, renderedPartially) {
- this.tabGroupId = tabGroupId,
- this.activeIndex = parseInt(activeIndex, 10);
- this.size = size;
- this.activeTabId = tabGroupId + Tobago.SUB_COMPONENT_SEP2 + activeIndex;
- this.renderedPartially = renderedPartially;
- LOG.debug("activeTabId : " + this.activeTabId); // @DEV_ONLY
+ var tabGroups = Tobago.selectWidthJQuery(elements, ".tobago-tabGroup");
- Tobago.element(this.tabGroupId).jsObject = this;
- Tobago.addJsObject(this);
-
- // var htmlId = this.tabGroupId;
- //
- // var onComplete = function() {
- // LOG.debug("htmlId = " + htmlId);
- // var obj = document.getElementById(htmlId).jsObject;
- // LOG.debug("obj = " + typeof obj);
- // obj.onComplete.apply(obj, []);
- // };
-
- // this.options.onComplete = this.onComplete.bind(this);
-
- this.options = {
- };
-
- LOG.debug("onComplete = " + this.options.onComplete); // @DEV_ONLY
-
- this.setUp();
- Tobago.addAjaxComponent(this.tabGroupId, this);
-};
-
-Tobago.TabGroup.prototype.setUp = function() {
- LOG.debug("tabgroup id " + this.tabGroupId); // @DEV_ONLY
- LOG.debug("setup tabgroup " + this.activeTabId); // @DEV_ONLY
- LOG.debug("activeIndex " + this.activeIndex); // @DEV_ONLY
- var i = 0;
- var idPrefix = this.activeTabId + Tobago.SUB_COMPONENT_SEP2;
-
- // var htmlId = this.tabGroupId;
- for (i = 0; i < this.size; i++) {
-
- var anchor = Tobago.element(idPrefix + i);
- if (anchor) {
- LOG.debug("observe tab " + anchor.id); // @DEV_ONLY
- // if (i != this.activeIndex) {
- // Event.observe(anchor, "click", this.reload.bindAsEventListener(this));
- // }
-
- // var onClick = function(event) {
- // LOG.debug("htmlId = " + htmlId);
- // var obj = document.getElementById(htmlId).jsObject;
- // LOG.debug("obj = " + obj);
- // LOG.debug("obj.reload = " + obj.reload);
- // obj.reload.call(obj, event);
- // };
-
- // Tobago.addEventListener(anchor, "click", onClick);
- Tobago.addBindEventListener(anchor, "click", this, "reloadWithAction");
- }
- /*var menu = Tobago.element(idPrefix + i + Tobago.SUB_COMPONENT_SEP2 + "menu");
- if (menu) {
- Tobago.addBindEventListener(menu, "click", this, "reload");
- } else {
- LOG.error("Menu not found " + idPrefix + i + Tobago.SUB_COMPONENT_SEP2 + "menu");
- }*/
- }
- var next = Tobago.element(idPrefix + "next");
- var previous = Tobago.element(idPrefix + "previous");
- if (next) {
- Tobago.addBindEventListener(next, "click", this, "next");
- } //else {
- //LOG.error("Next not found " + idPrefix + "next");
- //}
- if (previous) {
- Tobago.addBindEventListener(previous, "click", this, "previous");
- } //else {
- //LOG.error("Previous not found " + idPrefix + "previous");
- //}
-
-};
-
-Tobago.TabGroup.prototype.next = function(event) {
- LOG.debug("Reload "); // @DEV_ONLY
- if (event) {
- var element = Tobago.element(event);
- if (!element.id) {
- element = element.parentElement;
- }
-
- if (element.className && element.className.indexOf("tobago-") != -1) {
- //LOG.error(element.id);
- var idPrefix = element.id.substring(0, element.id.lastIndexOf(Tobago.SUB_COMPONENT_SEP2) + Tobago.SUB_COMPONENT_SEP2.length);
- //LOG.error(idPrefix);
- for (var i = parseInt(this.activeIndex, 10) + 1; i < this.size; i++) {
- var id = idPrefix + i;
- var span = Tobago.element(id);
- if (span && span.className.indexOf('tobago-tab-link-markup-disabled') == -1) {
- this.activeIndex = i;
- break;
- }
- }
- //this.activeIndex =
- //LOG.error("Request tab with index " + this.activeIndex);
-
- var hidden = Tobago.element(this.tabGroupId + Tobago.SUB_COMPONENT_SEP2 + "activeIndex");
- if (hidden) {
- hidden.value = this.activeIndex;
- }
- else {
- LOG.warn("No hidden field for tabindex Id='" + this.tabGroupId + Tobago.SUB_COMPONENT_SEP2 + "activeIndex" + "'"); // @DEV_ONLY
- LOG.warn("aId = " + aId); // @DEV_ONLY
- }
- if (Tobago.Transport.hasTransport()) {
- var id = idPrefix + this.activeIndex;
- this.removeRelatedAcceleratorKeys(id.substring(0, id.lastIndexOf(Tobago.SUB_COMPONENT_SEP2) + Tobago.SUB_COMPONENT_SEP2.length));
- Tobago.createOverlay(Tobago.element(this.tabGroupId));
- Tobago.Updater.update(event.srcElement, this.tabGroupId, this.renderedPartially?this.renderedPartially:this.tabGroupId, this.options);
- } else {
- Tobago.submitAction2(event.srcElement, this.tabGroupId, null, null);
- }
- }
- } else {
- LOG.info("No reload Event"); // @DEV_ONLY
- }
-
-};
-
-Tobago.TabGroup.prototype.previous = function(event) {
- LOG.debug("Reload "); // @DEV_ONLY
- if (event) {
- var element = Tobago.element(event);
- if (!element.id) {
- element = element.parentElement;
- }
- //LOG.debug(element.className);
- if (element.className && element.className.indexOf("tobago") != -1) {
- //LOG.error(element.id);
- var idPrefix = element.id.substring(0, element.id.lastIndexOf(Tobago.SUB_COMPONENT_SEP2) + Tobago.SUB_COMPONENT_SEP2.length);
- //LOG.error(idPrefix);
- for (var i = this.activeIndex - 1; i >= 0; i--) {
- var id = idPrefix + i;
- var span = Tobago.element(id);
- if (span && span.className.indexOf('tobago-tab-link-markup-disabled') == -1) {
- this.activeIndex = i;
- break;
- }
- }
- //this.activeIndex =
- //LOG.error("Request tab with index " + this.activeIndex);
-
- var hidden = Tobago.element(this.tabGroupId + Tobago.SUB_COMPONENT_SEP2 + "activeIndex");
- if (hidden) {
- hidden.value = this.activeIndex;
- }
- else {
- LOG.warn("No hidden field for tabindex Id='" + this.tabGroupId + Tobago.SUB_COMPONENT_SEP2 + "activeIndex" + "'"); // @DEV_ONLY
- LOG.warn("aId = " + aId); // @DEV_ONLY
- }
- if (Tobago.Transport.hasTransport()) {
- var id = idPrefix + this.activeIndex;
- this.removeRelatedAcceleratorKeys(id.substring(0, id.lastIndexOf(Tobago.SUB_COMPONENT_SEP2) + Tobago.SUB_COMPONENT_SEP2.length));
- Tobago.createOverlay(Tobago.element(this.tabGroupId));
- Tobago.Updater.update(event.srcElement, this.tabGroupId, this.renderedPartially?this.renderedPartially:this.tabGroupId, this.options);
- } else {
- Tobago.submitAction2(event.srcElement, this.tabGroupId, null, null);
- }
- }
- } else {
- LOG.info("No reload Event"); // @DEV_ONLY
- }
-
-};
-
-Tobago.TabGroup.prototype.prepareReload = function() {
- // todo: check if this is correct (AJAX tab switching)
-};
-
-Tobago.TabGroup.prototype.reloadWithAction = function(event) {
- LOG.debug("Reload "); // @DEV_ONLY
- if (event) {
- var element = Tobago.element(event);
- if (!element.id) {
- element = element.parentElement;
- }
- //LOG.debug(element.className);
- if (element.className && element.className.indexOf("tobago-tab-link") != -1) {
- var aId = Tobago.findAnchestorWithTagName(element, 'span').id;
- this.activeIndex = aId.substring(aId.lastIndexOf(Tobago.SUB_COMPONENT_SEP2) + Tobago.SUB_COMPONENT_SEP2.length);
- LOG.debug("Request tab with index " + this.activeIndex); // @DEV_ONLY
-
- var hidden = Tobago.element(this.tabGroupId + Tobago.SUB_COMPONENT_SEP2 + "activeIndex");
- if (hidden) {
- hidden.value = this.activeIndex;
- }
- else {
- LOG.warn("No hidden field for tabindex Id='" + this.tabGroupId + Tobago.SUB_COMPONENT_SEP2 + "activeIndex" + "'"); // @DEV_ONLY
- LOG.warn("aId = " + aId); // @DEV_ONLY
- }
- if (Tobago.Transport.hasTransport()) {
- this.removeRelatedAcceleratorKeys(aId.substring(0, aId.lastIndexOf(Tobago.SUB_COMPONENT_SEP2) + Tobago.SUB_COMPONENT_SEP2.length));
- Tobago.createOverlay(Tobago.element(this.tabGroupId));
- Tobago.Updater.update(event.srcElement, this.tabGroupId, this.renderedPartially?this.renderedPartially:this.tabGroupId, this.options);
- } else {
- Tobago.submitAction(event.srcElement, this.tabGroupId);
- }
- }
- } else {
- LOG.info("No reload Event"); // @DEV_ONLY
- }
-
-};
-
-Tobago.TabGroup.prototype.removeRelatedAcceleratorKeys = function(idPrefix) {
- var regex = new RegExp("Tobago.clickOnElement\\([\"']" + idPrefix);
- for (var name in Tobago.acceleratorKeys) {
- if (typeof Tobago.acceleratorKeys[name] == 'object'
- && typeof Tobago.acceleratorKeys[name].func == 'function'
- && regex.test(Tobago.acceleratorKeys[name].func.valueOf())) {
- Tobago.acceleratorKeys.remove(Tobago.acceleratorKeys[name]);
- }
- }
-};
-
-Tobago.TabGroup.prototype.afterDoUpdateSuccess = function() {
- this.activeTabId = Tobago.element(this.tabGroupId).firstChild.id;
- LOG.debug("activeTabId : " + this.activeTabId); // @DEV_ONLY
- this.setUp();
-};
-
-// tab.js
-
-function tobago_switchTab(type, controlId, selectedIndex, size) {
- if ('client' == type) {
- tobago_selectTab(controlId, selectedIndex, size);
- } else if ('reloadPage' == type) {
- tobago_requestTab(controlId, selectedIndex);
- }
+ // initialize the tab header elements
+ // client case
+ tabGroups.filter("[switchType='client']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
+ var activeIndex = tobago_tabUpdateHidden(jQuery(this));
+ jQuery(this).siblings(".tobago-tab-markup-selected").removeClass("tobago-tab-markup-selected");
+ jQuery(this).addClass("tobago-tab-markup-selected");
+ var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+ tabGroup.find(".tobago-tab-content-markup-selected").removeClass("tobago-tab-content-markup-selected");
+ tabGroup.find(".tobago-tab-content[tabgroupindex=" + activeIndex
+ + "]").addClass("tobago-tab-content-markup-selected");
+ });
+
+ // initialize the tab header elements
+ // reload tab case
+ tabGroups.filter("[switchType='reloadTab']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
+ var activeIndex = tobago_tabUpdateHidden(jQuery(this));
+ LOG.debug("todo: ajax reload, activeIndex=" + activeIndex); // @DEV_ONLY
+ var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+ Tobago.Updater.update(tabGroup, tabGroup.attr("id"), tabGroup.attr("id"), {});
+ });
+
+ // initialize the tab header elements
+ // reload page case
+ tabGroups.filter("[switchType='reloadPage']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
+ var activeIndex = tobago_tabUpdateHidden(jQuery(this));
+ LOG.debug("todo: full reload, activeIndex=" + activeIndex); // @DEV_ONLY
+ var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+ Tobago.submitAction(tabGroup.eq(0), tabGroup.attr("id"));
+ });
+
+ // initialize previous button
+ // XXX ":first" and eq(1) are dangerous, please define e.g. a unique class for "previous" and "next"
+ tabGroups.find(".tobago-tabGroupToolBar-button:first").click(function() {
+ var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+ var selected = tabGroup.find(".tobago-tab-markup-selected");
+ // the nearest of the previous siblings, which are not disabled
+ selected.prevAll(":not(.tobago-tab-markup-disabled):first").click();
+ });
+
+ // initialize next button
+ // XXX ":first" and eq(1) are dangerous, please define e.g. a unique class for "previous" and "next"
+ tabGroups.find(".tobago-tabGroupToolBar-button:eq(1)").click(function() {
+ var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+ var selected = tabGroup.find(".tobago-tab-markup-selected");
+ // the nearest of the next siblings, which are not disabled
+ selected.nextAll(":not(.tobago-tab-markup-disabled):first").click();
+ });
+
+ // initialize menu
+ // XXX ":last" is dangerous, please define e.g. a unique class for "menu"
+// tabGroups.find(".tobago-tabGroupToolBar-button:last").find(".tobago-menu").click(function() {
+// var index = jQuery(this).prevAll().size();
+// var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+// var selected = tabGroup.find(".tobago-tab").eq(index).click();
+// });
+
+ // XXX hack for webkit to avoid scrollbars in box
+// jQuery('.tobago-tabGroup').hide();
+// jQuery('.tobago-tabGroup').show();
}
-function tobago_nextTab(type, controlId, size) {
- var hidden = document.getElementById(controlId
- + '__activeIndex' /* TabGroupRenderer.ACTIVE_INDEX_POSTFIX*/);
- var selectedIndex = 0;
- if (hidden) {
- selectedIndex = parseInt(hidden.value, 10);
- }
- //LOG.error("Selected Index: " + selectedIndex);
- for (i = selectedIndex + 1; i < size; i++) {
- var tab = document.getElementById(controlId + Tobago.SUB_COMPONENT_SEP2 + selectedIndex + Tobago.SUB_COMPONENT_SEP2 + i);
- //LOG.error("Search " + controlId + Tobago.SUB_COMPONENT_SEP2 + selectedIndex + Tobago.SUB_COMPONENT_SEP2 + i);
- if (tab && tab.className.indexOf('tobago-tab-link-markup-disabled') == -1) {
- //LOG.error("Selected Index: " + selectedIndex);
- selectedIndex = i;
- break;
- }
- }
- tobago_switchTab(type, controlId, selectedIndex, size);
-}
-
-function tobago_previousTab(type, controlId, size) {
- var hidden = document.getElementById(controlId
- + '__activeIndex' /* TabGroupRenderer.ACTIVE_INDEX_POSTFIX*/);
- var selectedIndex = 0;
- if (hidden) {
- selectedIndex = hidden.value;
- }
-
- for (i = selectedIndex - 1; i >= 0; i--) {
- var tab = document.getElementById(controlId + Tobago.SUB_COMPONENT_SEP2 + selectedIndex + Tobago.SUB_COMPONENT_SEP2 + i);
- if (tab && tab.className.indexOf('tobago-tab-link-markup-disabled') == -1) {
- selectedIndex = i;
- break;
- }
- }
- tobago_switchTab(type, controlId, selectedIndex, size);
-}
-
-function tobago_selectTab(controlId, selectedIndex, size) {
- var hidden = document.getElementById(controlId
- + '__activeIndex' /* TabGroupRenderer.ACTIVE_INDEX_POSTFIX*/);
- if (hidden) {
- hidden.value = selectedIndex;
- }
-
- for (i = 0; i < size; i++) {
- var tab = document.getElementById(controlId + Tobago.SUB_COMPONENT_SEP2 + i);
- if (tab) {
- if (i == selectedIndex) {
- tab.style.display = 'block';
- } else {
- tab.style.display = 'none';
- }
- }
- }
-}
-
-function tobago_requestTab(controlId, selectedIndex) {
-
- var hidden = document.getElementById(controlId
- + '__activeIndex' /* TabGroupRenderer.ACTIVE_INDEX_POSTFIX*/);
- if (hidden) {
- hidden.value = selectedIndex;
- }
-
- Tobago.submitAction(null /*todo: source*/, controlId);
+/**
+ * Update the hidden field for the active index.
+ * @param tab is a jQuery object which represents the clicked tab area.
+ */
+function tobago_tabUpdateHidden(tab) {
+ var tabGroup = tab.parents(".tobago-tabGroup:first");
+ var hidden = tabGroup.children("input");
+ var activeIndex = tab.attr("tabgroupindex");
+ hidden.attr("value", activeIndex);
+ return activeIndex;
}
-
Modified: myfaces/tobago/trunk/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/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1045104&r1=1045103&r2=1045104&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Mon Dec 13 13:05:38 2010
@@ -65,13 +65,6 @@ var Tobago = {
*/
SUB_COMPONENT_SEP: '::',
- /**
- * Tobago's subComponent separator constant
- * @const
- * @type {string}
- */
- SUB_COMPONENT_SEP2: '__',
-
EMPTY_HREF: window.all ? '#' : 'javascript:;',
/**
@@ -1068,10 +1061,10 @@ var Tobago = {
* @param elements a jQuery object to initialize (ajax) or null for initializing the whole document (full load).
* @param selector a jQuery selector.
*/
- selectWidthJQuery: function(elements, selector) {
+ selectWidthJQuery: function(elements, selector) {
return elements == null
? jQuery(selector)
- : elements.find(selector);
+ : elements.find(selector).add(elements.filter(selector));
},
calculateScrollbarWeights: function(id) {
@@ -2570,6 +2563,7 @@ function tobago_toolBarSetRadioValue(id,
function xxx_tobagoInit(elements) {
xxx_tobagoMenuInit(elements);
+ tobago_initTab(elements);
Tobago.fixPngAlphaAll(elements);
}