1 30 31 package com.jgoodies.forms.layout; 32 33 34 57 58 public class ColumnSpec extends FormSpec { 59 60 61 63 66 public static final DefaultAlignment LEFT = FormSpec.LEFT_ALIGN; 67 68 71 public static final DefaultAlignment CENTER = FormSpec.CENTER_ALIGN; 72 73 76 public static final DefaultAlignment MIDDLE = CENTER; 77 78 81 public static final DefaultAlignment RIGHT = FormSpec.RIGHT_ALIGN; 82 83 86 public static final DefaultAlignment FILL = FormSpec.FILL_ALIGN; 87 88 91 public static final DefaultAlignment DEFAULT = FILL; 92 93 94 96 108 public ColumnSpec(DefaultAlignment defaultAlignment, 109 Size size, 110 double resizeWeight) { 111 super(defaultAlignment, size, resizeWeight); 112 } 113 114 115 123 public ColumnSpec(Size size) { 124 super(DEFAULT, size, NO_GROW); 125 } 126 127 133 public ColumnSpec(String encodedDescription) { 134 super(DEFAULT, encodedDescription); 135 } 136 137 143 public ColumnSpec asUnmodifyable() { 144 return new UnmodifyableColumnSpec(this); 145 } 146 147 148 150 157 protected final boolean isHorizontal() { 158 return true; 159 } 160 161 162 164 private static final class UnmodifyableColumnSpec extends ColumnSpec { 165 166 private UnmodifyableColumnSpec(ColumnSpec columnSpec) { 167 super(columnSpec.getDefaultAlignment(), 168 columnSpec.getSize(), 169 columnSpec.getResizeWeight()); 170 } 171 172 175 public void setDefaultAlignment(DefaultAlignment newDefaultAlignment) { 176 throw new UnsupportedOperationException (); 177 } 178 179 182 public void setSize(Size size) { 183 throw new UnsupportedOperationException (); 184 } 185 186 189 public void setResizeWeight(double weight) { 190 throw new UnsupportedOperationException (); 191 } 192 193 198 public ColumnSpec asUnmodifyable() { 199 return this; 200 } 201 202 } 203 204 205 } 206 207 | Popular Tags |