Skip to content

Commit

Permalink
Code refactoring (remove Vector und Hashtable)
Browse files Browse the repository at this point in the history
  • Loading branch information
kpatzwald committed Dec 4, 2021
1 parent 7b63674 commit 8efdd87
Show file tree
Hide file tree
Showing 16 changed files with 3,823 additions and 3,511 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* ******************************************************************** **
** Copyright notice **
** **
** (c) 2003 WiSim Development Team **
** https://github.com/kpatzwald/WiSim **
** (c) 2003 WiSim Development Team **
** https://github.com/kpatzwald/WiSim **
** **
** All rights reserved **
** **
Expand Down Expand Up @@ -47,6 +47,7 @@ public class IconNodeRenderer extends DefaultTreeCellRenderer {
* @param hasFocus
* @return WiSimComponent
*/
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {

super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private void initDAO(WiSimMainController wiSimMainController) {
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() { //GEN-BEGIN:initComponents
private void initComponents() {//GEN-BEGIN:initComponents
jPanelNeuerKunde3 = new javax.swing.JPanel();
jLabelNeuerKunde3 = new javax.swing.JLabel();
jLabelVorname3 = new javax.swing.JLabel();
Expand Down Expand Up @@ -429,38 +429,38 @@ public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
add(jTabbedPaneKundeBearbeitenNotizen);
jTabbedPaneKundeBearbeitenNotizen.setBounds(490, 210, 280, 130);

} //GEN-END:initComponents
}//GEN-END:initComponents

private void jTextFieldKundeBearbeitenPLZFocusGained(java.awt.event.FocusEvent evt) { //GEN-FIRST:event_jTextFieldKundeBearbeitenPLZFocusGained
private void jTextFieldKundeBearbeitenPLZFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextFieldKundeBearbeitenPLZFocusGained
setCurrentPLZ();
} //GEN-LAST:event_jTextFieldKundeBearbeitenPLZFocusGained
}//GEN-LAST:event_jTextFieldKundeBearbeitenPLZFocusGained

private void jTextFieldKundeBearbeitenEMailFocusGained(java.awt.event.FocusEvent evt) { //GEN-FIRST:event_jTextFieldKundeBearbeitenEMailFocusGained
private void jTextFieldKundeBearbeitenEMailFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextFieldKundeBearbeitenEMailFocusGained
setCurrentEmail();
} //GEN-LAST:event_jTextFieldKundeBearbeitenEMailFocusGained
}//GEN-LAST:event_jTextFieldKundeBearbeitenEMailFocusGained

private void jButtonKundeLoeschenActionPerformed(java.awt.event.ActionEvent evt) { //GEN-FIRST:event_jButtonKundeLoeschenActionPerformed
private void jButtonKundeLoeschenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonKundeLoeschenActionPerformed
int auswahl = getSelectedCustomerID();
if (auswahl != 0) {
deleteCostumer(getSelectedCustomerID());
} else {
JOptionPane.showMessageDialog(this, "Sie müssen erst einen Kunden auswählen.", "Fehler beim Löschen eines Kunden", JOptionPane.ERROR_MESSAGE);
}
} //GEN-LAST:event_jButtonKundeLoeschenActionPerformed
}//GEN-LAST:event_jButtonKundeLoeschenActionPerformed

private void jTextFieldKundeBearbeitenEMailFocusLost(java.awt.event.FocusEvent evt) { //GEN-FIRST:event_jTextFieldKundeBearbeitenEMailFocusLost
private void jTextFieldKundeBearbeitenEMailFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextFieldKundeBearbeitenEMailFocusLost
validateEmail();
} //GEN-LAST:event_jTextFieldKundeBearbeitenEMailFocusLost
}//GEN-LAST:event_jTextFieldKundeBearbeitenEMailFocusLost

