struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib AbstractFacesTag.java BaseTag.java ErrorsTag.java HtmlTag.java MessageTag.java StylesheetTag.java WriteTag.java
Date Thu, 08 Jul 2004 01:11:28 GMT
craigmcc    2004/07/07 18:11:28

  Modified:    contrib/struts-faces/src/conf faces-config.xml
                        struts-faces.xml
               contrib/struts-faces/src/java/org/apache/struts/faces/component
                        FormComponent.java
               contrib/struts-faces/src/java/org/apache/struts/faces/renderer
                        WriteRenderer.java
               contrib/struts-faces/src/java/org/apache/struts/faces/taglib
                        AbstractFacesTag.java BaseTag.java ErrorsTag.java
                        HtmlTag.java MessageTag.java StylesheetTag.java
                        WriteTag.java
  Added:       contrib/struts-faces/src/java/org/apache/struts/faces/component
                        BaseComponent.java ErrorsComponent.java
                        HtmlComponent.java MessageComponent.java
                        StylesheetComponent.java WriteComponent.java
  Log:
  Improve toolability by adding components with concrete properties, plus
  more complete metadata describing the components and their properties.
  Add "binding" attributes to the tags to enable component binding like that
  used with standard JSF components.
  
  Revision  Changes    Path
  1.6       +187 -7    jakarta-struts/contrib/struts-faces/src/conf/faces-config.xml
  
  Index: faces-config.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/struts-faces/src/conf/faces-config.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- faces-config.xml	7 Jul 2004 22:08:56 -0000	1.5
  +++ faces-config.xml	8 Jul 2004 01:11:27 -0000	1.6
  @@ -49,10 +49,190 @@
     <!-- Custom Components -->
   
     <component>
  +
  +    <component-type>org.apache.struts.faces.Base</component-type>
  +    <component-class>
  +      org.apache.struts.faces.component.BaseComponent
  +    </component-class>
  +
  +    <property>
  +      <description>
  +        Target frame for this base reference.
  +      </description>
  +      <display-name>Target Frame</display-name>
  +      <property-name>target</property-name>
  +      <property-class>java.lang.String</property-class>
  +    </property>
  +
  +  </component>
  +
  +
  +  <component>
  +
  +    <component-type>org.apache.struts.faces.Errors</component-type>
  +    <component-class>
  +      org.apache.struts.faces.component.ErrorsComponent
  +    </component-class>
  +
  +    <property>
  +      <description>
  +        Application scope attribute key for the MessageResources
  +        instance to use for lookup.  If not specified, the default
  +        MessageResources for the current module will be used.
  +      </description>
  +      <display-name>MessageResources Key</display-name>
  +      <property-name>bundle</property-name>
  +      <property-class>java.lang.String</property-class>
  +    </property>
  +
  +  </component>
  +
  +
  +  <component>
  +
       <component-type>org.apache.struts.faces.Form</component-type>
       <component-class>
         org.apache.struts.faces.component.FormComponent
       </component-class>
  +
  +  </component>
  +
  +
  +  <component>
  +
  +    <component-type>org.apache.struts.faces.Html</component-type>
  +    <component-class>
  +      org.apache.struts.faces.component.HtmlComponent
  +    </component-class>
  +
  +    <property>
  +      <description>
  +        Flag indicating whether a Locale should be stored in the
  +        user's session, based on the Accept-Language header, if
  +        one is not already present.
  +      </description>
  +      <display-name>Locale Flag</display-name>
  +      <property-name>locale</property-name>
  +      <property-class>boolean</property-class>
  +    </property>
  +
  +    <property>
  +      <description>
  +        Flag indicating whether XHTML-compatible output should
  +        be rendered.
  +      </description>
  +      <display-name>XHTML Flag</display-name>
  +      <property-name>xhtml</property-name>
  +      <property-class>boolean</property-class>
  +    </property>
  +
  +  </component>
  +
  +
  +  <component>
  +
  +    <component-type>org.apache.struts.faces.Message</component-type>
  +    <component-class>
  +      org.apache.struts.faces.component.MessageComponent
  +    </component-class>
  +
  +    <property>
  +      <description>
  +        Application scope attribute key for the MessageResources
  +        instance to use for lookup.  If not specified, the default
  +        MessageResources for the current module will be used.
  +      </description>
  +      <display-name>MessageResources Key</display-name>
  +      <property-name>bundle</property-name>
  +      <property-class>java.lang.String</property-class>
  +    </property>
  +
  +    <property>
  +      <description>
  +        Message key to use for message lookup
  +      </description>
  +      <display-name>Message Key</display-name>
  +      <property-name>key</property-name>
  +      <property-class>java.lang.String</property-class>
  +    </property>
  +
  +    <property>
  +      <description>
  +        CSS style(s) to render for this component.
  +      </description>
  +      <display-name>CSS Style(s)</display-name>
  +      <property-name>style</property-name>
  +      <property-class>java.lang.String</property-class>
  +    </property>
  +
  +    <property>
  +      <description>
  +        CSS style class(es) to render for this component.
  +      </description>
  +      <display-name>CSS Style Class(es)</display-name>
  +      <property-name>styleClass</property-name>
  +      <property-class>java.lang.String</property-class>
  +    </property>
  +
  +  </component>
  +
  +
  +  <component>
  +
  +    <component-type>org.apache.struts.faces.Stylesheet</component-type>
  +    <component-class>
  +      org.apache.struts.faces.component.StylesheetComponent
  +    </component-class>
  +
  +    <property>
  +      <description>
  +        Context-relative path (starting with a "/" character)
  +        of the stylesheet to which this link should point.
  +      </description>
  +      <display-name>Stylesheet Path</display-name>
  +      <property-name>path</property-name>
  +      <property-class>java.lang.String</property-class>
  +    </property>
  +
  +  </component>
  +
  +
  +  <component>
  +
  +    <component-type>org.apache.struts.faces.Write</component-type>
  +    <component-class>
  +      org.apache.struts.faces.component.WriteComponent
  +    </component-class>
  +
  +    <property>
  +      <description>
  +        Flag indicating that the rendered output should be filtered
  +        for characters that are sensitive in HTML.  Default value is
  +        "true".
  +      </description>
  +      <display-name>Filtered Flag</display-name>
  +      <property-name>filter</property-name>
  +      <property-class>boolean</property-class>
  +    </property>
  +
  +    <property>
  +      <description>
  +        CSS style(s) to render for this component.
  +      </description>
  +      <display-name>CSS Style(s)</display-name>
  +      <property-name>style</property-name>
  +      <property-class>java.lang.String</property-class>
  +    </property>
  +
  +    <property>
  +      <description>
  +        CSS style class(es) to render for this component.
  +      </description>
  +      <display-name>CSS Style Class(es)</display-name>
  +      <property-name>styleClass</property-name>
  +      <property-class>java.lang.String</property-class>
  +    </property>
  +
     </component>
   
   
  @@ -71,7 +251,7 @@
     <render-kit>
   
       <renderer>
  -      <component-family>javax.faces.Output</component-family>
  +      <component-family>org.apache.struts.faces.Base</component-family>
         <renderer-type>org.apache.struts.faces.Base</renderer-type>
         <renderer-class>
           org.apache.struts.faces.renderer.BaseRenderer
  @@ -79,7 +259,7 @@
       </renderer>
   
       <renderer>
  -      <component-family>javax.faces.Output</component-family>
  +      <component-family>org.apache.struts.faces.Errors</component-family>
         <renderer-type>org.apache.struts.faces.Errors</renderer-type>
         <renderer-class>
           org.apache.struts.faces.renderer.ErrorsRenderer
  @@ -87,7 +267,7 @@
       </renderer>
   
       <renderer>
  -      <component-family>javax.faces.Form</component-family>
  +      <component-family>org.apache.struts.faces.Form</component-family>
         <renderer-type>org.apache.struts.faces.Form</renderer-type>
         <renderer-class>
           org.apache.struts.faces.renderer.FormRenderer
  @@ -95,7 +275,7 @@
       </renderer>
   
       <renderer>
  -      <component-family>javax.faces.Output</component-family>
  +      <component-family>org.apache.struts.faces.Html</component-family>
         <renderer-type>org.apache.struts.faces.Html</renderer-type>
         <renderer-class>
           org.apache.struts.faces.renderer.HtmlRenderer
  @@ -103,7 +283,7 @@
       </renderer>
   
       <renderer>
  -      <component-family>javax.faces.Output</component-family>
  +      <component-family>org.apache.struts.faces.Message</component-family>
         <renderer-type>org.apache.struts.faces.Message</renderer-type>
         <renderer-class>
           org.apache.struts.faces.renderer.MessageRenderer
  @@ -111,7 +291,7 @@
       </renderer>
   
       <renderer>
  -      <component-family>javax.faces.Output</component-family>
  +      <component-family>org.apache.struts.faces.Stylesheet</component-family>
         <renderer-type>org.apache.struts.faces.Stylesheet</renderer-type>
         <renderer-class>
           org.apache.struts.faces.renderer.StylesheetRenderer
  @@ -119,7 +299,7 @@
       </renderer>
   
       <renderer>
  -      <component-family>javax.faces.Output</component-family>
  +      <component-family>org.apache.struts.faces.Write</component-family>
         <renderer-type>org.apache.struts.faces.Write</renderer-type>
         <renderer-class>
           org.apache.struts.faces.renderer.WriteRenderer
  
  
  
  1.7       +118 -0    jakarta-struts/contrib/struts-faces/src/conf/struts-faces.xml
  
  Index: struts-faces.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/struts-faces/src/conf/struts-faces.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- struts-faces.xml	8 Mar 2004 03:07:35 -0000	1.6
  +++ struts-faces.xml	8 Jul 2004 01:11:27 -0000	1.7
  @@ -79,6 +79,16 @@
       </description>
   
       <attribute>
  +      <name>binding</name>
  +      <required>false</required>
  +      <rtexprvalue>false</rtexprvalue>
  +      <description>
  +        <p>Value binding expression to bind this component to
  +        a backing bean property.</p>
  +      </description>
  +    </attribute>
  +
  +    <attribute>
         <name>id</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
  @@ -137,6 +147,16 @@
       </description>
   
       <attribute>
  +      <name>binding</name>
  +      <required>false</required>
  +      <rtexprvalue>false</rtexprvalue>
  +      <description>
  +        <p>Value binding expression to bind this component to
  +        a backing bean property.</p>
  +      </description>
  +    </attribute>
  +
  +    <attribute>
         <name>bundle</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
  @@ -198,6 +218,16 @@
       </attribute>
   
       <attribute>
  +      <name>binding</name>
  +      <required>false</required>
  +      <rtexprvalue>false</rtexprvalue>
  +      <description>
  +        <p>Value binding expression to bind this component to
  +        a backing bean property.</p>
  +      </description>
  +    </attribute>
  +
  +    <attribute>
         <name>enctype</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
  @@ -334,6 +364,16 @@
       </description>
   
       <attribute>
  +      <name>binding</name>
  +      <required>false</required>
  +      <rtexprvalue>false</rtexprvalue>
  +      <description>
  +        <p>Value binding expression to bind this component to
  +        a backing bean property.</p>
  +      </description>
  +    </attribute>
  +
  +    <attribute>
         <name>id</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
  @@ -354,6 +394,16 @@
       </attribute>
   
       <attribute>
  +      <name>rendered</name>
  +      <required>false</required>
  +      <rtexprvalue>false</rtexprvalue>
  +      <description>
  +        Boolean attribute indicating whether this component should be
  +        rendered or not.
  +      </description>
  +    </attribute>
  +
  +    <attribute>
         <name>xhtml</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
  @@ -563,6 +613,16 @@
       </description>
   
       <attribute>
  +      <name>binding</name>
  +      <required>false</required>
  +      <rtexprvalue>false</rtexprvalue>
  +      <description>
  +        <p>Value binding expression to bind this component to
  +        a backing bean property.</p>
  +      </description>
  +    </attribute>
  +
  +    <attribute>
         <name>bundle</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
  @@ -604,6 +664,15 @@
       </attribute>
   
       <attribute>
  +      <name>style</name>
  +      <required>false</required>
  +      <rtexprvalue>false</rtexprvalue>
  +      <description>
  +        <p>CSS styles used to render this component.</p>
  +      </description>
  +    </attribute>
  +
  +    <attribute>
         <name>styleClass</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
  @@ -640,6 +709,16 @@
       </description>
   
       <attribute>
  +      <name>binding</name>
  +      <required>false</required>
  +      <rtexprvalue>false</rtexprvalue>
  +      <description>
  +        <p>Value binding expression to bind this component to
  +        a backing bean property.</p>
  +      </description>
  +    </attribute>
  +
  +    <attribute>
         <name>id</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
  @@ -685,6 +764,16 @@
       </description>
   
       <attribute>
  +      <name>binding</name>
  +      <required>false</required>
  +      <rtexprvalue>false</rtexprvalue>
  +      <description>
  +        <p>Value binding expression to bind this component to
  +        a backing bean property.</p>
  +      </description>
  +    </attribute>
  +
  +    <attribute>
         <name>id</name>
         <required>true</required>
         <rtexprvalue>false</rtexprvalue>
  @@ -693,6 +782,16 @@
         </description>
       </attribute>
   
  +    <attribute>
  +      <name>rendered</name>
  +      <required>false</required>
  +      <rtexprvalue>false</rtexprvalue>
  +      <description>
  +        Boolean attribute indicating whether this component should be
  +        rendered or not.
  +      </description>
  +    </attribute>
  +
     </tag>
   
   
  @@ -726,6 +825,16 @@
       </description>
   
       <attribute>
  +      <name>binding</name>
  +      <required>false</required>
  +      <rtexprvalue>false</rtexprvalue>
  +      <description>
  +        <p>Value binding expression to bind this component to
  +        a backing bean property.</p>
  +      </description>
  +    </attribute>
  +
  +    <attribute>
         <name>filter</name>
         <required>false</required>
         <rtexprvalue>false</rtexprvalue>
  @@ -751,6 +860,15 @@
         <description>
           Boolean attribute indicating whether this component should be
           rendered or not.
  +      </description>
  +    </attribute>
  +
  +    <attribute>
  +      <name>style</name>
  +      <required>false</required>
  +      <rtexprvalue>false</rtexprvalue>
  +      <description>
  +        <p>CSS styles used to render this component.</p>
         </description>
       </attribute>
   
  
  
  
  1.11      +11 -1     jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/component/FormComponent.java
  
  Index: FormComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/component/FormComponent.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FormComponent.java	24 Jun 2004 01:16:44 -0000	1.10
  +++ FormComponent.java	8 Jul 2004 01:11:28 -0000	1.11
  @@ -91,6 +91,16 @@
       }
   
   
  +    /**
  +     * <p>Return the component family to which this component belongs.</p>
  +     */
  +    public String getFamily() {
  +
  +        return "org.apache.struts.faces.Form";
  +
  +    }
  +
  +
       // ---------------------------------------------------------- UIForm Methods
   
   
  
  
  
  1.1                  jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/component/BaseComponent.java
  
  Index: BaseComponent.java
  ===================================================================
  /*
   * Copyright 2002-2004 The Apache Software Foundation.
   * 
   * Licensed 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.
   */
  
  package org.apache.struts.faces.component;
  
  
  import java.io.IOException;
  import java.util.Iterator;
  
  import javax.faces.component.UIOutput;
  import javax.faces.context.FacesContext;
  import javax.faces.el.ValueBinding;
  
  
  /**
   * <p>Custom component that replaces the Struts
   * <code>&lt;html:base&gt;</code> tag.</p>
   */
  
  public class BaseComponent extends UIOutput {
  
  
      // ------------------------------------------------------------ Constructors
  
  
      /**
       * <p>Create a new {@link BaseComponent} with default properties.</p>
       */
      public BaseComponent() {
  
          super();
          setRendererType("org.apache.struts.faces.Base");
  
      }
  
  
      // ------------------------------------------------------ Instance Variables
  
  
      /**
       * <p>Target frame.</p>
       */
      private String target = null;
  
  
      // ---------------------------------------------------- Component Properties
  
  
      /**
       * <p>Return the component family to which this component belongs.</p>
       */
      public String getFamily() {
  
          return "org.apache.struts.faces.Base";
  
      }
  
  
      /**
       * <p>Return the target frame.</p>
       */
      public String getTarget() {
  
          ValueBinding vb = getValueBinding("target");
          if (vb != null) {
              return (String) vb.getValue(getFacesContext());
          } else {
              return target;
          }
  
      }
  
  
      /**
       * <p>Set the target frame.</p>
       *
       * @param target The new target frame
       */
      public void setTarget(String target) {
  
          this.target = target;
  
      }
  
  
      // ---------------------------------------------------- StateManager Methods
  
  
      /**
       * <p>Restore the state of this component.</p>
       *
       * @param context <code>FacesContext</code> for the current request
       * @param state State object from which to restore our state
       */
      public void restoreState(FacesContext context, Object state) {
  
          Object values[] = (Object[]) state;
          super.restoreState(context, values[0]);
          target = (String) values[1];
  
      }
  
  
      /**
       * <p>Save the state of this component.</p>
       *
       * @param context <code>FacesContext</code> for the current request
       */
      public Object saveState(FacesContext context) {
  
          Object values[] = new Object[2];
          values[0] = super.saveState(context);
          values[1] = target;
          return values;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/component/ErrorsComponent.java
  
  Index: ErrorsComponent.java
  ===================================================================
  /*
   * Copyright 2002-2004 The Apache Software Foundation.
   * 
   * Licensed 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.
   */
  
  package org.apache.struts.faces.component;
  
  
  import java.io.IOException;
  import java.util.Iterator;
  
  import javax.faces.component.UIOutput;
  import javax.faces.context.FacesContext;
  import javax.faces.el.ValueBinding;
  
  
  /**
   * <p>Custom component that replaces the Struts
   * <code>&lt;html:errors&gt;</code> tag.</p>
   */
  
  public class ErrorsComponent extends UIOutput {
  
  
      // ------------------------------------------------------------ Constructors
  
  
      /**
       * <p>Create a new {@link ErrorsComponent} with default properties.</p>
       */
      public ErrorsComponent() {
  
          super();
          setRendererType("org.apache.struts.faces.Errors");
  
      }
  
  
      // ------------------------------------------------------ Instance Variables
  
  
      /**
       * <p>MessageResources attribute key to use for message lookup.</p>
       */
      private String bundle = null;
  
  
      // ---------------------------------------------------- Component Properties
  
  
      /**
       * <p>Return the MessageResources key.</p>
       */
      public String getBundle() {
  
          ValueBinding vb = getValueBinding("bundle");
          if (vb != null) {
              return (String) vb.getValue(getFacesContext());
          } else {
              return bundle;
          }
  
      }
  
  
      /**
       * <p>Set the MessageResources key.</p>
       *
       * @param bundle The new key
       */
      public void setBundle(String bundle) {
  
          this.bundle = bundle;
  
      }
  
  
      /**
       * <p>Return the component family to which this component belongs.</p>
       */
      public String getFamily() {
  
          return "org.apache.struts.faces.Errors";
  
      }
  
  
      // ---------------------------------------------------- StateManager Methods
  
  
      /**
       * <p>Restore the state of this component.</p>
       *
       * @param context <code>FacesContext</code> for the current request
       * @param state State object from which to restore our state
       */
      public void restoreState(FacesContext context, Object state) {
  
          Object values[] = (Object[]) state;
          super.restoreState(context, values[0]);
          bundle = (String) values[1];
  
      }
  
  
      /**
       * <p>Save the state of this component.</p>
       *
       * @param context <code>FacesContext</code> for the current request
       */
      public Object saveState(FacesContext context) {
  
          Object values[] = new Object[2];
          values[0] = super.saveState(context);
          values[1] = bundle;
          return values;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/component/HtmlComponent.java
  
  Index: HtmlComponent.java
  ===================================================================
  /*
   * Copyright 2002-2004 The Apache Software Foundation.
   * 
   * Licensed 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.
   */
  
  package org.apache.struts.faces.component;
  
  
  import java.io.IOException;
  import java.util.Iterator;
  
  import javax.faces.component.UIOutput;
  import javax.faces.context.FacesContext;
  import javax.faces.el.ValueBinding;
  
  
  /**
   * <p>Custom component that replaces the Struts
   * <code>&lt;html:html&gt;</code> tag.</p>
   */
  
  public class HtmlComponent extends UIOutput {
  
  
      // ------------------------------------------------------------ Constructors
  
  
      /**
       * <p>Create a new {@link HtmlComponent} with default properties.</p>
       */
      public HtmlComponent() {
  
          super();
          setRendererType("org.apache.struts.faces.Html");
  
      }
  
  
      // ------------------------------------------------------ Instance Variables
  
  
      /**
       * <p>Flag indicating we should create a locale.</p>
       */
      private boolean locale = true;
      private boolean localeSet = false;
  
  
      /**
       * <p>Flag indicating we should render XHTML output.</p>
       */
      private boolean xhtml = false;
      private boolean xhtmlSet = false;
  
  
      // ---------------------------------------------------- Component Properties
  
  
      /**
       * <p>Return the component family to which this component belongs.</p>
       */
      public String getFamily() {
  
          return "org.apache.struts.faces.Html";
  
      }
  
  
      /**
       * <p>Return a flag indicating whether a locale should be created.</p>
       */
      public boolean isLocale() {
  
          if (localeSet) {
              return locale;
          }
          ValueBinding vb = getValueBinding("locale");
          if (vb != null) {
              Boolean value = (Boolean) vb.getValue(getFacesContext());
              if (null == value) {
                  return locale;
              }
              return value.booleanValue();
          } else {
              return locale;
          }
  
      }
  
  
      /**
       * <p>Set the flag indicating whether a locale should be created.</p>
       *
       * @param locale The new flag
       */
      public void setLocale(boolean locale) {
  
          this.locale = locale;
          this.localeSet = true;
  
      }
  
  
      /**
       * <p>Return a flag indicating whether xhtml should be created.</p>
       */
      public boolean isXhtml() {
  
          if (xhtmlSet) {
              return xhtml;
          }
          ValueBinding vb = getValueBinding("xhtml");
          if (vb != null) {
              Boolean value = (Boolean) vb.getValue(getFacesContext());
              if (null == value) {
                  return xhtml;
              }
              return value.booleanValue();
          } else {
              return xhtml;
          }
  
      }
  
  
      /**
       * <p>Set the flag indicating whether xhtml should be created.</p>
       *
       * @param xhtml The new flag
       */
      public void setXhtml(boolean xhtml) {
  
          this.xhtml = xhtml;
          this.xhtmlSet = true;
  
      }
  
  
      // ---------------------------------------------------- StateManager Methods
  
  
      /**
       * <p>Restore the state of this component.</p>
       *
       * @param context <code>FacesContext</code> for the current request
       * @param state State object from which to restore our state
       */
      public void restoreState(FacesContext context, Object state) {
  
          Object values[] = (Object[]) state;
          super.restoreState(context, values[0]);
          locale = ((Boolean) values[1]).booleanValue();
          localeSet = ((Boolean) values[2]).booleanValue();
          xhtml = ((Boolean) values[3]).booleanValue();
          xhtmlSet = ((Boolean) values[4]).booleanValue();
  
      }
  
  
      /**
       * <p>Save the state of this component.</p>
       *
       * @param context <code>FacesContext</code> for the current request
       */
      public Object saveState(FacesContext context) {
  
          Object values[] = new Object[5];
          values[0] = super.saveState(context);
          values[1] = locale ? Boolean.TRUE : Boolean.FALSE;
          values[2] = localeSet ? Boolean.TRUE : Boolean.FALSE;
          values[3] = xhtml ? Boolean.TRUE : Boolean.FALSE;
          values[4] = xhtmlSet ? Boolean.TRUE : Boolean.FALSE;
          return values;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/component/MessageComponent.java
  
  Index: MessageComponent.java
  ===================================================================
  /*
   * Copyright 2002-2004 The Apache Software Foundation.
   * 
   * Licensed 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.
   */
  
  package org.apache.struts.faces.component;
  
  
  import java.io.IOException;
  import java.util.Iterator;
  
  import javax.faces.component.UIOutput;
  import javax.faces.context.FacesContext;
  import javax.faces.el.ValueBinding;
  
  
  /**
   * <p>Custom component that replaces the Struts
   * <code>&lt;html:message&gt;</code> tag.</p>
   */
  
  public class MessageComponent extends UIOutput {
  
  
      // ------------------------------------------------------------ Constructors
  
  
      /**
       * <p>Create a new {@link MessageComponent} with default properties.</p>
       */
      public MessageComponent() {
  
          super();
          setRendererType("org.apache.struts.faces.Message");
  
      }
  
  
      // ------------------------------------------------------ Instance Variables
  
  
      /**
       * <p>MessageResources attribute key to use for message lookup.</p>
       */
      private String bundle = null;
  
  
      /**
       * <p>Message key to use for message lookup.</p>
       */
      private String key = null;
  
  
      /**
       * <p>CSS style(s) to be rendered for this component.</p>
       */
      private String style = null;
  
  
      /**
       * <p>CSS style class(es) to be rendered for this component.</p>
       */
      private String styleClass = null;
  
  
      // ---------------------------------------------------- Component Properties
  
  
      /**
       * <p>Return the MessageResources key.</p>
       */
      public String getBundle() {
  
          ValueBinding vb = getValueBinding("bundle");
          if (vb != null) {
              return (String) vb.getValue(getFacesContext());
          } else {
              return bundle;
          }
  
      }
  
  
      /**
       * <p>Set the MessageResources key.</p>
       *
       * @param bundle The new key
       */
      public void setBundle(String bundle) {
  
          this.bundle = bundle;
  
      }
  
  
      /**
       * <p>Return the component family to which this component belongs.</p>
       */
      public String getFamily() {
  
          return "org.apache.struts.faces.Message";
  
      }
  
  
      /**
       * <p>Return the message key.</p>
       */
      public String getKey() {
  
          ValueBinding vb = getValueBinding("key");
          if (vb != null) {
              return (String) vb.getValue(getFacesContext());
          } else {
              return key;
          }
  
      }
  
  
      /**
       * <p>Set the message key.</p>
       *
       * @param key The new key
       */
      public void setKey(String key) {
  
          this.key = key;
  
      }
  
  
      /**
       * <p>Return the CSS style(s) to be rendered for this component.</p>
       */
      public String getStyle() {
  
          ValueBinding vb = getValueBinding("style");
          if (vb != null) {
              return (String) vb.getValue(getFacesContext());
          } else {
              return style;
          }
  
      }
  
  
      /**
       * <p>Set the CSS style(s) to be rendered for this component.</p>
       *
       * @param style The new CSS style(s)
       */
      public void setStyle(String style) {
  
          this.style = style;
  
      }
  
  
      /**
       * <p>Return the CSS style class(es) to be rendered for this component.</p>
       */
      public String getStyleClass() {
  
          ValueBinding vb = getValueBinding("styleClass");
          if (vb != null) {
              return (String) vb.getValue(getFacesContext());
          } else {
              return styleClass;
          }
  
      }
  
  
      /**
       * <p>Set the CSS style class(es) to be rendered for this component.</p>
       *
       * @param style The new CSS style class(es)
       */
      public void setStyleClass(String styleClass) {
  
          this.styleClass = styleClass;
  
      }
  
  
      // ---------------------------------------------------- StateManager Methods
  
  
      /**
       * <p>Restore the state of this component.</p>
       *
       * @param context <code>FacesContext</code> for the current request
       * @param state State object from which to restore our state
       */
      public void restoreState(FacesContext context, Object state) {
  
          Object values[] = (Object[]) state;
          super.restoreState(context, values[0]);
          bundle = (String) values[1];
          key = (String) values[2];
          style = (String) values[3];
          styleClass = (String) values[4];
  
      }
  
  
      /**
       * <p>Save the state of this component.</p>
       *
       * @param context <code>FacesContext</code> for the current request
       */
      public Object saveState(FacesContext context) {
  
          Object values[] = new Object[5];
          values[0] = super.saveState(context);
          values[1] = bundle;
          values[2] = key;
          values[3] = style;
          values[4] = styleClass;
          return values;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/component/StylesheetComponent.java
  
  Index: StylesheetComponent.java
  ===================================================================
  /*
   * Copyright 2002-2004 The Apache Software Foundation.
   * 
   * Licensed 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.
   */
  
  package org.apache.struts.faces.component;
  
  
  import java.io.IOException;
  import java.util.Iterator;
  
  import javax.faces.component.UIOutput;
  import javax.faces.context.FacesContext;
  import javax.faces.el.ValueBinding;
  
  
  /**
   * <p>Custom component that replaces the Struts
   * <code>&lt;html:stylesheet&gt;</code> tag.</p>
   */
  
  public class StylesheetComponent extends UIOutput {
  
  
      // ------------------------------------------------------------ Constructors
  
  
      /**
       * <p>Create a new {@link StylesheetComponent} with default properties.</p>
       */
      public StylesheetComponent() {
  
          super();
          setRendererType("org.apache.struts.faces.Stylesheet");
  
      }
  
  
      // ------------------------------------------------------ Instance Variables
  
  
      /**
       * <p>Context-relative path of the stylesheet resource.</p>
       */
      private String path = null;
  
  
      // ---------------------------------------------------- Component Properties
  
  
      /**
       * <p>Return the component family to which this component belongs.</p>
       */
      public String getFamily() {
  
          return "org.apache.struts.faces.Stylesheet";
  
      }
  
  
      /**
       * <p>Return the context-relative stylesheet path.</p>
       */
      public String getPath() {
  
          ValueBinding vb = getValueBinding("path");
          if (vb != null) {
              return (String) vb.getValue(getFacesContext());
          } else {
              return path;
          }
  
      }
  
  
      /**
       * <p>Set the context-relative stylesheet path.</p>
       *
       * @param path The new path
       */
      public void setPath(String path) {
  
          this.path = path;
  
      }
  
  
      // ---------------------------------------------------- StateManager Methods
  
  
      /**
       * <p>Restore the state of this component.</p>
       *
       * @param context <code>FacesContext</code> for the current request
       * @param state State object from which to restore our state
       */
      public void restoreState(FacesContext context, Object state) {
  
          Object values[] = (Object[]) state;
          super.restoreState(context, values[0]);
          path = (String) values[1];
  
      }
  
  
      /**
       * <p>Save the state of this component.</p>
       *
       * @param context <code>FacesContext</code> for the current request
       */
      public Object saveState(FacesContext context) {
  
          Object values[] = new Object[2];
          values[0] = super.saveState(context);
          values[1] = path;
          return values;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/component/WriteComponent.java
  
  Index: WriteComponent.java
  ===================================================================
  /*
   * Copyright 2002-2004 The Apache Software Foundation.
   * 
   * Licensed 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.
   */
  
  package org.apache.struts.faces.component;
  
  
  import java.io.IOException;
  import java.util.Iterator;
  
  import javax.faces.component.UIOutput;
  import javax.faces.context.FacesContext;
  import javax.faces.el.ValueBinding;
  
  
  /**
   * <p>Custom component that replaces the Struts
   * <code>&lt;html:write&gt;</code> tag.</p>
   */
  
  public class WriteComponent extends UIOutput {
  
  
      // ------------------------------------------------------------ Constructors
  
  
      /**
       * <p>Create a new {@link WriteComponent} with default properties.</p>
       */
      public WriteComponent() {
  
          super();
          setRendererType("org.apache.struts.faces.Write");
  
      }
  
  
      // ------------------------------------------------------ Instance Variables
  
  
      /**
       * <p>Flag indicating whether output should be filtered.</p>
       */
      private boolean filter = true;
      private boolean filterSet = false;
  
  
      /**
       * <p>CSS style(s) to be rendered for this component.</p>
       */
      private String style = null;
  
  
      /**
       * <p>CSS style class(es) to be rendered for this component.</p>
       */
      private String styleClass = null;
  
  
      // ---------------------------------------------------- Component Properties
  
  
      /**
       * <p>Return the component family to which this component belongs.</p>
       */
      public String getFamily() {
  
          return "org.apache.struts.faces.Write";
  
      }
  
  
      /**
       * <p>Return a flag indicating whether filtering should take place.</p>
       */
      public boolean isFilter() {
  
          if (filterSet) {
              return filter;
          }
          ValueBinding vb = getValueBinding("filter");
          if (vb != null) {
              Boolean value = (Boolean) vb.getValue(getFacesContext());
              if (null == value) {
                  return filter;
              }
              return value.booleanValue();
          } else {
              return filter;
          }
  
      }
  
  
      /**
       * <p>Set the flag indicating that the output value should be filtered.</p>
       *
       * @param filter The new filter flag
       */
      public void setFilter(boolean filter) {
  
          this.filter = filter;
          this.filterSet = true;
  
      }
  
  
      /**
       * <p>Return the CSS style(s) to be rendered for this component.</p>
       */
      public String getStyle() {
  
          ValueBinding vb = getValueBinding("style");
          if (vb != null) {
              return (String) vb.getValue(getFacesContext());
          } else {
              return style;
          }
  
      }
  
  
      /**
       * <p>Set the CSS style(s) to be rendered for this component.</p>
       *
       * @param style The new CSS style(s)
       */
      public void setStyle(String style) {
  
          this.style = style;
  
      }
  
  
      /**
       * <p>Return the CSS style class(es) to be rendered for this component.</p>
       */
      public String getStyleClass() {
  
          ValueBinding vb = getValueBinding("styleClass");
          if (vb != null) {
              return (String) vb.getValue(getFacesContext());
          } else {
              return styleClass;
          }
  
      }
  
  
      /**
       * <p>Set the CSS style class(es) to be rendered for this component.</p>
       *
       * @param style The new CSS style class(es)
       */
      public void setStyleClass(String styleClass) {
  
          this.styleClass = styleClass;
  
      }
  
  
      // ---------------------------------------------------- StateManager Methods
  
  
      /**
       * <p>Restore the state of this component.</p>
       *
       * @param context <code>FacesContext</code> for the current request
       * @param state State object from which to restore our state
       */
      public void restoreState(FacesContext context, Object state) {
  
          Object values[] = (Object[]) state;
          super.restoreState(context, values[0]);
          filter = ((Boolean) values[1]).booleanValue();
          filterSet = ((Boolean) values[2]).booleanValue();
          style = (String) values[3];
          styleClass = (String) values[4];
  
      }
  
  
      /**
       * <p>Save the state of this component.</p>
       *
       * @param context <code>FacesContext</code> for the current request
       */
      public Object saveState(FacesContext context) {
  
          Object values[] = new Object[5];
          values[0] = super.saveState(context);
          values[1] = filter ? Boolean.TRUE : Boolean.FALSE;
          values[2] = filterSet ? Boolean.TRUE : Boolean.FALSE;
          values[3] = style;
          values[4] = styleClass;
          return values;
  
      }
  
  
  }
  
  
  
  1.6       +11 -4     jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/renderer/WriteRenderer.java
  
  Index: WriteRenderer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/renderer/WriteRenderer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WriteRenderer.java	8 Mar 2004 02:49:54 -0000	1.5
  +++ WriteRenderer.java	8 Jul 2004 01:11:28 -0000	1.6
  @@ -67,11 +67,18 @@
           }
   
           ResponseWriter writer = context.getResponseWriter();
  +        String style =
  +            (String) component.getAttributes().get("style");
           String styleClass =
               (String) component.getAttributes().get("styleClass");
  -        if (styleClass != null) {
  +        if ((style != null) || (styleClass != null)) {
               writer.startElement("span", component);
  -            writer.writeAttribute("class", styleClass, "styleClass");
  +            if (style != null) {
  +                writer.writeAttribute("style", style, "style");
  +            }
  +            if (styleClass != null) {
  +                writer.writeAttribute("class", styleClass, "styleClass");
  +            }
               writer.writeText("", null);
           }
           String text = getText(context, component);
  @@ -80,7 +87,7 @@
                         "," + text + ")");
           }
           writer.write(text);
  -        if (styleClass != null) {
  +        if ((style != null) || (styleClass != null)) {
               writer.endElement("span");
           }
   
  
  
  
  1.9       +14 -2     jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib/AbstractFacesTag.java
  
  Index: AbstractFacesTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib/AbstractFacesTag.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractFacesTag.java	9 Jun 2004 02:28:28 -0000	1.8
  +++ AbstractFacesTag.java	8 Jul 2004 01:11:28 -0000	1.9
  @@ -48,7 +48,17 @@
   
   
       /**
  -     * <p>The CSS style class used to render this component.</p>
  +     * <p>The CSS style(s) used to render this component.</p>
  +     */
  +    protected String style = null;
  +
  +    public void setStyle(String style) {
  +        this.style = style;
  +    }
  +
  +
  +    /**
  +     * <p>The CSS style class(es) used to render this component.</p>
        */
       protected String styleClass = null;
   
  @@ -91,6 +101,7 @@
   
           super.release();
           this.bundle = null;
  +        this.style = null;
           this.styleClass = null;
           this.value = null;
   
  @@ -109,6 +120,7 @@
   
           super.setProperties(component);
           setStringAttribute(component, "bundle", bundle);
  +        setStringAttribute(component, "style", style);
           setStringAttribute(component, "styleClass", styleClass);
           setStringAttribute(component, "value", value);
   
  
  
  
  1.8       +2 -2      jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib/BaseTag.java
  
  Index: BaseTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib/BaseTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BaseTag.java	9 Jun 2004 02:28:28 -0000	1.7
  +++ BaseTag.java	8 Jul 2004 01:11:28 -0000	1.8
  @@ -52,7 +52,7 @@
        */
       public String getComponentType() {
   
  -        return ("javax.faces.Output");
  +        return ("org.apache.struts.faces.Base");
   
       }
   
  
  
  
  1.8       +2 -2      jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib/ErrorsTag.java
  
  Index: ErrorsTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib/ErrorsTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ErrorsTag.java	8 Mar 2004 02:49:54 -0000	1.7
  +++ ErrorsTag.java	8 Jul 2004 01:11:28 -0000	1.8
  @@ -41,7 +41,7 @@
        */
       public String getComponentType() {
   
  -        return ("javax.faces.Output");
  +        return ("org.apache.struts.faces.Errors");
   
       }
   
  
  
  
  1.10      +2 -2      jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib/HtmlTag.java
  
  Index: HtmlTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib/HtmlTag.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- HtmlTag.java	24 Jun 2004 01:16:44 -0000	1.9
  +++ HtmlTag.java	8 Jul 2004 01:11:28 -0000	1.10
  @@ -64,7 +64,7 @@
        */
       public String getComponentType() {
   
  -        return ("javax.faces.Output");
  +        return ("org.apache.struts.faces.Html");
   
       }
   
  
  
  
  1.8       +2 -2      jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib/MessageTag.java
  
  Index: MessageTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib/MessageTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MessageTag.java	9 Jun 2004 02:28:28 -0000	1.7
  +++ MessageTag.java	8 Jul 2004 01:11:28 -0000	1.8
  @@ -66,7 +66,7 @@
        */
       public String getComponentType() {
   
  -        return ("javax.faces.Output");
  +        return ("org.apache.struts.faces.Message");
   
       }
   
  
  
  
  1.8       +2 -2      jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib/StylesheetTag.java
  
  Index: StylesheetTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib/StylesheetTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StylesheetTag.java	9 Jun 2004 02:28:28 -0000	1.7
  +++ StylesheetTag.java	8 Jul 2004 01:11:28 -0000	1.8
  @@ -53,7 +53,7 @@
        */
       public String getComponentType() {
   
  -        return ("javax.faces.Output");
  +        return ("org.apache.struts.faces.Stylesheet");
   
       }
   
  
  
  
  1.8       +2 -2      jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib/WriteTag.java
  
  Index: WriteTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/contrib/struts-faces/src/java/org/apache/struts/faces/taglib/WriteTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WriteTag.java	9 Jun 2004 02:28:28 -0000	1.7
  +++ WriteTag.java	8 Jul 2004 01:11:28 -0000	1.8
  @@ -54,7 +54,7 @@
        */
       public String getComponentType() {
   
  -        return ("javax.faces.Output");
  +        return ("org.apache.struts.faces.Write");
   
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message