myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1343909 - 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-demo/src/main/webapp/ tobago-exam...
Date Tue, 29 May 2012 18:46:07 GMT
Author: lofwyr
Date: Tue May 29 18:46:06 2012
New Revision: 1343909

URL: http://svn.apache.org/viewvc?rev=1343909&view=rev
Log:
TOBAGO-616: DefaultCommand on subforms

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/60-command/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/60-command/00-default/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/60-command/00-default/default-command.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/60-command/command.xhtml
      - copied, changed from r1343701, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/command.jsp
Removed:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/command.jsp
Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/footer.xhtml
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
    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/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.less
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.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/AbstractUIPage.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java?rev=1343909&r1=1343908&r2=1343909&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java
Tue May 29 18:46:06 2012
@@ -26,6 +26,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.internal.layout.LayoutUtils;
+import org.apache.myfaces.tobago.internal.util.Deprecation;
 import org.apache.myfaces.tobago.internal.webapp.TobagoMultipartFormdataRequest;
 import org.apache.myfaces.tobago.layout.Box;
 import org.apache.myfaces.tobago.layout.LayoutComponent;
@@ -65,8 +66,6 @@ public abstract class AbstractUIPage ext
 
   private Box actionPosition;
 
-  private String defaultActionId;
-
   private List<KeyValue> postfields;
 
   @Override
@@ -256,12 +255,15 @@ public abstract class AbstractUIPage ext
     this.actionPosition = actionPosition;
   }
 
+  /** @deprecated since 1.5.7 and 1.6.0 */
   public String getDefaultActionId() {
-    return defaultActionId;
+    Deprecation.LOG.error("The default action handling has been changed!");
+    return null;
   }
 
