You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2014/04/26 21:33:33 UTC

svn commit: r1590284 - in /myfaces/tobago/branches/tobago-3.0.x: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarboroug...

Author: weber
Date: Sat Apr 26 19:33:33 2014
New Revision: 1590284

URL: http://svn.apache.org/r1590284
Log:
TOBAGO-1391 - TabGroup should allow a icon in front of tab label [Merged from trunk: revision 1590282]

Modified:
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabTagDeclaration.java   (contents, props changed)
    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   (contents, props changed)
    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   (contents, props changed)

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabTagDeclaration.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/TabTagDeclaration.java?rev=1590284&r1=1590283&r2=1590284&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabTagDeclaration.java Sat Apr 26 19:33:33 2014
@@ -24,6 +24,7 @@ import org.apache.myfaces.tobago.apt.ann
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasCurrentMarkup;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasImage;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasLabelAndAccessKey;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasMarkup;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasTip;
@@ -46,5 +47,5 @@ import javax.faces.component.UIPanel;
     rendererType = RendererTypes.TAB)
 public interface TabTagDeclaration
     extends HasIdBindingAndRendered, IsGridLayoutContainer, IsGridLayoutComponent,
-    HasLabelAndAccessKey, HasTip, HasMarkup, HasCurrentMarkup, IsDisabled {
+    HasLabelAndAccessKey, HasTip, HasMarkup, HasCurrentMarkup, IsDisabled, HasImage {
 }

Propchange: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabTagDeclaration.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sat Apr 26 19:33:33 2014
@@ -0,0 +1,3 @@
+/myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabTagDeclaration.java:1356585,1357124
+/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabTagDeclaration.java:1226794-1341423
+/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabTagDeclaration.java:1571193,1571804,1571816,1571941,1571945,1571962,1571966,1576730,1589960,1590282

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=1590284&r1=1590283&r2=1590284&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 Sat Apr 26 19:33:33 2014
@@ -1290,6 +1290,17 @@ div.tobago-richTextEditor-body {
   right: -6px;
 }
 
+.tobago-tab-image {
+  position: relative;
+  top: 1px;
+}
+
+.tobago-tab-image-right-margin {
+  margin-right: 5px;
+  position: relative;
+  top: 1px;
+}
+
 .tobago-tabGroup {
   /*position: absolute;XXX TOBAGO3*/
 }

Propchange: 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
------------------------------------------------------------------------------
  Merged /myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css:r1590282

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=1590284&r1=1590283&r2=1590284&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 Sat Apr 26 19:33:33 2014
@@ -29,6 +29,7 @@ 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;
@@ -181,6 +182,7 @@ public class TabGroupRenderer extends La
         final UITab tab = (UITab) child;
         if (tab.isRendered()) {
           final LabelWithAccessKey label = new LabelWithAccessKey(tab);
+          final boolean disabled = tab.isDisabled();
           if (activeIndex == index) {
             ComponentUtils.addCurrentMarkup(tab, Markup.SELECTED);
           }
@@ -198,7 +200,7 @@ public class TabGroupRenderer extends La
           }
 
           writer.startElement(HtmlElements.A, tab);
-          if (!tab.isDisabled()) {
+          if (!disabled) {
             writer.writeAttribute(HtmlAttributes.HREF, "#", false);
           }
           final String tabId = tab.getClientId(facesContext);
@@ -206,9 +208,21 @@ public class TabGroupRenderer extends La
           if (label.getAccessKey() != null) {
             writer.writeAttribute(HtmlAttributes.ACCESSKEY, Character.toString(label.getAccessKey()), false);
           }
+          String image = tab.getImage();
+          if (image != null) {
+            if (ResourceManagerUtils.isAbsoluteResource(image)) {
+              // absolute Path to image : nothing to do
+            } else {
+              image = ResourceManagerUtils.getImageOrDisabledImageWithPath(facesContext, image, disabled);
+            }
+            writer.startElement(HtmlElements.IMG, null);
+            writer.writeAttribute(HtmlAttributes.SRC, image, true);
+            writer.writeClassAttribute(Classes.create(tab, (label.getText() != null? "image-right-margin" : "image")));
+            writer.endElement(HtmlElements.IMG);
+          }
           if (label.getText() != null) {
             HtmlRendererUtils.writeLabelWithAccessKey(writer, label);
-          } else {
+          } else if (image == null) {
             writer.writeText(Integer.toString(index + 1));
           }
           writer.endElement(HtmlElements.A);

Propchange: 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
------------------------------------------------------------------------------
  Merged /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java:r1590282