Changeset 11945 in josm
- Timestamp:
- 2017-04-17T14:47:28+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
r11747 r11945 73 73 * </pre> 74 74 */ 75 public class ExtendedDialog extends JDialog { 75 public class ExtendedDialog extends JDialog implements IExtendedDialog { 76 76 private final boolean disposeOnClose; 77 77 private volatile int result; … … 173 173 } 174 174 175 /** 176 * Allows decorating the buttons with icons. 177 * @param buttonIcons The button icons 178 * @return {@code this} 179 */ 175 @Override 180 176 public ExtendedDialog setButtonIcons(Icon... buttonIcons) { 181 177 this.bIcons = Utils.copyArray(buttonIcons); … … 183 179 } 184 180 185 /** 186 * Convenience method to provide image names instead of images. 187 * @param buttonIcons The button icon names 188 * @return {@code this} 189 */ 181 @Override 190 182 public ExtendedDialog setButtonIcons(String... buttonIcons) { 191 183 bIcons = new Icon[buttonIcons.length]; … … 196 188 } 197 189 198 /** 199 * Allows decorating the buttons with tooltips. Expects a String array with 200 * translated tooltip texts. 201 * 202 * @param toolTipTexts the tool tip texts. Ignored, if null. 203 * @return {@code this} 204 */ 190 @Override 205 191 public ExtendedDialog setToolTipTexts(String... toolTipTexts) { 206 192 this.bToolTipTexts = Utils.copyArray(toolTipTexts); … … 208 194 } 209 195 210 /** 211 * Sets the content that will be displayed in the message dialog. 212 * 213 * Note that depending on your other settings more UI elements may appear. 214 * The content is played on top of the other elements though. 215 * 216 * @param content Any element that can be displayed in the message dialog 217 * @return {@code this} 218 */ 196 @Override 219 197 public ExtendedDialog setContent(Component content) { 220 198 return setContent(content, true); 221 199 } 222 200 223 /** 224 * Sets the content that will be displayed in the message dialog. 225 * 226 * Note that depending on your other settings more UI elements may appear. 227 * The content is played on top of the other elements though. 228 * 229 * @param content Any element that can be displayed in the message dialog 230 * @param placeContentInScrollPane if true, places the content in a JScrollPane 231 * @return {@code this} 232 */ 201 @Override 233 202 public ExtendedDialog setContent(Component content, boolean placeContentInScrollPane) { 234 203 this.content = content; … … 237 206 } 238 207 239 /** 240 * Sets the message that will be displayed. The String will be automatically 241 * wrapped if it is too long. 242 * 243 * Note that depending on your other settings more UI elements may appear. 244 * The content is played on top of the other elements though. 245 * 246 * @param message The text that should be shown to the user 247 * @return {@code this} 248 */ 208 @Override 249 209 public ExtendedDialog setContent(String message) { 250 210 return setContent(string2label(message), false); 251 211 } 252 212 253 /** 254 * Decorate the dialog with an icon that is shown on the left part of 255 * the window area. (Similar to how it is done in {@link JOptionPane}) 256 * @param icon The icon to display 257 * @return {@code this} 258 */ 213 @Override 259 214 public ExtendedDialog setIcon(Icon icon) { 260 215 this.icon = icon; … … 262 217 } 263 218 264 /** 265 * Convenience method to allow values that would be accepted by {@link JOptionPane} as messageType. 266 * @param messageType The {@link JOptionPane} messageType 267 * @return {@code this} 268 */ 219 @Override 269 220 public ExtendedDialog setIcon(int messageType) { 270 221 switch (messageType) { … … 284 235 } 285 236 286 /** 287 * Show the dialog to the user. Call this after you have set all options 288 * for the dialog. You can retrieve the result using {@link #getValue()}. 289 * @return {@code this} 290 */ 237 @Override 291 238 public ExtendedDialog showDialog() { 292 239 // Check if the user has set the dialog to not be shown again … … 309 256 } 310 257 311 /** 312 * Retrieve the user choice after the dialog has been closed. 313 * 314 * @return <ul> <li>The selected button. The count starts with 1.</li> 315 * <li>A return value of {@link #DialogClosedOtherwise} means the dialog has been closed otherwise.</li> 316 * </ul> 317 */ 258 @Override 318 259 public int getValue() { 319 260 return result; … … 322 263 private boolean setupDone; 323 264 324 /** 325 * This is called by {@link #showDialog()}. 326 * Only invoke from outside if you need to modify the contentPane 327 */ 265 @Override 328 266 public void setupDialog() { 329 267 if (setupDone) … … 523 461 } 524 462 525 /** 526 * Call this if you want the dialog to remember the geometry (size and position) set by the user. 527 * Set the pref to <code>null</code> or to an empty string to disable again. 528 * By default, it's disabled. 529 * 530 * Note: If you want to set the width of this dialog directly use the usual 531 * setSize, setPreferredSize, setMaxSize, setMinSize 532 * 533 * @param pref The preference to save the dimension to 534 * @param wg The default window geometry that should be used if no 535 * existing preference is found (only takes effect if 536 * <code>pref</code> is not null or empty 537 * @return {@code this} 538 */ 463 @Override 539 464 public ExtendedDialog setRememberWindowGeometry(String pref, WindowGeometry wg) { 540 465 rememberSizePref = pref == null ? "" : pref; … … 543 468 } 544 469 545 /** 546 * Calling this will offer the user a "Do not show again" checkbox for the 547 * dialog. Default is to not offer the choice; the dialog will be shown 548 * every time. 549 * Currently, this is not supported for non-modal dialogs. 550 * @param togglePref The preference to save the checkbox state to 551 * @return {@code this} 552 */ 470 @Override 553 471 public ExtendedDialog toggleEnable(String togglePref) { 554 472 if (!modal) { … … 560 478 } 561 479 562 /** 563 * Sets the button that will react to ENTER. 564 * @param defaultButtonIdx The button index (starts to 1) 565 * @return {@code this} 566 */ 480 @Override 567 481 public ExtendedDialog setDefaultButton(int defaultButtonIdx) { 568 482 this.defaultButtonIdx = defaultButtonIdx; … … 570 484 } 571 485 572 /** 573 * Used in combination with toggle: 574 * If the user presses 'cancel' the toggle settings are ignored and not saved to the pref 575 * @param cancelButtonIdx index of the button that stands for cancel, accepts multiple values 576 * @return {@code this} 577 */ 486 @Override 578 487 public ExtendedDialog setCancelButton(Integer... cancelButtonIdx) { 579 488 this.cancelButtonIdx = new HashSet<>(Arrays.<Integer>asList(cancelButtonIdx)); … … 581 490 } 582 491 583 /** 584 * Makes default button request initial focus or not. 585 * @param focus {@code true} to make default button request initial focus 586 * @since 7407 587 */ 492 @Override 588 493 public void setFocusOnDefaultButton(boolean focus) { 589 494 focusOnDefaultButton = focus; … … 596 501 } 597 502 598 /** 599 * This function returns true if the dialog has been set to "do not show again" 600 * @return true if dialog should not be shown again 601 */ 503 @Override 602 504 public final boolean toggleCheckState() { 603 505 toggleable = togglePref != null && !togglePref.isEmpty(); … … 634 536 } 635 537 636 /** 637 * Configures how this dialog support for context sensitive help. 638 * <ul> 639 * <li>if helpTopic is null, the dialog doesn't provide context sensitive help</li> 640 * <li>if helpTopic != null, the dialog redirect user to the help page for this helpTopic when 641 * the user clicks F1 in the dialog</li> 642 * <li>if showHelpButton is true, the dialog displays "Help" button (rightmost button in 643 * the button row)</li> 644 * </ul> 645 * 646 * @param helpTopic the help topic 647 * @param showHelpButton true, if the dialog displays a help button 648 * @return {@code this} 649 */ 538 @Override 650 539 public ExtendedDialog configureContextsensitiveHelp(String helpTopic, boolean showHelpButton) { 651 540 this.helpTopic = helpTopic; -
trunk/src/org/openstreetmap/josm/gui/SelectionManager.java
r10716 r11945 16 16 import java.util.LinkedList; 17 17 18 import javax.swing.Action; 19 18 20 import org.openstreetmap.josm.Main; 19 21 import org.openstreetmap.josm.actions.SelectByInternalPointAction; … … 60 62 * @author imi 61 63 */ 62 public interface SelectionEnded { 64 public interface SelectionEnded extends Action { 63 65 /** 64 66 * Called, when the left mouse button was released. … … 69 71 */ 70 72 void selectionEnded(Rectangle r, MouseEvent e); 71 72 /**73 * Called to register the selection manager for "active" property.74 * @param listener The listener to register75 */76 void addPropertyChangeListener(PropertyChangeListener listener);77 78 /**79 * Called to remove the selection manager from the listener list80 * for "active" property.81 * @param listener The listener to register82 */83 void removePropertyChangeListener(PropertyChangeListener listener);84 73 } 85 74 -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r11804 r11945 76 76 import org.openstreetmap.josm.data.preferences.StringProperty; 77 77 import org.openstreetmap.josm.gui.ExtendedDialog; 78 import org.openstreetmap.josm.gui.IExtendedDialog; 78 79 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; 79 80 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; … … 241 242 } 242 243 244 /** 245 * Returns a new {@code AddTagsDialog}. 246 * @return a new {@code AddTagsDialog} 247 */ 243 248 protected AddTagsDialog getAddTagsDialog() { 244 249 return new AddTagsDialog(); … … 267 272 } 268 273 269 protected interface IEditTagDialog { 270 ExtendedDialog showDialog(); 271 272 int getValue(); 273 274 /** 275 * Extracted interface of {@link EditTagDialog}. 276 */ 277 protected interface IEditTagDialog extends IExtendedDialog { 278 /** 279 * Edit tags of multiple selected objects according to selected ComboBox values 280 * If value == "", tag will be deleted 281 * Confirmations may be needed. 282 */ 274 283 void performTagEdit(); 275 284 } … … 483 492 } 484 493 485 /**486 * Edit tags of multiple selected objects according to selected ComboBox values487 * If value == "", tag will be deleted488 * Confirmations may be needed.489 */490 494 @Override 491 495 public void performTagEdit() {
Note:
See TracChangeset
for help on using the changeset viewer.