public int submit() { String newName = produktgruppeFormular.nameField.getText(); if (isProdGrAlreadyKnown(newName)) { // not allowed: changing name to one that is already registered in DB JOptionPane.showMessageDialog( this, "Fehler: Produktgruppe '" + newName + "' bereits vorhanden!", "Info", JOptionPane.INFORMATION_MESSAGE); produktgruppeFormular.nameField.setText(""); return 0; } Integer parentProdGrID = produktgruppeFormular.parentProdGrIDs.get( produktgruppeFormular.parentProdGrBox.getSelectedIndex()); Vector<Integer> idsNew = produktgruppeFormular.idsOfNewProdGr(parentProdGrID); Integer topID = idsNew.get(0); Integer subID = idsNew.get(1); Integer subsubID = idsNew.get(2); Integer mwstID = produktgruppeFormular.mwstIDs.get(produktgruppeFormular.mwstBox.getSelectedIndex()); Integer pfandID = produktgruppeFormular.pfandIDs.get(produktgruppeFormular.pfandBox.getSelectedIndex()); return insertNewProdGr(topID, subID, subsubID, newName, mwstID, pfandID); }
void update() { ThingWithProperties show = graph.getSelection(); if (show != null) { Vector props = show.getProperties(); // new lab[0].setText(((Property) props.elementAt(0)).toString()); lab[1].setText(((Property) props.elementAt(1)).toString()); if (dl1 != null) textfields[0].getDocument().removeDocumentListener(dl1); if (dl2 != null) textfields[1].getDocument().removeDocumentListener(dl2); dl1 = new PropertyListener((Property) props.elementAt(0)); dl2 = new PropertyListener((Property) props.elementAt(1)); textfields[0].getDocument().addDocumentListener(dl1); textfields[1].getDocument().addDocumentListener(dl2); textfields[0].setText(((Property) props.elementAt(0)).get()); textfields[0].setEditable(((Property) props.elementAt(0)).getEditable()); textfields[1].setText(((Property) props.elementAt(1)).get()); textfields[1].setEditable(((Property) props.elementAt(1)).getEditable()); /* setLayout(new GridLayout(2, props.size())); JTextField tf; Property p; JLabel n; for (int i = 0; i < props.size(); i++) { p = (Property) props.elementAt(i); System.out.println("Proprty " + p); n = new JLabel(p.toString()); tf = new JTextField(3); add(n); add(tf); tf.setText(p.get()); tf.setEditable(p.getEditable()); tf.getDocument().addDocumentListener(new PropertyListener(p)); }*/ } repaint(); }
// ----------------------------------------- public void clear() { int size = data.size(); data = new Vector(); fireIntervalRemoved(this, 0, size); }
// ----------------------------------------- public void removeElement(String s) { data.removeElement(s); fireIntervalRemoved(this, 0, data.size()); }
// ----------------------------------------- public void addElement(String s) { data.addElement(s); fireIntervalAdded(this, data.size() - 1, data.size()); }
// ----------------------------------------- public Object getElementAt(int index) { return data.elementAt(index); }
// ----------------------------------------- public int getSize() { return data.size(); }