/**
* FyLLGen - A Java based tool for collecting and distributing family data
*
* Copyright (C) 2007-2011 Christian Packenius
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.chris_soft.fyllgen.menu.search;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import de.chris_soft.fyllgen.GUI;
import de.chris_soft.fyllgen.data.Family;
import de.chris_soft.fyllgen.data.Person;
import de.chris_soft.fyllgen.widget.dialog.PersonChoiceShell;
/**
* Selection-Listener f�r das Erzeugen eines Partners der aktuellen Person.
* @author Christian Packenius, Juni 2008.
*/
public class SearchPerson implements Listener {
/**
* Event-Handler f�r Erzeugung eines Partners.
* @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
*/
public void handleEvent(Event event) {
PersonChoiceShell pcs = new PersonChoiceShell(GUI.instance.shell, "Person suchen", "Zur Person springen",
"Neue Person anlegen", 1, false, null, true);
pcs.open();
if (pcs.personChoice != null) {
// Es wurde eine vorhandene Person angew�hlt.
Family.instance.setCurrentPerson(pcs.personChoice, 1);
}
else if (pcs.newPersonName != null) {
Person person = new Person();
person.setValue(Person.NAME, pcs.newPersonName);
Family.instance.addNewPerson(person);
Family.instance.setCurrentPerson(person, 2);
}
}
}