+  /** @deprecated since 1.5.7 and 1.6.0 */
   public void setDefaultActionId(String defaultActionId) {
-    this.defaultActionId = defaultActionId;
+    Deprecation.LOG.error("The default action handling has been changed!");
   }
 
   public void onComponentPopulated(FacesContext facesContext, UIComponent parent) {

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java?rev=1343909&r1=1343908&r2=1343909&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java
Tue May 29 18:46:06 2012
@@ -30,6 +30,11 @@ public final class DataAttributes {
   public static final String DISABLED = "data-tobago-disabled";
 
   /**
+   * Custom form attribute. Used to show the virtual form of the component.
+   */
+  public static final String DEFAULT = "data-tobago-default";
+
+  /**
    * Custom reload attribute. Used to reload a panel.
    */
   public static final String RELOAD = "data-tobago-reload";

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/60-command/00-default/default-command.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/60-command/00-default/default-command.xhtml?rev=1343909&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/60-command/00-default/default-command.xhtml
(added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/60-command/00-default/default-command.xhtml
Tue May 29 18:46:06 2012
@@ -0,0 +1,79 @@
+<?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.
+-->
+
+<ui:composition template="/WEB-INF/tags/layout/overview.xhtml"
+                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:f="http://java.sun.com/jsf/core">
+  <ui:param name="title" value="Default Commands"/>
+  <tc:panel>
+    <f:facet name="layout">
+      <tc:gridLayout rows="*;3*;3*;*" columns="300px"/>
+    </f:facet>
+
+    <tc:out escape="false" value="&lt;h1>      #{overviewController.lastAction}&lt;/h1>"/>
+
+    <tc:form id="form-1">
+      <tc:panel id="panel-1">
+        <f:facet name="layout">
+          <tc:gridLayout rows="auto;auto;auto;auto;auto;auto;auto;*"/>
+        </f:facet>
+
+        <tx:in value="#{demo.text[0]}" required="true" label="#{overviewBundle.newValue1}"/>
+
+        <tx:in value="#{demo.text[0]}" readonly="true" label="#{overviewBundle.modelValue1}"/>
+
+        <tx:date />
+
+        <tx:selectOneChoice>
+          <tc:selectItem itemLabel="A" itemValue="A"/>
+          <tc:selectItem itemLabel="B" itemValue="B"/>
+          <tc:selectItem itemLabel="C" itemValue="C"/>
+          <tc:selectItem itemLabel="D" itemValue="D"/>
+        </tx:selectOneChoice>
+
+        <tc:button id="default-1" defaultCommand="true" label="default" actionListener="#{overviewController.click}"/>
+
+        <tc:button id="any-1" label="any" actionListener="#{overviewController.click}"/>
+
+      </tc:panel>
+    </tc:form>
+    <tc:form id="form-2">
+      <tc:panel id="panel-2">
+        <f:facet name="layout">
+          <tc:gridLayout rows="auto;auto;auto;auto;auto;auto;*"/>
+        </f:facet>
+
+        <tx:in value="#{demo.text[1]}" required="true" label="#{overviewBundle.newValue1}"/>
+
+        <tx:in value="#{demo.text[1]}" readonly="true" label="#{overviewBundle.modelValue1}"/>
+
+        <tc:button id="default-2" defaultCommand="true" label="default" actionListener="#{overviewController.click}"/>
+
+        <tc:button id="any-2" label="any" actionListener="#{overviewController.click}"/>
+
+      </tc:panel>
+
+    </tc:form>
+
+    <tc:button id="default-3" defaultCommand="true" label="master" actionListener="#{overviewController.click}"/>
+
+  </tc:panel>
+</ui:composition>

Copied: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/60-command/command.xhtml
(from r1343701, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/command.jsp)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/60-command/command.xhtml?p2=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/60-command/command.xhtml&p1=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/command.jsp&r1=1343701&r2=1343909&rev=1343909&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/command.jsp
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/60-command/command.xhtml
Tue May 29 18:46:06 2012
@@ -1,4 +1,4 @@
-<%--
+<!--
  * 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.
@@ -13,175 +13,177 @@
  * 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.
---%>
-<%@ taglib uri="http://myfaces.apache.org/tobago/component" prefix="tc" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
-<%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
-<%@ taglib uri="http://myfaces.apache.org/tobago/extension" prefix="tx" %>
-
-<layout:overview>
-  <jsp:body>
-    <tc:box label="Command Controls">
-      <f:facet name="layout">
-        <tc:gridLayout columns="100px;100px;100px;100px;100px;*" rows="auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;*"/>
-      </f:facet>
-
-      <%-- standard --%>
-
-      <tc:cell spanY="2">
-        <tc:label value="Standard"/>
-      </tc:cell>
-
-      <%-- code-sniplet-start id="button" --%>
-      <tc:button label="Action" action="reference/command"/>
-      <%-- code-sniplet-end id="button" --%>
-      <tc:button label="On Click" onclick="alert('Hallo Tobago!');"/>
-      <tc:button label="Link" link="http://www.apache.org/"/>
-      <tc:button label="Resource" resource="help.html"/>
-      <tc:cell/>
-
-      <%-- code-sniplet-start id="link" --%>
-      <tc:link label="Action" action="reference/command"/>
-      <%-- code-sniplet-end id="link" --%>
-      <tc:link label="On Click" onclick="alert('Hallo Tobago!');"/>
-      <tc:link label="Link" link="http://www.apache.org/"/>
-      <tc:link label="Resource" resource="help.html"/>
-      <tc:cell/>
-
-      <%-- confirmation --%>
-
-      <tc:cell spanY="2">
-        <tc:label value="Confirmation" tip="The user will be asked, if the button/link
should be executed."/>
-      </tc:cell>
-
-      <tc:button label="Action" action="reference/command">
-        <f:facet name="confirmation">
-          <tc:out value="Are you sure?"/>
-        </f:facet>
-      </tc:button>
-      <tc:button label="On Click" onclick="alert('Hallo Tobago!');">
-        <f:facet name="confirmation">
-          <tc:out value="Are you sure?"/>
-        </f:facet>
-      </tc:button>
-      <tc:button label="Link" link="http://www.apache.org/">
-        <f:facet name="confirmation">
-          <tc:out value="Are you sure?"/>
-        </f:facet>
-      </tc:button>
-      <tc:button label="Resource" resource="help.html">
-        <f:facet name="confirmation">
-          <tc:out value="Are you sure?"/>
-        </f:facet>
-      </tc:button>
-      <tc:cell/>
+-->
+
+<ui:composition template="/WEB-INF/tags/layout/overview.xhtml"
+                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:f="http://java.sun.com/jsf/core"
+                xmlns:c="http://java.sun.com/jstl/core">
+  <ui:param name="title" value="Command Controls"/>
+  <tc:panel>
+    <f:facet name="layout">
+      <tc:gridLayout columns="100px;100px;100px;100px;100px;*"
+                     rows="auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;*"/>
+    </f:facet>
+
+    <!-- standard -->
+
+    <tc:cell spanY="2">
+      <tc:label value="Standard"/>
+    </tc:cell>
+
+    <!-- code-sniplet-start id="button" -->
+    <tc:button label="Action" action="reference/command"/>
+    <!-- code-sniplet-end id="button" -->
+    <tc:button label="On Click" onclick="alert('Hallo Tobago!');"/>
+    <tc:button label="Link" link="http://www.apache.org/"/>
+    <tc:button label="Resource" resource="help.html"/>
+    <tc:cell/>
+
+    <!-- code-sniplet-start id="link" -->
+    <tc:link label="Action" action="reference/command"/>
+    <!-- code-sniplet-end id="link" -->
+    <tc:link label="On Click" onclick="alert('Hallo Tobago!');"/>
+    <tc:link label="Link" link="http://www.apache.org/"/>
+    <tc:link label="Resource" resource="help.html"/>
+    <tc:cell/>
+
+    <!-- confirmation -->
+
+    <tc:cell spanY="2">
+      <tc:label value="Confirmation" tip="The user will be asked, if the button/link should
be executed."/>
+    </tc:cell>
+
+    <tc:button label="Action" action="reference/command">
+      <f:facet name="confirmation">
+        <tc:out value="Are you sure?"/>
+      </f:facet>
+    </tc:button>
+    <tc:button label="On Click" onclick="alert('Hallo Tobago!');">
+      <f:facet name="confirmation">
+        <tc:out value="Are you sure?"/>
+      </f:facet>
+    </tc:button>
+    <tc:button label="Link" link="http://www.apache.org/">
+      <f:facet name="confirmation">
+        <tc:out value="Are you sure?"/>
+      </f:facet>
+    </tc:button>
+    <tc:button label="Resource" resource="help.html">
+      <f:facet name="confirmation">
+        <tc:out value="Are you sure?"/>
+      </f:facet>
+    </tc:button>
+    <tc:cell/>
+
+    <tc:link label="Action" action="reference/command">
+      <f:facet name="confirmation">
+        <tc:out value="Are you sure?"/>
+      </f:facet>
+    </tc:link>
+    <tc:link label="On Click" onclick="alert('Hallo Tobago!');">
+      <f:facet name="confirmation">
+        <tc:out value="Are you sure?"/>
+      </f:facet>
+    </tc:link>
+    <tc:link label="Link" link="http://www.apache.org/">
+      <f:facet name="confirmation">
+        <tc:out value="Are you sure?"/>
+      </f:facet>
+    </tc:link>
+    <tc:link label="Resource" resource="help.html">
+      <f:facet name="confirmation">
+        <tc:out value="Are you sure?"/>
+      </f:facet>
+    </tc:link>
+    <tc:cell/>
+
+    <!-- target -->
 
-      <tc:link label="Action" action="reference/command">
-        <f:facet name="confirmation">
-          <tc:out value="Are you sure?"/>
+    <tc:cell spanY="2">
+      <tc:label value="Target"/>
+    </tc:cell>
+
+    <tc:button label="Action" action="reference/command" target="Command Target"/>
+    <tc:button label="N/A" disabled="true"/>
+    <tc:button label="N/A yet" disabled="true"/>
+    <tc:button label="N/A yet" disabled="true"/>
+    <tc:cell/>
+
+    <tc:link label="Action" action="reference/command" target="Command Target"/>
+    <tc:link label="N/A" disabled="true"/>
+    <tc:link label="Link" link="http://www.apache.org/" target="Command Target"/>
+    <tc:link label="Resource" resource="help.html" target="Command Target"/>
+    <tc:cell/>
+
+    <!-- default command -->
+
+    <tc:label value="Default Command"/>
+
+    <tc:button label="Action" action="reference/command" defaultCommand="true"/>
+    <tc:cell/>
+    <tc:cell/>
+    <tc:cell/>
+    <tc:cell/>
+
+    <!-- dynamic widths -->
+
+    <tc:cell spanX="6">
+      <tc:separator>
+        <f:facet name="label">
+          <tc:label value="Layout"/>
         </f:facet>
-      </tc:link>
-      <tc:link label="On Click" onclick="alert('Hallo Tobago!');">
-        <f:facet name="confirmation">
-          <tc:out value="Are you sure?"/>
+      </tc:separator>
+    </tc:cell>
+
+    <tc:cell spanX="6">
+      <tc:panel>
+        <f:facet name="layout">
+          <tc:gridLayout rows="auto" columns="auto;auto;auto;*"/>
         </f:facet>
-      </tc:link>
-      <tc:link label="Link" link="http://www.apache.org/">
-        <f:facet name="confirmation">
-          <tc:out value="Are you sure?"/>
+
+        <tc:button label="Hello"/>
+        <tc:button label="WWWWWWWWWW"/>
+        <tc:button label="llllllllll"/>
+        <tc:cell/>
+
+      </tc:panel>
+    </tc:cell>
+    <tc:cell spanX="6">
+      <tc:panel>
+        <f:facet name="layout">
+          <tc:gridLayout rows="auto" columns="auto;*"/>
         </f:facet>
-      </tc:link>
-      <tc:link label="Resource" resource="help.html">
-        <f:facet name="confirmation">
-          <tc:out value="Are you sure?"/>
+
+        <tc:button
+            label="The goal of Tobago is to provide the community with a well designed set
of user interface components."/>
+        <tc:cell/>
+
+      </tc:panel>
+    </tc:cell>
+    <tc:cell spanX="6">
+      <tc:panel>
+        <f:facet name="layout">
+          <tc:gridLayout rows="45px" columns="100px;100px;*"/>
         </f:facet>
-      </tc:link>
-      <tc:cell/>
 
-      <%-- target --%>
+        <tc:button label="This is a button with a long text."/>
+        <tc:button image="image/next.gif" label="This is a button with a long text."/>
+        <tc:cell/>
+
+      </tc:panel>
+    </tc:cell>
+
+    <!-- empty -->
+
+    <tc:cell/>
+    <tc:cell/>
+    <tc:cell/>
+    <tc:cell/>
+    <tc:cell/>
+    <tc:cell/>
 
-      <tc:cell spanY="2">
-        <tc:label value="Target"/>
-      </tc:cell>
-
-      <tc:button label="Action" action="reference/command" target="Command Target"/>
-      <tc:button label="N/A" disabled="true"/>
-      <tc:button label="N/A yet" disabled="true"/>
-      <tc:button label="N/A yet" disabled="true"/>
-      <tc:cell/>
-
-      <tc:link label="Action" action="reference/command" target="Command Target"/>
-      <tc:link label="N/A"  disabled="true"/>
-      <tc:link label="Link" link="http://www.apache.org/" target="Command Target"/>
-      <tc:link label="Resource" resource="help.html" target="Command Target"/>
-      <tc:cell/>
-
-      <%-- default command --%>
-
-      <tc:label value="Default Command"/>
-
-      <tc:button label="Action" action="reference/command" defaultCommand="true"/>
-      <tc:cell/>
-      <tc:cell/>
-      <tc:cell/>
-      <tc:cell/>
-
-      <%-- dynamic widths --%>
-
-      <tc:cell spanX="6">
-        <tc:separator>
-          <f:facet name="label">
-            <tc:label value="Layout"/>
-          </f:facet>
-        </tc:separator>
-      </tc:cell>
-
-      <tc:cell spanX="6">
-        <tc:panel>
-          <f:facet name="layout">
-            <tc:gridLayout rows="auto" columns="auto;auto;auto;*"/>
-          </f:facet>
-
-          <tc:button label="Hello" />
-          <tc:button label="WWWWWWWWWW" />
-          <tc:button label="llllllllll" />
-          <tc:cell/>
-
-        </tc:panel>
-      </tc:cell>
-      <tc:cell spanX="6">
-        <tc:panel>
-          <f:facet name="layout">
-            <tc:gridLayout rows="auto" columns="auto;*"/>
-          </f:facet>
-
-          <tc:button label="The goal of Tobago is to provide the community with a well
designed set of user interface components." />
-          <tc:cell/>
-
-        </tc:panel>
-      </tc:cell>
-      <tc:cell spanX="6">
-        <tc:panel>
-          <f:facet name="layout">
-            <tc:gridLayout rows="45px" columns="100px;100px;*"/>
-          </f:facet>
-
-          <tc:button label="This is a button with a long text." />
-          <tc:button image="image/next.gif" label="This is a button with a long text."
/>
-          <tc:cell/>
-
-        </tc:panel>
-      </tc:cell>
-
-      <%-- empty --%>
-
-      <tc:cell/>
-      <tc:cell/>
-      <tc:cell/>
-      <tc:cell/>
-      <tc:cell/>
-      <tc:cell/>
-
-    </tc:box>
-  </jsp:body>
-</layout:overview>
+  </tc:panel>
+</ui:composition>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/footer.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/footer.xhtml?rev=1343909&r1=1343908&r2=1343909&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/footer.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/footer.xhtml Tue
May 29 18:46:06 2012
@@ -38,7 +38,7 @@
                disabled="#{navigation.first}"
                label="#{overviewBundle.footer_previous}"/>
 
-    <tc:button immediate="true" id="next"
+    <tc:button immediate="true" id="next" defaultCommand="true"
                image="image/next.gif"
                action="#{navigation.gotoNext}"
                disabled="#{navigation.last}"
@@ -56,5 +56,77 @@
 
     <tc:out value="#{overviewBundle.notTranslated}"/>
 
+    <tc:style>
+      .tobago-button-markup-default {
+        border-width: 2px;
+      }
+    </tc:style>
+
+    <tc:script onload="init()">
+
+      function init() {
+
+        jQuery("body").keypress(function (event) {
+          var code = event.which;
+          if (code == 0) {
+            code = event.keyCode;
+          }
+          if (code == 13) {
+            var target = event.target;
+            if (target.tagName == "A" || target.tagName == "BUTTON") {
+              return;
+            }
+            if (target.tagName == "TEXTAREA") {
+              if (!event.metaKey &amp;&amp; !event.ctrlKey) {
+                return;
+              }
+            }
+            var id = target.id;
+            while (id != "") {
+              var command = jQuery("[data-tobago-default='" + id + "']");
+              if (command.size() > 0) {
+                LOG.error(code + " on " + id + " command=" + command.attr('id'));
+                command.click();
+                break;
+              }
+              id = Tobago.Utils.getNamingContainerId(id);
+            }
+            return false;
+          }
+        });
+
+        jQuery("input, select, textarea, a, button").focus(function (event) {
+          var target = event.target;
+          var id = target.id;
+          var command;
+          if (target.tagName == "A" || target.tagName == "BUTTON") {
+            command = jQuery(target);
+          } else {
+            while (id != "") {
+              command = jQuery("[data-tobago-default='" + id + "']");
+              if (command.size() > 0) {
+                break;
+              }
+              id = Tobago.Utils.getNamingContainerId(id);
+            }
+          }
+
+          if (command.size() > 0) {
+            // remove old
+            jQuery(".tobago-link-markup-default").removeClass("tobago-link-markup-default");
+            jQuery(".tobago-button-markup-default").removeClass("tobago-button-markup-default");
+
+            command.filter("a").addClass("tobago-link-markup-default");
+            command.filter("button").addClass("tobago-button-markup-default");
+          }
+        });
+      }
+
+      Tobago.Utils.getNamingContainerId = function (id) {
+        return id.substring(0, id.lastIndexOf(":"));
+      };
+
+    </tc:script>
+
   </tc:panel>
 </f:subview>

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.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/ButtonRenderer.java?rev=1343909&r1=1343908&r2=1343909&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
Tue May 29 18:46:06 2012
@@ -21,12 +21,14 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.UIButton;
 import org.apache.myfaces.tobago.config.Configurable;
 import org.apache.myfaces.tobago.context.ResourceManagerUtils;
+import org.apache.myfaces.tobago.internal.component.AbstractUIForm;
 import org.apache.myfaces.tobago.internal.util.AccessKeyMap;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.CommandRendererBase;
 import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
 import org.apache.myfaces.tobago.renderkit.css.Classes;
 import org.apache.myfaces.tobago.renderkit.css.Style;
+import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlButtonTypes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
@@ -58,7 +60,7 @@ public class ButtonRenderer extends Comm
     LabelWithAccessKey label = new LabelWithAccessKey(button);
 
     writer.startElement(HtmlElements.BUTTON, button);
-    writer.writeAttribute(HtmlAttributes.TYPE, createButtonType(button), false);
+    writer.writeAttribute(HtmlAttributes.TYPE, HtmlButtonTypes.BUTTON, false);
     writer.writeNameAttribute(clientId);
     writer.writeIdAttribute(clientId);
     HtmlRendererUtils.renderTip(button, writer);
@@ -74,6 +76,10 @@ public class ButtonRenderer extends Comm
     writer.writeStyleAttribute(style);
     HtmlRendererUtils.renderDojoDndItem(component, writer, true);
     writer.writeClassAttribute(Classes.create(button));
+    if (((UIButton) component).isDefaultCommand()) {
+      final AbstractUIForm form = ComponentUtils.findAncestor(component, AbstractUIForm.class);
+      writer.writeAttribute(DataAttributes.DEFAULT, form.getClientId(facesContext), false);
+    }
     writer.flush(); // force closing the start tag
 
     String image = (String) button.getAttributes().get(Attributes.IMAGE);
@@ -105,24 +111,6 @@ public class ButtonRenderer extends Comm
       HtmlRendererUtils.addClickAcceleratorKey(
           facesContext, button.getClientId(facesContext), label.getAccessKey());
     }
-
-    if (ComponentUtils.getBooleanAttribute(component, Attributes.DEFAULT_COMMAND)) {
-      boolean transition = ComponentUtils.getBooleanAttribute(button, Attributes.TRANSITION);
-      HtmlRendererUtils.setDefaultTransition(facesContext, transition);
-
-      HtmlRendererUtils.writeScriptLoader(facesContext, null, new String[]{
-          "Tobago.registerListener(\n"
-              + "function() { \n"
-              + "Tobago.setDefaultAction('" + button.getClientId(facesContext) + "') \n"
-              + "}, \n"
-              + "Tobago.Phase.DOCUMENT_READY);"
-              });
-    }
-  }
-
-  private String createButtonType(UIComponent component) {
-    boolean defaultCommand = ComponentUtils.getBooleanAttribute(component, Attributes.DEFAULT_COMMAND);
-    return defaultCommand ? HtmlButtonTypes.SUBMIT : HtmlButtonTypes.BUTTON;
   }
 
   @Override

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.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/PageRenderer.java?rev=1343909&r1=1343908&r2=1343909&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
Tue May 29 18:46:06 2012
@@ -371,7 +371,6 @@ public class PageRenderer extends PageRe
       writer.endElement(HtmlElements.HEAD);
     }
 
