Changeset 10228 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2016-05-16T14:59:34+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r10173 r10228 824 824 } 825 825 826 private int getMaximumAvailableWidth() {827 int maxWidth = getSize().width;828 for (int i = 0; i < getMenuCount(); i++) {829 JMenu menu = getMenu(i);830 if (menu != null) {831 maxWidth -= menu.getPreferredSize().width;832 }833 }834 return maxWidth;835 }836 837 826 /** 838 827 * Search main menu for items with {@code textToFind} in title. -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r10212 r10228 93 93 * @author imi 94 94 */ 95 public class MapStatus extends JPanel implements Helpful, Destroyable, PreferenceChangedListener, SoMChangeListener {95 public final class MapStatus extends JPanel implements Helpful, Destroyable, PreferenceChangedListener, SoMChangeListener { 96 96 97 97 private final DecimalFormat DECIMAL_FORMAT = new DecimalFormat(Main.pref.get("statusbar.decimal-format", "0.0")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r10212 r10228 719 719 @Override 720 720 public int compare(Relation o1, Relation o2) { 721 int comp = Boolean. valueOf(o1.isDisabledAndHidden()).compareTo(o2.isDisabledAndHidden());721 int comp = Boolean.compare(o1.isDisabledAndHidden(), o2.isDisabledAndHidden()); 722 722 return comp != 0 ? comp : DefaultNameFormatter.getInstance().getRelationComparator().compare(o1, o2); 723 723 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackAction.java
r10074 r10228 60 60 protected void realRun() throws SAXException, IOException, OsmTransferException { 61 61 precacheTask = layer.downloadAreaToCache(progressMonitor, points, 0, 0); 62 while (!precacheTask.isFinished() && !progressMonitor.isCanceled()) {63 synchronized (this){64 try{62 synchronized (this) { 63 try { 64 while (!precacheTask.isFinished() && !progressMonitor.isCanceled()) { 65 65 wait(200); 66 } catch (InterruptedException ex) {67 Main.warn("InterruptedException in "+getClass().getSimpleName()+" while precaching WMS");68 66 } 67 } catch (InterruptedException ex) { 68 Main.warn("InterruptedException in "+getClass().getSimpleName()+" while precaching WMS"); 69 69 } 70 70 } -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginListPanel.java
r10137 r10228 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.trn;6 5 7 import java.awt.Component;8 6 import java.awt.GridBagConstraints; 9 7 import java.awt.GridBagLayout; 10 8 import java.awt.Insets; 11 9 import java.awt.Rectangle; 12 import java.awt.event.ActionEvent;13 import java.awt.event.ActionListener;14 10 import java.awt.event.MouseAdapter; 15 11 import java.awt.event.MouseEvent; 16 import java.util.HashSet;17 12 import java.util.List; 18 import java.util.Set;19 13 20 import javax.swing.JCheckBox;21 14 import javax.swing.JLabel; 22 import javax.swing.JOptionPane;23 15 import javax.swing.SwingConstants; 24 16 import javax.swing.SwingUtilities; … … 29 21 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 30 22 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 31 import org.openstreetmap.josm.plugins.PluginHandler;32 23 import org.openstreetmap.josm.plugins.PluginInformation; 33 24 import org.openstreetmap.josm.tools.OpenBrowser; 34 import org.openstreetmap.josm.tools.Utils;35 25 36 26 /** … … 56 46 } 57 47 58 protected String formatPluginRemoteVersion(PluginInformation pi) {48 protected static String formatPluginRemoteVersion(PluginInformation pi) { 59 49 StringBuilder sb = new StringBuilder(); 60 50 if (pi.version == null || pi.version.trim().isEmpty()) { … … 69 59 } 70 60 71 protected String formatPluginLocalVersion(PluginInformation pi) {61 protected static String formatPluginLocalVersion(PluginInformation pi) { 72 62 if (pi == null) 73 63 return tr("unknown"); … … 77 67 } 78 68 79 protected String formatCheckboxTooltipText(PluginInformation pi) {69 protected static String formatCheckboxTooltipText(PluginInformation pi) { 80 70 if (pi == null) 81 71 return ""; … … 108 98 109 99 /** 110 * A plugin checkbox.111 */112 private class JPluginCheckBox extends JCheckBox {113 protected final transient PluginInformation pi;114 115 JPluginCheckBox(final PluginInformation pi, boolean selected) {116 this.pi = pi;117 setSelected(selected);118 setToolTipText(formatCheckboxTooltipText(pi));119 addActionListener(new PluginCbActionListener(this));120 }121 }122 123 /**124 * Listener called when the user selects/unselects a plugin checkbox.125 */126 private class PluginCbActionListener implements ActionListener {127 private final JPluginCheckBox cb;128 129 PluginCbActionListener(JPluginCheckBox cb) {130 this.cb = cb;131 }132 133 protected void selectRequiredPlugins(PluginInformation info) {134 if (info != null && info.requires != null) {135 for (String s : info.getRequiredPlugins()) {136 if (!model.isSelectedPlugin(s)) {137 model.setPluginSelected(s, true);138 selectRequiredPlugins(model.getPluginInformation(s));139 }140 }141 }142 }143 144 @Override145 public void actionPerformed(ActionEvent e) {146 // Select/unselect corresponding plugin in the model147 model.setPluginSelected(cb.pi.getName(), cb.isSelected());148 // Does the newly selected plugin require other plugins ?149 if (cb.isSelected() && cb.pi.requires != null) {150 // Select required plugins151 selectRequiredPlugins(cb.pi);152 // Alert user if plugin requirements are not met153 PluginHandler.checkRequiredPluginsPreconditions(PluginListPanel.this, model.getAvailablePlugins(), cb.pi, false);154 } else if (!cb.isSelected()) {155 // If the plugin has been unselected, was it required by other plugins still selected ?156 Set<String> otherPlugins = new HashSet<>();157 for (PluginInformation pi : model.getAvailablePlugins()) {158 if (!pi.equals(cb.pi) && pi.requires != null && model.isSelectedPlugin(pi.getName())) {159 for (String s : pi.getRequiredPlugins()) {160 if (s.equals(cb.pi.getName())) {161 otherPlugins.add(pi.getName());162 break;163 }164 }165 }166 }167 if (!otherPlugins.isEmpty()) {168 alertPluginStillRequired(PluginListPanel.this, cb.pi.getName(), otherPlugins);169 }170 }171 }172 }173 174 /**175 * Alerts the user if an unselected plugin is still required by another plugins176 *177 * @param parent The parent Component used to display error popup178 * @param plugin the plugin179 * @param otherPlugins the other plugins180 */181 private static void alertPluginStillRequired(Component parent, String plugin, Set<String> otherPlugins) {182 StringBuilder sb = new StringBuilder("<html>")183 .append(trn("Plugin {0} is still required by this plugin:",184 "Plugin {0} is still required by these {1} plugins:",185 otherPlugins.size(),186 plugin,187 otherPlugins.size()))188 .append(Utils.joinAsHtmlUnorderedList(otherPlugins))189 .append("</html>");190 JOptionPane.showMessageDialog(191 parent,192 sb.toString(),193 tr("Warning"),194 JOptionPane.WARNING_MESSAGE195 );196 }197 198 /**199 100 * Refreshes the list. 200 101 */ … … 221 122 String localversion = formatPluginLocalVersion(model.getPluginInformation(pi.getName())); 222 123 223 final JPluginCheckBox cbPlugin = new JPluginCheckBox(pi, selected);124 final PluginCheckBox cbPlugin = new PluginCheckBox(pi, selected, this, model); 224 125 String pluginText = tr("{0}: Version {1} (local: {2})", pi.getName(), remoteversion, localversion); 225 126 if (pi.requires != null && !pi.requires.isEmpty()) { -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionItemPriority.java
r10137 r10228 117 117 return ui; 118 118 119 int sel = Boolean. valueOf(selected).compareTo(other.selected);119 int sel = Boolean.compare(selected, other.selected); 120 120 if (sel != 0) 121 121 return sel; 122 122 123 int ds = Boolean. valueOf(inDataSet).compareTo(other.inDataSet);123 int ds = Boolean.compare(inDataSet, other.inDataSet); 124 124 if (ds != 0) 125 125 return ds; 126 126 127 int std = Boolean. valueOf(inStandard).compareTo(other.inStandard);127 int std = Boolean.compare(inStandard, other.inStandard); 128 128 if (std != 0) 129 129 return std; -
trunk/src/org/openstreetmap/josm/gui/util/RotationAngle.java
r8929 r10228 67 67 case "n": 68 68 case "north": 69 return Math.toRadians(0);69 return 0; // 0 degree => 0 radian 70 70 case "ne": 71 71 case "northeast": … … 79 79 case "s": 80 80 case "south": 81 return Math. toRadians(180);81 return Math.PI; // 180 degree 82 82 case "sw": 83 83 case "southwest":
Note:
See TracChangeset
for help on using the changeset viewer.