commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/jelly/jelly-tags/swing/xdocs changes.xml
Date Tue, 07 Sep 2004 06:38:15 GMT
dion        2004/09/06 23:38:15

  Modified:    jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing
                        SwingTagLibrary.java
               jelly/jelly-tags/swing/xdocs changes.xml
  Added:       jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing
                        EtchedBorderTag.java
  Log:
  Add EtchedBorderTag. Jelly-93
  
  Revision  Changes    Path
  1.24      +1 -0      jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/SwingTagLibrary.java
  
  Index: SwingTagLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/SwingTagLibrary.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- SwingTagLibrary.java	5 Jun 2004 01:29:16 -0000	1.23
  +++ SwingTagLibrary.java	7 Sep 2004 06:38:15 -0000	1.24
  @@ -78,6 +78,7 @@
           
           // the border tags...
           registerTag( "titledBorder", TitledBorderTag.class );
  +        registerTag( "etchedBorder", EtchedBorderTag.class );
           // @todo the other kinds of borders, empty, bevelled, compound etc
               
           // the layout tags...
  
  
  
  1.1                  jakarta-commons/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/EtchedBorderTag.java
  
  Index: EtchedBorderTag.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.commons.jelly.tags.swing;
  
  import java.awt.Color;
  import javax.swing.BorderFactory;
  import javax.swing.border.Border;
  import javax.swing.border.EtchedBorder;
  
  import org.apache.commons.jelly.JellyTagException;
  import org.apache.commons.jelly.MissingAttributeException;
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  /**
   * Creates an etched border.
   * The border will either be exported as a variable defined by the 'var' attribute
   * or will be set on the parent widget's border property
   *
   * @author <a href="mailto:robert@bull-enterprises.com">Robert McIntosh</a>
   * @version $Revision: 1.1 $
   */
  public class EtchedBorderTag extends BorderTagSupport {
  
      /** The Log to which logging calls will be made. */
      private static final Log log = LogFactory.getLog(EtchedBorderTag.class);
  
      private int     etchType  = -1;
      private Color   highlight = null;
      private Color   shadow    = null;
  
      // Tag interface
      //-------------------------------------------------------------------------
      public void doTag(final XMLOutput output) throws MissingAttributeException, JellyTagException
{
          if( highlight != null && shadow == null ) {
              throw new MissingAttributeException("shadow must be supplied when highlight
is supplied");
          }
          if( shadow != null && highlight == null) {
              throw new MissingAttributeException("highlight must be supplied when shadow
is supplied");
          }
          if( etchType != EtchedBorder.LOWERED || etchType != EtchedBorder.RAISED ) {
              if( log.isDebugEnabled() ) log.debug( "etchType set to [" + etchType + "], which
is invalid. Reseting to -1" );
          }
          super.doTag(output);
      }
  
      // Properties
      //-------------------------------------------------------------------------
      /**
       * Sets the etch type. Must be either EtchedBorder.LOWERED or EtchedBorder.RAISED
       * @param type
       */
      public void setEtchType( int type ) {
          etchType = type;
      }
  
      /**
       * Sets the highlight color
       * @param highlight
       */
      public void setHighlight( Color highlight ) {
          this.highlight = highlight;
      }
  
      /**
       * Sets the shadow color
       * @param shadow
       */
      public void setTop( Color shadow ) {
          this.shadow = shadow;
      }
  
      /**
       * Factory method to create a new EtchedBorder instance.
       */
      protected Border createBorder() {
          if( etchType == -1 && shadow == null && highlight == null) {
              return BorderFactory.createEtchedBorder();
          }
          else if ( highlight != null && shadow != null && etchType > -1
) {
              return BorderFactory.createEtchedBorder( etchType, highlight, shadow );
          }
          else {
              return BorderFactory.createEtchedBorder( highlight, shadow );
          }
  
      }
  
  }
  
  
  
  1.3       +1 -0      jakarta-commons/jelly/jelly-tags/swing/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/swing/xdocs/changes.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- changes.xml	6 Sep 2004 02:52:33 -0000	1.2
  +++ changes.xml	7 Sep 2004 06:38:15 -0000	1.3
  @@ -25,6 +25,7 @@
     </properties>
     <body>
       <release version="1.0-SNAPSHOT" date="in CVS">
  +      <action dev="dion" type="fix" issue="JELLY-93" due-to="Robert McIntosh">Add
EtchedBorder tag.</action>
         <action dev="dion" type="fix">Ensure JDK 1.3 compatibility.</action>
         <action dev="dion" type="fix" issue="JELLY-130" due-to="Hans Gilde">Handle
JDK 1.4 GridbagConstraints using reflection</action>
         <action dev="dion" type="fix" issue="JELLY-122" due-to="Hans Gilde">ComponentTag
should clear it's bean reference after doTag</action>
  
  
  

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


Mime
View raw message