private void jTextFieldKundeBearbeitenPLZFocusLost(java.awt.event.FocusEvent evt) { //GEN-FIRST:event_jTextFieldKundeBearbeitenPLZFocusLost
private void jTextFieldKundeBearbeitenPLZFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextFieldKundeBearbeitenPLZFocusLost
validatePLZ();
} //GEN-LAST:event_jTextFieldKundeBearbeitenPLZFocusLost
}//GEN-LAST:event_jTextFieldKundeBearbeitenPLZFocusLost

private void jButtonKundeBearbeitenActionPerformed(java.awt.event.ActionEvent evt) { //GEN-FIRST:event_jButtonKundeBearbeitenActionPerformed
private void jButtonKundeBearbeitenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonKundeBearbeitenActionPerformed
validateMandatoryFields();
} //GEN-LAST:event_jButtonKundeBearbeitenActionPerformed
}//GEN-LAST:event_jButtonKundeBearbeitenActionPerformed

private void jButtonNotizEntfernenActionPerformed(java.awt.event.ActionEvent evt) { //GEN-FIRST:event_jButtonNotizEntfernenActionPerformed
private void jButtonNotizEntfernenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNotizEntfernenActionPerformed
if (jListTextFieldKundeBearbeitenVerlauf.isShowing()) {
if (!jListTextFieldKundeBearbeitenVerlauf.isSelectionEmpty()) {
deleteMemo(jListTextFieldKundeBearbeitenVerlauf.getAnchorSelectionIndex());
Expand All @@ -470,26 +470,26 @@ private void jButtonNotizEntfernenActionPerformed(java.awt.event.ActionEvent evt
} else {
JOptionPane.showMessageDialog(this, "Sie müssen in Verlauf wechseln um eine Bemerkung zu löschen.", "Hinweis", JOptionPane.INFORMATION_MESSAGE);
}
} //GEN-LAST:event_jButtonNotizEntfernenActionPerformed
}//GEN-LAST:event_jButtonNotizEntfernenActionPerformed

private void jButtonNotizHinzufuegenActionPerformed(java.awt.event.ActionEvent evt) { //GEN-FIRST:event_jButtonNotizHinzufuegenActionPerformed
private void jButtonNotizHinzufuegenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNotizHinzufuegenActionPerformed
jTextAreaKundeBearbeitenBemerkung.removeAll();
newMemo();
} //GEN-LAST:event_jButtonNotizHinzufuegenActionPerformed
}//GEN-LAST:event_jButtonNotizHinzufuegenActionPerformed

private void jListTextFieldKundeBearbeitenVerlaufValueChanged(javax.swing.event.ListSelectionEvent evt) { //GEN-FIRST:event_jListTextFieldKundeBearbeitenVerlaufValueChanged
private void jListTextFieldKundeBearbeitenVerlaufValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jListTextFieldKundeBearbeitenVerlaufValueChanged
if (!jListTextFieldKundeBearbeitenVerlauf.isSelectionEmpty()) {
showMemo(jListTextFieldKundeBearbeitenVerlauf.getMaxSelectionIndex());
}
} //GEN-LAST:event_jListTextFieldKundeBearbeitenVerlaufValueChanged
}//GEN-LAST:event_jListTextFieldKundeBearbeitenVerlaufValueChanged

private void jComboBoxKundenBearbeitenActionPerformed(java.awt.event.ActionEvent evt) { //GEN-FIRST:event_jComboBoxKundenBearbeitenActionPerformed
private void jComboBoxKundenBearbeitenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxKundenBearbeitenActionPerformed
loadCustomer(getSelectedCustomerID());
} //GEN-LAST:event_jComboBoxKundenBearbeitenActionPerformed
}//GEN-LAST:event_jComboBoxKundenBearbeitenActionPerformed

private void jComboBoxKundenBearbeitenAncestorAdded(javax.swing.event.AncestorEvent evt) { //GEN-FIRST:event_jComboBoxKundenBearbeitenAncestorAdded
private void jComboBoxKundenBearbeitenAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_jComboBoxKundenBearbeitenAncestorAdded
loadCustomers();
} //GEN-LAST:event_jComboBoxKundenBearbeitenAncestorAdded
}//GEN-LAST:event_jComboBoxKundenBearbeitenAncestorAdded

