Changeset 1228 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-01-09T22:11:24+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r1169 r1228 60 60 61 61 private void buildList() { 62 if(Main.main.undoRedo.commands.size() != 0) { 63 setTitle(tr("Command Stack: {0}", Main.main.undoRedo.commands.size()), true); 64 } else { 65 setTitle(tr("Command Stack"), false); 66 } 62 67 if (Main.map == null || Main.map.mapView == null || Main.map.mapView.editLayer == null) 63 68 return; -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r1221 r1228 130 130 if (osm instanceof Relation) 131 131 model.addElement(osm); 132 133 if(model.size() != 0) { 134 setTitle(tr("Conflicts: {0}", model.size()), true); 135 } else { 136 setTitle(tr("Conflicts"), false); 137 } 132 138 } 133 139 -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r1213 r1228 286 286 downButton.setEnabled(sel >= 0 && sel < model.getSize()-1); 287 287 deleteAction.setEnabled(!model.isEmpty()); 288 289 if(model.getSize() != 0) { 290 setTitle(tr("Layers: {0}", model.getSize()), true); 291 } else { 292 setTitle(tr("Layers"), false); 293 } 288 294 } 289 295 -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r1169 r1228 695 695 696 696 membershipTable.getTableHeader().setVisible(membershipData.getRowCount() > 0); 697 } 697 698 if(propertyData.getRowCount() != 0 || membershipData.getRowCount() != 0) { 699 setTitle(tr("Properties: {0} / Memberships: {1}", 700 propertyData.getRowCount(), membershipData.getRowCount()), true); 701 } else { 702 setTitle(tr("Properties / Memberships"), false); 703 } 704 705 } 698 706 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r1169 r1228 122 122 } 123 123 list.setSize(i); 124 125 if(Main.ds.relations.size() != 0) { 126 setTitle(tr("Relations: {0}", Main.ds.relations.size()), true); 127 } else { 128 setTitle(tr("Relations"), false); 129 } 124 130 } 125 131 -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r1195 r1228 262 262 selectionHistory.removeLast(); 263 263 } 264 265 int ways = 0; 266 int nodes = 0; 267 int relations = 0; 268 for (OsmPrimitive o : newSelection) { 269 if (o instanceof Way) 270 ways++; 271 else if (o instanceof Node) 272 nodes++; 273 else if (o instanceof Relation) 274 relations++; 275 } 276 277 if( (nodes+ways+relations) != 0) { 278 setTitle(tr("Selection: Rel.: {0} / Ways: {1} / Nodes: {2}", relations, ways, nodes), true); 279 } else { 280 setTitle(tr("Selection"), false); 281 } 264 282 } 265 283 -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r1180 r1228 1 1 // License: GPL. Copyright 2007 by Immanuel Scholz and others 2 2 package org.openstreetmap.josm.gui.dialogs; 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 3 5 4 6 import java.awt.BorderLayout; … … 6 8 import java.awt.EventQueue; 7 9 import java.awt.GridBagLayout; 10 import java.awt.Component; 11 import java.awt.Image; 8 12 import java.awt.event.ActionEvent; 9 13 import java.awt.event.ActionListener; 10 14 import java.awt.event.ComponentAdapter; 11 15 import java.awt.event.ComponentEvent; 16 import java.awt.event.MouseEvent; 17 import java.awt.event.MouseListener; 12 18 import java.awt.event.WindowAdapter; 13 19 import java.awt.event.WindowEvent; … … 20 26 import javax.swing.JLabel; 21 27 import javax.swing.JPanel; 28 import javax.swing.ImageIcon; 22 29 23 30 import org.openstreetmap.josm.Main; … … 61 68 public JPanel parent; 62 69 private final JPanel titleBar = new JPanel(new GridBagLayout()); 70 public JLabel label = new JLabel(); 63 71 64 72 public ToggleDialog(final String name, String iconName, String tooltip, Shortcut shortcut, int preferredHeight) { … … 68 76 } 69 77 70 private void ToggleDialogInit(final String name, String iconName, String tooltip, Shortcut shortcut, int preferredHeight) {78 private void ToggleDialogInit(final String name, String iconName, String tooltip, Shortcut shortcut, final int preferredHeight) { 71 79 setPreferredSize(new Dimension(330,preferredHeight)); 72 80 action = new ToggleDialogAction(name, "dialogs/"+iconName, tooltip, shortcut, iconName); … … 75 83 setLayout(new BorderLayout()); 76 84 77 titleBar.add(new JLabel(name), GBC.std()); 85 // show the minimize button 86 final JLabel minimize = new JLabel(ImageProvider.get("misc", "normal")); 87 titleBar.add(minimize); 88 89 // scale down the dialog icon 90 ImageIcon inIcon = ImageProvider.get("dialogs", iconName); 91 ImageIcon smallIcon = new ImageIcon(inIcon.getImage().getScaledInstance(16 , 16, Image.SCALE_SMOOTH)); 92 JLabel labelSmallIcon = new JLabel(smallIcon); 93 titleBar.add(labelSmallIcon); 94 95 final ActionListener hideActionListener = new ActionListener(){ 96 public void actionPerformed(ActionEvent e) { 97 boolean nowVisible = false; 98 Component comps[] = getComponents(); 99 for(int i=0; i<comps.length; i++) 100 { 101 if(comps[i] != titleBar) 102 { 103 if(comps[i].isVisible()) { 104 comps[i].setVisible(false); 105 } else { 106 comps[i].setVisible(true); 107 nowVisible = true; 108 } 109 } 110 } 111 112 Main.pref.put(action.prefname+".minimized", !nowVisible); 113 if(nowVisible == true) { 114 setPreferredSize(new Dimension(330,preferredHeight)); 115 setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); 116 minimize.setIcon(ImageProvider.get("misc", "normal")); 117 } else { 118 setPreferredSize(new Dimension(330,20)); 119 setMaximumSize(new Dimension(330,20)); 120 minimize.setIcon(ImageProvider.get("misc", "minimized")); 121 } 122 // doLayout() - workaround 123 parent.setVisible(false); 124 parent.setVisible(true); 125 } 126 }; 127 //hide.addActionListener(hideActionListener); 128 129 final MouseListener titleMouseListener = new MouseListener(){ 130 public void mouseClicked(MouseEvent e) { 131 hideActionListener.actionPerformed(null); 132 } 133 public void mouseEntered(MouseEvent e) {} 134 public void mouseExited(MouseEvent e) {} 135 public void mousePressed(MouseEvent e) {} 136 public void mouseReleased(MouseEvent e) {} 137 }; 138 titleBar.addMouseListener(titleMouseListener); 139 140 // add some padding space (there must be a better way to do this!) 141 JLabel padding = new JLabel(" "); 142 titleBar.add(padding); 143 144 // show the title label 145 label.setText(name); 146 titleBar.add(label, GBC.std()); 78 147 titleBar.add(Box.createHorizontalGlue(),GBC.std().fill(GBC.HORIZONTAL)); 79 148 149 // show the sticky button 80 150 JButton sticky = new JButton(ImageProvider.get("misc", "sticky")); 151 sticky.setToolTipText(tr("Undock the panel")); 81 152 sticky.setBorder(BorderFactory.createEmptyBorder()); 82 153 final ActionListener stickyActionListener = new ActionListener(){ … … 121 192 }; 122 193 sticky.addActionListener(stickyActionListener); 123 124 194 titleBar.add(sticky); 195 196 // show the close button 197 JButton close = new JButton(ImageProvider.get("misc", "close")); 198 close.setToolTipText(tr("Close this panel. You can reopen it with the buttons in the left toolbar")); 199 close.setBorder(BorderFactory.createEmptyBorder()); 200 final ActionListener closeActionListener = new ActionListener(){ 201 public void actionPerformed(ActionEvent e) { 202 // fake an event to toggle dialog 203 action.actionPerformed(new ActionEvent(titleBar, 0, "")); 204 } 205 }; 206 close.addActionListener(closeActionListener); 207 titleBar.add(close); 208 125 209 add(titleBar, BorderLayout.NORTH); 210 titleBar.setToolTipText(tr("Click to minimize/maximize the panel content")); 126 211 127 212 setVisible(false); … … 135 220 }); 136 221 } 222 if (Main.pref.getBoolean(action.prefname+".minimized", false)) { 223 EventQueue.invokeLater(new Runnable(){ 224 public void run() { 225 titleMouseListener.mouseClicked(null); 226 } 227 }); 228 } 229 } 230 231 public void setTitle(String title, boolean active) { 232 if(active) { 233 label.setText("<html><b>" + title + "</b>"); 234 } else { 235 label.setText(title); 236 } 137 237 } 138 238 -
trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
r1169 r1228 109 109 data.addRow(new Object[] { uc.user.name, uc.count, uc.count * 100 / all }); 110 110 } 111 112 if(ucArr.length != 0) { 113 setTitle(tr("Authors: {0}", ucArr.length), true); 114 } else { 115 setTitle(tr("Authors"), false); 116 } 111 117 } 112 118
Note:
See TracChangeset
for help on using the changeset viewer.