Changeset 32581 in osm for applications
- Timestamp:
- 2016-07-05T14:49:10+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryMainDialog.java
r32396 r32581 8 8 import java.awt.Color; 9 9 import java.awt.Component; 10 import java.awt.FlowLayout;11 import java.awt.GridLayout;12 10 import java.awt.event.ActionEvent; 13 11 import java.awt.event.KeyEvent; … … 21 19 import javax.swing.AbstractAction; 22 20 import javax.swing.JComponent; 23 import javax.swing.JPanel;24 21 import javax.swing.KeyStroke; 25 22 import javax.swing.SwingUtilities; … … 60 57 61 58 private final SideButton nextButton = new SideButton(new NextPictureAction()); 62 private final SideButton previousButton = new SideButton( 63 new PreviousPictureAction()); 59 private final SideButton previousButton = new SideButton(new PreviousPictureAction()); 64 60 /** 65 61 * Button used to jump to the image following the red line … … 90 86 WALK; 91 87 } 92 93 private JPanel buttonsPanel;94 88 95 89 /** … … 112 106 this.redButton.setForeground(Color.RED); 113 107 114 createLayout( 115 this.mapillaryImageDisplay, 116 Arrays.asList(new SideButton[]{this.blueButton, this.previousButton, this.nextButton, this.redButton}), 117 Main.pref.getBoolean("mapillary.reverse-buttons")); 118 disableAllButtons(); 119 108 setMode(MODE.NORMAL); 120 109 } 121 110 … … 153 142 * Sets a new mode for the dialog. 154 143 * 155 * @param mode The mode to be set. 144 * @param mode The mode to be set. Must not be {@code null}. 156 145 */ 157 146 public void setMode(MODE mode) { … … 159 148 case WALK: 160 149 createLayout( 161 162 Arrays.asList(new SideButton[]{playButton, pauseButton, stopButton}),163 Main.pref.getBoolean("mapillary.reverse-buttons"));150 this.mapillaryImageDisplay, 151 Arrays.asList(new SideButton[]{playButton, pauseButton, stopButton}) 152 ); 164 153 break; 165 154 case NORMAL: 166 155 default: 167 156 createLayout( 168 169 Arrays.asList(new SideButton[]{blueButton, previousButton, nextButton, redButton}),170 Main.pref.getBoolean("mapillary.reverse-buttons"));157 this.mapillaryImageDisplay, 158 Arrays.asList(new SideButton[]{blueButton, previousButton, nextButton, redButton}) 159 ); 171 160 break; 172 161 } 173 162 disableAllButtons(); 174 if ( mode.equals(MODE.NORMAL))163 if (MODE.NORMAL.equals(mode)) { 175 164 updateImage(); 176 165 } 177 166 } 178 167 … … 379 368 public PreviousPictureAction() { 380 369 putValue(NAME, tr("Previous picture")); 381 putValue(SHORT_DESCRIPTION, 382 tr("Shows the previous picture in the sequence")); 370 putValue(SHORT_DESCRIPTION, tr("Shows the previous picture in the sequence")); 383 371 } 384 372 … … 563 551 * @param data The content of the dialog 564 552 * @param buttons The buttons where you can click 565 * @param reverse {@code true} if the buttons should go at the top; {@code false} 566 * otherwise. 567 */ 568 public void createLayout(Component data, List<SideButton> buttons, 569 boolean reverse) { 570 this.removeAll(); 571 JPanel panel = new JPanel(); 572 panel.setLayout(new BorderLayout()); 573 panel.add(data, BorderLayout.CENTER); 574 if (reverse) { 575 this.buttonsPanel = new JPanel(new GridLayout(1, 1)); 576 if (!buttons.isEmpty() && buttons.get(0) != null) { 577 final JPanel buttonRowPanel = new JPanel( 578 Main.pref.getBoolean("dialog.align.left", false) 579 ? new FlowLayout(FlowLayout.LEFT) 580 : new GridLayout(1, buttons.size()) 581 ); 582 this.buttonsPanel.add(buttonRowPanel); 583 for (SideButton button : buttons) { 584 buttonRowPanel.add(button); 585 } 586 } 587 panel.add(this.buttonsPanel, BorderLayout.NORTH); 588 createLayout(panel, true, null); 589 } else { 590 createLayout(panel, true, buttons); 591 } 592 this.add(this.titleBar, BorderLayout.NORTH); 553 */ 554 public void createLayout(Component data, List<SideButton> buttons) { 555 removeAll(); 556 createLayout(data, true, buttons); 557 add(titleBar, BorderLayout.NORTH); 593 558 } 594 559 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryPreferenceSetting.java
r32579 r32581 47 47 */ 48 48 public class MapillaryPreferenceSetting implements SubPreferenceSetting, MapillaryLoginListener { 49 50 private final JCheckBox reverseButtons = new JCheckBox(I18n.tr("Reverse buttons position when displaying images."));51 49 private final JComboBox<String> downloadModeComboBox = new JComboBox<>(new String[]{ 52 50 MapillaryDownloader.MODES.Automatic.toString(), … … 96 94 97 95 JPanel mainPanel = new JPanel(); 98 reverseButtons.setSelected(Main.pref.getBoolean("mapillary.reverse-buttons"));99 96 displayHour.setSelected(Main.pref.getBoolean("mapillary.display-hour", true)); 100 97 format24.setSelected(Main.pref.getBoolean("mapillary.format-24")); … … 117 114 mainPanel.add(downloadModePanel, GBC.eol()); 118 115 119 mainPanel.add(reverseButtons, GBC.eol());120 116 mainPanel.add(displayHour, GBC.eol()); 121 117 mainPanel.add(format24, GBC.eol()); … … 123 119 mainPanel.add(hoverEnabled, GBC.eol()); 124 120 MapillaryColorScheme.styleAsDefaultPanel( 125 mainPanel, downloadModePanel, reverseButtons, displayHour, format24, moveTo121 mainPanel, downloadModePanel, displayHour, format24, moveTo, hoverEnabled 126 122 ); 127 123 mainPanel.add(Box.createVerticalGlue(), GBC.eol().fill(GridBagConstraints.BOTH)); … … 172 168 public boolean ok() { 173 169 boolean mod = false; 174 Main.pref.put("mapillary.reverse-buttons", this.reverseButtons.isSelected());175 170 176 171 MapillaryPlugin.setMenuEnabled(MapillaryPlugin.getDownloadViewMenu(), false);
Note:
See TracChangeset
for help on using the changeset viewer.