/** Löscht die Eingabemasken
*
Expand Down Expand Up @@ -847,7 +847,7 @@ private void validateMandatoryFields() {
if (auswahl == 0) {
JOptionPane.showMessageDialog(this, "Sie müssen erst einen Kunden auswählen.", "Fehler beim Speichern eines Kunden", JOptionPane.ERROR_MESSAGE);
} else {
Vector check = new Vector();
ArrayList <String> check = new ArrayList<>();
if (jTextFieldKundeBearbeitenFirma.getText().equals(""))
check.add("Firma");
if (jTextFieldKundeBearbeitenNachname.getText().equals(""))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.util.Vector;
import java.util.ArrayList;

import javax.swing.JLabel;
import javax.swing.JScrollPane;
Expand All @@ -36,6 +36,7 @@
import net.sourceforge.wisim.dao.WiSimDAOException;
import net.sourceforge.wisim.model.*;
import net.sourceforge.wisim.networkplan.JNetworkplan;
import net.sourceforge.wisim.networkplan.NetworkplanElement;

/**
* [DoItBen] Kommentar Klasse JPanelNetworkplan
Expand All @@ -44,7 +45,7 @@
public class JPanelNetworkplan extends javax.swing.JPanel {

/** Vector containing all networkplan elements */
private Vector npElemente;
private ArrayList<NetworkplanElement> npElemente;

/** Extends JPanel and holds all JNetworkplanElements */
private JNetworkplan netzplanGrafik;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@

