Changeset 24451 in osm for applications/editors
- Timestamp:
- 2010-11-29T03:29:14+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/smed/plugs/harbour/src/harbour
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/harbour/src/harbour/panels/PanelLimits.java
r24438 r24451 3 3 import harbour.widgets.LightTile; 4 4 import harbour.widgets.TextFieldEx; 5 import harbour.widgets.TextFieldEx.Ssize; 5 6 import harbour.widgets.TristateCheckBox; 6 7 … … 43 44 private JCheckBox etaCheckBox = null; 44 45 private JPanel exPanel = null; 46 45 47 public PanelLimits() { 46 48 super(); … … 75 77 this.add(getTideTextField(), null); 76 78 this.add(mLabel, null); 77 this.add(getAllComboBox(), null);78 79 this.add(grLabel, null); 79 80 this.add(getGrButton(), null); … … 83 84 this.add(getUsCheckBox(), null); 84 85 this.add(getEtaCheckBox(), null); 86 this.add(getAllComboBox(), null); 85 87 this.add(getExPanel(), null); 86 88 } … … 168 170 allComboBox = new JComboBox(); 169 171 allComboBox.setBounds(new Rectangle(135, 70, 190, 20)); 172 allComboBox.setFont(new Font("Dialog", Font.PLAIN, 12)); 173 allComboBox.addActionListener(new java.awt.event.ActionListener() { 174 public void actionPerformed(java.awt.event.ActionEvent e) { 175 int type = allComboBox.getSelectedIndex(); 176 Ssize sType = ((TextFieldEx) exPanel).getSizeType(); 177 if(sType == TextFieldEx.VS_SIZE ) { 178 switch (type) { 179 case TextFieldEx.NOT_SELECTED: 180 if(((TextFieldEx) exPanel).selTextField != null ) ((TextFieldEx) exPanel).selTextField.setText(""); 181 break; 182 183 case TextFieldEx.LARGE: 184 ((TextFieldEx) exPanel).selTextField.setText("> 500ft"); 185 break; 186 187 case TextFieldEx.MEDIUM: 188 ((TextFieldEx) exPanel).selTextField.setText("bis 500ft"); 189 break; 190 191 case TextFieldEx.UNKNOWN: 192 ((TextFieldEx) exPanel).selTextField.setText("unbekannt"); 193 break; 194 195 } 196 197 } 198 } 199 }); 170 200 } 171 201 return allComboBox; … … 275 305 exPanel.setLayout(null); 276 306 exPanel.setBounds(new Rectangle(135, 95, 190, 112)); 307 ((TextFieldEx) exPanel).setComboBox(allComboBox); 308 ((TextFieldEx) exPanel).initialize(); 277 309 } 278 310 return exPanel; -
applications/editors/josm/plugins/smed/plugs/harbour/src/harbour/widgets/TextFieldEx.java
r24428 r24451 1 1 package harbour.widgets; 2 2 3 import harbour.widgets.TristateCheckBox.State; 4 3 5 import java.awt.GridBagLayout; 4 6 5 7 import javax.swing.ButtonGroup; 8 import javax.swing.JComboBox; 6 9 import javax.swing.JPanel; 7 10 import javax.swing.JTextField; … … 34 37 35 38 private JRadioButton oilRadioButton = null; 36 39 40 private JComboBox comboBox = null; 41 private Ssize sizeType = VS_SIZE; // @jve:decl-index=0: 42 public JTextField selTextField = null; 43 44 // Enumarations 45 public static class Ssize {private Ssize() {} } 46 public final static Ssize VS_SIZE = new Ssize(); // @jve:decl-index=0: 47 public final static Ssize AN_SIZE = new Ssize(); // @jve:decl-index=0: 48 49 public final static int NOT_SELECTED = 0; 50 public final static int LARGE = 1; 51 public final static int MEDIUM = 2; 52 public final static int UNKNOWN = 3; 53 37 54 /** 38 55 * This is the default constructor … … 40 57 public TextFieldEx() { 41 58 super(); 42 initialize();43 59 } 44 60 … … 48 64 * @return void 49 65 */ 50 p rivatevoid initialize() {66 public void initialize() { 51 67 oilLabel = new JLabel(); 52 68 oilLabel.setBounds(new Rectangle(75, 94, 80, 15)); … … 92 108 buttons.add(cargoRadioButton); 93 109 buttons.add(oilRadioButton); 110 111 sizeRadioButton.setSelected(true); 112 selTextField = sizeTextField; 94 113 } 95 114 … … 103 122 sizeTextField = new JTextField(); 104 123 sizeTextField.setBounds(new Rectangle(0, 0, 75, 20)); 124 sizeTextField.setEditable(false); 105 125 } 106 126 return sizeTextField; … … 116 136 sizeRadioButton = new JRadioButton(); 117 137 sizeRadioButton.setBounds(new Rectangle(170, 0, 20, 20)); 138 139 setComboBoxSize(); 140 141 sizeRadioButton.addActionListener(new java.awt.event.ActionListener() { 142 public void actionPerformed(java.awt.event.ActionEvent e) { 143 sizeType = VS_SIZE; 144 selTextField = sizeTextField ; 145 comboBox.removeAllItems(); 146 setComboBoxSize(); 147 } 148 }); 118 149 } 119 150 return sizeRadioButton; 120 151 } 152 121 153 122 154 /** … … 142 174 chRadioButton = new JRadioButton(); 143 175 chRadioButton.setBounds(new Rectangle(170, 23, 20, 20)); 176 chRadioButton.addActionListener(new java.awt.event.ActionListener() { 177 public void actionPerformed(java.awt.event.ActionEvent e) { 178 sizeType = AN_SIZE; 179 selTextField = chTextField ; 180 comboBox.removeAllItems(); 181 setAnchorageSize(); 182 } 183 }); 144 184 } 145 185 return chRadioButton; 146 186 } 187 147 188 148 189 /** … … 168 209 tieRadioButton = new JRadioButton(); 169 210 tieRadioButton.setBounds(new Rectangle(170, 46, 20, 20)); 211 tieRadioButton.addActionListener(new java.awt.event.ActionListener() { 212 public void actionPerformed(java.awt.event.ActionEvent e) { 213 sizeType = AN_SIZE; 214 selTextField = tieTextField; 215 comboBox.removeAllItems(); 216 setAnchorageSize(); 217 } 218 }); 170 219 } 171 220 return tieRadioButton; … … 194 243 cargoRadioButton = new JRadioButton(); 195 244 cargoRadioButton.setBounds(new Rectangle(170, 69, 20, 20)); 245 cargoRadioButton.addActionListener(new java.awt.event.ActionListener() { 246 public void actionPerformed(java.awt.event.ActionEvent e) { 247 sizeType = AN_SIZE; 248 selTextField = cargoTextField; 249 comboBox.removeAllItems(); 250 setAnchorageSize(); 251 } 252 }); 196 253 } 197 254 return cargoRadioButton; … … 220 277 oilRadioButton = new JRadioButton(); 221 278 oilRadioButton.setBounds(new Rectangle(170, 92, 20, 20)); 279 oilRadioButton.addActionListener(new java.awt.event.ActionListener() { 280 public void actionPerformed(java.awt.event.ActionEvent e) { 281 sizeType = AN_SIZE; 282 selTextField = oilTextField; 283 comboBox.removeAllItems(); 284 setAnchorageSize(); 285 } 286 }); 222 287 } 223 288 return oilRadioButton; 224 289 } 225 290 291 public void setComboBox(JComboBox box) { 292 comboBox = box; 293 } 294 295 private void setComboBoxSize() { 296 comboBox.addItem("* Waehle Groesse ..."); 297 comboBox.addItem("> 500 ft lang"); 298 comboBox.addItem("bis 500 ft lang"); 299 comboBox.addItem("Unbekannt"); 300 } 301 302 private void setAnchorageSize() { 303 comboBox.addItem("* Waehle Groesse ..."); 304 comboBox.addItem("A > 76 ft > 23.2m"); 305 comboBox.addItem("B 71-75ft 21.6-22.9m"); 306 comboBox.addItem("C 66-70ft 20.1-21.3m"); 307 comboBox.addItem("D 61-65ft 18.6-19.8m"); 308 comboBox.addItem("E 56-60ft 17.1-18.2m"); 309 comboBox.addItem("F 51-55ft 15.5-16.0m"); 310 comboBox.addItem("G 46-50ft 14.0-15.2m"); 311 comboBox.addItem("H 41-45ft 12.5-13.7m"); 312 comboBox.addItem("J 36-40ft 11.0-12.2m"); 313 comboBox.addItem("K 31-35ft 9.4-10.0m"); 314 comboBox.addItem("L 26-30ft 7.9- 9.1m"); 315 comboBox.addItem("M 21-25ft 6.4- 7.6m"); 316 comboBox.addItem("N 16-20ft 4.9- 6.1m"); 317 comboBox.addItem("O 11-15ft 3.4- 4.6m"); 318 comboBox.addItem("P 6-10ft 1.8- 3.0m"); 319 comboBox.addItem("Q 0- 5ft 0.0- 1.5m"); 320 comboBox.addItem("U Unbekannt Unbekannt"); 321 } 322 323 public Ssize getSizeType() { 324 return sizeType; 325 } 226 326 }
Note:
See TracChangeset
for help on using the changeset viewer.