public void okPersoonInvoer(Event evt) { // todo opgave 3 String voornamen = this.tfVoornamenInvoer.getText(); String achternaam = this.tfAchternaamInvoer.getText(); String tussenvoegsels = this.tfTussenvoegselInvoer.getText(); Geslacht geslacht = (Geslacht) this.cbGeslachtInvoer .getSelectionModel() .getSelectedItem(); // Geslacht.valueOf(this.cbGeslachtInvoer.getSelectionModel().getSelectedItem().toString()); Calendar c = Calendar.getInstance(); c.clear(); c = StringUtilities.datum(this.tfGeboortedatumInvoer.getText()); String geboorteplaats = this.tfGeboorteplaatsInvoer.getText(); Gezin gezin; if (this.cbOuderlijkGezinInvoer.getSelectionModel().isEmpty()) gezin = null; else gezin = (Gezin) this.cbOuderlijkGezinInvoer.getSelectionModel().getSelectedItem(); this.personen.add( getAdministratie() .addPersoon( geslacht, voornamen.split(" "), achternaam, tussenvoegsels, c, geboorteplaats, gezin)); this.clearTabPersoonInvoer(); }
Calendar readDate(String helptekst) { String datumString = readString(helptekst + "; voer datum in (dd-mm-jjjj)"); try { return StringUtilities.datum(datumString); } catch (IllegalArgumentException exc) { System.out.println(exc.getMessage()); return readDate(helptekst); } }
public void okGezinInvoer(Event evt) { Persoon ouder1 = (Persoon) cbOuder1Invoer.getSelectionModel().getSelectedItem(); if (ouder1 == null) { showDialog("Warning", "eerste ouder is niet ingevoerd"); return; } Persoon ouder2 = (Persoon) cbOuder2Invoer.getSelectionModel().getSelectedItem(); Calendar huwdatum; try { huwdatum = StringUtilities.datum(tfHuwelijkInvoer.getText()); } catch (IllegalArgumentException exc) { showDialog("Warning", "huwelijksdatum :" + exc.getMessage()); return; } Gezin g; if (huwdatum != null) { g = getAdministratie().addHuwelijk(ouder1, ouder2, huwdatum); if (g == null) { showDialog("Warning", "Invoer huwelijk is niet geaccepteerd"); } else { Calendar scheidingsdatum; try { scheidingsdatum = StringUtilities.datum(tfScheidingInvoer.getText()); if (scheidingsdatum != null) getAdministratie().setScheiding(g, scheidingsdatum); } catch (IllegalArgumentException exc) { showDialog("Warning", "scheidingsdatum :" + exc.getMessage()); } } } else { g = getAdministratie().addOngehuwdGezin(ouder1, ouder2); if (g == null) { showDialog("Warning", "Invoer ongehuwd gezin is niet geaccepteerd"); } } if (g != null) { this.gezinnen.add(g); } this.clearTabGezinInvoer(); }
public void setScheidingsdatum(Event evt) { // todo opgave 3 if (this.tfScheiding.getText().isEmpty()) { Calendar c = Calendar.getInstance(); c.clear(); c = StringUtilities.datum(this.tfHuwelijk.getText()); int i = Integer.parseInt(this.tfGezinNr.getText()); Gezin g = this.getAdministratie().getGezin(i); this.gezinnen.remove(g); this.getAdministratie().setScheiding(g, c); g = this.getAdministratie().getGezin(i); this.gezinnen.add(g); } }