/** * Save the focus settings. * * @param settings instance of the ArgusSettings */ private void saveFocusSettings(ArgusSettings settings) { if (m_focusCheckBox.isSelected()) { settings.setAttribute("msc.statementFocus", "true"); } else { settings.setAttribute("msc.statementFocus", "false"); } }
/** * Save the collapse settings. * * @param settings instance of the ArgusSettings */ private void saveCollapseSettings(ArgusSettings settings) { if (m_autoCollapseCheckBox.isSelected()) { settings.setAttribute("msc.collapse", "true"); } else { settings.setAttribute("msc.collapse", "false"); } }
/** * Create the panel for the Message Sequence Chart settings * * @return The Message Sequence Chart settings panel */ private JPanel createMscSettingsPanel() { JPanel mscPanel = new JPanel(new GridLayout(2, 1)); m_focusCheckBox = new JCheckBox("Automatic statement focus"); m_autoCollapseCheckBox = new JCheckBox("Collapse whitespace between statements"); ArgusSettings settings = ArgusSettings.getInstance(); boolean statementFocusEnabled = settings.getAttribute("msc.statementfocus", "false").equals("true"); m_focusCheckBox.setSelected(statementFocusEnabled); boolean collapseEnabled = settings.getAttribute("msc.collapse", "true").equals("true"); m_autoCollapseCheckBox.setSelected(collapseEnabled); mscPanel.setBorder(BorderFactory.createTitledBorder(FOCUSTITLE)); mscPanel.add(m_focusCheckBox); mscPanel.add(m_autoCollapseCheckBox); return mscPanel; }
/** * Processes a button clicked event * * @param e the event */ public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals("Save")) { ArgusSettings settings = ArgusSettings.getInstance(); saveHistorySettings(); saveFocusSettings(settings); saveCollapseSettings(settings); } else if (command.equals("Cancel")) { dispose(); } }