1 14 package org.wings; 15 16 import java.util.HashMap ; 17 import java.util.Iterator ; 18 import java.util.Map ; 19 20 29 public class SBorderLayout 30 extends SAbstractLayoutManager { 31 32 public static final String NORTH = "North"; 33 public static final String SOUTH = "South"; 34 public static final String EAST = "East"; 35 public static final String WEST = "West"; 36 public static final String CENTER = "Center"; 37 38 protected Map components = new HashMap (5); 39 protected int border = 0; 40 41 46 protected int hgap = 0; 47 48 53 protected int vgap = 0; 54 55 56 59 public SBorderLayout() {} 60 61 64 public SBorderLayout(int hgap, int vgap) { 65 setHgap(hgap); 66 setVgap(vgap); 67 } 68 69 70 public void addComponent(SComponent c, Object constraint, int index) { 71 if (constraint == null) 72 constraint = CENTER; 73 74 components.put(constraint, c); 75 } 76 77 public void removeComponent(SComponent c) { 78 if (c == null) 79 return; 80 81 Iterator iterator = components.entrySet().iterator(); 82 while (iterator.hasNext()) { 83 Map.Entry entry = (Map.Entry ) iterator.next(); 84 if (c.equals(entry.getValue())) { 85 iterator.remove(); 86 break; 87 } 88 } 89 } 90 91 public Map getComponents() { 92 return components; 93 } 94 95 101 public void setBorder(int pixel) { 102 border = pixel; 103 } 104 105 110 public int getBorder() { 111 return border; 112 } 113 114 120 public int getHgap() { 121 return hgap; 122 } 123 124 130 public void setHgap(int hgap) { 131 this.hgap = hgap; 132 } 133 134 140 public int getVgap() { 141 return vgap; 142 } 143 144 150 public void setVgap(int vgap) { 151 this.vgap = vgap; 152 } 153 } 154 155 156 | Popular Tags |