// ----- loads the remainder parameters -----// public void loadParams() { this.workTime = settingsDialog.getWorkTime(); this.breakTime = settingsDialog.getShortBreakTime(); this.longBreaks = settingsDialog.isLongBreaks(); this.shortBreaksBeforeLongOne = settingsDialog.getShortBreaksBeforeLongOne(); isBreak = false; }
// ----- starts the timer -----// public synchronized void start() { settingsDialog.paintStatus(Integer.toString(workTime)); if (isBreak) { breakDialog.setVisible(true); settingsDialog.paintStatus("Break!"); } timer.start(); }
/** * The action has been activated. The argument of the method represents the 'real' action sitting * in the workbench UI. * * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { final SettingsDialog sd = new SettingsDialog(window.getShell()); if (sd.open() == Dialog.OK) { if (SWTHelper.askYesNo( "Wirklich Datenbank anonymisieren", "Achtung! Diese Aktion macht die Datenbank unwiderruflich unbrauchbar! Wirklich anonymisieren?")) { zufallsnamen = sd.replaceNames; IWorkbench wb = PlatformUI.getWorkbench(); IProgressService ps = wb.getProgressService(); try { ps.busyCursorWhile( new IRunnableWithProgress() { public void run(IProgressMonitor pm) { pm.beginTask("Anonymisiere Datenbank", TOTAL); int jobs = 1; if (sd.replaceKons) { jobs++; } if (sd.deleteDocs) { jobs++; } if (sd.purgeDB) { jobs++; } doShakeNames(pm, TOTAL / jobs); if (sd.replaceKons) { doShakeKons(pm, TOTAL / jobs); } if (sd.deleteDocs) { new DocumentRemover().run(pm, TOTAL / jobs); } if (sd.purgeDB) { doPurgeDB(pm, TOTAL / jobs); } pm.done(); } }); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
/** * Pops up a dialog for viewing/editing complex parameter settings. * * <p>This method automatically updates the visual settings for the complex parameter if the user * presses the "OK" or "Save as Default" button. It also attempts to save the * settings if the user presses the "Save as Default" button and displays an error * message in case the attempt was not successful. * * <p><b>Note:</b> It is the responsibility of the caller to update all the controls created by * the visualizer by calling the {@link #updateControl(JFreeChart)} method for each of them. * * @param aOwner The <code>Dialog</code> from which the settings dialog is displayed. * @return The status as returned by the settings dialog. * @see SettingsDialog#STATUS_CANCEL * @see SettingsDialog#STATUS_DEFAULT * @see SettingsDialog#STATUS_OK */ public int showSettingsDialog(Dialog aOwner) { SettingsDialog d = new SettingsDialog(aOwner, Messages.DI_CHARTSETTINGS); JComponent dataComp = addSettingsPanels(d.getSettingsPane()); d.pack(); d.setLocationRelativeTo(aOwner); d.setVisible(true); int status = d.getStatus(); if (status != SettingsDialog.STATUS_CANCEL) { try { d.update(); updateSettings(dataComp); if (status == SettingsDialog.STATUS_DEFAULT) { try { saveDefault(); } catch (SecurityException ex) { Utils.showErrorBox(aOwner, Messages.DT_SECERROR, Messages.SM_SECERROR2); } catch (Exception ex) { // FileNotFoundException // IOException Utils.showErrorBox(aOwner, Messages.DT_IOERROR, Messages.SM_DEFFAILED); } } } catch (InvocationTargetException ex) { throw new InnerException(ex); } } return status; }
private void jButton1ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed // Save the Right Side try { SettingsDialog.getRight().saveForms(); } catch (Exception e) { jLabel1.setText("Error! Cannot be saved! (Message: " + e.getMessage() + ")"); Logging.warning( "There was an issue saving the form. Form = " + SettingsDialog.getRight().toString(), e); } // Set jLabel1 to say "Saved" in order to inform the user jLabel1.setText("Saved"); jLabel1.revalidate(); jLabel1.repaint(); isSaved = true; } // GEN-LAST:event_jButton1ActionPerformed
// ----- resets the remainder parameters -----// public synchronized void reset() { if (timer.isRunning()) { timer.stop(); breakDialog.setVisible(false); settingsDialog.paintStatus(Integer.toString(workTime)); loadParams(); timer.start(); } else { loadParams(); } }
@Override public synchronized void actionPerformed(ActionEvent e) { if (isBreak) { if (breakTime > 0) { breakDialog.paintStatus(convert(breakTime)); breakTime--; } else { isBreak = false; breakDialog.setVisible(false); // Utils.playSound(); if (longBreaks) { if (shortBreaksBeforeLongOne > 0) { shortBreaksBeforeLongOne--; } else { shortBreaksBeforeLongOne = settingsDialog.getShortBreaksBeforeLongOne(); } } workTime = settingsDialog.getWorkTime(); settingsDialog.paintStatus(convert(workTime) + " until the next break"); workTime--; } } else { if (workTime > 0) { settingsDialog.paintStatus(convert(workTime) + " until the next break"); workTime--; } else { isBreak = true; settingsDialog.paintStatus("Break!"); if (longBreaks) { if (shortBreaksBeforeLongOne > 0) { breakTime = settingsDialog.getShortBreakTime(); } else { breakTime = settingsDialog.getLongBreakTime(); } } else { breakTime = settingsDialog.getShortBreakTime(); } breakDialog.paintStatus(convert(breakTime)); breakDialog.setVisible(true); // Utils.playSound(); breakTime--; } } }
public AdvancedSettings(final SettingsDialog d) { JPanel connection = addTitledPanel("Connection", 1); connection.add(new JLabel("Server:"), d.makeGbc(0, 0, 1, 1, GridBagConstraints.EAST)); connection.add( d.addSimpleStringSetting("serverDefault", 20, true), d.makeGbc(1, 0, 1, 1, GridBagConstraints.WEST)); connection.add(new JLabel("Ports:"), d.makeGbc(0, 1, 1, 1, GridBagConstraints.EAST)); connection.add( d.addSimpleStringSetting("portDefault", 14, true), d.makeGbc(1, 1, 1, 1, GridBagConstraints.WEST)); connection.add( new JLabel("(These might be overridden by commandline parameters.)"), d.makeGbc(0, 2, 2, 1)); connection.add( d.addSimpleBooleanSetting( "membershipEnabled", "Correct Userlist (receives joins/parts, userlist)", "Enables the membership capability while connecting, which allows receiving of joins/parts/userlist"), d.makeGbc(0, 4, 2, 1, GridBagConstraints.NORTHWEST)); JPanel login = addTitledPanel("Login Settings (login under <Main Menu - Login>)", 2); login.add( d.addSimpleBooleanSetting( "allowTokenOverride", "<html><body>Allow <code>-token</code> parameter to override existing token", "If enabled, the -token commandline argument will replace an existing token (which can cause issues)"), d.makeGbc(0, 5, 2, 1, GridBagConstraints.WEST)); JPanel whisper = addTitledPanel("Whisper (experimental, read help!)", 3); whisper.add( d.addSimpleBooleanSetting( "whisperEnabled", "Whisper Enabled", "Connects to group chat to allow for whispering"), d.makeGbc(0, 0, 3, 1, GridBagConstraints.WEST)); whisper.add( d.addSimpleBooleanSetting( "whisperWhitelist", "Whitelist", "Only users in the Addressbook category 'whisper' may send messages to you."), d.makeGbc(4, 1, 1, 1, GridBagConstraints.EAST)); whisper.add(new JLabel("Display:"), d.makeGbc(3, 0, 1, 1)); Map<Long, String> displayMode = new LinkedHashMap<>(); displayMode.put(Long.valueOf(WhisperManager.DISPLAY_IN_CHAT), "Active Chat"); displayMode.put(Long.valueOf(WhisperManager.DISPLAY_ONE_WINDOW), "One Window"); displayMode.put(Long.valueOf(WhisperManager.DISPLAY_PER_USER), "Per User"); ComboLongSetting displayModeSetting = new ComboLongSetting(displayMode); d.addLongSetting("whisperDisplayMode", displayModeSetting); whisper.add(displayModeSetting, d.makeGbc(4, 0, 1, 1)); whisper.add( new LinkLabel("[help-whisper:top Whisper Help]", d.getLinkLabelListener()), d.makeGbc(2, 1, 2, 1)); whisper.add( d.addSimpleBooleanSetting( "whisperAutoRespond", "Auto-respond to ignored/non-whitelisted users", "Sends an automatic message telling users you didn't receive their message"), d.makeGbc(0, 2, 5, 1, GridBagConstraints.WEST)); }
public ConflationToggleDialog(ConflationPlugin conflationPlugin) { // TODO: create shortcut? super(TITLE_PREFIX, "conflation.png", tr("Activates the conflation plugin"), null, 150); matches = new SimpleMatchList(); settingsDialog = new SettingsDialog(); settingsDialog.setModalityType(Dialog.ModalityType.MODELESS); settingsDialog.addWindowListener( new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { // "Generate matches" was clicked if (settingsDialog.getValue() == 1) { settings = settingsDialog.getSettings(); performMatching(); } } }); // create table to show matches and allow multiple selections matchTableModel = new SimpleMatchesTableModel(); matchTable = new JTable(matchTableModel); // add selection handler, to center/zoom view matchTable.getSelectionModel().addListSelectionListener(new MatchListSelectionHandler()); matchTable .getColumnModel() .getSelectionModel() .addListSelectionListener(new MatchListSelectionHandler()); // FIXME: doesn't work right now matchTable.getColumnModel().getColumn(0).setCellRenderer(new OsmPrimitivRenderer()); matchTable.getColumnModel().getColumn(1).setCellRenderer(new OsmPrimitivRenderer()); matchTable.getColumnModel().getColumn(4).setCellRenderer(new ColorTableCellRenderer("Tags")); matchTable.setRowSelectionAllowed(true); matchTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); referenceOnlyListModel = new UnmatchedObjectListModel(); referenceOnlyList = new JList<>(referenceOnlyListModel); referenceOnlyList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); referenceOnlyList.setCellRenderer(new OsmPrimitivRenderer()); referenceOnlyList.setTransferHandler(null); // no drag & drop subjectOnlyListModel = new UnmatchedObjectListModel(); subjectOnlyList = new JList<>(subjectOnlyListModel); subjectOnlyList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); subjectOnlyList.setCellRenderer(new OsmPrimitivRenderer()); subjectOnlyList.setTransferHandler(null); // no drag & drop // add popup menu for zoom on selection zoomToListSelectionAction = new ZoomToListSelectionAction(); selectionPopup = new SelectionPopup(); SelectionPopupMenuLauncher launcher = new SelectionPopupMenuLauncher(); matchTable.addMouseListener(launcher); subjectOnlyList.addMouseListener(launcher); referenceOnlyList.addMouseListener(launcher); // on enter key zoom to selection InputMapUtils.addEnterAction(matchTable, zoomToListSelectionAction); InputMapUtils.addEnterAction(subjectOnlyList, zoomToListSelectionAction); InputMapUtils.addEnterAction(referenceOnlyList, zoomToListSelectionAction); DoubleClickHandler dblClickHandler = new DoubleClickHandler(); matchTable.addMouseListener(dblClickHandler); referenceOnlyList.addMouseListener(dblClickHandler); subjectOnlyList.addMouseListener(dblClickHandler); tabbedPane = new JTabbedPane(); tabbedPane.addTab(tr("Matches"), matchTable); tabbedPane.addTab(tr("Reference only"), referenceOnlyList); tabbedPane.addTab(tr("Subject only"), subjectOnlyList); conflateAction = new ConflateAction(); final SideButton conflateButton = new SideButton(conflateAction); // TODO: don't need this arrow box now, but likely will shortly // conflateButton.createArrow(new ActionListener() { // @Override // public void actionPerformed(ActionEvent e) { // ConflatePopupMenu.launch(conflateButton); // } // }); removeAction = new RemoveAction(); // add listeners to update enable state of buttons tabbedPane.addChangeListener(conflateAction); tabbedPane.addChangeListener(removeAction); referenceOnlyList.addListSelectionListener(conflateAction); referenceOnlyList.addListSelectionListener(removeAction); subjectOnlyList.addListSelectionListener(conflateAction); subjectOnlyList.addListSelectionListener(removeAction); UnmatchedListDataListener unmatchedListener = new UnmatchedListDataListener(); subjectOnlyListModel.addListDataListener(unmatchedListener); referenceOnlyListModel.addListDataListener(unmatchedListener); createLayout( tabbedPane, true, Arrays.asList( new SideButton[] { new SideButton(new ConfigureAction()), conflateButton, new SideButton(removeAction) // new SideButton("Replace Geometry", false), // new SideButton("Merge Tags", false), // new SideButton("Remove", false) })); }
public static void showSettingsDialog(Window ownerWindow) { SettingsDialog.create(ownerWindow).show(true); }
// ----- stops the remainder parameters -----// public synchronized void stop() { timer.stop(); settingsDialog.paintStatus("Stopped!"); breakDialog.setVisible(false); }
/** Show the settings dialog. */ public void showSettings() { set.showDialogBox(); }