Changeset 10317 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-06-02T23:01:09+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java
r10316 r10317 18 18 import org.openstreetmap.josm.tools.Destroyable; 19 19 20 /** 21 * This is the panel displayed on the right side of JOSM. It displays a list of panels. 22 */ 20 23 public class DialogsPanel extends JPanel implements Destroyable { 21 24 private final List<ToggleDialog> allDialogs = new ArrayList<>(); … … 28 31 private final List<JPanel> panels = new ArrayList<>(); 29 32 33 /** 34 * If {@link #initialize(List)} was called. read only from outside 35 */ 36 public boolean initialized; 37 30 38 private final JSplitPane parent; 31 39 40 /** 41 * Creates a new {@link DialogsPanel}. 42 * @param parent The parent split pane that allows this panel to change it's size. 43 */ 32 44 public DialogsPanel(JSplitPane parent) { 33 45 this.parent = parent; 34 46 } 35 47 36 public boolean initialized; // read only from outside 37 48 /** 49 * Initializes this panel 50 * @param pAllDialogs The list of dialogs this panel should contain on start. 51 */ 38 52 public void initialize(List<ToggleDialog> pAllDialogs) { 39 if (initialized) 40 throw new IllegalStateException(); 53 if (initialized) { 54 throw new IllegalStateException("Panel can only be initialized once."); 55 } 41 56 initialized = true; 42 57 allDialogs.clear(); … … 50 65 } 51 66 67 /** 68 * Add a new {@link ToggleDialog} to the list of known dialogs and trigger reconstruct. 69 * @param dlg The dialog to add 70 */ 52 71 public void add(ToggleDialog dlg) { 53 72 add(dlg, true); 54 73 } 55 74 75 /** 76 * Add a new {@link ToggleDialog} to the list of known dialogs. 77 * @param dlg The dialog to add 78 * @param doReconstruct <code>true</code> if reconstruction should be triggered. 79 */ 56 80 public void add(ToggleDialog dlg, boolean doReconstruct) { 57 81 allDialogs.add(dlg); 58 int i = allDialogs.size() - 1;59 82 dlg.setDialogsPanel(this); 60 83 dlg.setVisible(false); … … 72 95 p.setVisible(false); 73 96 74 mSpltPane.add(p, 'L'+Integer.toString(i)); 97 int dialogIndex = allDialogs.size() - 1; 98 mSpltPane.add(p, 'L'+Integer.toString(dialogIndex)); 75 99 panels.add(p); 76 100 … … 94 118 */ 95 119 public enum Action { 120 /** 121 * The panel was invisible previously 122 */ 96 123 INVISIBLE_TO_DEFAULT, 124 /** 125 * The panel was collapsed by the user. 126 */ 97 127 COLLAPSED_TO_DEFAULT, 98 128 /* INVISIBLE_TO_COLLAPSED, does not happen */ 99 ELEMENT_SHRINKS /* else. (Remaining elements have more space.) */ 129 /** 130 * else. (Remaining elements have more space.) 131 */ 132 ELEMENT_SHRINKS 100 133 } 101 134 -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r10173 r10317 605 605 } 606 606 607 /** 608 * This is the popup menu used for the title bar. 609 */ 607 610 public class DialogPopupMenu extends JPopupMenu { 608 611 … … 627 630 } 628 631 632 /** 633 * Registers the mouse listeners. 634 * <p> 635 * Should be called once after this title was added to the dialog. 636 */ 629 637 public final void registerMouseListener() { 630 638 popupMenu = new DialogPopupMenu(); … … 826 834 } 827 835 836 /** 837 * Sets the button from the button list that is used to display this dialog. 838 * <p> 839 * Note: This is ignored by the {@link ToggleDialog} for now. 840 * @param button The button for this dialog. 841 */ 828 842 public void setButton(JToggleButton button) { 829 843 this.button = button; 830 844 } 831 845 846 /** 847 * Gets the button from the button list that is used to display this dialog. 848 * @return button The button for this dialog. 849 */ 832 850 public JToggleButton getButton() { 833 851 return button; … … 866 884 } 867 885 886 /** 887 * Create a component with the given layout for this component. 888 * @param data The content to be displayed 889 * @param scroll <code>true</code> if it should be wrapped in a {@link JScrollPane} 890 * @param buttons The buttons to add. 891 * @return The component. 892 */ 868 893 protected Component createLayout(Component data, boolean scroll, Collection<SideButton> buttons) { 869 894 return createLayout(data, scroll, buttons, (Collection<SideButton>[]) null);
Note:
See TracChangeset
for help on using the changeset viewer.