Changeset 34005 in osm for applications/editors/josm/plugins/indoorhelper/src/views/DialogPanel.java
- Timestamp:
- 2018-01-13T18:19:22+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/indoorhelper/src/views/DialogPanel.java
r32637 r34005 68 68 powerButton = new JToggleButton(); 69 69 levelLabel = new JLabel(); 70 levelBox = new JosmComboBox< String>();70 levelBox = new JosmComboBox<>(); 71 71 levelTagLabel = new JLabel(); 72 72 levelTagField = new DisableShortcutsOnFocusGainedTextField(); … … 88 88 89 89 //======== dialogPane ======== 90 { 91 this.setBorder(new EmptyBorder(12, 12, 12, 12)); 92 this.setLayout(new BorderLayout()); 93 94 //======== contentPanel ======== 95 { 96 contentPanel.setLayout(new GridBagLayout()); 97 ((GridBagLayout) contentPanel.getLayout()).columnWidths = new int[] { 98 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 99 ((GridBagLayout) contentPanel.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0}; 100 ((GridBagLayout) contentPanel.getLayout()).columnWeights = new double[] { 101 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4}; 102 ((GridBagLayout) contentPanel.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4}; 103 104 //---- powerButton ---- 105 powerButton.setText(tr("POWER")); 106 powerButton.setToolTipText(tr("Activates the plug-in")); 107 contentPanel.add(powerButton, new GridBagConstraints(8, 0, 4, 1, 0.0, 0.0, 108 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 109 new Insets(0, 0, 5, 5), 0, 0)); 110 contentPanel.add(separator1, new GridBagConstraints(1, 1, 12, 1, 0.0, 0.0, 111 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 112 new Insets(0, 0, 5, 5), 0, 0)); 113 114 //---- levelLabel ---- 115 levelLabel.setText(tr("Working Level")); 116 contentPanel.add(levelLabel, new GridBagConstraints(1, 2, 2, 1, 0.0, 0.0, 117 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 118 new Insets(0, 0, 5, 5), 0, 0)); 119 120 //---- levelBox ---- 121 levelBox.setEnabled(false); 122 levelBox.setEditable(false); 123 levelBox.setToolTipText(tr("Selects the working level.")); 124 contentPanel.add(levelBox, new GridBagConstraints(3, 2, 3, 1, 0.0, 0.0, 125 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 126 new Insets(0, 0, 5, 5), 0, 0)); 127 128 //---- levelTagLabel ---- 129 levelTagLabel.setText(tr("Level Name")); 130 contentPanel.add(levelTagLabel, new GridBagConstraints(7, 2, 1, 1, 0.0, 0.0, 131 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 132 new Insets(0, 0, 5, 5), 0, 0)); 133 134 //---- levelTagField ---- 135 levelTagField.setEnabled(false); 136 levelTagField.setColumns(6); 137 levelTagField.setToolTipText(tr("Optional name-tag for a level.")); 138 contentPanel.add(levelTagField, new GridBagConstraints(8, 2, 5, 1, 0.0, 0.0, 139 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 140 new Insets(0, 0, 5, 5), 0, 0)); 141 contentPanel.add(separator2, new GridBagConstraints(1, 3, 12, 1, 0.0, 0.0, 142 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 143 new Insets(0, 0, 5, 5), 0, 0)); 144 145 //---- objectLabel ---- 146 objectLabel.setText(tr("Object")); 147 contentPanel.add(objectLabel, new GridBagConstraints(0, 4, 3, 1, 0.0, 0.0, 148 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 149 new Insets(0, 0, 5, 5), 0, 0)); 150 151 //---- objectBox ---- 152 objectBox.setEnabled(false); 153 objectBox.setPrototypeDisplayValue(IndoorObject.CONCRETE_WALL); 154 objectBox.setToolTipText(tr("The object preset you want to tag.")); 155 contentPanel.add(objectBox, new GridBagConstraints(3, 4, 3, 1, 0.0, 0.0, 156 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 157 new Insets(0, 0, 5, 5), 0, 0)); 158 159 //---- nameLabel ---- 160 nameLabel.setText(tr("Name")); 161 contentPanel.add(nameLabel, new GridBagConstraints(0, 5, 3, 1, 0.0, 0.0, 162 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 163 new Insets(0, 0, 5, 5), 0, 0)); 164 165 //---- nameField ---- 166 nameField.setEnabled(false); 167 nameField.addFocusListener(new FocusListener() { 168 169 @Override 170 public void focusLost(FocusEvent e) {} 171 172 @Override 173 public void focusGained(FocusEvent e) { 174 nameField.selectAll(); 175 } 176 }); 177 nameField.setToolTipText(tr("Sets the name tag when the room-object is selected.")); 178 contentPanel.add(nameField, new GridBagConstraints(3, 5, 3, 1, 0.0, 0.0, 179 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 180 new Insets(0, 0, 5, 5), 0, 0)); 181 182 //---- refLabel ---- 183 refLabel.setText(tr("Reference")); 184 contentPanel.add(refLabel, new GridBagConstraints(0, 6, 3, 1, 0.0, 0.0, 185 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 186 new Insets(0, 0, 0, 5), 0, 0)); 187 188 //---- refField ---- 189 refField.setEnabled(false); 190 refField.addFocusListener(new FocusListener() { 191 192 @Override 193 public void focusLost(FocusEvent e) {} 194 195 @Override 196 public void focusGained(FocusEvent e) { 197 refField.selectAll(); 198 } 199 }); 200 refField.setToolTipText(tr("Sets the ref tag when the room-object is selected.")); 201 contentPanel.add(refField, new GridBagConstraints(3, 6, 3, 1, 0.0, 0.0, 202 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 203 new Insets(0, 0, 0, 5), 0, 0)); 90 91 this.setBorder(new EmptyBorder(12, 12, 12, 12)); 92 this.setLayout(new BorderLayout()); 93 94 //======== contentPanel ======== 95 96 contentPanel.setLayout(new GridBagLayout()); 97 ((GridBagLayout) contentPanel.getLayout()).columnWidths = new int[] { 98 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 99 ((GridBagLayout) contentPanel.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0}; 100 ((GridBagLayout) contentPanel.getLayout()).columnWeights = new double[] { 101 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 102 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4}; 103 ((GridBagLayout) contentPanel.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4}; 104 105 //---- powerButton ---- 106 powerButton.setText(tr("POWER")); 107 powerButton.setToolTipText(tr("Activates the plug-in")); 108 contentPanel.add(powerButton, new GridBagConstraints(8, 0, 4, 1, 0.0, 0.0, 109 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 110 new Insets(0, 0, 5, 5), 0, 0)); 111 contentPanel.add(separator1, new GridBagConstraints(1, 1, 12, 1, 0.0, 0.0, 112 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 113 new Insets(0, 0, 5, 5), 0, 0)); 114 115 //---- levelLabel ---- 116 levelLabel.setText(tr("Working Level")); 117 contentPanel.add(levelLabel, new GridBagConstraints(1, 2, 2, 1, 0.0, 0.0, 118 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 119 new Insets(0, 0, 5, 5), 0, 0)); 120 121 //---- levelBox ---- 122 levelBox.setEnabled(false); 123 levelBox.setEditable(false); 124 levelBox.setToolTipText(tr("Selects the working level.")); 125 contentPanel.add(levelBox, new GridBagConstraints(3, 2, 3, 1, 0.0, 0.0, 126 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 127 new Insets(0, 0, 5, 5), 0, 0)); 128 129 //---- levelTagLabel ---- 130 levelTagLabel.setText(tr("Level Name")); 131 contentPanel.add(levelTagLabel, new GridBagConstraints(7, 2, 1, 1, 0.0, 0.0, 132 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 133 new Insets(0, 0, 5, 5), 0, 0)); 134 135 //---- levelTagField ---- 136 levelTagField.setEnabled(false); 137 levelTagField.setColumns(6); 138 levelTagField.setToolTipText(tr("Optional name-tag for a level.")); 139 contentPanel.add(levelTagField, new GridBagConstraints(8, 2, 5, 1, 0.0, 0.0, 140 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 141 new Insets(0, 0, 5, 5), 0, 0)); 142 contentPanel.add(separator2, new GridBagConstraints(1, 3, 12, 1, 0.0, 0.0, 143 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 144 new Insets(0, 0, 5, 5), 0, 0)); 145 146 //---- objectLabel ---- 147 objectLabel.setText(tr("Object")); 148 contentPanel.add(objectLabel, new GridBagConstraints(0, 4, 3, 1, 0.0, 0.0, 149 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 150 new Insets(0, 0, 5, 5), 0, 0)); 151 152 //---- objectBox ---- 153 objectBox.setEnabled(false); 154 objectBox.setPrototypeDisplayValue(IndoorObject.CONCRETE_WALL); 155 objectBox.setToolTipText(tr("The object preset you want to tag.")); 156 contentPanel.add(objectBox, new GridBagConstraints(3, 4, 3, 1, 0.0, 0.0, 157 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 158 new Insets(0, 0, 5, 5), 0, 0)); 159 160 //---- nameLabel ---- 161 nameLabel.setText(tr("Name")); 162 contentPanel.add(nameLabel, new GridBagConstraints(0, 5, 3, 1, 0.0, 0.0, 163 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 164 new Insets(0, 0, 5, 5), 0, 0)); 165 166 //---- nameField ---- 167 nameField.setEnabled(false); 168 nameField.addFocusListener(new FocusListener() { 169 170 @Override 171 public void focusLost(FocusEvent e) {} 172 173 @Override 174 public void focusGained(FocusEvent e) { 175 nameField.selectAll(); 204 176 } 205 this.add(contentPanel, BorderLayout.CENTER); 206 207 //======== buttonBar ======== 208 { 209 buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); 210 buttonBar.setLayout(new GridBagLayout()); 211 ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 80}; 212 ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0}; 213 214 //---- applyButton ---- 215 applyButton.setText(tr("Apply Tags")); 216 applyButton.setEnabled(false); 217 buttonBar.add(applyButton, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, 218 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 219 new Insets(0, 0, 0, 0), 0, 0)); 177 }); 178 nameField.setToolTipText(tr("Sets the name tag when the room-object is selected.")); 179 contentPanel.add(nameField, new GridBagConstraints(3, 5, 3, 1, 0.0, 0.0, 180 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 181 new Insets(0, 0, 5, 5), 0, 0)); 182 183 //---- refLabel ---- 184 refLabel.setText(tr("Reference")); 185 contentPanel.add(refLabel, new GridBagConstraints(0, 6, 3, 1, 0.0, 0.0, 186 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 187 new Insets(0, 0, 0, 5), 0, 0)); 188 189 //---- refField ---- 190 refField.setEnabled(false); 191 refField.addFocusListener(new FocusListener() { 192 193 @Override 194 public void focusLost(FocusEvent e) {} 195 196 @Override 197 public void focusGained(FocusEvent e) { 198 refField.selectAll(); 220 199 } 221 this.add(buttonBar, BorderLayout.SOUTH); 222 } 200 }); 201 refField.setToolTipText(tr("Sets the ref tag when the room-object is selected.")); 202 contentPanel.add(refField, new GridBagConstraints(3, 6, 3, 1, 0.0, 0.0, 203 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 204 new Insets(0, 0, 0, 5), 0, 0)); 205 206 this.add(contentPanel, BorderLayout.CENTER); 207 208 //======== buttonBar ======== 209 210 buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); 211 buttonBar.setLayout(new GridBagLayout()); 212 ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 80}; 213 ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0}; 214 215 //---- applyButton ---- 216 applyButton.setText(tr("Apply Tags")); 217 applyButton.setEnabled(false); 218 buttonBar.add(applyButton, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, 219 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 220 new Insets(0, 0, 0, 0), 0, 0)); 221 222 this.add(buttonBar, BorderLayout.SOUTH); 223 223 } 224 225 224 }
Note:
See TracChangeset
for help on using the changeset viewer.
