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 2016/01/28 14:15:57 UTC
svn commit: r1727333 - in /myfaces/tobago/branches/tobago-3.0.x:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/
tobago-core/src/main/java/org/apache...
Author: lofwyr
Date: Thu Jan 28 13:15:56 2016
New Revision: 1727333
URL: http://svn.apache.org/viewvc?rev=1727333&view=rev
Log:
TOBAGO-1496: Adapt the tc:tabGroup and tc:tab to Bootstrap
Added:
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SwitchType.java
Modified:
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabGroupTagDeclaration.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/tobago.css
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/tobago.css
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tab.js
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css
myfaces/tobago/branches/tobago-3.0.x/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component.stg
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java?rev=1727333&r1=1727332&r2=1727333&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java Thu Jan 28 13:15:56 2016
@@ -29,6 +29,7 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.event.TabChangeEvent;
import org.apache.myfaces.tobago.event.TabChangeListener;
import org.apache.myfaces.tobago.event.TabChangeSource2;
+import org.apache.myfaces.tobago.model.SwitchType;
import org.apache.myfaces.tobago.util.ComponentUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,12 +52,6 @@ public abstract class AbstractUITabGroup
private static final Logger LOG = LoggerFactory.getLogger(AbstractUITabGroup.class);
- public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.TabGroup";
-
- public static final String SWITCH_TYPE_CLIENT = "client";
- public static final String SWITCH_TYPE_RELOAD_PAGE = "reloadPage";
- public static final String SWITCH_TYPE_RELOAD_TAB = "reloadTab";
-
@Override
public void encodeChildren(final FacesContext facesContext) throws IOException {
}
@@ -75,7 +70,7 @@ public abstract class AbstractUITabGroup
public void queueEvent(final FacesEvent event) {
if (this == event.getSource()) {
- if (isImmediate() || isSwitchTypeClient()) {
+ if (isImmediate() || getSwitchType() == SwitchType.client) {
// if switch type client event is always immediate
event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
} else {
@@ -85,28 +80,28 @@ public abstract class AbstractUITabGroup
super.queueEvent(event);
}
- public AbstractUIPanel[] getTabs() {
- final List<AbstractUIPanel> tabs = new ArrayList<AbstractUIPanel>();
+ public AbstractUITab[] getTabs() {
+ final List<AbstractUITab> tabs = new ArrayList<AbstractUITab>();
for (final UIComponent kid : getChildren()) {
- if (kid instanceof AbstractUIPanel) {
+ if (kid instanceof AbstractUITab) {
//if (kid.isRendered()) {
- tabs.add((AbstractUIPanel) kid);
+ tabs.add((AbstractUITab) kid);
//}
} else {
LOG.error("Invalid component in UITabGroup: " + kid);
}
}
- return tabs.toArray(new AbstractUIPanel[tabs.size()]);
+ return tabs.toArray(new AbstractUITab[tabs.size()]);
}
- public AbstractUIPanel getActiveTab() {
+ public AbstractUITab getActiveTab() {
return getTab(getSelectedIndex());
}
@Override
public void processDecodes(final FacesContext context) {
- if (!isSwitchTypeClient()) {
+ if (!(getSwitchType() == SwitchType.client)) {
if (context == null) {
throw new NullPointerException("context");
@@ -149,14 +144,14 @@ public abstract class AbstractUITabGroup
@Override
public void processValidators(final FacesContext context) {
- if (!isSwitchTypeClient()) {
+ if (!(getSwitchType() == SwitchType.client)) {
if (context == null) {
throw new NullPointerException("context");
}
if (!isRendered()) {
return;
}
- final AbstractUIPanel renderedTab = getRenderedTab();
+ final AbstractUITab renderedTab = getRenderedTab();
renderedTab.processValidators(context);
for (final UIComponent facet : getFacets().values()) {
facet.processValidators(context);
@@ -168,14 +163,14 @@ public abstract class AbstractUITabGroup
@Override
public void processUpdates(final FacesContext context) {
- if (!isSwitchTypeClient()) {
+ if (!(getSwitchType() == SwitchType.client)) {
if (context == null) {
throw new NullPointerException("context");
}
if (!isRendered()) {
return;
}
- final AbstractUIPanel renderedTab = getRenderedTab();
+ final AbstractUITab renderedTab = getRenderedTab();
renderedTab.processUpdates(context);
for (final UIComponent facet : getFacets().values()) {
facet.processUpdates(context);
@@ -203,7 +198,7 @@ public abstract class AbstractUITabGroup
// }
// XXX is this needed?
- if (!isSwitchTypeClient()) {
+ if (!(getSwitchType() == SwitchType.client)) {
final ActionListener defaultActionListener = getFacesContext().getApplication().getActionListener();
if (defaultActionListener != null) {
defaultActionListener.processAction(event);
@@ -220,17 +215,12 @@ public abstract class AbstractUITabGroup
}
public void addTabChangeListener(final TabChangeListener listener) {
- if (LOG.isWarnEnabled() && isSwitchTypeClient()) {
+ if (LOG.isWarnEnabled() && getSwitchType() == SwitchType.client) {
LOG.warn("Adding TabChangeListener to client side TabGroup!");
}
addFacesListener(listener);
}
- public boolean isSwitchTypeClient() {
- final String switchType = getSwitchType();
- return (switchType == null || switchType.equals(SWITCH_TYPE_CLIENT));
- }
-
public void removeTabChangeListener(final TabChangeListener listener) {
removeFacesListener(listener);
}
@@ -247,14 +237,14 @@ public abstract class AbstractUITabGroup
public abstract void setSelectedIndex(Integer index);
- public abstract String getSwitchType();
+ public abstract SwitchType getSwitchType();
- private AbstractUIPanel getTab(final int index) {
+ private AbstractUITab getTab(final int index) {
int i = 0;
for (final UIComponent component : getChildren()) {
- if (component instanceof AbstractUIPanel) {
+ if (component instanceof AbstractUITab) {
if (i == index) {
- return (AbstractUIPanel) component;
+ return (AbstractUITab) component;
}
i++;
} else {
@@ -265,7 +255,7 @@ public abstract class AbstractUITabGroup
return null;
}
- private AbstractUIPanel getRenderedTab() {
+ private AbstractUITab getRenderedTab() {
return getTab(getRenderedIndex());
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabGroupTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabGroupTagDeclaration.java?rev=1727333&r1=1727332&r2=1727333&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabGroupTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabGroupTagDeclaration.java Thu Jan 28 13:15:56 2016
@@ -26,13 +26,13 @@ import org.apache.myfaces.tobago.apt.ann
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.internal.component.AbstractUITabGroup;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasAction;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasActionListener;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasRenderedPartially;
import org.apache.myfaces.tobago.internal.taglib.declaration.IsImmediateCommand;
import org.apache.myfaces.tobago.internal.taglib.declaration.IsVisual;
+import org.apache.myfaces.tobago.model.SwitchType;
import javax.faces.component.UIPanel;
@@ -75,10 +75,10 @@ public interface TabGroupTagDeclaration
* @param switchType Sets the switching type.
*/
@TagAttribute
- @UIComponentTagAttribute(type = "java.lang.String",
- allowedValues = {AbstractUITabGroup.SWITCH_TYPE_CLIENT, AbstractUITabGroup.SWITCH_TYPE_RELOAD_PAGE,
- AbstractUITabGroup.SWITCH_TYPE_RELOAD_TAB},
- defaultValue = AbstractUITabGroup.SWITCH_TYPE_CLIENT)
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.model.SwitchType",
+ allowedValues = {SwitchType.CLIENT, SwitchType.RELOAD_PAGE, SwitchType.RELOAD_TAB},
+ defaultValue = SwitchType.CLIENT,
+ defaultCode = "org.apache.myfaces.tobago.model.SwitchType.client")
void setSwitchType(String switchType);
/**
@@ -92,7 +92,7 @@ public interface TabGroupTagDeclaration
void setSelectedIndex(String selectedIndex);
/**
- * For internal use. TODO: Check if this long needed
+ * For internal use. TBD: Check if this is needed any longer.
*/
@UIComponentTagAttribute(type = "java.lang.Integer", defaultValue = "0")
void setRenderedIndex(String renderedIndex);
Added: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SwitchType.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SwitchType.java?rev=1727333&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SwitchType.java (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SwitchType.java Thu Jan 28 13:15:56 2016
@@ -0,0 +1,32 @@
+/*
+ * 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.model;
+
+public enum SwitchType {
+
+ client,
+ reloadPage,
+ reloadTab;
+
+ public static final String CLIENT = "client";
+ public static final String RELOAD_PAGE = "reloadPage";
+ public static final String RELOAD_TAB = "reloadTab";
+
+}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java?rev=1727333&r1=1727332&r2=1727333&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRoleValues.java Thu Jan 28 13:15:56 2016
@@ -27,7 +27,9 @@ public enum HtmlRoleValues {
MENU("menu"),
NAVIGATION("navigation"),
PRESENTATION("presentation"),
- TABLIST("tablist");
+ TAB("tab"),
+ TABLIST("tablist"),
+ TABPANEL("tabpanel");
private String value;
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/tobago.css?rev=1727333&r1=1727332&r2=1727333&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/tobago.css (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/tobago.css Thu Jan 28 13:15:56 2016
@@ -119,35 +119,6 @@ li.tobago-menu-markup-selected {
color: highlighttext;
}
-/* tab ---------------------------------------------------------------------- */
-
-.tobago-tab {
- background: #FFEECF;
- border-color: #FECB66;
- color: #660000;
-}
-
-.tobago-tab-content {
- border-color: #FECB66;
- background: #FAFAFA;
-}
-
-.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-tabGroup-headerInner {
- border-bottom-color: #FECB66;
-}
-
-.tobago-tabGroup-toolBar {
- border-bottom-color: #FECB66;
-}
-
/* tabGroupToolBar ----------------------------------------------------------------- */
/* FIXME this is the same code for "toolBar", "boxToolBar" and "tabGroupToolBar"
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/tobago.css?rev=1727333&r1=1727332&r2=1727333&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/tobago.css (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/tobago.css Thu Jan 28 13:15:56 2016
@@ -235,41 +235,6 @@ li.tobago-menu-markup-selected {
color: highlighttext;
}
-/* tab ---------------------------------------------------------------------- */
-
-.tobago-tab {
- background: #6699FF repeat-x top;
- border-color: #3366CC;
- color: #D6EBFF;
-}
-
-.tobago-tab-content {
- border-color: #3366CC;
- background: #FAFAFA;
-}
-
-.tobago-tab a:link,
-.tobago-tab a:visited,
-.tobago-tab a:active {
- color: #D6EBFF;
-}
-
-.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-tabGroup-headerInner {
- border-bottom-color: #3366CC;
-}
-
-.tobago-tabGroup-toolBar {
- border-bottom-color: #3366CC;
-}
-
/* toolBar ----------------------------------------------------------------- */
/* FIXME this is the same code for "toolBar", "boxToolBar" and "tabGroupToolBar"
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=1727333&r1=1727332&r2=1727333&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css Thu Jan 28 13:15:56 2016
@@ -1002,25 +1002,6 @@ hr.tobago-separator {
border: none;
}
-.tobago-tabGroup {
- /*position: absolute;XXX TOBAGO3*/
-}
-
-.tobago-tabGroup-header {
- /*position: relative;XXX TOBAGO3*/
- font: 12px arial, helvetica, sans-serif;
- overflow: auto;
- /*overflow: hidden;XXX TOBAGO3*/
-}
-
-.tobago-tabGroup-headerInner {
- border-bottom: 1px solid #ddeeff;
- height: 20px;
- /*width: 10000px;XXX TOBAGO3*/
- font: 12px arial, helvetica, sans-serif;
- /*overflow: visible;XXX TOBAGO3*/
-}
-
.tobago-tabGroup-toolBar {
/*position: absolute;XXX TOBAGO3
right: 0;
@@ -1034,17 +1015,6 @@ hr.tobago-separator {
border-bottom: 1px solid #ddeeff;
}
-.tobago-tab-content {
- /*position: relative;XXX TOBAGO3*/
- border-color: #ddeeff #778899 #778899 #ddeeff;
- border-style: solid;
- /*overflow: hidden;XXX TOBAGO3*/
-}
-
-.tobago-tab-content-markup-selected {
- display: block;
-}
-
/* tabGroupToolBar ----------------------------------------------------------------- */
/* FIXME this is the same code for "toolBar", "boxToolBar" and "tabGroupToolBar"
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=1727333&r1=1727332&r2=1727333&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less Thu Jan 28 13:15:56 2016
@@ -597,104 +597,6 @@ hr.tobago-separator, .tobago-separator-s
margin-left: 0px;
}
-/* tab ---------------------------------------------------------------------- */
-
-.tobago-tab {
- background-color: #E2E2E2;
- border-color: darken(@borderColor, 10%);
- .border-radius(2px 2px 0 0);
-}
-
-.tobago-tab-markup-selected {
- color: @textColor2;
- background: url("../image/box-header-bg.png") repeat-x scroll center top #E8E8E8;
-}
-
-.tobago-tab-content {
- border: 1px solid darken(@borderColor, 10%);
- 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: @disabledTextColor;
-}
-
-.tobago-tab-markup-selected a:link,
-.tobago-tab-markup-selected a:visited,
-.tobago-tab-markup-selected a:active {
- color: @textColor2;
-}
-
-.tobago-tabGroup-headerInner {
- border-bottom-color: darken(@borderColor, 10%);
-}
-
-.tobago-tabGroup-toolBar {
- border-bottom-color: darken(@borderColor, 10%);
-}
-
-/*
-.tobago-tab-link {
- font: 12px Arial, Helvetica, sans-serif;
- color: @textColor2;
-}
-
-.tobago-tab-link-markup-disabled {
- color: @disabledTextColor;
-}
-
-.tobago-tab {
- display: inline-block;
- height: 100%;
-}
-
-.tobago-tabGroup-header {
- position: relative;
-}
-
-.tobago-tab-outer {
- display: inline-block;
- border-color: darken(@borderColor, 10%);
- background: url(../image/tab-header-unselected-bg.png) repeat-x top;
-}
-
-.tobago-tab-outer-markup-selected {
- padding: 0 0 0 0;
- background: url(../image/tab-header-selected-bg.png) repeat-x top;
- height: 18px;
-}
-
-.tobago-tab-inner {
- font: @font;
- color: @textColor2;
-}
-
-.tobago-tab-inner-markup-selected {
- display: inline-block;
-}
-
-span.tobago-tabGroup-fulfill {
- border-color: darken(@borderColor, 10%);
- display: inline-block;
- border-bottom: 1px solid;
- vertical-align: bottom;
-}
-
-.tobago-tab-shadow {
- background: #B4B4B4;
- border: 1px solid #B4B4B4;
- border-top: 0px solid transparent;
- border-left: 0px solid transparent;
-}
-
-div.tobago-tabGroup-toolBar {
- border-color: darken(@borderColor, 10%);
-}
-*/
-
/* tabGroupToolBar ----------------------------------------------------------------- */
/*.tobago-tabGroupToolBar {
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.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/css/BootstrapClass.java?rev=1727333&r1=1727332&r2=1727333&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java Thu Jan 28 13:15:56 2016
@@ -141,6 +141,8 @@ public enum BootstrapClass implements Cs
RADIO("radio"),
ROW("row"),
SR_ONLY("sr-only"),
+ TAB_CONTENT("tab-content"),
+ TAB_PANE("tab-pane"),
TABLE("table"),
TABLE_BORDERED("table-bordered"),
TABLE_HOVER("table-hover"),
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=1727333&r1=1727332&r2=1727333&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 Thu Jan 28 13:15:56 2016
@@ -19,6 +19,7 @@
package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
+import org.apache.myfaces.tobago.ajax.AjaxUtils;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
@@ -33,6 +34,7 @@ import org.apache.myfaces.tobago.context
import org.apache.myfaces.tobago.event.TabChangeEvent;
import org.apache.myfaces.tobago.internal.component.AbstractUIPanel;
import org.apache.myfaces.tobago.internal.util.AccessKeyLogger;
+import org.apache.myfaces.tobago.model.SwitchType;
import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import org.apache.myfaces.tobago.renderkit.css.Classes;
@@ -99,7 +101,7 @@ public class TabGroupRenderer extends Re
final String clientId = tabGroup.getClientId(facesContext);
final String hiddenId = clientId + TabGroupRenderer.ACTIVE_INDEX_POSTFIX;
- final String switchType = tabGroup.getSwitchType();
+ final SwitchType switchType = tabGroup.getSwitchType();
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
writer.startElement(HtmlElements.DIV);
@@ -107,7 +109,7 @@ public class TabGroupRenderer extends Re
writer.writeClassAttribute(Classes.create(tabGroup), tabGroup.getCustomClass());
HtmlRendererUtils.writeDataAttributes(facesContext, writer, tabGroup);
writer.writeStyleAttribute(tabGroup.getStyle());
- writer.writeAttribute(HtmlAttributes.SWITCHTYPE, switchType, false);
+ writer.writeAttribute(HtmlAttributes.SWITCHTYPE, switchType.name(), false);
final String[] clientIds
= ComponentUtils.evaluateClientIds(facesContext, tabGroup, tabGroup.getRenderedPartially());
if (clientIds.length > 0) {
@@ -121,17 +123,9 @@ public class TabGroupRenderer extends Re
writer.writeIdAttribute(hiddenId);
writer.endElement(HtmlElements.INPUT);
- encodeHeader(facesContext, writer, tabGroup, activeIndex);
+ encodeHeader(facesContext, writer, tabGroup, activeIndex, switchType);
- int index = 0;
- for (final UIComponent tab : tabGroup.getChildren()) {
- if (tab instanceof UITab) {
- if (tab.isRendered() && (UITabGroup.SWITCH_TYPE_CLIENT.equals(switchType) || index == activeIndex)) {
- encodeContent(writer, facesContext, (UITab) tab, index);
- }
- index++;
- }
- }
+ encodeContent(facesContext, writer, tabGroup, activeIndex, switchType);
writer.endElement(HtmlElements.DIV);
}
@@ -174,14 +168,11 @@ public class TabGroupRenderer extends Re
private void encodeHeader(
final FacesContext facesContext, final TobagoResponseWriter writer, final UITabGroup tabGroup,
- final int activeIndex)
+ final int activeIndex, final SwitchType switchType)
throws IOException {
- writer.startElement(HtmlElements.DIV);
- writer.writeClassAttribute(Classes.create(tabGroup, "header"));
-
writer.startElement(HtmlElements.UL);
- writer.writeClassAttribute(Classes.create(tabGroup, "headerInner"), BootstrapClass.NAV, BootstrapClass.NAV_TABS);
+ writer.writeClassAttribute(Classes.create(tabGroup, "header"), BootstrapClass.NAV, BootstrapClass.NAV_TABS);
writer.writeAttribute(HtmlAttributes.ROLE, HtmlRoleValues.TABLIST.toString(), false);
int index = 0;
@@ -201,12 +192,7 @@ public class TabGroupRenderer extends Re
ComponentUtils.addCurrentMarkup(tab, ComponentUtils.markupOfSeverity(maxSeverity));
}
writer.startElement(HtmlElements.LI);
- // todo: fix Css management
- if (activeIndex == index) {
- writer.writeClassAttribute(Classes.create(tab), BootstrapClass.NAV_ITEM, BootstrapClass.ACTIVE);
- } else {
- writer.writeClassAttribute(Classes.create(tab), BootstrapClass.NAV_ITEM);
- }
+ writer.writeClassAttribute(Classes.create(tab), BootstrapClass.NAV_ITEM);
writer.writeAttribute(HtmlAttributes.ROLE, HtmlRoleValues.PRESENTATION.toString(), false);
writer.writeAttribute(HtmlAttributes.TABGROUPINDEX, index);
final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, tab);
@@ -215,9 +201,21 @@ public class TabGroupRenderer extends Re
}
writer.startElement(HtmlElements.A);
- writer.writeClassAttribute(BootstrapClass.NAV_ITEM);
- if (!disabled) {
- writer.writeAttribute(HtmlAttributes.HREF, "#", false);
+ writer.writeAttribute(DataAttributes.TOGGLE, "tab", false);
+ if (activeIndex == index) {
+ writer.writeClassAttribute(BootstrapClass.NAV_LINK, BootstrapClass.ACTIVE);
+ } else {
+ writer.writeClassAttribute(BootstrapClass.NAV_LINK);
+ }
+ if (!disabled && switchType == SwitchType.client) {
+ writer.writeAttribute(HtmlAttributes.HREF, '#' + getTabPanelId(facesContext, tab), false);
+ if (AjaxUtils.isAjaxRequest(facesContext)) {
+ writer.writeAttribute(
+ DataAttributes.TARGET, '#' + getTabPanelId(facesContext, tab).replaceAll(":", "\\\\\\\\:"), false);
+ } else {
+ writer.writeAttribute(
+ DataAttributes.TARGET, '#' + getTabPanelId(facesContext, tab).replaceAll(":", "\\\\:"), false);
+ }
}
final String tabId = tab.getClientId(facesContext);
writer.writeIdAttribute(tabId);
@@ -226,6 +224,7 @@ public class TabGroupRenderer extends Re
writer.writeAttribute(HtmlAttributes.ACCESSKEY, Character.toString(label.getAccessKey()), false);
AccessKeyLogger.addAccessKey(facesContext, label.getAccessKey(), tabId);
}
+ writer.writeAttribute(HtmlAttributes.ROLE, HtmlRoleValues.TAB.toString(), false);
String image = tab.getImage();
// tab.getImage() resolves to empty string if el-expression resolves to null
@@ -258,7 +257,6 @@ public class TabGroupRenderer extends Re
index++;
}
writer.endElement(HtmlElements.UL);
- writer.endElement(HtmlElements.DIV);
if (tabGroup.isShowNavigationBar()) {
final UIToolBar toolBar = createToolBar(facesContext, tabGroup);
renderToolBar(facesContext, writer, tabGroup, toolBar);
@@ -353,21 +351,38 @@ public class TabGroupRenderer extends Re
}
protected void encodeContent(
- final TobagoResponseWriter writer, final FacesContext facesContext, final UITab tab, final int index)
- throws IOException {
+ FacesContext facesContext, TobagoResponseWriter writer, UITabGroup tabGroup,
+ int activeIndex, SwitchType switchType) throws IOException {
+ writer.startElement(HtmlElements.DIV);
+ writer.writeClassAttribute(BootstrapClass.TAB_CONTENT);
+ int index = 0;
+ for (final UIComponent tab : tabGroup.getChildren()) {
+ if (tab instanceof UITab) {
+ if (tab.isRendered() && (switchType == SwitchType.client || index == activeIndex)) {
- if (tab.isDisabled()) {
- return;
- }
+ if (((UITab) tab).isDisabled()) {
+ continue;
+ }
- writer.startElement(HtmlElements.DIV);
- writer.writeClassAttribute(Classes.create(tab, "content"), BootstrapClass.CARD_BLOCK);
- writer.writeIdAttribute(tab.getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "content");
+ writer.startElement(HtmlElements.DIV);
+ writer.writeClassAttribute(Classes.create(tab, "content"),
+ BootstrapClass.TAB_PANE, index == activeIndex ? BootstrapClass.ACTIVE: null);
+ writer.writeAttribute(HtmlAttributes.ROLE, HtmlRoleValues.TABPANEL.toString(), false);
+ writer.writeIdAttribute(getTabPanelId(facesContext, (UITab) tab));
- writer.writeAttribute(HtmlAttributes.TABGROUPINDEX, index);
+ writer.writeAttribute(HtmlAttributes.TABGROUPINDEX, index);
- RenderUtils.encode(facesContext, tab);
+ RenderUtils.encode(facesContext, tab);
+ writer.endElement(HtmlElements.DIV);
+ }
+ index++;
+ }
+ }
writer.endElement(HtmlElements.DIV);
}
+
+ private String getTabPanelId(FacesContext facesContext, UITab tab) {
+ return tab.getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "content";
+ }
}
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-tab.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-tab.js?rev=1727333&r1=1727332&r2=1727333&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-tab.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-tab.js Thu Jan 28 13:15:56 2016
@@ -26,28 +26,9 @@ Tobago.TabGroup.init = function(elements
var tabGroups = Tobago.Utils.selectWithJQuery(elements, ".tobago-tabGroup");
// initialize the tab header elements
- // client case
- tabGroups.filter("[switchType='client']").each(function() {
- jQuery(this).find(".tobago-tabGroup-headerInner").first()
- .children(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
- var activeIndex = Tobago.TabGroup.updateHidden(jQuery(this));
- jQuery(this).siblings(".tobago-tab-markup-selected").removeClass("tobago-tab-markup-selected")
- .removeClass("active"); // "active" is bootstrap
- jQuery(this).addClass("tobago-tab-markup-selected").addClass("active"); // "active" is bootstrap
- var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
- tabGroup.children(".tobago-tab-content-markup-selected").removeClass("tobago-tab-content-markup-selected");
- tabGroup.children(".tobago-tab-content[tabgroupindex=" + activeIndex + "]")
- .addClass("tobago-tab-content-markup-selected");
- // scroll the tabs, if necessary
- var header = jQuery(this).parents(".tobago-tabGroup-header:first");
- Tobago.TabGroup.ensureScrollPosition(header);
- })
- });
-
- // initialize the tab header elements
// reload tab case
tabGroups.filter("[switchType='reloadTab']").each(function() {
- jQuery(this).find(".tobago-tabGroup-headerInner").first()
+ jQuery(this).find(".tobago-tabGroup-header").first()
.children(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
var tab = jQuery(this);
var activeIndex = Tobago.TabGroup.updateHidden(tab);
@@ -64,7 +45,7 @@ Tobago.TabGroup.init = function(elements
// initialize the tab header elements
// reload page case
tabGroups.filter("[switchType='reloadPage']").each(function() {
- jQuery(this).find(".tobago-tabGroup-headerInner").first()
+ jQuery(this).find(".tobago-tabGroup-header").first()
.children(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
var activeIndex = Tobago.TabGroup.updateHidden(jQuery(this));
console.debug("todo: full reload, activeIndex=" + activeIndex); // @DEV_ONLY
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css
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/style/tobago.css?rev=1727333&r1=1727332&r2=1727333&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/style/tobago.css (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css Thu Jan 28 13:15:56 2016
@@ -434,27 +434,7 @@ table.tobago-sheet-bodyTable>tbody>tr>td
margin: 0;
}
-/* tab -------------------------------------------------------------- */
-
-.tobago-tab-content {
- display: none;
- border: 1px solid #cccccc;
- padding: 5px;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
-}
-
-/* 1st is hidden, 2nd is header, 3rd is toolbar, 4th is the first content tab */
-.tobago-tab-content:nth-child(4) {
- -webkit-border-top-left-radius: 0;
- -moz-border-radius-topleft: 0;
- border-top-left-radius: 0;
-}
-
-.tobago-tab-content-markup-selected {
- display: block;
-}
+/* out -------------------------------------------------------------- */
.tobago-out {
display: inline-block;
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component.stg?rev=1727333&r1=1727332&r2=1727333&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component.stg (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component.stg Thu Jan 28 13:15:56 2016
@@ -350,6 +350,10 @@ SelectableProperty(property) ::= <<
<NormalProperty(property)>
>>
+SwitchTypeProperty(property) ::= <<
+<NormalProperty(property)>
+>>
+
StringProperty(property) ::= <<
<NormalProperty(property)>
>>