org.hwo.pulscounter/src/org/hwo/pulscounter/ui/InspectionMainFrame.java

123 lines
3.8 KiB
Java

package org.hwo.pulscounter.ui;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridBagLayout;
import javax.swing.JButton;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.border.TitledBorder;
import org.hwo.datetime.Date;
import org.hwo.pulscounter.PulsCounter;
import org.hwo.pulscounter.elements.WorkShift;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class InspectionMainFrame extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
InspectionMainFrame frame = new InspectionMainFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public InspectionMainFrame() {
setTitle("Inspektor");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 841, 607);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
GridBagLayout gbl_contentPane = new GridBagLayout();
gbl_contentPane.columnWidths = new int[]{0, 0};
gbl_contentPane.rowHeights = new int[]{0, 0, 0};
gbl_contentPane.columnWeights = new double[]{1.0, Double.MIN_VALUE};
gbl_contentPane.rowWeights = new double[]{1.0, 1.0, Double.MIN_VALUE};
contentPane.setLayout(gbl_contentPane);
JPanel panel = new JPanel();
GridBagConstraints gbc_panel = new GridBagConstraints();
gbc_panel.insets = new Insets(0, 0, 5, 0);
gbc_panel.fill = GridBagConstraints.BOTH;
gbc_panel.gridx = 0;
gbc_panel.gridy = 0;
contentPane.add(panel, gbc_panel);
GridBagLayout gbl_panel = new GridBagLayout();
gbl_panel.columnWidths = new int[]{0, 0};
gbl_panel.rowHeights = new int[]{0, 0};
gbl_panel.columnWeights = new double[]{0.0, Double.MIN_VALUE};
gbl_panel.rowWeights = new double[]{0.0, Double.MIN_VALUE};
panel.setLayout(gbl_panel);
JButton btnNewButton = new JButton("Schichtdaten prüfen...");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
WorkShift[] shifts = PulsCounter.getInspectorApplication().getWorkShifts();
Date d = new Date();
d.addDays(10);
for (int i=0;i<40;i++){
for (int s = 0;s<shifts.length;s++){
System.out.println(shifts[s].getName() + ": " + shifts[s].getShiftBegins(d).getSQLDateTime() + " - " + shifts[s].getShiftEnds(d).getSQLDateTime() );
}
}
}
});
GridBagConstraints gbc_btnNewButton = new GridBagConstraints();
gbc_btnNewButton.gridx = 0;
gbc_btnNewButton.gridy = 0;
panel.add(btnNewButton, gbc_btnNewButton);
JPanel panel_1 = new JPanel();
panel_1.setBorder(new TitledBorder(null, "Einstellungen", TitledBorder.LEADING, TitledBorder.TOP, null, null));
GridBagConstraints gbc_panel_1 = new GridBagConstraints();
gbc_panel_1.fill = GridBagConstraints.BOTH;
gbc_panel_1.gridx = 0;
gbc_panel_1.gridy = 1;
contentPane.add(panel_1, gbc_panel_1);
GridBagLayout gbl_panel_1 = new GridBagLayout();
gbl_panel_1.columnWidths = new int[]{0, 0};
gbl_panel_1.rowHeights = new int[]{0, 0};
gbl_panel_1.columnWeights = new double[]{0.0, Double.MIN_VALUE};
gbl_panel_1.rowWeights = new double[]{0.0, Double.MIN_VALUE};
panel_1.setLayout(gbl_panel_1);
JButton btnSchichten = new JButton("Schichten");
btnSchichten.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
GridBagConstraints gbc_btnSchichten = new GridBagConstraints();
gbc_btnSchichten.gridx = 0;
gbc_btnSchichten.gridy = 0;
panel_1.add(btnSchichten, gbc_btnSchichten);
}
}