You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2007/07/27 17:07:01 UTC

svn commit: r560266 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/component/ core/src/main/java/org/apache/myfaces/tobago/taglib/component/ theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/...

Author: bommel
Date: Fri Jul 27 08:06:58 2007
New Revision: 560266

URL: http://svn.apache.org/viewvc?view=rev&rev=560266
Log:
(TOBAGO-450) New attribute disabled for tc:tab

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITab.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTag.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTagDeclaration.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
    myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css
    myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITab.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITab.java?view=diff&rev=560266&r1=560265&r2=560266
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITab.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITab.java Fri Jul 27 08:06:58 2007
@@ -19,6 +19,7 @@
 
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
 
 import javax.faces.el.ValueBinding;
 import javax.faces.context.FacesContext;
@@ -34,6 +35,7 @@
 
   private String label;
   private String tip;
+  private Boolean disabled;
 
   public String getTip() {
     if (tip != null) {
@@ -67,11 +69,28 @@
     this.label = label;
   }
 
+  public boolean isDisabled() {
+    if (disabled != null) {
+      return disabled;
+    }
+    ValueBinding vb = getValueBinding(ATTR_DISABLED);
+    if (vb != null) {
+      return Boolean.TRUE.equals(vb.getValue(getFacesContext()));
+    } else {
+      return false;
+    }
+  }
+
+  public void setDisabled(boolean disabled) {
+    this.disabled = disabled;
+  }
+
   public Object saveState(FacesContext context) {
-    Object[] state = new Object[3];
+    Object[] state = new Object[4];
     state[0] = super.saveState(context);
     state[1] = tip;
     state[2] = label;
+    state[3] = disabled;
     return state;
   }
 
@@ -80,5 +99,6 @@
     super.restoreState(context, values[0]);
     tip = (String) values[1];
     label = (String) values[2];
+    disabled = (Boolean) values[3];
   }
 }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTag.java?view=diff&rev=560266&r1=560265&r2=560266
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTag.java Fri Jul 27 08:06:58 2007
@@ -21,6 +21,7 @@
 import org.apache.commons.logging.LogFactory;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
 import org.apache.myfaces.tobago.component.ComponentUtil;
 import org.apache.myfaces.tobago.component.UITab;
 
@@ -36,6 +37,7 @@
   private String label;
   private String tip;
   private String markup;
+  private String disabled;
 
   public String getComponentType() {
     return UITab.COMPONENT_TYPE;
@@ -46,6 +48,7 @@
     ComponentUtil.setStringProperty(component, ATTR_LABEL, label);
     ComponentUtil.setStringProperty(component, ATTR_TIP, tip);
     ComponentUtil.setMarkup(component, markup);
+    ComponentUtil.setBooleanProperty(component, ATTR_DISABLED, disabled);
   }
 
   public void release() {
@@ -53,6 +56,7 @@
     label = null;
     tip = null;
     markup = null;
+    disabled = null;
   }
 
   public void setMarkup(String markup) {
@@ -92,6 +96,14 @@
 
   public void setTip(String tip) {
     this.tip = tip;
+  }
+
+  public String getDisabled() {
+    return disabled;
+  }
+
+  public void setDisabled(String disabled) {
+    this.disabled = disabled;
   }
 }
 

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTagDeclaration.java?view=diff&rev=560266&r1=560265&r2=560266
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTagDeclaration.java Fri Jul 27 08:06:58 2007
@@ -23,6 +23,7 @@
 import org.apache.myfaces.tobago.taglib.decl.HasLabelAndAccessKey;
 import org.apache.myfaces.tobago.taglib.decl.HasTip;
 import org.apache.myfaces.tobago.taglib.decl.HasMarkup;
