package de.fhswf.in.inf.se.projektthemenvergabe.model; import javafx.beans.Observable; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.util.Callback; public class Ansprechpartner { private StringProperty vorname = new SimpleStringProperty(); private StringProperty nachname = new SimpleStringProperty(); private Organisation organisation; /** * Generates an extractor that fires when a property of a list value * changes. * * @return The extractor. */ public static Callback extractor() { return ansprechpartner -> new Observable[] { ansprechpartner.vornameProperty(), ansprechpartner.nachnameProperty(), ansprechpartner.getOrganisation().nameProperty() }; } /** * TODO Add constructor comment here * * @param organisation */ public Ansprechpartner(Organisation organisation) { if (organisation == null) { throw new IllegalArgumentException( "Ansprechpartner sollten nicht arbeitslos sein."); } this.organisation = organisation; this.organisation.addAnsprechpartner(this); } /** * Getter for property organisation. * * @return Returns the organisation. */ public Organisation getOrganisation() { return organisation; } /** * Setter for organisation. * * @param organisation * The organisation to set. */ public void setOrganisation(Organisation organisation) { if (organisation == null) { throw new IllegalArgumentException( "Ansprechpartner sollten nicht arbeitslos sein."); } this.organisation.removeAnsprechpartner(this); this.organisation = organisation; this.organisation.addAnsprechpartner(this); } /** * Getter for property nachname. * * @return Returns the nachname. */ public final StringProperty nachnameProperty() { return this.nachname; } /** * Getter for nachname. * * @return Returns the nachname. */ public String getNachname() { return this.nachname.get(); } /** * Setter for nachname. * * @param nachname * The nachname to set. */ public void setNachname(String nachname) { this.nachname.set(nachname); } /** * Getter for property vorname. * * @return Returns the vorname. */ public final StringProperty vornameProperty() { return this.vorname; } /** * Getter for property vorname. * * @return Returns the vorname. */ public String getVorname() { return vorname.get(); } /** * Setter for vorname. * * @param vorname * The vorname to set. */ public void setVorname(String vorname) { this.vorname.set(vorname); } }