@Override public Object getNextPanelId() { String path = model.getGtfsPath(); if (path == null || path.isEmpty()) return null; return model.isRunEnabled() ? GtfsRealtimePathsWizardPanelController.class : RunWizardPanelController.class; }
private static void loadModel(GuiQuickstartDataModel model) { Preferences preferences = Preferences.userNodeForPackage(GuiBootstrapMain.class); model.setTransitDataBundlePath(preferences.get("transitDataBundlePath", null)); model.setGtfsPath(preferences.get("gtfsPath", null)); model.setTripUpdatesUrl(preferences.get("tripUpdatesUrl", null)); model.setVehiclePositionsUrl(preferences.get("vehiclePositionsUrl", null)); model.setAlertsUrl(preferences.get("alertsUrl", null)); }
@Override public void willSetVisible(WizardController controller, boolean visible) { super.willSetVisible(controller, visible); if (visible) { model.addPropertyChangeListener(handler); } else { model.addPropertyChangeListener(handler); } }
private static void saveModel(GuiQuickstartDataModel model) { Preferences preferences = Preferences.userNodeForPackage(GuiBootstrapMain.class); updatePreferences(preferences, "transitDataBundlePath", model.getTransitDataBundlePath()); updatePreferences(preferences, "gtfsPath", model.getGtfsPath()); updatePreferences(preferences, "tripUpdatesUrl", model.getTripUpdatesUrl()); updatePreferences(preferences, "vehiclePositionsUrl", model.getVehiclePositionsUrl()); updatePreferences(preferences, "alertsUrl", model.getAlertsUrl()); try { preferences.sync(); } catch (BackingStoreException e) { e.printStackTrace(); } }
public static GuiQuickstartDataModel configureBootstrapArgs() throws IOException, Exception { final GuiQuickstartDataModel model = new GuiQuickstartDataModel(); loadModel(model); WizardController controller = new WizardController(); controller.addPanel(WelcomeWizardPanelController.class, new WelcomeWizardPanelController()); controller.addPanel( TransitDataBundlePathWizardPanelController.class, new TransitDataBundlePathWizardPanelController(model, controller)); controller.addPanel( QuickStartTypeWizardPanelController.class, new QuickStartTypeWizardPanelController(model)); controller.addPanel( GtfsPathWizardPanelController.class, new GtfsPathWizardPanelController(model, controller)); controller.addPanel( GtfsRealtimePathsWizardPanelController.class, new GtfsRealtimePathsWizardPanelController(model)); controller.addPanel(RunWizardPanelController.class, new RunWizardPanelController(model)); controller.setCurrentPanel(WelcomeWizardPanelController.class); WizardDialog dialog = new WizardDialog(controller); dialog.setModal(true); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setVisible(true); saveModel(model); if (controller.getCompletionState() == ECompletionState.CANCELLED) System.exit(0); String path = model.getTransitDataBundlePath(); new File(path).mkdirs(); JConsoleDialog console = new JConsoleDialog(new File(path, "console.log").getAbsolutePath()); console.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); console.setVisible(true); return model; }