Changeset 4353 in josm for trunk/src/org
- Timestamp:
- 2011-08-27T13:57:45+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r4223 r4353 12 12 import java.awt.event.MouseEvent; 13 13 import java.util.ArrayList; 14 import java.util.Arrays; 14 15 import java.util.Collection; 15 16 import java.util.Collections; … … 23 24 import javax.swing.DefaultListSelectionModel; 24 25 import javax.swing.JList; 25 import javax.swing.JPanel;26 26 import javax.swing.JPopupMenu; 27 import javax.swing.JScrollPane;28 27 import javax.swing.KeyStroke; 29 28 import javax.swing.ListSelectionModel; … … 106 105 displaylist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 107 106 displaylist.addMouseListener(new MouseEventHandler()); 108 add(new JScrollPane(displaylist), BorderLayout.CENTER); 109 110 // create the panel with buttons 111 // 112 JPanel tp = getButtonPanel(5); 107 113 108 // the new action 114 109 // 115 110 newAction = new NewAction(); 116 tp.add(new SideButton(newAction, false));117 111 118 112 // the edit action … … 120 114 editAction = new EditAction(); 121 115 displaylist.addListSelectionListener(editAction); 122 tp.add(new SideButton(editAction, false));123 116 124 117 // the duplicate action … … 126 119 DuplicateAction duplicateAction = new DuplicateAction(); 127 120 displaylist.addListSelectionListener(duplicateAction); 128 tp.add(new SideButton(duplicateAction, false));129 121 130 122 // the delete action … … 132 124 deleteAction = new DeleteAction(); 133 125 displaylist.addListSelectionListener(deleteAction); 134 tp.add(new SideButton(deleteAction, false));135 126 136 127 // the select action … … 138 129 SelectAction selectAction = new SelectAction(false); 139 130 displaylist.addListSelectionListener(selectAction); 140 tp.add(new SideButton(selectAction, false)); 141 142 add(tp, BorderLayout.SOUTH); 131 132 createLayout(displaylist, true, Arrays.asList(new SideButton[] { 133 new SideButton(newAction, false), 134 new SideButton(editAction, false), 135 new SideButton(duplicateAction, false), 136 new SideButton(deleteAction, false), 137 new SideButton(selectAction, false) 138 })); 143 139 144 140 // activate DEL in the list of relations -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r3598 r4353 22 22 import java.awt.event.WindowEvent; 23 23 24 import java.util.Collection; 25 24 26 import javax.swing.AbstractAction; 25 27 import javax.swing.BorderFactory; … … 30 32 import javax.swing.JLabel; 31 33 import javax.swing.JOptionPane; 34 import javax.swing.JScrollPane; 32 35 import javax.swing.JPanel; 33 36 import javax.swing.JToggleButton; … … 39 42 import org.openstreetmap.josm.gui.help.Helpful; 40 43 import org.openstreetmap.josm.gui.util.RedirectInputMap; 44 import org.openstreetmap.josm.gui.SideButton; 41 45 import org.openstreetmap.josm.tools.GBC; 42 46 import org.openstreetmap.josm.tools.ImageProvider; … … 116 120 String helpId = "Dialog/"+getClass().getName().substring(getClass().getName().lastIndexOf('.')+1); 117 121 toggleAction.putValue("help", helpId.substring(0, helpId.length()-6)); 118 119 setLayout(new BorderLayout());120 122 121 123 /** show the minimize button */ … … 654 656 } 655 657 658 /* use createLayout() instead of self-constructed dialogs */ 659 @Deprecated 656 660 protected JPanel getButtonPanel(int columns) { 657 661 JPanel pnl = new JPanel(); … … 660 664 return pnl; 661 665 } 666 667 protected void createLayout(Component data, boolean scroll, Collection<SideButton> buttons) { 668 if(scroll) 669 add(new JScrollPane(data), BorderLayout.CENTER); 670 else 671 add(data, BorderLayout.CENTER); 672 if(buttons != null && buttons.size() != 0) { 673 JPanel buttonsPanel = new JPanel(); 674 buttonsPanel.setLayout(Main.pref.getBoolean("dialog.align.left", false) 675 ? new FlowLayout(FlowLayout.LEFT) : new GridLayout(1,buttons.size())); 676 for(SideButton button : buttons) 677 buttonsPanel.add(button); 678 add(buttonsPanel, BorderLayout.SOUTH); 679 } 680 } 662 681 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
r4078 r4353 15 15 import java.text.NumberFormat; 16 16 import java.util.ArrayList; 17 import java.util.Arrays; 17 18 import java.util.Collection; 18 19 import java.util.Collections; … … 29 30 import javax.swing.JLabel; 30 31 import javax.swing.JOptionPane; 31 import javax.swing.JPanel;32 import javax.swing.JScrollPane;33 32 import javax.swing.JTable; 34 33 import javax.swing.ListSelectionModel; … … 87 86 } 88 87 89 protected JPanel buildButtonRow() {90 JPanel pnl = getButtonPanel(2);91 92 // -- select users primitives action93 //94 selectionUsersPrimitivesAction = new SelectUsersPrimitivesAction();95 userTable.getSelectionModel().addListSelectionListener(selectionUsersPrimitivesAction);96 pnl.add(new SideButton(selectionUsersPrimitivesAction));97 98 // -- info action99 //100 showUserInfoAction = new ShowUserInfoAction();101 userTable.getSelectionModel().addListSelectionListener(showUserInfoAction);102 pnl.add(new SideButton(showUserInfoAction));103 104 // -- load relicensing info action105 loadRelicensingInformationAction = new LoadRelicensingInformationAction();106 pnl.add(new SideButton(loadRelicensingInformationAction));107 return pnl;108 }109 110 88 protected void build() { 111 JPanel pnl = new JPanel();112 pnl.setLayout(new BorderLayout());113 89 model = new UserTableModel(); 114 90 userTable = new JTable(model); 115 91 userTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 92 userTable.addMouseListener(new DoubleClickAdapter()); 116 93 TableColumnModel columnModel = userTable.getColumnModel(); 117 94 columnModel.getColumn(3).setPreferredWidth(20); … … 125 102 }; 126 103 }); 127 pnl.add(new JScrollPane(userTable), BorderLayout.CENTER); 128 129 // -- the button row 130 pnl.add(buildButtonRow(), BorderLayout.SOUTH); 131 userTable.addMouseListener(new DoubleClickAdapter()); 132 add(pnl, BorderLayout.CENTER); 104 105 // -- select users primitives action 106 // 107 selectionUsersPrimitivesAction = new SelectUsersPrimitivesAction(); 108 userTable.getSelectionModel().addListSelectionListener(selectionUsersPrimitivesAction); 109 110 // -- info action 111 // 112 showUserInfoAction = new ShowUserInfoAction(); 113 userTable.getSelectionModel().addListSelectionListener(showUserInfoAction); 114 115 // -- load relicensing info action 116 loadRelicensingInformationAction = new LoadRelicensingInformationAction(); 117 118 createLayout(userTable, true, Arrays.asList(new SideButton[] { 119 new SideButton(selectionUsersPrimitivesAction), 120 new SideButton(showUserInfoAction), 121 new SideButton(loadRelicensingInformationAction) 122 })); 133 123 } 134 124
Note:
See TracChangeset
for help on using the changeset viewer.