public class HauptPanel extends javax.swing.JPanel {
/**
* Creates new form Hauptpanel
*
* @throws ParseException
*/
public HauptPanel() {
initComponents();
initDispoTabel();
initSetEditable();
initButtonGroup();
}
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jP_artikel1 = new JPanel();
jL_artikelnummer1 = new javax.swing.JLabel();
jTx_artikelnummer1 = new javax.swing.JTextField();
jL_groesse1 = new javax.swing.JLabel();
jTx_groesse1 = new javax.swing.JTextField();
jL_armellaenge1 = new javax.swing.JLabel();
jTx_armellaenge1 = new javax.swing.JTextField();
jB_artikelSuchen1 = new javax.swing.JButton();
jL_artikelbezeichnung1 = new javax.swing.JLabel();
jTx_artikelbezeichnung1 = new javax.swing.JTextField();
jP_filialversorgung1 = new javax.swing.JPanel();
jRb_keineDisposition1 = new javax.swing.JRadioButton();
jRb_ganzjahr1 = new javax.swing.JRadioButton();
jRb_sasionFS1 = new javax.swing.JRadioButton();
jRb_manuellerZeitraum1 = new javax.swing.JRadioButton();
jRb_sasionHW1 = new javax.swing.JRadioButton();
jB_mkmSpeichern1 = new javax.swing.JButton();
jL_von1 = new javax.swing.JLabel();
jTx_von1 = new javax.swing.JTextField();
jL_bis1 = new javax.swing.JLabel();
jTf_bis1 = new javax.swing.JTextField();
jScrollPane5 = new javax.swing.JScrollPane();
jB_abbrechen1 = new javax.swing.JButton();
jB_speichern1 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jList1 = new javax.swing.JList();
setLayout(new java.awt.GridBagLayout());
jP_artikel1.setBorder(javax.swing.BorderFactory
.createTitledBorder("Artikel"));
jP_artikel1.setLayout(new java.awt.GridBagLayout());
jL_artikelnummer1.setText("Artikelnummer:");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jP_artikel1.add(jL_artikelnummer1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.ipadx = 46;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 6);
jP_artikel1.add(jTx_artikelnummer1, gridBagConstraints);
jL_groesse1.setText("Grösse :");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
jP_artikel1.add(jL_groesse1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.ipadx = 30;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 6);
jP_artikel1.add(jTx_groesse1, gridBagConstraints);
jL_armellaenge1.setText("Ärmellänge:");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 4;
gridBagConstraints.gridy = 0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
jP_artikel1.add(jL_armellaenge1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 5;
gridBagConstraints.gridy = 0;
gridBagConstraints.ipadx = 30;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 7);
jP_artikel1.add(jTx_armellaenge1, gridBagConstraints);
jB_artikelSuchen1.setText("Artikel suchen");
jB_artikelSuchen1
.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jB_artikelSuchen1ActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 6;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
jP_artikel1.add(jB_artikelSuchen1, gridBagConstraints);
jL_artikelbezeichnung1.setText("Artikelbezeichnung: ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.insets = new java.awt.Insets(3, 0, 0, 0);
jP_artikel1.add(jL_artikelbezeichnung1, gridBagConstraints);
jTx_artikelbezeichnung1.setEditable(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 6;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(3, 0, 0, 0);
jP_artikel1.add(jTx_artikelbezeichnung1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 4;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 2.0;
add(jP_artikel1, gridBagConstraints);
jP_filialversorgung1.setBorder(javax.swing.BorderFactory
.createTitledBorder("Filialversorgung"));
jP_filialversorgung1.setLayout(new java.awt.GridBagLayout());
jRb_keineDisposition1.setText("keine Disposition");
jRb_keineDisposition1
.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRb_keineDisposition1ActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 3, 0);
jP_filialversorgung1.add(jRb_keineDisposition1, gridBagConstraints);
jRb_ganzjahr1.setText("Ganzjahr");
jRb_ganzjahr1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRb_ganzjahr1ActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 3, 0);
jP_filialversorgung1.add(jRb_ganzjahr1, gridBagConstraints);
jRb_sasionFS1.setText("Sasion F/S");
jRb_sasionFS1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRb_sasionFS1ActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jP_filialversorgung1.add(jRb_sasionFS1, gridBagConstraints);
jRb_manuellerZeitraum1.setText("manueller Zeitraum");
jRb_manuellerZeitraum1
.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRb_manuellerZeitraum1ActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 4;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jP_filialversorgung1.add(jRb_manuellerZeitraum1, gridBagConstraints);
jRb_sasionHW1.setText("Sasion H/W");
jRb_sasionHW1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRb_sasionHW1ActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
jP_filialversorgung1.add(jRb_sasionHW1, gridBagConstraints);
jB_mkmSpeichern1.setText("Mkm speichern");
jB_mkmSpeichern1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jB_mkmSpeichern1ActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 6;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 3, 0);
jP_filialversorgung1.add(jB_mkmSpeichern1, gridBagConstraints);
jL_von1.setText("von: ");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
jP_filialversorgung1.add(jL_von1, gridBagConstraints);
jTx_von1.setEditable(false);
jTx_von1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTx_von1ActionPerformed(evt);
}
});
jTx_von1.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
jTx_von1FocusGained(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 4;
gridBagConstraints.gridy = 1;
gridBagConstraints.ipadx = 45;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jP_filialversorgung1.add(jTx_von1, gridBagConstraints);
jL_bis1.setText("bis:");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 5;
gridBagConstraints.gridy = 1;
jP_filialversorgung1.add(jL_bis1, gridBagConstraints);
jTf_bis1.setEditable(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 6;
gridBagConstraints.gridy = 1;
gridBagConstraints.ipadx = 45;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 1);
jP_filialversorgung1.add(jTf_bis1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 4;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 2.0;
add(jP_filialversorgung1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = 5;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.ipady = 33;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
add(jScrollPane5, gridBagConstraints);
jB_abbrechen1.setText("Abbrechen");
jB_abbrechen1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jB_abbrechen1ActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 4;
gridBagConstraints.gridy = 3;
gridBagConstraints.insets = new java.awt.Insets(7, 0, 0, 0);
add(jB_abbrechen1, gridBagConstraints);
jB_speichern1.setText("Speichern");
jB_speichern1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jB_speichern1ActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 3;
gridBagConstraints.ipadx = 6;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.insets = new java.awt.Insets(7, 0, 0, 0);
add(jB_speichern1, gridBagConstraints);
jPanel1.setBorder(javax.swing.BorderFactory
.createTitledBorder("Filialen"));
jScrollPane1.setViewportView(jList1);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(
jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addComponent(
jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, 149, Short.MAX_VALUE));
jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addComponent(
jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 121,
Short.MAX_VALUE));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 4;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridheight = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
gridBagConstraints.ipadx = 125;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
add(jPanel1, gridBagConstraints);
}// </editor-fold>
/**
* Inizialisiert die Dispotable
*
*/
private void initDispoTabel() {
DispoTable jT_Dispotable = new DispoTable();
jScrollPane5.setViewportView(jT_Dispotable);
}
/**
* Setzt die Felder von / bis in nicht editiertbar
*
*/
private void initSetEditable() {
jTx_von1.setEditable(false);
jTf_bis1.setEditable(false);
}
/**
* Inizialisiert für die Radiobuttons eine ButtonGroup und fügt die
* Radiobuttons hinzu.
*
*/
private void initButtonGroup() {
bG_buttonGroup = new javax.swing.ButtonGroup();
bG_buttonGroup.add(jRb_ganzjahr1);
bG_buttonGroup.add(jRb_keineDisposition1);
bG_buttonGroup.add(jRb_manuellerZeitraum1);
bG_buttonGroup.add(jRb_sasionFS1);
bG_buttonGroup.add(jRb_sasionHW1);
}
/**
* Übergibt die die Hauptfiliale
*
* @param filiale
*/
public void uebergabeHauptFiliale(Filiale filiale) {
hauptFiliale = filiale;
}
/**
* Setzt die Filiale in die JList, desweiteren wird dort überprüft ob die
* Filiale schon im Model enthalten ist.
*
* @param filiale
*/
public void hinzufuegenEintragList(Filiale filiale) {
jList1.setModel(model);
boolean check = false;
if (model.size() == 0) {
model.addElement(filiale);
} else {
for (int i = 0; i < model.size(); i++) {
if (model.getElementAt(i).equals(filiale)) {
check = false;
break;
} else {
check = true;
}
}
if (check) {
model.addElement(filiale);
}
}
}
/**
* Gibt die Dispo von dem gesuchten Artikel an die DispoTable weiter und
* setzt die Bezeichnung
*
* @param artikel
*/
private void datenEinpflegenInListe(ArtikelDispoVO artikel) {
jTx_artikelbezeichnung1.setText(artikel.getArtBez());
jT_Dispotable.uebergabeDaten(artikel.getDispo());
}
/**
* Entfernt die mitgegebene Filiale aus dem Model. Fängt erst an, wenn im
* Model bereits ein Eintrag enthalten ist.
*
* Kann nicht die Hauptfiliale löschen!
*
* @param ausgewaehlteFiliale
*/
public void entfernenEintragList(Filiale ausgewaehlteFiliale) {
if (model.size() != 0) {
for (int i = 1; i < model.size(); i++) {
if (model.getElementAt(i).equals(ausgewaehlteFiliale)) {
model.remove(i);
}
}
}
}
// /////////////////METHODEN ENDE
private void jB_artikelSuchen1ActionPerformed(java.awt.event.ActionEvent evt) {
FilialDelegate fDelegate = new FilialDelegate();
if (jTx_groesse1.getText().equals("")
&& jTx_armellaenge1.getText().equals("")) {
advo = fDelegate.getArtikelDispo("0001", 440606L, null, null);
// advo = fDelegate.getArtikelDispo(hauptFiliale.getSauele(), Long
// .valueOf(jTx_artikelnummer1.getText()).longValue(), null,
// null);
} else if (jTx_groesse1.getText().equals("")) {
advo = fDelegate.getArtikelDispo(hauptFiliale.getSauele(), Long
.valueOf(jTx_artikelnummer1.getText()).longValue(),
jTx_armellaenge1.getText(), null);
}
else if (jTx_armellaenge1.getText().equals("")) {
advo = fDelegate.getArtikelDispo(hauptFiliale.getSauele(), Long
.valueOf(jTx_artikelnummer1.getText()).longValue(), null,
Long.valueOf(jTx_groesse1.getText()).longValue());
} else {
advo = fDelegate.getArtikelDispo(hauptFiliale.getSauele(), Long
.valueOf(jTx_artikelnummer1.getText()).longValue(),
jTx_armellaenge1.getText(), Long.valueOf(
jTx_groesse1.getText()).longValue());
}
datenEinpflegenInListe(advo);
}
private void jB_mkmSpeichern1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jB_abbrechen1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jB_speichern1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jTx_von1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jTx_von1FocusGained(java.awt.event.FocusEvent evt) {
// TODO add your handling code here:
}
private void jRb_keineDisposition1ActionPerformed(
java.awt.event.ActionEvent evt) {
jTx_von1.setEditable(false);
jTf_bis1.setEditable(false);
}
private void jRb_ganzjahr1ActionPerformed(java.awt.event.ActionEvent evt) {
jTx_von1.setEditable(false);
jTf_bis1.setEditable(false);
}
private void jRb_manuellerZeitraum1ActionPerformed(
java.awt.event.ActionEvent evt) {
jTx_von1.setEditable(true);
jTf_bis1.setEditable(true);
}
private void jRb_sasionFS1ActionPerformed(java.awt.event.ActionEvent evt) {
jTx_von1.setEditable(false);
jTf_bis1.setEditable(false);
}
private void jRb_sasionHW1ActionPerformed(java.awt.event.ActionEvent evt) {
jTx_von1.setEditable(false);
jTf_bis1.setEditable(false);
}
// Variables declaration - do not modify
private javax.swing.JButton jB_abbrechen1;
private javax.swing.JButton jB_artikelSuchen1;
private javax.swing.JButton jB_mkmSpeichern1;
private javax.swing.JButton jB_speichern1;
private javax.swing.JLabel jL_armellaenge1;
private javax.swing.JLabel jL_artikelbezeichnung1;
private javax.swing.JLabel jL_artikelnummer1;
private javax.swing.JLabel jL_bis1;
private javax.swing.JLabel jL_groesse1;
private javax.swing.JLabel jL_von1;
private javax.swing.JList jList1;
private javax.swing.JPanel jP_artikel1;
private javax.swing.JPanel jP_filialversorgung1;
private javax.swing.JPanel jPanel1;
private javax.swing.JRadioButton jRb_ganzjahr1;
private javax.swing.JRadioButton jRb_keineDisposition1;
private javax.swing.JRadioButton jRb_manuellerZeitraum1;
private javax.swing.JRadioButton jRb_sasionFS1;
private javax.swing.JRadioButton jRb_sasionHW1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane5;
private javax.swing.JTextField jTf_bis1;
private javax.swing.JTextField jTx_armellaenge1;
private javax.swing.JTextField jTx_artikelbezeichnung1;
private javax.swing.JTextField jTx_artikelnummer1;
private javax.swing.JTextField jTx_groesse1;
private javax.swing.JTextField jTx_von1;
// End of variables declaration
private Filiale hauptFiliale;
DefaultListModel model = new DefaultListModel();
private ArtikelDispoVO advo;
private DispoTable jT_Dispotable;
private ButtonGroup bG_buttonGroup;
}