myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject svn commit: r1590236 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/ tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/ tobag...
Date Sat, 26 Apr 2014 13:44:44 GMT
Author: weber
Date: Sat Apr 26 13:44:44 2014
New Revision: 1590236

URL: http://svn.apache.org/r1590236
Log:
TOBAGO-1386 - ToolbarButtons in TabLabels

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java
    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/AbstractUITabGroup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java?rev=1590236&r1=1590235&r2=1590236&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
Sat Apr 26 13:44:44 2014
@@ -25,6 +25,7 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.OnComponentPopulated;
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.component.SupportsRenderedPartially;
+import org.apache.myfaces.tobago.component.UITab;
 import org.apache.myfaces.tobago.event.TabChangeEvent;
 import org.apache.myfaces.tobago.event.TabChangeListener;
 import org.apache.myfaces.tobago.event.TabChangeSource2;
@@ -138,8 +139,25 @@ public abstract class AbstractUITabGroup
       if (!isRendered()) {
         return;
       }
-      final AbstractUIPanelBase renderedTab = getRenderedTab();
-      renderedTab.processDecodes(context);
+      int index = 0;
+      for (final UIComponent child : getChildren()) {
+        if (child instanceof UITab) {
+          final UITab tab = (UITab) child;
+          if (tab.isRendered()) {
+            if (getRenderedIndex() == index) {
+              tab.processDecodes(context);
+            } else {
+              UIComponent facet = tab.getFacet(Facets.TOOL_BAR);
+              if (facet != null) {
+                facet.processDecodes(context);
+              }
+            }
+          }
+          index++;
+        }
+      }
+//      final AbstractUIPanelBase renderedTab = getRenderedTab();
+//      renderedTab.processDecodes(context);
       for (final UIComponent facet : getFacets().values()) {
         facet.processDecodes(context);
       }

Modified: myfaces/tobago/trunk/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/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css?rev=1590236&r1=1590235&r2=1590236&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
Sat Apr 26 13:44:44 2014
@@ -1277,6 +1277,18 @@ div.tobago-richTextEditor-body {
   padding-left: 13px;
 }
 
+.tobago-tab-toolBar {
+  position: relative;
+  float: right;
+  top: -2px;
+  right: -7px;
+}
+
+.tobago-tab-toolBar-markup-selected {
+  top: -1px;
+  right: -6px;
+}
+
 .tobago-tabGroup {
   position: absolute;
 }

Modified: myfaces/tobago/trunk/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/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java?rev=1590236&r1=1590235&r2=1590236&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java
Sat Apr 26 13:44:44 2014
@@ -54,6 +54,7 @@ import javax.el.ValueExpression;
 import javax.faces.application.Application;
 import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
+import javax.faces.component.UIPanel;
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.FacesContext;
 import java.io.IOException;
@@ -222,6 +223,11 @@ public class TabGroupRenderer extends La
           }
           writer.endElement(HtmlElements.A);
 
+          final UIPanel toolbar = (UIPanel) tab.getFacet(Facets.TOOL_BAR);
+          if (toolbar != null) {
+            renderTabToolbar(facesContext, writer, tab, toolbar);
+          }
+
           if (label.getAccessKey() != null) {
             if (LOG.isWarnEnabled()
                 && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey()))
{
@@ -245,6 +251,16 @@ public class TabGroupRenderer extends La
     }
   }
 
+  protected void renderTabToolbar(
+      final FacesContext facesContext, final TobagoResponseWriter writer, final UITab tab,
final UIPanel toolbar)
+      throws IOException {
+    writer.startElement(HtmlElements.SPAN, null);
+    writer.writeClassAttribute(Classes.create(tab, "toolBar"));
+    toolbar.setRendererType("TabGroupToolBar");
+    RenderUtils.encode(facesContext, toolbar);
+    writer.endElement(HtmlElements.SPAN);
+  }
+
   private UIToolBar createToolBar(final FacesContext facesContext, final UITabGroup tabGroup)
{
     final String clientId = tabGroup.getClientId(facesContext);
     final Application application = facesContext.getApplication();
@@ -256,12 +272,15 @@ public class TabGroupRenderer extends La
     previous.setRendererType(null);
     previous.getAttributes().put(Attributes.IMAGE, "image/tabPrev.gif");
     previous.setOmit(true); // avoid submit
+    ComponentUtils.putDataAttribute(previous, "tobago-tabgroup-toolbar-prev", "p");
+
     // next
     final UICommand next = (UICommand) application.createComponent(UICommand.COMPONENT_TYPE);
     next.setId(viewRoot.createUniqueId());
     next.setRendererType(null);
     next.getAttributes().put(Attributes.IMAGE, "image/tabNext.gif");
     next.setOmit(true); // avoid submit
+    ComponentUtils.putDataAttribute(next, "tobago-tabgroup-toolbar-next", "n");
 
     // all: sub menu to select any tab directly
     final UICommand all = (UICommand) CreateComponentUtils.createComponent(

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=1590236&r1=1590235&r2=1590236&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
Sat Apr 26 13:44:44 2014
@@ -890,6 +890,8 @@ var Tobago = {
                 } else {
                   Tobago.reloadComponent(this, commands.click.partially, action, commands.click);
                 }
+                event.preventDefault();
+                return false;
               } else if (commands.click.url) {
                 if (commands.click.target) {
                   window.open(commands.click.url, commands.click.target)
@@ -2627,8 +2629,7 @@ Tobago.TabGroup.init = function(elements
   });
 
   // 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() {
+  tabGroups.find("[data-tobago-tabgroup-toolbar-prev]").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
@@ -2636,8 +2637,7 @@ Tobago.TabGroup.init = function(elements
   });
 
   // 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() {
+  tabGroups.find("[data-tobago-tabgroup-toolbar-next]").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



Mime
View raw message