-    String defaultActionId = page.getDefaultActionId() != null ? page.getDefaultActionId()
: "";
     writer.startElement(HtmlElements.BODY, page);
 //    writer.writeAttribute(HtmlAttributes.ONLOAD, "Tobago.init('" + clientId + "');", false);
 //    writer.writeAttribute("onunload", "Tobago.onexit();", null);
@@ -416,7 +415,6 @@ public class PageRenderer extends PageRe
     writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
     writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "form-action");
     writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "form-action");
-    writer.writeAttribute(HtmlAttributes.VALUE, defaultActionId, true);
     writer.endElement(HtmlElements.INPUT);
 
     writer.startElement(HtmlElements.INPUT, null);

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=1343909&r1=1343908&r2=1343909&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
Tue May 29 18:46:06 2012
@@ -139,10 +139,11 @@ fieldset.tobago-box {
 /* button ------------------------------------------------------------------ */
 
 .tobago-button {
-  border-left: 1px solid #ddeeff;
-  border-right: 1px solid #6688aa;
-  border-top: 1px solid #ddeeff;
-  border-bottom: 1px solid #6688aa;
+  border-width: 1px;
+  border-style: solid;
+  border-color: #ddeeff;
+  border-right-color: #6688aa;
+  border-bottom-color: #6688aa;
   padding: 2px;
   background: #bbccdd;
   font-weight: normal;
@@ -154,6 +155,11 @@ fieldset.tobago-box {
   -ms-box-sizing: content-box;
 }
 
+.tobago-button-markup-default {
+  border-width: 2px;
+  padding: 1px;
+}
+
 .tobago-button-markup-disabled {
   cursor: default;
 }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.less
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.less?rev=1343909&r1=1343908&r2=1343909&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.less
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.less
Tue May 29 18:46:06 2012
@@ -116,7 +116,7 @@
 /* button ------------------------------------------------------------------ */
 
 .tobago-button {
-  border: 1px @darkBorderColor solid;
+  border-color: @darkBorderColor;
   background: #ffffff;
   font: @boldFont;
   color: #660000;

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java?rev=1343909&r1=1343908&r2=1343909&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java
Tue May 29 18:46:06 2012
@@ -68,7 +68,6 @@ public class CommandRendererHelper {
         }
       }
 
-      boolean defaultCommand = ComponentUtils.getBooleanAttribute(command, Attributes.DEFAULT_COMMAND);
       boolean transition = ComponentUtils.getBooleanAttribute(command, Attributes.TRANSITION);
 
       if (StringUtils.isNotEmpty(command.getLink()) || StringUtils.isNotEmpty(command.getResource()))
{
@@ -101,10 +100,6 @@ public class CommandRendererHelper {
               + HtmlRendererUtils.getComponentIds(facesContext, command, componentIds) +
"','" + clientId + "', {});";
         }
 
-      } else if (defaultCommand) {
-        String clientId = command.getClientId(facesContext);
-        ComponentUtils.findPage(facesContext, command).setDefaultActionId(clientId);
-        onclick = null;
       } else {
         String clientId = command.getClientId(facesContext);
         String target = ComponentUtils.getStringAttribute(command, Attributes.TARGET);

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java?rev=1343909&r1=1343908&r2=1343909&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
Tue May 29 18:46:06 2012
@@ -131,6 +131,8 @@ public final class HtmlRendererUtils {
     }
   }
 
+  /** @deprecated since 1.5.7 and 1.6.0 */
+  @Deprecated
   public static void setDefaultTransition(FacesContext facesContext, boolean transition)
       throws IOException {
     writeScriptLoader(facesContext, null, new String[]{"Tobago.transition = " + transition
+ ";"});

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=1343909&r1=1343908&r2=1343909&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
Tue May 29 18:46:06 2012
@@ -337,7 +337,6 @@ var Tobago = {
       var result = Tobago.applicationOnsubmit();
       if (!result) {
         this.isSubmit = false;
-        Tobago.action.value = oldAction;
         Tobago.form.target = oldTarget;
         return false;
       }
@@ -579,7 +578,6 @@ var Tobago = {
         this.isSubmit = true;
         var req = Tobago.Transport.requests.shift(); // remove this from queue
         LOG.debug('request removed: ' + req.toString()); // @DEV_ONLY
-        var oldAction = Tobago.action.value;
         var oldTarget = Tobago.form.target;
         Tobago.action.value = actionId;
         if (options.target) {
@@ -599,7 +597,6 @@ var Tobago = {
             alert('Submit failed: ' + e); // XXX localization, better error handling
           }
         }
-        Tobago.action.value = oldAction;
         if (options.target) {
           Tobago.form.target = oldTarget;
         }
@@ -1469,8 +1466,9 @@ var Tobago = {
     return ajaxComponentIds.split(',');
   },
 
+  /** @deprecated since Tobago 1.5.7 and 1.6.0 */
   setDefaultAction: function(defaultActionId) {
-    Tobago.action.value = defaultActionId;
+    LOG.warn("setDefaultAction is deprecated");
   },
 
   isFunction: function(func) {
@@ -1952,13 +1950,11 @@ Tobago.Transport.JqueryTransport = {
     };
 
     return Tobago.Transport.request(function() {
-      requestOptions.originalAction = Tobago.action.value;
       requestObject.url = requestOptions.url;
       Tobago.action.value = requestOptions.actionId;
       Tobago.partialRequestIds.value = requestOptions.ajaxComponentIds;
       requestObject.data = jQuery(Tobago.form).serialize();
       requestOptions.xhr = jQuery.ajax(requestObject);
-      Tobago.action.value = requestOptions.originalAction;
     }, false, requestOptions.actionId);
   }
 };



Mime
View raw message