You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Volker Weber <v....@inexso.de> on 2007/09/04 13:45:32 UTC

Re: svn commit: r572627 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/ajax/api/ core/src/main/java/org/apache/myfaces/tobago/webapp/ theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/stand

Hi,

the check for UIButtonCommand breaks the datePicker and one of my
custom components.
I changed this to check for javax.faces.component.UICommand.

Was there a reason for this specific check? The same problem may
occour with the LinkRenderer and maybe at some other places where the
check is to exact.


Regards,
    Volker

2007/9/4, weber@apache.org <we...@apache.org>:
> Author: weber
> Date: Tue Sep  4 04:36:54 2007
> New Revision: 572627
>
> URL: http://svn.apache.org/viewvc?rev=572627&view=rev
> Log:
> <http://issues.apache.org/jira/browse/TOBAGO-465> how I can set the tabindex attribute
>
> Modified:
>     myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxResponseRenderer.java
>     myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java
>     myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
>
> Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxResponseRenderer.java
> URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxResponseRenderer.java?rev=572627&r1=572626&r2=572627&view=diff
> ==============================================================================
> --- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxResponseRenderer.java (original)
> +++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxResponseRenderer.java Tue Sep  4 04:36:54 2007
> @@ -50,6 +50,7 @@
>  import java.util.ArrayList;
>  import java.util.Map;
>  import java.util.Iterator;
> +import java.util.EmptyStackException;
>
>  public class AjaxResponseRenderer {
>
> @@ -124,8 +125,13 @@
>        LOG.debug("write ajax response for " + component);
>      }
>
> -    // TODO: invokeOnComponent()
> -    ComponentUtil.invokeOnComponent(facesContext, clientId, (UIComponent) component, callback);
> +    try {
> +      // TODO: invokeOnComponent()
> +      ComponentUtil.invokeOnComponent(facesContext, clientId, (UIComponent) component, callback);
> +    } catch (EmptyStackException e) {
> +      LOG.error(" content = \"" + content.getBuffer().toString() + "\"");
> +      throw e;
> +    }
>
>      return content;
>    }
>
> Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java
> URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java?rev=572627&r1=572626&r2=572627&view=diff
> ==============================================================================
> --- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java (original)
> +++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java Tue Sep  4 04:36:54 2007
> @@ -35,6 +35,7 @@
>  import java.util.HashSet;
>  import java.util.Set;
>  import java.util.Stack;
> +import java.util.EmptyStackException;
>
>  public class TobagoResponseWriterImpl extends TobagoResponseWriter {
>
> @@ -229,7 +230,13 @@
>        LOG.debug("end Element: " + name);
>      }
>
> -    final String top = stack.pop();
> +    String top = "";
> +    try {
> +      top = stack.pop();
> +    } catch (EmptyStackException e) {
> +      LOG.error("Failed to close element \"" + name + "\"!");
> +      throw e;
> +    }
>      if (!top.equals(name)) {
>        final String trace = getCallingClassStackTraceElementString();
>        LOG.error("Element end with name='" + name + "' doesn't "
>
> Modified: myfaces/tobago/trunk/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/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java?rev=572627&r1=572626&r2=572627&view=diff
> ==============================================================================
> --- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java (original)
> +++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java Tue Sep  4 04:36:54 2007
> @@ -40,6 +40,7 @@
>  import org.apache.myfaces.tobago.util.AccessKeyMap;
>  import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
>
> +import javax.faces.component.UICommand;
>  import javax.faces.component.UIComponent;
>  import javax.faces.context.FacesContext;
>  import javax.faces.context.ResponseWriter;
> @@ -50,12 +51,12 @@
>    private static final Log LOG = LogFactory.getLog(ButtonRenderer.class);
>
>    public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
> -    if (!(component instanceof UIButtonCommand)) {
> -      LOG.error("Wrong type: Need " + UIButtonCommand.class.getName() + ", but was " + component.getClass().getName());
> +    if (!(component instanceof UICommand)) {
> +      LOG.error("Wrong type: Need " + UICommand.class.getName() + ", but was " + component.getClass().getName());
>        return;
>      }
>
> -    UIButtonCommand command = (UIButtonCommand) component;
> +    UICommand command = (UICommand) component;
>      String clientId = command.getClientId(facesContext);
>      String buttonType = createButtonType(command);
>
> @@ -71,7 +72,10 @@
>      writer.writeIdAttribute(clientId);
>      writer.writeAttributeFromComponent(HtmlAttributes.TITLE, ATTR_TIP);
>      writer.writeAttribute(HtmlAttributes.DISABLED, helper.isDisabled());
> -    Integer tabIndex = command.getTabIndex();
> +    Integer tabIndex = null;
> +    if (command instanceof UIButtonCommand) {
> +      tabIndex = ((UIButtonCommand) command).getTabIndex();
> +    }
>      if (tabIndex != null) {
>        writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
>      }
> @@ -126,6 +130,9 @@
>
>    public void encodeEnd(FacesContext facesContext,
>        UIComponent component) throws IOException {
> +    if (!(component instanceof UICommand)) {
> +      return;
> +    }
>      ResponseWriter writer = facesContext.getResponseWriter();
>      writer.endElement(HtmlConstants.BUTTON);
>    }
>
>
>