From fc28ffad2f4e26d0defd19b7af2562e3a56f06d8 Mon Sep 17 00:00:00 2001 From: Simon Ebner Date: Wed, 18 Dec 2013 12:58:20 +0100 Subject: [PATCH] Removed unused / non functioning UI classes FDA-99 --- .../ch/psi/fda/cdump/ui/CalibratePanel.java | 47 ---- .../ch/psi/fda/cdump/ui/ControlPanel.java | 251 ------------------ .../java/ch/psi/fda/cdump/ui/MainGui.java | 50 ---- 3 files changed, 348 deletions(-) delete mode 100644 ch.psi.fda.cdump/src/main/java/ch/psi/fda/cdump/ui/CalibratePanel.java delete mode 100644 ch.psi.fda.cdump/src/main/java/ch/psi/fda/cdump/ui/ControlPanel.java delete mode 100644 ch.psi.fda.cdump/src/main/java/ch/psi/fda/cdump/ui/MainGui.java diff --git a/ch.psi.fda.cdump/src/main/java/ch/psi/fda/cdump/ui/CalibratePanel.java b/ch.psi.fda.cdump/src/main/java/ch/psi/fda/cdump/ui/CalibratePanel.java deleted file mode 100644 index 2a8ff78..0000000 --- a/ch.psi.fda.cdump/src/main/java/ch/psi/fda/cdump/ui/CalibratePanel.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * Copyright 2010 Paul Scherrer Institute. All rights reserved. - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This code is distributed in the hope that it will be useful, - * but without any warranty; without even the implied warranty of - * merchantability or fitness for a particular purpose. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this code. If not, see . - * - */ - -package ch.psi.fda.cdump.ui; - -import javax.swing.JPanel; -import java.awt.BorderLayout; -import javax.swing.JLabel; -import javax.swing.ImageIcon; - -/** - * @author ebner - * - */ -public class CalibratePanel extends JPanel { - - private static final long serialVersionUID = 1L; - - /** - * Create the panel. - */ - public CalibratePanel() { - setLayout(new BorderLayout(0, 0)); - - JLabel label = new JLabel(""); - label.setIcon(new ImageIcon(CalibratePanel.class.getResource("/ch/psi/cdump/gui/sine.png"))); - add(label, BorderLayout.CENTER); - - } - -} diff --git a/ch.psi.fda.cdump/src/main/java/ch/psi/fda/cdump/ui/ControlPanel.java b/ch.psi.fda.cdump/src/main/java/ch/psi/fda/cdump/ui/ControlPanel.java deleted file mode 100644 index 77c6427..0000000 --- a/ch.psi.fda.cdump/src/main/java/ch/psi/fda/cdump/ui/ControlPanel.java +++ /dev/null @@ -1,251 +0,0 @@ -/** - * - * Copyright 2010 Paul Scherrer Institute. All rights reserved. - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This code is distributed in the hope that it will be useful, - * but without any warranty; without even the implied warranty of - * merchantability or fitness for a particular purpose. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this code. If not, see . - * - */ - -package ch.psi.fda.cdump.ui; - -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.GroupLayout; -import javax.swing.GroupLayout.Alignment; -import javax.swing.JTextField; -import javax.swing.JLabel; -import javax.swing.LayoutStyle.ComponentPlacement; -import javax.swing.JComboBox; -import javax.swing.JButton; - -import java.awt.EventQueue; -import java.awt.Font; -import java.awt.Point; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -/** - * @author ebner - * - */ -public class ControlPanel extends JPanel { - private static final long serialVersionUID = 1L; - - private JTextField tfScanName; - private JButton btnCalibrate; - private JComboBox cbSamplingRate; - private JButton btnAcquire; - private JLabel lblRunning; - private JTextField tfMonoFrequency; - private JLabel lblScanName; - private JLabel lblMonoFrequency; - private JLabel lblSamplingRate; - - /** - * Create the panel. - */ - public ControlPanel() { - - tfMonoFrequency = new JTextField(); - tfMonoFrequency.setColumns(10); - - lblMonoFrequency = new JLabel("Mono Frequency [rpm]"); - - JLabel lblFrequency = new JLabel("frequency"); - - cbSamplingRate = new JComboBox<>(); - - lblSamplingRate = new JLabel("Sampling Rate"); - - tfScanName = new JTextField(); - tfScanName.setColumns(10); - - lblScanName = new JLabel("Scan Name"); - - btnAcquire = new JButton("Acquire"); - btnAcquire.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - if(btnAcquire.getText().equals("Acquire")){ - lblRunning.setVisible(true); - btnAcquire.setText("Stop"); - btnAcquire.requestFocus(); - - // Disable calibrate button - btnCalibrate.setEnabled(false); - cbSamplingRate.setEnabled(false); - lblSamplingRate.setEnabled(false); - lblMonoFrequency.setEnabled(false); - tfMonoFrequency.setEnabled(false); - - tfScanName.setEnabled(false); - lblScanName.setEnabled(false); - - ControlPanel.this.validate(); - - acquire(); - } - else{ - lblRunning.setVisible(false); - btnAcquire.setText("Acquire"); - tfScanName.requestFocus(); - - // Enable calibrate button again - btnCalibrate.setEnabled(true); - cbSamplingRate.setEnabled(true); - lblSamplingRate.setEnabled(true); - lblMonoFrequency.setEnabled(true); - tfMonoFrequency.setEnabled(true); - - tfScanName.setEnabled(true); - lblScanName.setEnabled(true); - - ControlPanel.this.validate(); - - stopAcquire(); - } - } - }); - - lblRunning = new JLabel("[running]"); - lblRunning.setVisible(false); - lblRunning.setFont(new Font("Lucida Grande", Font.BOLD, 13)); - - btnCalibrate = new JButton("Calibrate"); - btnCalibrate.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - if(btnCalibrate.getText().equals("Calibrate")){ - - btnCalibrate.setText("Stop"); - btnCalibrate.requestFocus(); - - // Disable acquire components - tfScanName.setEnabled(false); - lblScanName.setEnabled(false); - btnAcquire.setEnabled(false); - lblRunning.setEnabled(false); - - ControlPanel.this.validate(); - - calibrate(); - } - else{ - - btnCalibrate.setText("Calibrate"); - tfScanName.requestFocus(); - - // Enable acquire components - tfScanName.setEnabled(true); - lblScanName.setEnabled(true); - btnAcquire.setEnabled(true); - lblRunning.setEnabled(true); - - ControlPanel.this.validate(); - - stopCalibrate(); - } - } - }); - GroupLayout groupLayout = new GroupLayout(this); - groupLayout.setHorizontalGroup( - groupLayout.createParallelGroup(Alignment.LEADING) - .addGroup(groupLayout.createSequentialGroup() - .addContainerGap() - .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false) - .addGroup(groupLayout.createSequentialGroup() - .addComponent(btnAcquire, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(lblRunning)) - .addGroup(groupLayout.createSequentialGroup() - .addComponent(tfMonoFrequency, 113, 113, Short.MAX_VALUE) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(lblMonoFrequency) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(lblFrequency) - .addGap(29)) - .addGroup(groupLayout.createSequentialGroup() - .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false) - .addComponent(cbSamplingRate, Alignment.LEADING, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(btnCalibrate, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(tfScanName, 113, 113, Short.MAX_VALUE)) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) - .addComponent(lblSamplingRate) - .addComponent(lblScanName)) - .addGap(148))) - .addContainerGap(38, Short.MAX_VALUE)) - ); - groupLayout.setVerticalGroup( - groupLayout.createParallelGroup(Alignment.LEADING) - .addGroup(groupLayout.createSequentialGroup() - .addContainerGap() - .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) - .addComponent(tfMonoFrequency, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(lblMonoFrequency) - .addComponent(lblFrequency)) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) - .addComponent(cbSamplingRate, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(lblSamplingRate)) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(btnCalibrate) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) - .addComponent(tfScanName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(lblScanName)) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) - .addComponent(btnAcquire) - .addComponent(lblRunning)) - .addContainerGap(131, Short.MAX_VALUE)) - ); - setLayout(groupLayout); - } - - private void acquire(){ - } - - private void stopAcquire() { - } - - private JFrame calibratePlot = null; - - private void calibrate(){ - - Point p = this.getLocationOnScreen(); - - Point p1 = new Point(p.getLocation().x+this.getWidth(), p.getLocation().y); - - final JFrame frame = new JFrame(); - frame.setLocation(p1); - frame.add(new CalibratePanel()); - - frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - frame.setUndecorated(true); - frame.pack(); - - calibratePlot = frame; - - EventQueue.invokeLater(new Runnable() { - public void run() { - frame.setVisible(true); - } - }); - } - - private void stopCalibrate(){ - if(calibratePlot!=null){ - calibratePlot.dispose(); - } - } -} diff --git a/ch.psi.fda.cdump/src/main/java/ch/psi/fda/cdump/ui/MainGui.java b/ch.psi.fda.cdump/src/main/java/ch/psi/fda/cdump/ui/MainGui.java deleted file mode 100644 index 6d55d87..0000000 --- a/ch.psi.fda.cdump/src/main/java/ch/psi/fda/cdump/ui/MainGui.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * - * Copyright 2010 Paul Scherrer Institute. All rights reserved. - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This code is distributed in the hope that it will be useful, - * but without any warranty; without even the implied warranty of - * merchantability or fitness for a particular purpose. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this code. If not, see . - * - */ - -package ch.psi.fda.cdump.ui; - -import java.awt.EventQueue; - -import javax.swing.JFrame; - -/** - * @author ebner - * - */ -public class MainGui { - - /** - * @param args - */ - public static void main(String[] args) { - // TODO Auto-generated method stub - final JFrame frame = new JFrame(); - frame.add(new ControlPanel()); - - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.pack(); - - EventQueue.invokeLater(new Runnable() { - public void run() { - frame.setVisible(true); - } - }); - } - -}