package net.sourceforge.wisim.controller;
import java.sql.Date;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.Enumeration;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
Expand Down Expand Up @@ -68,8 +70,8 @@ public class JPanelSimulationAnalysis extends javax.swing.JPanel implements Refr
private WiSimDAO dao;
private Date actDate;
private int hubBestand;
private Vector artikelLagerElemente;
private Hashtable stueckliste;
private ArrayList<ComponentWarehouseItem> artikelLagerElemente;
private HashMap<String, String> stueckliste;
private Collection vertraege;
private GregorianCalendar actDateGC;
private GregorianCalendar lieferDateGC;
Expand Down Expand Up @@ -129,8 +131,8 @@ public JPanelSimulationAnalysis(WiSimMainController wiSimMainController) {
actDay = 0;
actDate = new Date(new GregorianCalendar(2003, 8, 1, 0, 0).getTimeInMillis());
hubBestand = 0;
artikelLagerElemente = new Vector();
stueckliste = new Hashtable();
artikelLagerElemente = new ArrayList<>();
stueckliste = new HashMap<>();
vertraege = new Vector();

actDateGC = new GregorianCalendar();
Expand Down Expand Up @@ -171,7 +173,7 @@ private void initDAO(WiSimMainController wiSimMainController) {
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() { //GEN-BEGIN:initComponents
private void initComponents() {//GEN-BEGIN:initComponents
jLabelSimulation = new javax.swing.JLabel();
jTabbedPaneSimulationsverlauf = new javax.swing.JTabbedPane();
jScrollPaneTreeHolderEinkauf = new javax.swing.JScrollPane();
Expand Down Expand Up @@ -222,15 +224,15 @@ public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
add(jTabbedPaneSimulationsverlauf);
jTabbedPaneSimulationsverlauf.setBounds(20, 50, 750, 460);

} //GEN-END:initComponents
}//GEN-END:initComponents

private void formAncestorRemoved(javax.swing.event.AncestorEvent evt) { //GEN-FIRST:event_formAncestorRemoved
private void formAncestorRemoved(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_formAncestorRemoved
wiSimMainController.removeActivPanel(this);
} //GEN-LAST:event_formAncestorRemoved
}//GEN-LAST:event_formAncestorRemoved

private void formAncestorAdded(javax.swing.event.AncestorEvent evt) { //GEN-FIRST:event_formAncestorAdded
private void formAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_formAncestorAdded
wiSimMainController.addActivPanel(this);
} //GEN-LAST:event_formAncestorAdded
}//GEN-LAST:event_formAncestorAdded

// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabelSimulation;
Expand Down Expand Up @@ -343,7 +345,7 @@ public void refreshJTreeProduktion() {
dateNode = new IconNode(actDateGC.get(5) + "." + (actDateGC.get(2) + 1) + "." + actDateGC.get(1));
dateNode.setIcon(rightIcon);

Vector artikelLagerElemente = new Vector();
ArrayList<ComponentWarehouseItem> artikelLagerElemente = new ArrayList<>();
int hubBestandAktuell = 0;

try {
Expand All @@ -367,9 +369,10 @@ public void refreshJTreeProduktion() {

//Neues Nodes im JTree
if (hubBestandDifferenz > 0) {
Enumeration keys = stueckliste.keys();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
for (String key:stueckliste.keySet()) {
//Enumeration keys = stueckliste.keys();
//while (keys.hasMoreElements()) {
// String key = (String) keys.nextElement();
WiSimComponent et = new WiSimComponent();

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
public class JPanelViewOrders extends javax.swing.JPanel implements Refreshable {

private WiSimDAO dao;
private Vector etatListe;
private ArrayList<ComponentContract> etatListe;
private Collection etatPos;
private int etatAnzahl;
private int etatPosAnzahl;
Expand All @@ -69,7 +69,7 @@ public JPanelViewOrders(WiSimMainController wiSimMainController) {
this.wiSimMainController = wiSimMainController;
wiSimLogger = wiSimMainController.getWiSimLogger();
initDAO(wiSimMainController);
etatListe = new Vector();
etatListe = new ArrayList<>();
etatPos = new Vector();
etatAnzahl = 0;
etatPosAnzahl = 0;
Expand All @@ -95,7 +95,7 @@ private void initDAO(WiSimMainController wiSimMainController) {
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() { //GEN-BEGIN:initComponents
private void initComponents() {//GEN-BEGIN:initComponents
jLabelEtatEinsehen = new javax.swing.JLabel();
jScrollPaneEtatListe = new javax.swing.JScrollPane();
jTableEtatListe = new javax.swing.JTable();
Expand Down Expand Up @@ -392,24 +392,24 @@ public void mouseClicked(java.awt.event.MouseEvent evt) {
add(jPanelLegende);
jPanelLegende.setBounds(10, 450, 270, 80);

} //GEN-END:initComponents
}//GEN-END:initComponents

private void formAncestorRemoved(javax.swing.event.AncestorEvent evt) { //GEN-FIRST:event_formAncestorRemoved
private void formAncestorRemoved(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_formAncestorRemoved
wiSimMainController.removeActivPanel(this);
} //GEN-LAST:event_formAncestorRemoved
}//GEN-LAST:event_formAncestorRemoved

private void formAncestorAdded(javax.swing.event.AncestorEvent evt) { //GEN-FIRST:event_formAncestorAdded
private void formAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_formAncestorAdded
wiSimMainController.addActivPanel(this);
} //GEN-LAST:event_formAncestorAdded
}//GEN-LAST:event_formAncestorAdded

private void jTableEtatListeMouseClicked(java.awt.event.MouseEvent evt) { //GEN-FIRST:event_jTableEtatListeMouseClicked
private void jTableEtatListeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableEtatListeMouseClicked
getEtatInfo();
} //GEN-LAST:event_jTableEtatListeMouseClicked
}//GEN-LAST:event_jTableEtatListeMouseClicked

private void jTableEtatListeAncestorAdded(javax.swing.event.AncestorEvent evt) { //GEN-FIRST:event_jTableEtatListeAncestorAdded
private void jTableEtatListeAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_jTableEtatListeAncestorAdded
getEtatListe();
showLegende();
} //GEN-LAST:event_jTableEtatListeAncestorAdded
}//GEN-LAST:event_jTableEtatListeAncestorAdded

// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabelAbz;
Expand Down
Loading

0 comments on commit 8efdd87

Please sign in to comment.