+import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
 
 /*
  * Created by IntelliJ IDEA.
@@ -39,5 +40,5 @@
     uiComponent = "org.apache.myfaces.tobago.component.UITab",
     rendererType = "Tab")
 public interface TabTagDeclaration extends TobagoBodyTagDeclaration, HasIdBindingAndRendered, HasLabelAndAccessKey,
-    HasTip, HasMarkup {
+    HasTip, HasMarkup, IsDisabled {
 }

Modified: myfaces/tobago/trunk/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/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java?view=diff&rev=560266&r1=560265&r2=560266
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java Fri Jul 27 08:06:58 2007
@@ -243,8 +243,9 @@
     UITab activeTab = null;
 
     int index = 0;
-    for (UIComponent tab: (List<UIComponent>) component.getChildren()) {
-      if (tab instanceof UITab) {
+    for (UIComponent child: (List<UIComponent>) component.getChildren()) {
+      if (child instanceof UITab) {
+        UITab tab = (UITab) children;
         if (tab.isRendered()) {
           String onclick;
           if (TobagoConfig.getInstance(facesContext).isAjaxEnabled()
@@ -286,11 +287,16 @@
           writer.writeClassAttribute(innerClass);
 
           writer.startElement(HtmlConstants.SPAN, null);
-          writer.writeClassAttribute("tobago-tab-link");
           String tabId = clientId + "." + virtualTab + SUBCOMPONENT_SEP + index;
           writer.writeIdAttribute(tabId);
-          if (onclick != null) {
-            writer.writeAttribute(HtmlAttributes.ONCLICK, onclick, true);
+
+          if (tab.isDisabled()) {
+            writer.writeClassAttribute("tobago-tab-disabled");
+          } else {
+            writer.writeClassAttribute("tobago-tab-link");
+            if (onclick != null) {
+              writer.writeAttribute(HtmlAttributes.ONCLICK, onclick, true);
+            }
           }
           if (label.getText() != null) {
             HtmlRendererUtil.writeLabelWithAccessKey(writer, label);

Modified: myfaces/tobago/trunk/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/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css?view=diff&rev=560266&r1=560265&r2=560266
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css Fri Jul 27 08:06:58 2007
@@ -1018,6 +1018,10 @@
 }
 */
 
+.tobago-tab-disabled {
+   color: #778899;
+}
+
 .tobago-toolBar-button-label {
   padding-left: 5px;
 }

Modified: myfaces/tobago/trunk/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/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css?view=diff&rev=560266&r1=560265&r2=560266
==============================================================================
--- myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css (original)
+++ myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css Fri Jul 27 08:06:58 2007
@@ -95,6 +95,10 @@
   color: #660000;
 }
 
+.tobago-tab-disabled {
+  color: #808080;
+}
+
 div.tobago-tab-selected-outer {
   border-color: #000000;
   padding: 2px 0.2em 1px 0.2em;
@@ -105,7 +109,7 @@
 }
 
 div.tobago-tab-selected-inner {
-  font: bold 12px arial, helvetica, sans-serif;
+  font: 12px arial, helvetica, sans-serif;
   color: #660000;
 }
 
@@ -117,7 +121,7 @@
 }
 
 div.tobago-tab-unselected-inner {
-  font: bold 12px arial, helvetica, sans-serif;
+  font: 12px arial, helvetica, sans-serif;
   color: #660000;
 }
 
@@ -570,6 +574,19 @@
 .tobago-selectOneChoice-error  {
   border: 1px solid #FF0000;
 }
+
+/* selectOneRadio --------------------------------------------------------- */
+
+.tobago-selectOneRadio-default  {
+  border: 1px;
+  font: 12px arial, helvetica, sans-serif;
+  color: #000000;
+}
+
+.tobago-selectOneRadio-error  {
+  border: 1px solid #FF0000;
+}
+
 
 /* selectManyListbox ------------------------------------------------------- */
 

Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js?view=diff&rev=560266&r1=560265&r2=560266
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js Fri Jul 27 08:06:58 2007
@@ -85,8 +85,10 @@
 
 Tobago.TabGroup.prototype.reload = function(event) {
   LOG.debug("Reload ");
-    if (event) {
-      var element = Tobago.element(event);
+  if (event) {
+    var element = Tobago.element(event);
+    //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_SEP) + Tobago.SUB_COMPONENT_SEP.length);
       LOG.debug("Request tab with index " + this.activeIndex);
@@ -106,9 +108,10 @@
       } else {
         Tobago.submitAction(this.tabGroupId);
       }
-    } else {
-      LOG.info("No reload Event");
     }
+  } else {
+    LOG.info("No reload Event");
+  }
 
 };