View Javadoc

1   /*
2    * Created on Nov 6, 2005
3    *
4    */
5   package org.apache.commons.jelly.tags.swing;
6   
7   import java.awt.CardLayout;
8   import java.awt.LayoutManager;
9   
10  /*** Implements CardLayout. Takes parameters hgap, vgap per the class. You can
11   * set the "var" attribute of this tag, this will store the layout manager
12   * in that context attribute, for later use.
13   * 
14   * @author Hans Gilde
15   *
16   */
17  public class CardLayoutTag extends LayoutTagSupport {
18      private int hgap;
19      private boolean hgapSet = false;
20      private int vgap;
21      private boolean vgapSet = false;
22  
23      protected LayoutManager createLayoutManager() {
24          CardLayout cl = new CardLayout();
25  
26          if (hgapSet) {
27              cl.setHgap(hgap);
28          }
29          
30          if (vgapSet) {
31              cl.setVgap(vgap);
32          }
33          
34          return cl;
35      }
36  
37      /***
38       * @return Returns the hgap.
39       */
40      public int getHgap() {
41          return hgap;
42      }
43  
44      /***
45       * @param hgap The hgap to set.
46       */
47      public void setHgap(int hgap) {
48          this.hgap = hgap;
49          hgapSet = true;
50      }
51  
52      /***
53       * @return Returns the vgap.
54       */
55      public int getVgap() {
56          return vgap;
57      }
58  
59      /***
60       * @param vgap The vgap to set.
61       */
62      public void setVgap(int vgap) {
63          this.vgap = vgap;
64          vgapSet = true;
65      }
66  
67  }