Changeset 5117 for incubator/widgets/coordinatelayout/src/com/itmill/toolkit/tests/tickets/Ticket1267.java
- Timestamp:
- 07/25/08 06:49:03 (6 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
incubator/widgets/coordinatelayout/src/com/itmill/toolkit/tests/tickets/Ticket1267.java
r4980 r5117 7 7 import com.itmill.toolkit.data.Property.ValueChangeListener; 8 8 import com.itmill.toolkit.ui.CheckBox; 9 import com.itmill.toolkit.ui.Component; 9 10 import com.itmill.toolkit.ui.CoordinateLayout; 10 11 import com.itmill.toolkit.ui.GridLayout; … … 19 20 public class Ticket1267 extends Application { 20 21 21 final int[] values = new int[6];22 22 final CoordinateLayout layout = new CoordinateLayout(); 23 final Table table = new Table(); 24 25 public void updateCoords() { 26 Coordinates newCoord = layout.new Coordinates(values[0], values[1], 27 values[2], values[3], values[4], values[5]); 28 newCoord.setUnitsPercent(true, true, true, true, true, true); 29 layout.setCoordinates(table, newCoord); 30 } 23 Table table = new Table("Test table"); 31 24 32 25 public void init() { … … 35 28 36 29 SplitPanel sPanel = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL); 37 Panel right = new Panel();38 39 final GridLayout rightLayout = new GridLayout(3, 6);40 30 41 31 table.setPageLength(10); … … 65 55 table.setSizeFull(); 66 56 layout.addComponent(table); 57 layout.setCoordinates(table, layout.new Coordinates("0,-1,-1,0,-1,-1")); 67 58 68 59 Coordinates xy1 = layout.new Coordinates("0, -1, -1, 0, 20%, -1"); … … 95 86 */ 96 87 88 sPanel.addComponent(layout); 89 90 sPanel.addComponent(getControlPanel(table)); 91 92 sPanel.setSplitPosition(75); 93 94 main.setLayout(sPanel); 95 setMainWindow(main); 96 } 97 98 public Panel getControlPanel(final Component c) { 99 Panel newPanel = new Panel("Controls for " + c.getCaption()); 100 newPanel.setLayout(new GridLayout(3, 6)); 101 102 final int[] values = new int[6]; 97 103 Arrays.fill(values, -1); 98 104 … … 139 145 sliderArray[j].setEnabled(false); 140 146 labelArray[j].setEnabled(false); 141 updateCoords(); 147 148 Coordinates newCoord = layout.new Coordinates( 149 values[0], values[1], values[2], values[3], 150 values[4], values[5]); 151 newCoord.setUnitsPercent(true, true, true, true, true, 152 true); 153 layout.setCoordinates(c, newCoord); 142 154 } 143 155 } … … 148 160 Double newValue = (Double) event.getProperty().getValue(); 149 161 values[j] = (int) newValue.doubleValue(); 150 updateCoords(); 162 163 Coordinates newCoord = layout.new Coordinates(values[0], 164 values[1], values[2], values[3], values[4], 165 values[5]); 166 newCoord 167 .setUnitsPercent(true, true, true, true, true, true); 168 layout.setCoordinates(c, newCoord); 151 169 labelArray[j].setValue(new Integer(values[j])); 152 170 } … … 155 173 156 174 for (int i = 0; i < sliderArray.length; i++) { 157 rightLayout.addComponent(checkBoxArray[i]);158 rightLayout.addComponent(sliderArray[i]);159 rightLayout.addComponent(labelArray[i]);175 newPanel.addComponent(checkBoxArray[i]); 176 newPanel.addComponent(sliderArray[i]); 177 newPanel.addComponent(labelArray[i]); 160 178 } 161 179 162 sPanel.addComponent(layout); 163 right.setLayout(rightLayout); 164 sPanel.addComponent(right); 165 166 sPanel.setSplitPosition(75); 167 168 main.setLayout(sPanel); 169 setMainWindow(main); 180 return newPanel; 170 181 } 171 182 }
