[jboss-cvs] jboss-seam/src/ui/org/jboss/seam/ui ...

Gavin King gavin.king at jboss.com
Sun Nov 19 12:36:11 EST 2006


  User: gavin   
  Date: 06/11/19 12:36:11

  Modified:    src/ui/org/jboss/seam/ui    HtmlButton.java HtmlLink.java
                        UIAction.java
  Log:
  fix JBSEAM-494
  
  Revision  Changes    Path
  1.2       +51 -10    jboss-seam/src/ui/org/jboss/seam/ui/HtmlButton.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: HtmlButton.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/ui/org/jboss/seam/ui/HtmlButton.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- HtmlButton.java	14 Nov 2006 04:59:39 -0000	1.1
  +++ HtmlButton.java	19 Nov 2006 17:36:11 -0000	1.2
  @@ -7,23 +7,26 @@
   import java.util.Map;
   import java.util.Set;
   
  +import javax.faces.component.ActionSource;
   import javax.faces.component.UIComponent;
   import javax.faces.component.UIData;
   import javax.faces.component.UIParameter;
   import javax.faces.context.FacesContext;
   import javax.faces.context.ResponseWriter;
  +import javax.faces.el.MethodBinding;
   import javax.faces.el.ValueBinding;
  +import javax.faces.event.ActionListener;
   import javax.faces.model.DataModel;
   
   import org.jboss.seam.core.Conversation;
   import org.jboss.seam.core.Pages;
   
  -public class HtmlButton extends HtmlOutputButton
  +public class HtmlButton extends HtmlOutputButton implements ActionSource
   {
      public static final String COMPONENT_TYPE = "org.jboss.seam.ui.HtmlButton";
   
      private String view;
  -   private String action;
  +   private MethodBinding action;
      private String pageflow;
      private String propagation = "default";
      private String fragment;
  @@ -125,12 +128,10 @@
            }
         }
         
  -      ValueBinding actionValueBinding = getValueBinding("action");
  -      if (actionValueBinding!=null || action!=null)
  +      if (action!=null)
         {
            UIAction uiAction = new UIAction();
  -         uiAction.setValueBinding( "action", actionValueBinding );
  -         uiAction.setAction(action);
  +         uiAction.setAction( action.getExpressionString() );
            encodedUrl += getParameterString(characterEncoding, uiAction, first);
            first = false;
         }
  @@ -235,7 +236,7 @@
         view = (String) values[1];
         pageflow = (String) values[2];
         propagation = (String) values[3];
  -      action =  (String) values[4];
  +      action = (MethodBinding) restoreAttachedState(context, values[4]);
      }
   
      @Override
  @@ -245,7 +246,7 @@
         values[1] = view;
         values[2] = pageflow;
         values[3] = propagation;
  -      values[4] = action;
  +      values[4] = saveAttachedState(context, action);
         return values;
      }
   
  @@ -269,12 +270,12 @@
         this.propagation = propagation;
      }
   
  -   public String getAction()
  +   public MethodBinding getAction()
      {
         return action;
      }
   
  -   public void setAction(String action)
  +   public void setAction(MethodBinding action)
      {
         this.action = action;
      }
  @@ -289,4 +290,44 @@
         this.fragment = fragment;
      }
   
  +   //IMPLEMENT ActionSource:
  +   
  +   public void addActionListener(ActionListener listener)
  +   {
  +      // TODO Auto-generated method stub 
  +   }
  +
  +   public MethodBinding getActionListener()
  +   {
  +      // TODO Auto-generated method stub
  +      return null;
  +   }
  +
  +   public ActionListener[] getActionListeners()
  +   {
  +      // TODO Auto-generated method stub
  +      return null;
  +   }
  +
  +   public boolean isImmediate()
  +   {
  +      // TODO Auto-generated method stub
  +      return false;
  +   }
  +
  +   public void setImmediate(boolean immediate)
  +   {
  +      // TODO Auto-generated method stub
  +   }
  +
  +   public void removeActionListener(ActionListener listener)
  +   {
  +      // TODO Auto-generated method stub
  +   }
  +
  +   public void setActionListener(MethodBinding actionListener)
  +   {
  +      // TODO Auto-generated method stub
  +   }
  +
   }
  
  
  
  1.23      +55 -13    jboss-seam/src/ui/org/jboss/seam/ui/HtmlLink.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: HtmlLink.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/ui/org/jboss/seam/ui/HtmlLink.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -b -r1.22 -r1.23
  --- HtmlLink.java	14 Nov 2006 04:59:39 -0000	1.22
  +++ HtmlLink.java	19 Nov 2006 17:36:11 -0000	1.23
  @@ -7,24 +7,27 @@
   import java.util.Map;
   import java.util.Set;
   
  +import javax.faces.component.ActionSource;
   import javax.faces.component.UIComponent;
   import javax.faces.component.UIData;
   import javax.faces.component.UIParameter;
   import javax.faces.component.html.HtmlOutputLink;
   import javax.faces.context.FacesContext;
   import javax.faces.context.ResponseWriter;
  +import javax.faces.el.MethodBinding;
   import javax.faces.el.ValueBinding;
  +import javax.faces.event.ActionListener;
   import javax.faces.model.DataModel;
   
   import org.jboss.seam.core.Conversation;
   import org.jboss.seam.core.Pages;
   
  -public class HtmlLink extends HtmlOutputLink
  +public class HtmlLink extends HtmlOutputLink implements ActionSource
   {
      public static final String COMPONENT_TYPE = "org.jboss.seam.ui.HtmlLink";
   
      private String view;
  -   private String action;
  +   private MethodBinding action;
      private String pageflow;
      private String propagation = "default";
      private String fragment;
  @@ -125,12 +128,10 @@
            }
         }
         
  -      ValueBinding actionValueBinding = getValueBinding("action");
  -      if (actionValueBinding!=null || action!=null)
  +      if (action!=null)
         {
            UIAction uiAction = new UIAction();
  -         uiAction.setValueBinding( "action", actionValueBinding );
  -         uiAction.setAction(action);
  +         uiAction.setAction( action.getExpressionString() );
            encodedUrl += getParameterString(characterEncoding, uiAction, first);
            first = false;
         }
  @@ -232,19 +233,19 @@
         view = (String) values[1];
         pageflow = (String) values[2];
         propagation = (String) values[3];
  -      action =  (String) values[4];
  -      disabled = (Boolean) values[7];
  +      action = (MethodBinding) restoreAttachedState(context, values[4]);
  +      disabled = (Boolean) values[5];
      }
   
      @Override
      public Object saveState(FacesContext context) {
  -      Object[] values = new Object[8];
  +      Object[] values = new Object[6];
         values[0] = super.saveState(context);
         values[1] = view;
         values[2] = pageflow;
         values[3] = propagation;
  -      values[4] = action;
  -      values[7] = disabled;
  +      values[4] = saveAttachedState(context, action);
  +      values[5] = disabled;
         return values;
      }
   
  @@ -268,12 +269,12 @@
         this.propagation = propagation;
      }
   
  -   public String getAction()
  +   public MethodBinding getAction()
      {
         return action;
      }
   
  -   public void setAction(String action)
  +   public void setAction(MethodBinding action)
      {
         this.action = action;
      }
  @@ -298,4 +299,45 @@
         this.disabled = disabled;
      }
   
  +   
  +   //IMPLEMENT ActionSource:
  +   
  +   public void addActionListener(ActionListener listener)
  +   {
  +      // TODO Auto-generated method stub 
  +   }
  +
  +   public MethodBinding getActionListener()
  +   {
  +      // TODO Auto-generated method stub
  +      return null;
  +   }
  +
  +   public ActionListener[] getActionListeners()
  +   {
  +      // TODO Auto-generated method stub
  +      return null;
  +   }
  +
  +   public boolean isImmediate()
  +   {
  +      // TODO Auto-generated method stub
  +      return false;
  +   }
  +
  +   public void setImmediate(boolean immediate)
  +   {
  +      // TODO Auto-generated method stub
  +   }
  +
  +   public void removeActionListener(ActionListener listener)
  +   {
  +      // TODO Auto-generated method stub
  +   }
  +
  +   public void setActionListener(MethodBinding actionListener)
  +   {
  +      // TODO Auto-generated method stub
  +   }
  +
   }
  
  
  
  1.4       +8 -13     jboss-seam/src/ui/org/jboss/seam/ui/UIAction.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UIAction.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/ui/org/jboss/seam/ui/UIAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- UIAction.java	9 Oct 2006 00:10:31 -0000	1.3
  +++ UIAction.java	19 Nov 2006 17:36:11 -0000	1.4
  @@ -10,26 +10,21 @@
      
      public static final String COMPONENT_TYPE = "org.jboss.seam.ui.UIAction";
      
  -   private String outcome;
  +   private String action;
      
      public void setAction(String action)
      {
  -      this.outcome = action;
  +      this.action = action;
      }
      
      public String getAction()
      {
  -      return outcome;
  +      return action;
      }
      
      private boolean isMethodBinding()
      {
  -      return outcome==null;
  -   }
  -
  -   private String getMethodBindingExpression()
  -   {
  -      return getValueBinding("action").getExpressionString();
  +      return action.startsWith("#{");
      }
   
      @Override
  @@ -44,13 +39,13 @@
         String viewId = getFacesContext().getViewRoot().getViewId();
         if ( isMethodBinding() )
         {
  -         String actionId = SafeActions.toActionId( viewId, getMethodBindingExpression() );
  +         String actionId = SafeActions.toActionId( viewId, action );
            SafeActions.instance().addSafeAction(actionId);
            return actionId;
         }
         else
         {
  -         return outcome;
  +         return action;
         }
      }
      
  @@ -58,14 +53,14 @@
      public void restoreState(FacesContext context, Object state) {
         Object[] values = (Object[]) state;
         super.restoreState(context, values[0]);
  -      outcome = (String) values[1];
  +      action = (String) values[1];
      }
   
      @Override
      public Object saveState(FacesContext context) {
         Object[] values = new Object[2];
         values[0] = super.saveState(context);
  -      values[1] = outcome;
  +      values[1] = action;
         return values;
      }
   
  
  
  



More information about the jboss-cvs-commits mailing list