diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/IDatePicker.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/IDatePicker.java
index cc5187aff..45df18318 100644
|
a
|
b
|
import java.util.function.Consumer;
|
| 6 | 6 | |
| 7 | 7 | import javax.swing.JComponent; |
| 8 | 8 | |
| | 9 | import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryProperties; |
| | 10 | import org.openstreetmap.josm.tools.Logging; |
| | 11 | |
| 9 | 12 | /** |
| 10 | 13 | * @author Taylor Smock |
| 11 | 14 | */ |
| … |
… |
public interface IDatePicker<T extends JComponent> {
|
| 19 | 22 | void reset(); |
| 20 | 23 | |
| 21 | 24 | void addEventHandler(Consumer<IDatePicker<?>> function); |
| | 25 | |
| | 26 | public static IDatePicker<? extends JComponent> getNewDatePicker() { |
| | 27 | boolean fx = false; |
| | 28 | boolean useFx = MapillaryProperties.JAVA_FX.get(); |
| | 29 | if (useFx) { |
| | 30 | try { |
| | 31 | new DatePickerFx(); |
| | 32 | fx = true; |
| | 33 | } catch (UnsupportedClassVersionError e) { |
| | 34 | Logging.error(e); |
| | 35 | } |
| | 36 | } |
| | 37 | if (fx) { |
| | 38 | return new DatePickerFx(); |
| | 39 | } |
| | 40 | return new DatePickerSwing(); |
| | 41 | } |
| 22 | 42 | } |
diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterDialog.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterDialog.java
index 196ecc9c1..680e6d91d 100644
|
a
|
b
|
import org.openstreetmap.josm.plugins.mapillary.oauth.MapillaryLoginListener;
|
| 50 | 50 | import org.openstreetmap.josm.plugins.mapillary.oauth.MapillaryUser; |
| 51 | 51 | import org.openstreetmap.josm.tools.GBC; |
| 52 | 52 | import org.openstreetmap.josm.tools.ImageProvider; |
| 53 | | import org.openstreetmap.josm.tools.Logging; |
| 54 | 53 | |
| 55 | 54 | /** |
| 56 | 55 | * ToggleDialog that lets you filter the images that are being shown. |
| … |
… |
public final class MapillaryFilterDialog extends ToggleDialog implements Mapilla
|
| 119 | 118 | fromPanel.add(this.time); |
| 120 | 119 | |
| 121 | 120 | JPanel timePanel; |
| 122 | | try { |
| 123 | | startDate = new DatePickerFx(); |
| 124 | | endDate = new DatePickerFx(); |
| 125 | | } catch (UnsupportedClassVersionError e) { |
| 126 | | // Don't kill the plugin if JavaFX cannot be loaded |
| 127 | | Logging.error(e); |
| 128 | | startDate = new DatePickerSwing(); |
| 129 | | endDate = new DatePickerSwing(); |
| 130 | | } |
| | 121 | startDate = IDatePicker.getNewDatePicker(); |
| | 122 | endDate = IDatePicker.getNewDatePicker(); |
| 131 | 123 | Consumer<IDatePicker<?>> function = this::updateDates; |
| 132 | 124 | startDate.addEventHandler(function); |
| 133 | 125 | endDate.addEventHandler(function); |
diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryPreferenceSetting.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryPreferenceSetting.java
index 14ab11af1..8b88af105 100644
|
a
|
b
|
public class MapillaryPreferenceSetting implements SubPreferenceSetting, Mapilla
|
| 101 | 101 | private final JLabel loginLabel = new JLabel(); |
| 102 | 102 | private final JPanel loginPanel = new JPanel(); |
| 103 | 103 | |
| | 104 | private JCheckBox javaFx; |
| | 105 | |
| 104 | 106 | @Override |
| 105 | 107 | public TabPreferenceSetting getTabPreferenceSetting(PreferenceTabbedPane gui) { |
| 106 | 108 | return gui.getDisplayPreference(); |
| … |
… |
public class MapillaryPreferenceSetting implements SubPreferenceSetting, Mapilla
|
| 169 | 171 | requiresLogin.add(new JSeparator(), GBC.eol().fill(GBC.HORIZONTAL)); |
| 170 | 172 | mainPanel.add(requiresLogin, GBC.eol().fill(GBC.HORIZONTAL)); |
| 171 | 173 | |
| | 174 | javaFx = new JCheckBox(I18n.tr("Use JavaFX for better looking dialogs")); |
| | 175 | javaFx.setToolTipText(I18n.tr("Enable/disable JavaFX (requires restart). Using JavaFX may cause a smaller window issue, or a whited-out sidebar.")); |
| | 176 | javaFx.setSelected(MapillaryProperties.JAVA_FX.get()); |
| | 177 | mainPanel.add(new JSeparator(), GBC.eol().fill(GBC.HORIZONTAL)); |
| | 178 | mainPanel.add(javaFx, GBC.eol()); |
| | 179 | |
| 172 | 180 | if (ExpertToggleAction.isExpert() || developer.isSelected()) { |
| 173 | 181 | mainPanel.add(developer, GBC.eol()); |
| 174 | 182 | } |
| 175 | 183 | MapillaryColorScheme.styleAsDefaultPanel( |
| 176 | 184 | mainPanel, downloadModePanel, displayHour, format24, moveTo, hoverEnabled, darkMode, cutOffSeq, |
| 177 | | imageLinkToBlurEditor, developer, preFetchPanel, requiresLogin |
| | 185 | imageLinkToBlurEditor, developer, preFetchPanel, requiresLogin, javaFx |
| 178 | 186 | ); |
| 179 | 187 | mainPanel.add(Box.createVerticalGlue(), GBC.eol().fill(GridBagConstraints.BOTH)); |
| 180 | 188 | |
| … |
… |
public class MapillaryPreferenceSetting implements SubPreferenceSetting, Mapilla
|
| 236 | 244 | MapillaryProperties.PRE_FETCH_IMAGE_COUNT.put(preFetchSize.getNumber().intValue()); |
| 237 | 245 | MapillaryProperties.IMAGE_MODE.put(((PRIVATE_IMAGE_DOWNLOAD_MODE) privateImages.getSelectedItem()).getPrefId()); |
| 238 | 246 | |
| 239 | | //Restart is never required |
| 240 | | return false; |
| | 247 | //Restart is never required, except when JavaFX is switched on/off |
| | 248 | return MapillaryProperties.JAVA_FX.put(javaFx.isSelected()); |
| 241 | 249 | } |
| 242 | 250 | |
| 243 | 251 | @Override |
diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/dialog/MapillaryExpertFilterDialog.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/dialog/MapillaryExpertFilterDialog.java
index de6c0f09b..8a22e88db 100644
|
a
|
b
|
public class MapillaryExpertFilterDialog extends ToggleDialog implements DataSet
|
| 519 | 519 | } |
| 520 | 520 | } |
| 521 | 521 | } |
| 522 | | } |
| 523 | | No newline at end of file |
| | 522 | } |
diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/dialog/TrafficSignFilter.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/dialog/TrafficSignFilter.java
index 3cf31dfdd..e8f17865e 100644
|
a
|
b
|
import org.apache.commons.io.IOUtils;
|
| 39 | 39 | import org.openstreetmap.josm.data.osm.Filter; |
| 40 | 40 | import org.openstreetmap.josm.gui.MainApplication; |
| 41 | 41 | import org.openstreetmap.josm.gui.widgets.FilterField; |
| 42 | | import org.openstreetmap.josm.plugins.mapillary.gui.DatePickerFx; |
| 43 | | import org.openstreetmap.josm.plugins.mapillary.gui.DatePickerSwing; |
| 44 | 42 | import org.openstreetmap.josm.plugins.mapillary.gui.IDatePicker; |
| 45 | 43 | import org.openstreetmap.josm.plugins.mapillary.gui.ImageCheckBoxButton; |
| 46 | 44 | import org.openstreetmap.josm.tools.Destroyable; |
| … |
… |
public class TrafficSignFilter extends JPanel implements Destroyable {
|
| 194 | 192 | lastSeen.add(new JLabel(I18n.tr("Last Seen End")), GBC.eol()); |
| 195 | 193 | } |
| 196 | 194 | |
| 197 | | boolean fx = false; |
| 198 | | try { |
| 199 | | new DatePickerFx(); |
| 200 | | fx = true; |
| 201 | | } catch (UnsupportedClassVersionError e) { |
| 202 | | Logging.error(e); |
| 203 | | } |
| 204 | | final IDatePicker<?> firstSeenPicker; |
| 205 | | final IDatePicker<?> lastSeenPicker; |
| 206 | | if (fx) { |
| 207 | | firstSeenPicker = new DatePickerFx(); |
| 208 | | lastSeenPicker = new DatePickerFx(); |
| 209 | | } else { |
| 210 | | firstSeenPicker = new DatePickerSwing(); |
| 211 | | lastSeenPicker = new DatePickerSwing(); |
| 212 | | } |
| | 195 | final IDatePicker<?> firstSeenPicker = IDatePicker.getNewDatePicker(); |
| | 196 | final IDatePicker<?> lastSeenPicker = IDatePicker.getNewDatePicker(); |
| 213 | 197 | firstSeen.add(firstSeenPicker.getComponent(), GBC.eol()); |
| 214 | 198 | lastSeen.add(lastSeenPicker.getComponent(), GBC.eol()); |
| 215 | 199 | firstSeenPicker.addEventHandler(t -> updateDates(firstLast, firstSeenPicker, firstSeenPicker, lastSeenPicker)); |
diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryProperties.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryProperties.java
index 376571157..bf5801f76 100644
|
a
|
b
|
public final class MapillaryProperties {
|
| 87 | 87 | */ |
| 88 | 88 | public static final DoubleProperty UNSELECTED_OPACITY = new DoubleProperty("mapillary.unselectedimageopacity", 0.50); |
| 89 | 89 | |
| | 90 | /** |
| | 91 | * Whether or not to try to use JavaFX |
| | 92 | */ |
| | 93 | public static final BooleanProperty JAVA_FX = new BooleanProperty("mapillary.javafx", true); |
| | 94 | |
| 90 | 95 | private MapillaryProperties() { |
| 91 | 96 | // Private constructor to avoid instantiation |
| 92 | 97 | } |