Package de.chris_soft.fyllgen.menu.extra

Source Code of de.chris_soft.fyllgen.menu.extra.BigFamilyName

/**
* 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.extra;

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

import de.chris_soft.fyllgen.data.Family;
import de.chris_soft.fyllgen.data.Person;

/**
* Wandelt den Familiennamen der aktuellen Person (also das letzte Wort des
* Namens) in Gro�buchstaben um.
* @author Christian Packenius, 2009.
*/
public class BigFamilyName implements Listener {
  /**
   * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
   */
  public void handleEvent(Event event) {
    Family family = Family.instance;
    Person currentPerson = family.getCurrentPerson();
    String fullName = currentPerson.getValueView(Person.NAME);
    int afterSpace = fullName.lastIndexOf(' ') + 1;
    fullName = fullName.substring(0, afterSpace) + fullName.substring(afterSpace).toUpperCase();
    currentPerson.setValue(Person.NAME, fullName);
    family.setChanged(true);
    family.setCurrentPerson(currentPerson, 0);
  }
}
TOP

Related Classes of de.chris_soft.fyllgen.menu.extra.BigFamilyName

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.