/** * Switches to the advanced setup mode. * * @param exp the experiment to configure */ public void switchToAdvanced(Experiment exp) { if (exp == null) { exp = m_simplePanel.getExperiment(); } if (exp != null) { m_AdvancedSetupRBut.setSelected(true); m_advancedPanel.setExperiment(exp); } remove(m_simplePanel); m_simplePanel.removeNotesFrame(); add(m_advancedPanel, BorderLayout.CENTER); validate(); repaint(); }
/** Creates the setup panel with no initial experiment. */ public SetupModePanel() { m_simplePanel.setModePanel(this); m_SimpleSetupRBut.setMnemonic('S'); m_SimpleSetupRBut.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { switchToSimple(null); } }); m_AdvancedSetupRBut.setMnemonic('A'); m_AdvancedSetupRBut.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { switchToAdvanced(null); } }); ButtonGroup modeBG = new ButtonGroup(); modeBG.add(m_SimpleSetupRBut); modeBG.add(m_AdvancedSetupRBut); m_SimpleSetupRBut.setSelected(true); JPanel modeButtons = new JPanel(); modeButtons.setLayout(new GridLayout(1, 0)); modeButtons.add(m_SimpleSetupRBut); modeButtons.add(m_AdvancedSetupRBut); JPanel switchPanel = new JPanel(); switchPanel.setLayout(new GridLayout(1, 0)); switchPanel.add(new JLabel("Experiment Configuration Mode:")); switchPanel.add(modeButtons); setLayout(new BorderLayout()); add(switchPanel, BorderLayout.NORTH); add(m_simplePanel, BorderLayout.CENTER); }
/** * Gets the currently configured experiment. * * @return the currently configured experiment. */ public Experiment getExperiment() { if (m_SimpleSetupRBut.isSelected()) return m_simplePanel.getExperiment(); else return m_advancedPanel.getExperiment(); }
/** * Adds a PropertyChangeListener who will be notified of value changes. * * @param l a value of type 'PropertyChangeListener' */ public void addPropertyChangeListener(PropertyChangeListener l) { m_simplePanel.addPropertyChangeListener(l); m_advancedPanel.addPropertyChangeListener(l); }