<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
-<project name="addressbook" default="default" basedir=".">
- <description>Builds, tests, and runs the project addressbook.</description>
+<project name="addressbook-lib" default="default" basedir=".">
+ <description>Builds, tests, and runs the project addressbook-lib.</description>
<import file="nbproject/build-impl.xml"/>
<!--
An example of overriding the target for project execution could look like this:
- <target name="run" depends="addressbook-impl.jar">
+ <target name="run" depends="addressbook-lib-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
-build.xml.data.CRC32=9ad00d87
-build.xml.script.CRC32=8387809e
+build.xml.data.CRC32=5c7b88c5
+build.xml.script.CRC32=3172ff94
build.xml.stylesheet.CRC32=8064a381@1.75.2.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
-application.title=addressbook
+application.title=addressbook-lib
application.vendor=Roland Haeder
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
build.classes.dir=${build.dir}/classes
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
-dist.jar=${dist.dir}/addressbook.jar
+dist.jar=${dist.dir}/addressbook-lib.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
- <name>addressbook</name>
+ <name>addressbook-lib</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
+++ /dev/null
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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
- * (at your option) 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 org.mxchange.addressbook.application;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.text.MessageFormat;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.addressbook.client.AddressbookClient;
-import org.mxchange.addressbook.client.console.ConsoleClient;
-import org.mxchange.addressbook.client.gui.SwingClient;
-import org.mxchange.jcore.application.Application;
-import org.mxchange.jcore.application.BaseApplication;
-import org.mxchange.jcore.client.Client;
-import org.mxchange.jcore.exceptions.MenuInitializationException;
-import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
-import org.mxchange.jcore.manager.application.ApplicationManager;
-import org.mxchange.jcoreeelogger.beans.local.logger.Log;
-import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
-
-/**
- * Address book application class. Please see ROADMAP.txt for details.
- * <p>
- * @author Roland Haeder
- * @version 0.0
- */
-public class AddressbookApplication extends BaseApplication implements Application {
-
- /**
- * Application title
- */
- public static final String APP_TITLE = "Adressbuch"; //NOI18N
-
- /**
- * Application version
- */
- public static final String APP_VERSION = "0.0"; //NOI18N
-
- /**
- * Console client is enabled by default
- */
- private boolean consoleClient = true;
-
- /**
- * GUI client is disabled by default
- */
- private boolean guiClient = false;
-
- /**
- * Logger instance
- */
- @Log
- private LoggerBeanLocal logger;
-
- /**
- * Protected constructor
- */
- protected AddressbookApplication () {
- // Try this
- try {
- // Get context
- Context context = new InitialContext();
-
- // Get logger
- this.logger = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal");
- } catch (final NamingException ex) {
- // Output it and exit
- System.err.println(MessageFormat.format("Cannot initialize: {0}", ex));
-
- // Abort here
- System.exit(1);
- }
-
- // Call init method
- this.init();
- }
-
- /**
- * Main method (entry point)
- * <p>
- * @param args the command line arguments
- */
- public static void main (String[] args) {
- // Start application
- new AddressbookApplication().start(args);
- }
-
- /**
- * Getter for printable application name
- * <p>
- * @return A printable name
- */
- public static String printableTitle () {
- return MessageFormat.format("{0} v{1}", APP_TITLE, APP_VERSION); //NOI18N
- }
-
- @Override
- public void doBootstrap () {
- this.getLogger().logDebug("Initializing application ..."); //NOI18N
-
- // Init client variable
- Client client = null;
-
- // Is console or Swing choosen?
- if (this.isConsole()) {
- // Debug message
- this.getLogger().logDebug("Initializing console client ..."); //NOI18N
-
- // Init console client instance
- client = new ConsoleClient(this);
- } else if (this.isGui()) {
- // Debug message
- this.getLogger().logDebug("Initializing GUI (Swing) client ..."); //NOI18N
-
- // Init console instance
- client = new SwingClient(this);
- } else {
- // Not client choosen
- this.getLogger().logError("No client choosen. Cannot launch."); //NOI18N
-
- try {
- this.doShutdown();
- } catch (final SQLException | IOException ex) {
- // Abort here
- this.abortProgramWithException(ex);
- }
-
- // Bye ...
- System.exit(1);
- }
-
- // Init client
- client.init();
-
- // Set client instance
- this.setClient(client);
-
- // The application is running at this point
- this.getClient().enableIsRunning();
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public void doMainLoop () throws MenuInitializationException {
- // Get client and cast it
- AddressbookClient client = (AddressbookClient) this.getClient();
-
- // Debug message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // TODO The application should be running now
- // Output introduction
- this.showIntro();
-
- // Set current menu to main
- client.setCurrentMenu("main"); //NOI18N
-
- // --- Main loop starts here ---
- while (this.getClient().isRunning()) {
- // The application is still active, show menu selection
- client.showCurrentMenu();
-
- try {
- // Ask for user input and run proper method
- client.doUserMenuChoice();
- } catch (final UnhandledUserChoiceException ex) {
- // Log exception
- this.getLogger().logException(ex);
- }
-
- try {
- // Sleep a little to reduce system load
- Thread.sleep(100);
- } catch (final InterruptedException ex) {
- // Ignore it
- }
- }
- // --- Main loop ends here ---
-
- // Debug message
- this.getLogger().logDebug("Main loop exit - shutting down ..."); //NOI18N
- }
-
- /**
- * Shuts down the application.
- */
- @Override
- public void doShutdown () throws SQLException, IOException {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Shutdown client
- this.getClient().doShutdown();
-
- // Regular exit reached
- this.getLogger().logInfo("End of program (last line)"); //NOI18N
- System.exit(0);
- }
-
- /**
- * Enables console client by setting propper flag
- */
- private void enableConsoleClient () {
- this.getLogger().logDebug("Enabling console client (may become optional client) ..."); //NOI18N
- this.consoleClient = true;
- this.guiClient = false;
- }
-
- /**
- * Enables GUI client by setting propper flag
- */
- private void enableGuiClient () {
- this.getLogger().logDebug("Enabling GUI client (may become new default client) ..."); //NOI18N
- this.consoleClient = false;
- this.guiClient = true;
- }
-
- /**
- * Initializes this application
- */
- private void init () {
- // Try this
- try {
- // Init properties file
- this.initProperties();
- } catch (final IOException ex) {
- // Abort here
- this.abortProgramWithException(ex);
- }
-
- // Is the bundle initialized?
- if (!isBundledInitialized()) {
- // Temporary initialize default bundle
- // TODO The enum Gender uses this
- this.initBundle();
- }
- }
-
- /**
- * Initializes properties
- */
- private void initProperties () throws IOException {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- /**
- * Checks whether the client shoule be console client should be launched by
- * checking if -console is set.
- * <p>
- * @return Whether console client should be taken
- */
- private boolean isConsole () {
- return this.consoleClient;
- }
-
- /**
- * Checks whether the client shoule be GUI client should be launched by
- * checking if -gui is set.
- * <p>
- * @return Whether GUI client should be taken
- */
- private boolean isGui () {
- return this.guiClient;
- }
-
- /**
- * Parses all given arguments
- * <p>
- * @param args Arguments from program launch
- */
- private void parseArguments (final String[] args) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("args()={0} - CALLED!", args.length)); //NOI18N
-
- // Debug message
- this.getLogger().logDebug(MessageFormat.format("Parsing {0} arguments ...", args.length)); //NOI18N
-
- for (final String arg : args) {
- // Switch on it
- switch (arg) {
- case "-console": //NOI18N
- enableConsoleClient();
- break;
-
- case "-gui": //NOI18N
- enableGuiClient();
- break;
- }
- }
- }
-
- /**
- * Show introduction which depends on client
- */
- private void showIntro () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Let the client show it
- this.getClient().showWelcome();
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Launches the application
- * <p>
- * @param args Arguments handled to program
- */
- private void start (final String args[]) {
- this.getLogger().logInfo("Program is started."); //NOI18N
-
- try {
- // Init properties file
- this.initProperties();
- } catch (final IOException ex) {
- // Something bad happened
- this.abortProgramWithException(ex);
- }
-
- // Parse arguments
- this.parseArguments(args);
-
- try {
- // Launch application
- ApplicationManager.getSingeltonManager(this).start();
- } catch (final MenuInitializationException ex) {
- // Something bad happened
- this.abortProgramWithException(ex);
- }
-
- // Good bye, but this should not be reached ...
- this.getLogger().logWarning("Unusual exit reached."); //NOI18N
-
- try {
- this.doShutdown();
- } catch (final SQLException | IOException ex) {
- // Something bad happened
- this.abortProgramWithException(ex);
- }
- }
-
- /**
- * Log exception and abort program.
- * <p>
- * @param throwable Throwable
- */
- protected void abortProgramWithException (final Throwable throwable) {
- // Log exception
- this.logException(throwable);
-
- // Abort here
- System.exit(1);
- }
-
- /**
- * Getter for logger instance
- * <p>
- * @return Logger instance
- */
- protected LoggerBeanLocal getLogger () {
- return this.logger;
- }
-
- /**
- * Logs given exception
- * <p>
- * @param exception Throwable
- */
- protected void logException (final Throwable exception) {
- this.getLogger().logException(exception);
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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
- * (at your option) 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 org.mxchange.addressbook.client.console;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.SQLException;
-import java.text.MessageFormat;
-import java.util.Arrays;
-import java.util.Scanner;
-import org.mxchange.addressbook.application.AddressbookApplication;
-import org.mxchange.addressbook.client.AddressbookClient;
-import org.mxchange.addressbook.client.BaseAddressbookClient;
-import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
-import org.mxchange.jcore.exceptions.MenuInitializationException;
-import org.mxchange.addressbook.manager.contact.ManageableContactAddressbook;
-import org.mxchange.addressbook.menu.Menu;
-import org.mxchange.addressbook.menu.MenuTools;
-import org.mxchange.addressbook.menu.console.ConsoleMenu;
-import org.mxchange.addressbook.menu.item.SelectableMenuItem;
-import org.mxchange.addressbook.menu.item.console.ConsoleMenuItem;
-import org.mxchange.jcore.application.Application;
-import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
-import org.mxchange.jcore.model.contact.Contact;
-import org.mxchange.jcore.model.contact.UserContact;
-import org.mxchange.jcore.model.contact.gender.Gender;
-import org.mxchange.jcore.model.contact.gender.GenderUtils;
-
-/**
- * A client for the console
- * <p>
- * @author Roland Haeder
- */
-public class ConsoleClient extends BaseAddressbookClient implements AddressbookClient {
-
- /**
- * Scanner instance for reading data from console input
- */
- private final Scanner scanner;
-
- /**
- * Parameterless constructor
- * <p>
- * @param application An instance of an Application class
- */
- public ConsoleClient (final Application application) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("application={0} - CALLED!", application)); //NOI18N
-
- // Set application instance
- this.setApplication(application);
-
- // Init scanner instance
- this.scanner = new Scanner(System.in, "UTF-8"); //NOI18N
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public void displayAddressBox (final Contact contact) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
-
- // Is it null?
- if (null == contact) {
- // Abort here
- throw new NullPointerException("contact is null"); //NOI18N
- }
-
- // Simple display ...
- this.outputMessage(MessageFormat.format("Strasse, PLZ Ort, Land: {0}\n{1} {2}\n{3}", contact.getStreet(), contact.getZipCode(), contact.getCity(), contact.getCountryCode()));
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public void displayNameBox (final Contact contact) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
-
- // Is it null?
- if (null == contact) {
- // Abort here
- throw new NullPointerException("contact is null"); //NOI18N
- }
-
- // Get translated gender as the user may want to see "Mr.", "Mrs."
- String gender = GenderUtils.getTranslatedGender(contact);
-
- // Get company name
- String companyName = contact.getCompanyName();
-
- // If it is empty/null, then assume private contact
- if ((null == companyName) || (companyName.isEmpty())) {
- // Now put all together: gender, surname, family name
- // TODO Use mask
- this.outputMessage(MessageFormat.format("Anrede, Vorname, Name: {0} {1} {2}", gender, contact.getFirstName(), contact.getFamilyName()));
- } else {
- // Company contact
- this.outputMessage(MessageFormat.format("Firma: {0}\nAnsprechpartner: {1} {2} {3}", companyName, gender, contact.getFirstName(), contact.getFamilyName()));
- }
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public void displayOtherDataBox (final Contact contact) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
-
- // Is it null?
- if (null == contact) {
- // Abort here
- throw new NullPointerException("contact is null"); //NOI18N
- }
-
- // Cellphone and such ...
- this.outputMessage(MessageFormat.format("Telefonnumer: {0}\nFaxnummer: {1}\nHandy: {2}\nKommentar:\n{3}", contact.getPhoneNumber(), contact.getFaxNumber(), contact.getCellphoneNumber(), contact.getComment()));
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public void doChangeOwnAddressData (final Contact contact) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
-
- // Is it null?
- if (null == contact) {
- // Abort here
- throw new NullPointerException("contact is null"); //NOI18N
- }
-
- // Make sure it is own contact
- if (!contact.isOwnContact()) {
- // Not own contact
- throw new IllegalArgumentException("Contact is not own data."); //NOI18N
- }
-
- // Get manager and cast it
- ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
-
- // Own street and number
- String streetNumber = manager.enterOwnStreet();
-
- // Get zip code
- Long zipCode = (long) manager.enterOwnZipCode();
-
- // Get city name
- String city = manager.enterOwnCity();
-
- // Get country code
- String countryCode = manager.enterOwnCountryCode();
-
- // Update address data
- contact.setStreet(streetNumber);
- contact.setZipCode(zipCode);
- contact.setCity(city);
- contact.setCountryCode(countryCode);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public void doChangeOwnNameData (final Contact contact) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
-
- // Is it null?
- if (null == contact) {
- // Abort here
- throw new NullPointerException("contact is null"); //NOI18N
- }
-
- // Make sure it is own contact
- if (!contact.isOwnContact()) {
- // Not own contact
- throw new IllegalArgumentException("Contact is not own data."); //NOI18N
- }
-
- // Get manager and cast it
- ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
-
- // Gender:
- Gender gender = manager.enterOwnGender();
-
- // Surname
- String firstName = manager.enterOwnFirstName();
-
- // Family name
- String familyName = manager.enterOwnFamilyName();
-
- // And company
- String companyName = manager.enterOwnCompanyName();
-
- // Update contact instance
- contact.setGender(gender);
- contact.setFirstName(firstName);
- contact.setFamilyName(familyName);
- contact.setCompanyName(companyName);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public void doChangeOwnOtherData (final Contact contact) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
-
- // Is it null?
- if (null == contact) {
- // Abort here
- throw new NullPointerException("contact is null"); //NOI18N
- }
-
- // Make sure it is own contact
- if (!contact.isOwnContact()) {
- // Not own contact
- throw new IllegalArgumentException("Contact is not own data."); //NOI18N
- }
-
- // Get manager and cast it
- ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
-
- // Phone number
- String phoneNumber = manager.enterOwnPhoneNumber();
-
- // Phone number
- String cellphonePhoneNumber = manager.enterOwnCellNumber();
-
- // Fax number
- String faxNumber = manager.enterOwnFaxNumber();
-
- // Email address
- String email = manager.enterOwnEmailAddress();
-
- // Comment
- String comment = manager.enterOwnComment();
-
- // Update contact instance
- contact.setPhoneNumber(phoneNumber);
- contact.setCellphoneNumber(cellphonePhoneNumber);
- contact.setFaxNumber(faxNumber);
- contact.setEmailAddress(email);
- contact.setComment(comment);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public Contact doEnterOwnData () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Get manager and cast it
- ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
-
- // First ask for gender
- Gender gender = manager.enterOwnGender();
-
- // 2nd for first name
- String firstName = manager.enterOwnFirstName();
-
- // And 3rd for family name
- String familyName = manager.enterOwnFamilyName();
-
- // Company name ...
- String companyName = manager.enterOwnCompanyName();
-
- // Construct UserContact instance
- Contact contact = new UserContact(gender, firstName, familyName, companyName);
-
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("contact={0} - EXIT!", contact)); //NOI18N
-
- // And return object
- return contact;
- }
-
- @Override
- public void doShutdown () throws SQLException, IOException {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Parent call
- super.doShutdown();
-
- // TODO Add other shutdown stuff
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public void doUserMenuChoice () throws UnhandledUserChoiceException, MenuInitializationException {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Get all access keys from menu
- char[] accessKeys = MenuTools.getAccessKeysFromMenuMap(this.getMenus(), this.getCurrentMenu());
-
- // Output textural message and ask for a char as input
- char choice = this.enterChar(accessKeys, "Bitte Auswahl eingeben (0=Programm beenden): ");
-
- // Get manager and cast it
- ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
-
- // Try it!
- try {
- // TODO Rewrite this ugly switch() block
- switch (choice) {
- case '1':
- try {
- // Enter/add own data
- manager.doEnterOwnData();
- } catch (final ContactAlreadyAddedException ex) {
- // Already added
- this.outputMessage("Sie haben bereits Ihre eigenen Daten eingegeben.");
- }
- break;
-
- case '2': // Change own data
- manager.doChangeOwnData();
- break;
-
- case '3': // Add new addess
- manager.doAddOtherAddress();
- break;
-
- case '4': // List contacts
- manager.doListContacts();
- break;
-
- case '5': // Search addresses
- manager.doSearchContacts();
- break;
-
- case '6': // Change other addess
- manager.doChangeOtherAddress();
- break;
-
- case '7': // Delete other address
- manager.doDeleteOtherAddress();
- break;
-
- case '0':
- try {
- // Program exit
- this.getApplication().doShutdown();
- } catch (final SQLException | IOException ex) {
- this.abortProgramWithException(ex);
- }
- break;
-
- default:
- // TODO throw own exception
- throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice)); //NOI18N
- }
- } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
- // Something bad happened
- this.abortProgramWithException(ex);
- }
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public char enterChar (final char[] validChars, final String message) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("validChars={0},message={1} - CALLED!", Arrays.toString(validChars), message)); //NOI18N
-
- // The validChars must not null be null and filled with at least one char
- if (null == validChars) {
- // Is null
- throw new NullPointerException("validChars is null"); //NOI18N
- } else if (validChars.length == 0) {
- // Is not filled
- throw new IllegalArgumentException("validChars is not filled."); //NOI18N
- }
-
- char input = 0;
-
- // Sort array, else binarySearch() won't work
- Arrays.sort(validChars);
-
- // Keep asking until valid char has been entered
- while (Arrays.binarySearch(validChars, input) < 0) {
- // Output message
- System.out.print(message);
-
- // Read char
- input = this.readChar();
- }
-
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("input={0} - EXIT!", input)); //NOI18N
-
- // Return read char
- return input;
- }
-
- @Override
- public Gender enterGender (final String message) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("message={0} - CALLED!", message)); //NOI18N
-
- // Get valid chars
- char[] validChars = Gender.validChars();
-
- // Debug message
- //* NOISY-DEBUG: */ System.out.println(validChars);
- // Call inner method
- char gender = this.enterChar(validChars, message);
-
- // Now get a Gender instance back
- Gender g = Gender.fromChar(gender);
-
- // g must not be null
- assert (g instanceof Gender) : "g is not set."; //NOI18N
-
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("g={0} - EXIT!", g)); //NOI18N
-
- // Return it
- return g;
- }
-
- @Override
- public int enterInt (final int minimum, final int maximum, final String message) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("minimum={0},maximum={1},message={2} - CALLED!", minimum, maximum, message)); //NOI18N
-
- // Minimum should not be below zero
- assert (minimum >= 0) : MessageFormat.format("minimum={0} is below zero", minimum); //NOI18N
- assert (maximum > minimum) : MessageFormat.format("maximum {0} is smaller than minimum {1}", maximum, minimum); //NOI18N
-
- // Init input
- int input = -1;
-
- while ((input < minimum) || (input > maximum)) {
- // Output message
- System.out.print(message);
-
- // Read integer from user
- input = this.readInt();
- }
-
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("input={0} - EXIT!", input)); //NOI18N
-
- // Return it
- return input;
- }
-
- @Override
- public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("minLength={0},maxLength={1},message={2}allowEmpty={3} - CALLED!", minLength, maxLength, message, allowEmpty)); //NOI18N
-
- // Check on length, e.g. country codes are excactly 2 chars long
- assert (maxLength >= minLength);
-
- // Init input
- String input = null;
-
- // Check if it is to short or to long
- while (((null == input) || ((input.length() < minLength) && (!allowEmpty))) || ((input.length() > 0) && (input.length() < minLength) && (allowEmpty)) || ((input instanceof String) && (input.length() > maxLength))) {
- // Output message
- System.out.print(message);
-
- // Read line
- input = this.readString();
- }
-
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("input={0} - EXIT!", input)); //NOI18N
-
- // Return it
- return input;
- }
-
- @Override
- public SelectableMenuItem getMenuItem (final char accessKey, final String text) {
- // Return a new console menu item
- return new ConsoleMenuItem(accessKey, text);
- }
-
- @Override
- public void init () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Init contact manager here
- try {
- this.initContactManager();
- } catch (final SQLException ex) {
- // End here
- this.abortProgramWithException(ex);
- }
-
- // Fill menu map
- this.fillMenuMap();
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public void outputMessage (final String message) {
- System.out.println(message);
- }
-
- @Override
- public void show (final Contact contact) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public void showCurrentMenu () {
- this.showMenu(this.getCurrentMenu());
- }
-
- @Override
- public void showEntry (final SelectableMenuItem item) {
- // Access key then text
- this.outputMessage(MessageFormat.format("[{0}] {1}", item.getAccessKey(), item.getText())); //NOI18N
- }
-
- @Override
- public void showWelcome () {
- this.outputMessage(MessageFormat.format("Welcome to {0}", AddressbookApplication.printableTitle())); //NOI18N
- this.outputMessage(""); //NOI18N
- this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software"); //NOI18N
-
- // Debug message
- this.getLogger().logDebug("Intro shown to user"); //NOI18N
- }
-
- @Override
- public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N
-
- // Contact must not be null
- if (null == contact) {
- // Abort here
- throw new NullPointerException("contact is null"); //NOI18N
- }
-
- // Ask the user for editing [name], [a]ddress or [other] data
- char choice = this.enterChar(new char[] {'n', 'a', 'o', 'x'}, "Welchen Daten möchten Sie ändern? (n=Namensdaten, a=Anschriftsdaten, o=Andere, x=Zurück zur Hauptauswahl) ");
-
- // Get manager and cast it
- ManageableContactAddressbook manager = (ManageableContactAddressbook) this.getManager();
-
- // TODO Get rid of this ugly switch block, too
- switch (choice) {
- case 'n': // Name data
- manager.doChangeNameData(contact);
- break;
-
- case 'a': // Address data
- manager.doChangeAddressData(contact);
- break;
-
- case 'o': // Other data
- manager.doChangeOtherData(contact);
- break;
-
- case 'x': // Exit this menu
- // Ignored as it should go back
- break;
-
- default:
- // TODO throw own exception
- throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice)); //NOI18N
- }
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Reads one character
- * <p>
- * @return A single character
- */
- private char readChar () {
- // Read line
- String input = this.readString();
-
- // Debug message
- this.getLogger().logDebug(MessageFormat.format("input={0}", input)); //NOI18N
-
- // This must be only one character
- if (input.length() != 1) {
- // Return zero
- return 0;
- }
-
- // Get char from first (and only) position
- return input.charAt(0);
- }
-
- /**
- * Reads an integer (int) from user
- * <p>
- * @return An integer number
- */
- private int readInt () {
- // First read a string
- String input = this.readString();
-
- // Debug message
- this.getLogger().logDebug(MessageFormat.format("input={0}", input)); //NOI18N
-
- // Init number with invalid value
- int num = -1;
-
- // Parse number, this can be risky
- try {
- num = Integer.parseInt(input);
- } catch (final NumberFormatException e) {
- this.outputMessage("Bitte geben Sie nur Zahlen ein!");
- this.getLogger().logWarning(MessageFormat.format("No numbers-only entered. input={0},message={1}", input, e.getMessage())); //NOI18N
- }
-
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("num={0} - EXIT!", num)); //NOI18N
-
- // Return read number
- return num;
- }
-
- /**
- * Reads a string from a scanner until RETURN is pressed
- * <p>
- * @return Read string from scanner
- */
- private String readString () {
- return this.scanner.nextLine();
- }
-
- @Override
- protected final void fillMenuMap () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Initialize first (main) menu
- Menu menu = new ConsoleMenu("main", this); //NOI18N
-
- // Add it
- this.getMenus().put("main", menu); //NOI18N
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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
- * (at your option) 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 org.mxchange.addressbook.client.gui;
-
-import java.awt.BorderLayout;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.SQLException;
-import java.text.MessageFormat;
-import javax.swing.BorderFactory;
-import javax.swing.BoxLayout;
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JDialog;
-import javax.swing.JFormattedTextField;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.border.TitledBorder;
-import javax.swing.table.TableModel;
-import org.mxchange.addressbook.BaseAddressbookSystem;
-import org.mxchange.addressbook.application.AddressbookApplication;
-import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
-import org.mxchange.addressbook.manager.contact.ManageableContactAddressbook;
-import org.mxchange.jcore.application.Application;
-import org.mxchange.jcore.client.Client;
-import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException;
-import org.mxchange.jcore.manager.Manageable;
-import org.mxchange.jcore.model.contact.Contact;
-import org.mxchange.jcore.model.contact.gender.Gender;
-import org.mxchange.jcoreswing.client.gui.ClientFrame;
-import org.mxchange.jcoreswing.model.swing.contact.ContactTableModel;
-
-/**
- * A Swing frame for addressbook.
- * <p>
- * @author Roland Haeder
- */
-public class AddressbookFrame extends BaseAddressbookSystem implements ClientFrame {
-
- /**
- * Own instance
- */
- private static ClientFrame self;
-
- /**
- * Singelton getter for this frame instance.
- * <p>
- * @param client Client instance
- * @return Returns a singelton instance of this frame
- */
- public static final ClientFrame getSelfInstance (final Client client) {
- // Is it set?
- if (!(self instanceof ClientFrame)) {
- // Create new instance
- self = new AddressbookFrame(client);
- }
-
- // Return instance
- return self;
- }
-
- /**
- * Dialog box "add contact"
- */
- private JDialog addContact;
-
- /**
- * Frame instance for "add own data"
- */
- private JMenuItem addOwnItem;
-
- /**
- * Instance to table model
- */
- private TableModel dataModel;
-
- /**
- * Table instance
- */
- private JTable dataTable;
-
- /**
- * Frame instance for "edit own data"
- */
- private JMenuItem editOwnItem;
-
- /**
- * Frame instance
- */
- private final JFrame frame;
-
- /**
- * Whether this frame has been initialized
- */
- private boolean initialized;
-
- /**
- * Status label needs to be updated
- */
- private JLabel statusLabel;
-
- /**
- * Creates an instance of this frame with a client instance
- * <p>
- * @param client
- */
- private AddressbookFrame (final Client client) {
- // Debug line
- this.getLogger().logTrace(MessageFormat.format("client={0}: CALLED!", client)); //NOI18N
-
- // Set frame instance
- this.frame = new JFrame();
- this.frame.setTitle(this.generateFrameTitle("main")); //NOI18N
-
- // Set client here
- this.setClient(client);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public Contact doEnterOwnData () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Is the "add contact" window visible?
- if (this.addContact.isVisible()) {
- // Something bad happened
- throw new IllegalStateException("Window addContact is already visible."); //NOI18N
- }
-
- // Disable main window
- this.frame.setEnabled(false);
-
- // Make other window visible
- this.addContact.setVisible(true);
-
- // Trace message
- this.getLogger().logTrace("Returning null : EXIT!"); //NOI18N
-
- // Return value is not supported
- return null;
- }
-
- /**
- * Shutdown this frame
- */
- @Override
- public void doShutdown () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // First only show shutdown status
- this.updateStatus("shutdown"); //NOI18N
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Enables main window (frame)
- */
- @Override
- public void enableMainWindow () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Enable it again
- this.frame.setEnabled(true);
-
- // Request focus for this window
- this.frame.requestFocus();
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public Application getApplication () {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public Client getClient () {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public Manageable getManager () {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public String getMessageStringFromKey (String key) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- /**
- * Setups the frame, do not set isInitialized here
- * <p>
- * @param client Client instance
- */
- @Override
- public void setupFrame (final Client client) throws IOException {
- // Debug line
- this.getLogger().logTrace(MessageFormat.format("client={0}: CALLED!", client)); //NOI18N
-
- // Has the user entered own data?
- if (((ManageableContactAddressbook) this.getClient().getManager()).isOwnContactAdded()) {
- // Debug message
- this.getLogger().logDebug("Disabling menus: isOwnContactAdded()=false"); //NOI18N
-
- // Not entered yet, so disable "add" menu
- this.addOwnItem.setEnabled(false);
- } else {
- // Disable "edit"
- this.editOwnItem.setEnabled(false);
- }
-
- // Make the frame visible
- this.frame.setVisible(true);
-
- // All done here
- this.updateStatus("done"); //NOI18N
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Initalizes this frame. Having initComponents() exposed (publicly
- * accessible) means that any other object can initialize components which
- * you may not want.
- * <p>
- * @throws org.mxchange.jcore.exceptions.FrameAlreadyInitializedException If
- * this method has been called twice
- */
- @Override
- public void init () throws FrameAlreadyInitializedException {
- // Debug line
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Has this frame been initialized?
- if (this.isInitialized()) {
- // Throw exception
- throw new FrameAlreadyInitializedException();
- }
-
- // Init components
- this.initComponents();
-
- // Set flag
- this.initialized = true;
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Returns field isInitialized. This flag indicates whether this frame has
- * been initialized or not.
- * <p>
- * @return Field isInitialized
- */
- @Override
- public final boolean isInitialized () {
- return this.initialized;
- }
-
- @Override
- public void logException (Throwable exception) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- /**
- * Shuts down the application.
- */
- @Override
- public void shutdownApplication () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // To do this, the frame must be initialized
- if (!this.isInitialized()) {
- // Not initalized, so bad call
- this.getLogger().logFatal("Bad call of shutdownApplication(). Please report this."); //NOI18N
- return;
- }
-
- // Call shutdown method
- try {
- this.getClient().getApplication().doShutdown();
- } catch (final SQLException | IOException ex) {
- // Abort here
- this.abortProgramWithException(ex);
- }
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Adds a new menu item with given key to menu instance
- * <p>
- * @param menu Menu instance to add item to
- * @param key Message key part
- * @param listener Listener instance
- */
- private void addMenuItem (final JMenu menu, final String key, final ActionListener listener) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("menu={0},key={1},listener={2} - CALLED!", menu, key, listener)); //NOI18N
-
- // New instance
- JMenuItem item = this.initMenuItemWithTooltip(key);
-
- // Add listener
- item.addActionListener(listener);
-
- // Add item -> menu
- menu.add(item);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Adds a JTextField with label and tool tip to given panel
- * <p>
- * @param panel Panel instance to add text field
- * @param key Part of message key from resource bundle
- * @param fieldLength Length of text field
- */
- private void addTextFieldWithLabelToPanel (final JPanel panel, final String key, final int fieldLength) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("panel={0},key={1},fieldLength={2} - CALLED!", panel, key, fieldLength)); //NOI18N
-
- // Init label for given key
- JLabel label = new JLabel(this.getBundle().getString(String.format("AddressbookFrame.%s.text", key))); //NOI18N
-
- // And input box wih tool tip
- JTextField field = new JTextField(fieldLength);
- field.setToolTipText(this.getBundle().getString(String.format("AddressbookFrame.%s.toolTipText", key))); //NOI18N
-
- // Add both to panel
- panel.add(label);
- panel.add(field);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Generates a title for borders
- * <p>
- * @param key Key part to look for
- * @return Human-readable title
- */
- private String generateBorderTitle (final String key) {
- // Call bundle instance
- return this.getBundle().getString(String.format("AddressbookFrame.border.%s.title.text", key)); //NOI18N
- }
-
- /**
- * Generates a title for all frames based on given sub title key. If null is
- * given, the sub title is not generated.
- * <p>
- * @param subKey Key for sub title resource
- * @return A full application title
- */
- private String generateFrameTitle (final String subKey) {
- // Base title
- String title = AddressbookApplication.printableTitle();
-
- // Is key given?
- if (subKey != null) {
- // Add sub title
- title = String.format("%s - %s", title, this.getBundle().getString(String.format("AddressbookFrame.%s.title.text", subKey))); //NOI18N
- }
-
- // Return it
- return title;
- }
-
- /**
- * Initializes "add" and "cancel" buttons
- */
- private void initAddCancelButtons () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Init panel
- JPanel panel = new JPanel();
- panel.setLayout(new GridLayout(1, 2, 10, 10));
-
- // Generate "add" button
- JButton addButton = new JButton(this.getBundle().getString("AddressbookFrame.button.addAddress.text"));
-
- // Add listener
- addButton.addActionListener(new AddActionListener(this.addContact, this));
-
- // Add button to panel
- panel.add(addButton);
-
- // Generate "cancel" button
- JButton cancelButton = new JButton(this.getBundle().getString("AddressbookFrame.button.cancel.text"));
-
- // Add listener
- cancelButton.addActionListener(new CancelActionListener(this.addContact, this));
-
- // Add button to panel
- panel.add(cancelButton);
-
- // Add panel to main panel
- this.addContact.add(panel);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Initializes "add contact" dialog
- */
- private void initAddContactDialog () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Instance dialog and set title
- this.addContact = new JDialog();
- this.addContact.setTitle(this.generateFrameTitle("dialog.addContact")); //NOI18N
-
- // Set layout
- this.addContact.setLayout(new GridLayout(0, 1, 2, 2));
-
- // Only hide it on close and make it appear in middle of screen
- this.addContact.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
- this.addContact.setLocationRelativeTo(this.frame);
-
- // Set always on top and auto-focus
- this.addContact.setAlwaysOnTop(true);
- this.addContact.setAutoRequestFocus(true);
-
- // Initial dimension
- this.addContact.setSize(500, 500);
-
- // And it is not resizeable
- this.addContact.setResizable(false);
-
- /*
- * Add listener which asks for confirmation, if data has been entered
- * but not saved yet. The user may appriciate this ... ;-)
- *
- * TODO Unfinished
- */
- this.addContact.addWindowListener(new WindowAdapter() {
- /**
- * Invoked when a window has been closed.
- */
- @Override
- public void windowClosed (final WindowEvent e) {
- // Enable main window again
- AddressbookFrame.getSelfInstance(null).enableMainWindow();
- }
-
- /**
- * Invoked when a window is in the process of being closed. The
- * close operation can be overridden at this point.
- */
- @Override
- public void windowClosing (final WindowEvent e) {
- e.getWindow().dispose();
- }
- });
-
- // Init 3 panels:
- // 1) "name" panel
- initNameDataPanel(this.addContact);
-
- // 2) "address" panel
- initAddressDataPanel(this.addContact);
-
- // 3) "other" panel
- initOtherDataPanel(this.addContact);
-
- // 4) "Add" and "Cancel" buttons, combined they are unique for this dialog
- initAddCancelButtons();
-
- // x)Only for developing:
- /*
- * DEBUG:
- */ this.addContact.setVisible(true);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Initializes address panel
- * <p>
- * @param dialog A JDialog instance to this components to
- */
- private void initAddressDataPanel (final JDialog dialog) {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Panel "address" input boxes
- JPanel addressPanel = new JPanel();
- addressPanel.setLayout(new GridLayout(0, 4, 3, 3));
-
- // Set border to titled version
- addressPanel.setBorder(new TitledBorder(this.generateBorderTitle("address"))); //NOI18N
-
- // Add text field for street
- this.addTextFieldWithLabelToPanel(addressPanel, "street", 20); //NOI18N
-
- // Number label
- JLabel numberLabel = new JLabel(this.getBundle().getString("AddressbookFrame.number.text"));
-
- // And text field, but only accept numbers
- JFormattedTextField number = new JFormattedTextField();
- number.setToolTipText(this.getBundle().getString("AddressbookFrame.number.toolTipText"));
-
- // Add both to street panel
- addressPanel.add(numberLabel);
- addressPanel.add(number);
-
- // Label for ZIP code, again numbers only
- JLabel zipLabel = new JLabel(this.getBundle().getString("AddressbookFrame.zip.text"));
-
- // Init text field with label
- JFormattedTextField zip = new JFormattedTextField();
- zip.setToolTipText(this.getBundle().getString("AddressbookFrame.zip.toolTipText"));
-
- // Add both to street panel
- addressPanel.add(zipLabel);
- addressPanel.add(zip);
-
- // Add text field for city name
- this.addTextFieldWithLabelToPanel(addressPanel, "city", 20); //NOI18N
-
- // Add panel to dialog
- dialog.add(addressPanel);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Initialize components
- */
- private void initComponents () {
- // Debug line
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Set default close operation
- this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
- // Register shutdown listener
- this.frame.addWindowListener(new WindowAdapter() {
- /**
- * Invoked when a window has been closed.
- */
- @Override
- public void windowClosed (final WindowEvent e) {
- // Shutdown application cleanly
- self.shutdownApplication();
- }
-
- /**
- * Invoked when a window is in the process of being closed. The
- * close operation can be overridden at this point.
- */
- @Override
- public void windowClosing (final WindowEvent e) {
- // Also shutdown cleanly here
- self.shutdownApplication();
- }
- });
-
- // Setup layout manager
- this.frame.setLayout(new BorderLayout(2, 2));
-
- // Set window size
- this.frame.setSize(700, 400);
-
- // Center window in middle of screen, instead of top-left corner
- this.frame.setLocationRelativeTo(null);
-
- // Init menu system
- this.initMenuSystem();
-
- // Init table
- this.initTable();
-
- // Init status panel
- this.initStatusPanel();
-
- // Init other windows
- this.initOtherDialogs();
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Initializes a menu item instance with tool tip
- * <p>
- * @param key Message key part
- * @return A finished JMenuItem instance
- */
- private JMenuItem initMenuItemWithTooltip (final String key) {
- // Debug line
- this.getLogger().logTrace(MessageFormat.format("key={0} - CALLED!", key)); //NOI18N
-
- JMenuItem item = new JMenuItem(this.getBundle().getString(String.format("AddressbookFrame.menuItem.%s.text", key))); //NOI18N
- item.setToolTipText(this.getBundle().getString(String.format("AddressbookFrame.menuItem.%s.toolTipText", key))); //NOI18N
-
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("item={0} - EXIT!", item)); //NOI18N
-
- // Return it
- return item;
- }
-
- /**
- * Initializes the menu system
- */
- private void initMenuSystem () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Init menu bar, menu and item instances
- JMenuBar menuBar = new JMenuBar();
- JMenu menu;
- JMenuItem item;
-
- // Init some menus:
- // 1) File menu
- menu = new JMenu(this.getBundle().getString("AddressbookFrame.menu.file.text"));
-
- // Add menu items:
- // 1.x) Exit program (should be last)
- this.addMenuItem(menu, "exitProgram", new ActionListener() { //NOI18N
- /**
- * If the user has performed this action
- * <p>
- * @param e An instance of an ActionEvent class
- */
- @Override
- public void actionPerformed (final ActionEvent e) {
- self.shutdownApplication();
- }
- });
-
- // Add menu -> menu bar
- menuBar.add(menu);
-
- // Init some menus:
- // 2) Addressbook menu
- menu = new JMenu(this.getBundle().getString("AddressbookFrame.menu.addressbook.text"));
-
- // 2.1) Add own data
- this.addOwnItem = this.initMenuItemWithTooltip("addOwnData"); //NOI18N
-
- // Add listener to exit menu
- this.addOwnItem.addActionListener(new ActionListener() {
- /**
- * If the user has performed this action
- * <p>
- * @param e An instance of an ActionEvent class
- */
- @Override
- public void actionPerformed (final ActionEvent e) {
- try {
- ((ManageableContactAddressbook) self.getClient().getManager()).doEnterOwnData();
- } catch (final ContactAlreadyAddedException ex) {
- // Already added, log away
- // TODO maybe output message here?
- self.logException(ex);
- } catch (final IOException ex) {
- // Somethind bad happened here
- // TODO Output error message here?
- }
- }
- });
-
- // Add item -> menu
- menu.add(this.addOwnItem);
-
- // 2.2) Edit own data
- this.editOwnItem = this.initMenuItemWithTooltip("editOwnData"); //NOI18N
-
- // Add listener to exit menu
- this.editOwnItem.addActionListener(new ActionListener() {
- /**
- * If the user has performed this action
- * <p>
- * @param e An instance of an ActionEvent class
- */
- @Override
- public void actionPerformed (final ActionEvent e) {
- try {
- ((ManageableContactAddressbook) self.getClient().getManager()).doChangeOwnData();
- } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
- self.logException(ex);
- }
- }
- });
-
- // Add item -> menu
- menu.add(this.editOwnItem);
-
- // Init more menus:
- // 1) Add new contact
- this.addMenuItem(menu, "addNewContact", new ActionListener() { //NOI18N
- /**
- * If the user has performed this action
- * <p>
- * @param e An instance of an ActionEvent class
- */
- @Override
- public void actionPerformed (final ActionEvent e) {
- ((ManageableContactAddressbook) self.getClient().getManager()).doAddOtherAddress();
- }
- });
-
- // Add menu -> menu bar
- menuBar.add(menu);
-
- // Add menu bar -> frame
- this.frame.add(menuBar, BorderLayout.NORTH);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Initializes name panel
- * <p>
- * @param dialog A JDialog instance to this components to
- */
- private void initNameDataPanel (final JDialog dialog) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("dialog={0} - CALLED!", dialog)); //NOI18N
-
- // Panel "name" input boxes
- JPanel namePanel = new JPanel();
- namePanel.setLayout(new GridLayout(0, 2, 3, 3));
-
- // Set border to titled version
- namePanel.setBorder(new TitledBorder(this.generateBorderTitle("name"))); //NOI18N
-
- // Gender text field
- JLabel gLabel = new JLabel(this.getBundle().getString("AddressbookFrame.gender.text"));
-
- // Get all genders
- Gender[] genders = Gender.values();
-
- // Init gender combo box with tool tip
- JComboBox<Gender> gender = new JComboBox<>(new DefaultComboBoxModel<>(genders));
- gender.setToolTipText(this.getBundle().getString("AddressbookFrame.gender.toolTipText"));
-
- // Add both to gender panel
- namePanel.add(gLabel);
- namePanel.add(gender);
-
- // Add text field for surname
- this.addTextFieldWithLabelToPanel(namePanel, "surname", 20); //NOI18N
-
- // Add text field for family name
- this.addTextFieldWithLabelToPanel(namePanel, "familyName", 20); //NOI18N
-
- // Finally add panel to dialog
- dialog.add(namePanel);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Initializes "other" data panel
- * <p>
- * @param dialog A JDialog instance to this components to TODO Fill this
- * with life
- */
- private void initOtherDataPanel (final JDialog dialog) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("dialog={0} - CALLED!", dialog)); //NOI18N
-
- // Panel "other" input boxes
- JPanel otherPanel = new JPanel();
- otherPanel.setLayout(new GridLayout(0, 2, 3, 3));
- otherPanel.setBorder(new TitledBorder(this.generateBorderTitle("other"))); //NOI18N
-
- // Add text field for email address
- this.addTextFieldWithLabelToPanel(otherPanel, "emailAddress", 20); //NOI18N
-
- // Add text field for phone number
- this.addTextFieldWithLabelToPanel(otherPanel, "phoneNumber", 20); //NOI18N
-
- // Add text field for cellphone number
- this.addTextFieldWithLabelToPanel(otherPanel, "cellphoneNumber", 20); //NOI18N
-
- // Add text field for fax number
- this.addTextFieldWithLabelToPanel(otherPanel, "faxNumber", 20); //NOI18N
-
- // Init label
- JLabel commentLabel = new JLabel(this.getBundle().getString("AddressbookFrame.comment.text"));
-
- // Init text area with tool tip
- JTextArea comment = new JTextArea(5, 20);
- comment.setToolTipText(this.getBundle().getString("AddressbookFrame.comment.toolTipText"));
-
- // Add both to panel
- otherPanel.add(commentLabel);
- otherPanel.add(comment);
-
- // Finally add panel to dialog
- dialog.add(otherPanel);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Initialize other dialogs (e.g. "Add contact")
- */
- private void initOtherDialogs () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Init other windows:
- // 1) Add contact
- initAddContactDialog();
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Initializes status panel
- */
- private void initStatusPanel () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Init status label (which needs to be updated
- this.statusLabel = new JLabel();
- this.updateStatus("initializing"); //NOI18N
-
- // Init status bar in south
- JPanel panel = new JPanel();
- panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
- panel.add(this.statusLabel);
- panel.setBorder(BorderFactory.createEtchedBorder());
-
- // Add panel to frame
- this.frame.add(panel, BorderLayout.SOUTH);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Initializes the table which will show all contacts
- */
- private void initTable () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Instance table model
- this.dataModel = new ContactTableModel(this.getClient().getManager());
-
- // Instance table
- this.dataTable = new JTable(this.dataModel);
-
- // Add mouse listener
- this.dataTable.addMouseListener(new MouseAdapter() {
- /**
- * If the user peformed a click on a cell
- * <p>
- * @param e Mouse event instance
- */
- @Override
- public void mouseClicked (final MouseEvent e) {
- throw new UnsupportedOperationException("Unfinished."); //NOI18N
- }
- });
-
- // Instance scroll pane
- JScrollPane scroller = new JScrollPane();
-
- // Add table to scroll pane
- scroller.setViewportView(this.dataTable);
- scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
- scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-
- // Add pane to frame
- this.frame.add(scroller, BorderLayout.CENTER);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Updates status to given type
- * <p>
- * @param type Status type
- */
- private void updateStatus (final String type) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("type={0} - CALLED!", type)); //NOI18N
-
- // Set status message
- this.statusLabel.setText(this.getBundle().getString(String.format("AddressbookFrame.statusLabel.%s.text", type))); //NOI18N
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Class for "add address" button
- */
- private static class AddActionListener extends BaseAddressbookSystem implements ActionListener {
-
- /**
- * Dialog instance
- */
- private final JDialog dialog;
-
- /**
- * Frame (not JFrame) instance
- */
- private final ClientFrame frame;
-
- /**
- * Constructor for action listener
- * <p>
- * @param dialog Dialog instance to call back
- * @param frame Frame instance (not JFrame)
- */
- protected AddActionListener (final JDialog dialog, final ClientFrame frame) {
- // Set dialog and frame here
- this.dialog = dialog;
- this.frame = frame;
- }
-
- /**
- * If the action has been performed
- * <p>
- * @param e The performed action event
- */
- @Override
- public void actionPerformed (final ActionEvent e) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
- }
-
- /**
- * Class for "cancel address" button
- */
- private static class CancelActionListener extends BaseAddressbookSystem implements ActionListener {
-
- /**
- * Dialog instance
- */
- private final JDialog dialog;
-
- /**
- * Frame (not JFrame) instance
- */
- private final ClientFrame frame;
-
- /**
- * Constructor for action listener
- * <p>
- * @param dialog Dialog instance to call back
- * @param frame Frame instance (not JFrame)
- */
- protected CancelActionListener (final JDialog dialog, final ClientFrame frame) {
- // Set dialog and frame here
- this.dialog = dialog;
- this.frame = frame;
- }
-
- /**
- * If the action has been performed
- * <p>
- * @param e The performed action event
- */
- @Override
- public void actionPerformed (final ActionEvent e) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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
- * (at your option) 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 org.mxchange.addressbook.client.gui;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import org.mxchange.addressbook.client.AddressbookClient;
-import org.mxchange.addressbook.client.BaseAddressbookClient;
-import org.mxchange.addressbook.menu.item.SelectableMenuItem;
-import org.mxchange.jcore.application.Application;
-import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException;
-import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
-import org.mxchange.jcore.model.contact.Contact;
-import org.mxchange.jcore.model.contact.gender.Gender;
-import org.mxchange.jcoreswing.client.gui.ClientFrame;
-
-/**
- * A swing client
- * <p>
- * @author Roland Haeder
- */
-public class SwingClient extends BaseAddressbookClient implements AddressbookClient {
-
- /**
- * Swing frame instance
- */
- private final ClientFrame frame;
-
- /**
- * Constructor with an Application instance.
- * <p>
- * @param application Application instance
- */
- public SwingClient (final Application application) {
- // Debug message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Set application instance
- this.setApplication(application);
-
- // Init frame instance
- this.frame = AddressbookFrame.getSelfInstance(this);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public void displayAddressBox (final Contact contact) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
- }
-
- @Override
- public void displayNameBox (final Contact contact) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
- }
-
- @Override
- public void displayOtherDataBox (final Contact contact) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
- }
-
- @Override
- public void doChangeOwnAddressData (final Contact contact) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
- }
-
- @Override
- public void doChangeOwnNameData (final Contact contact) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
- }
-
- @Override
- public void doChangeOwnOtherData (final Contact contact) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
- }
-
- /**
- * Shows dialog to enter new contact
- * <p>
- * @return Returns finished Contact instance
- */
- @Override
- public Contact doEnterOwnData () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Deligate this call to the frame
- return this.frame.doEnterOwnData();
- }
-
- /**
- * Shuts down this client
- */
- @Override
- public void doShutdown () throws SQLException, IOException {
- // Debug message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Parent call
- super.doShutdown();
-
- // Shutdown frame
- this.frame.doShutdown();
-
- // TODO Add other shutdown stuff
- // Debug message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public void doUserMenuChoice () throws UnhandledUserChoiceException {
- // Debug message
- //* NOISY-DEBUG: */ this.getLogger().logTrace("CALLED!");
-
- // Not implemented here
- }
-
- @Override
- public char enterChar (final char[] validChars, String message) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
- }
-
- @Override
- public Gender enterGender (final String message) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
- }
-
- @Override
- public int enterInt (final int minimum, final int maximum, final String message) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
- }
-
- @Override
- public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
- }
-
- /**
- * Returns a Swing menu item
- * <p>
- * @param accessKey Key to access the menu
- * @param text Text to show to user
- * @return A SelectableMenuItem
- */
- @Override
- public SelectableMenuItem getMenuItem (final char accessKey, final String text) {
- // Debug message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Returns null as the menu is now no longer controlled here.
- return null;
- }
-
- /**
- * Inizializes this client
- */
- @Override
- public void init () {
- // Debug message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- try {
- // Init contact manager here
- this.initContactManager();
-
- // Init frame
- this.frame.init();
-
- // Now start the frame
- this.frame.setupFrame(this);
- } catch (final FrameAlreadyInitializedException | IOException | SQLException ex) {
- // Abort program
- this.abortProgramWithException(ex);
- }
-
- // Debug message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- @Override
- public void outputMessage (final String message) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
- }
-
- @Override
- public void show (final Contact contact) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public void showCurrentMenu () {
- // Debug message
- //* NOISY-DEBUG: */ this.getLogger().logTrace("CALLED!");
-
- // Not implemented here
- }
-
- @Override
- public void showEntry (final SelectableMenuItem item) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
- }
-
- @Override
- public void showWelcome () {
- // Debug message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
- // Not implemented here
- }
-
- @Override
- public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N
- }
-
- /**
- * Fills menu map with swing menus
- */
- @Override
- protected final void fillMenuMap () {
- // Nothing to fill here as the Swing frame is handling this all
- throw new UnsupportedOperationException("Not implemented."); //NOI18N
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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
- * (at your option) 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 org.mxchange.addressbook.menu.console;
-
-import java.text.MessageFormat;
-import org.mxchange.addressbook.menu.AddressbookMenu;
-import org.mxchange.addressbook.menu.BaseMenu;
-import org.mxchange.addressbook.menu.Menu;
-import org.mxchange.jcore.client.Client;
-
-/**
- * A menu system for the console
- * <p>
- * @author Roland Haeder
- */
-public class ConsoleMenu extends BaseMenu implements Menu {
-
- /**
- * Constructor for this menu
- * <p>
- * @param menuType Menu type to initialize
- * @param client CLient to call back
- */
- public ConsoleMenu (final String menuType, final Client client) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("menuType={0},client={1} - CALLED!", menuType, client)); //NOI18N
-
- // Client must not be null
- if (null == client) {
- // Abort here
- throw new NullPointerException("client is null");
- }
-
- // Init menu
- this.initMenu(menuType, client);
-
- // Add all items
- AddressbookMenu.addItemsToList(this.getMenuList(), menuType, client);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * 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
- * (at your option) 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 org.mxchange.addressbook.menu.item.console;
-
-import java.text.MessageFormat;
-import org.mxchange.addressbook.client.AddressbookClient;
-import org.mxchange.addressbook.menu.item.BaseMenuItem;
-import org.mxchange.addressbook.menu.item.SelectableMenuItem;
-import org.mxchange.jcore.client.Client;
-
-/**
- * A menu item class for the console
- * <p>
- * @author Roland Haeder
- */
-public class ConsoleMenuItem extends BaseMenuItem implements SelectableMenuItem {
-
- /**
- * Access key
- */
- private char accessKey;
-
- /**
- * Text to user
- */
- private String text;
-
- /**
- * Constructor for building a console menu with access key and text
- * <p>
- * @param accessKey Access key for this menu entry
- * @param text Text to show to user
- */
- public ConsoleMenuItem (final char accessKey, final String text) {
- this.setAccessKey(accessKey);
- this.setText(text);
- }
-
- @Override
- public final char getAccessKey () {
- return this.accessKey;
- }
-
- @Override
- public String getText () {
- return this.text;
- }
-
- @Override
- public void show (final Client client) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("client={0} - CALLED!", client)); //NOI18N
-
- // Client must not be null
- if (null == client) {
- // Abort here
- throw new NullPointerException("client is null");
- } else if (!(client instanceof AddressbookClient)) {
- // Wrong interface
- throw new IllegalArgumentException("client " + client + " must implement AddressbookClient");
- }
-
- // Cast it
- AddressbookClient c = (AddressbookClient) client;
-
- // Call-back client over menu
- c.showEntry(this);
-
- // Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
- }
-
- /**
- * Text to user
- * <p>
- * @param text the text to set
- */
- private void setText (final String text) {
- this.text = text;
- }
-
- /**
- * Access key
- * <p>
- * @param accessKey the accessKey to set
- */
- private void setAccessKey (final char accessKey) {
- this.accessKey = accessKey;
- }
-
-}
+++ /dev/null
-# Copyright (C) 2015 Roland Haeder
-#
-# 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
-# (at your option) 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/>.
-AddressbookFrame.border.name.title.text=Anrede, Vorname, Nachname:
-AddressbookFrame.border.address.title.text=Anschrift:
-AddressbookFrame.border.other.title.text=Andere Angaben:
-AddressbookFrame.button.addAddress.text=Adresse hinzuf\u00fcgen
-AddressbookFrame.button.cancel.text=Abbrechen
-AddressbookFrame.menu.file.text=Datei
-AddressbookFrame.menu.addressbook.text=Adressbuch
-AddressbookFrame.statusLabel.initializing.text=Initialisiere ...
-AddressbookFrame.statusLabel.done.text=Fertig.
-AddressbookFrame.statusLabel.shutdown.text=Shuttting down ...
-AddressbookFrame.menuItem.exitProgram.text=Programm beenden
-AddressbookFrame.menuItem.exitProgram.toolTipText=Beendet das Programm und speichert alle Einstellungen ab.
-AddressbookFrame.menuItem.addOwnData.text=Eigene Adresse hinzuf\u00fcgen
-AddressbookFrame.menuItem.addOwnData.toolTipText=Erlaubt das Hinzuf\u00fcgen eigener Daten.
-AddressbookFrame.menuItem.editOwnData.text=Eigene Adresse \u00e4ndern
-AddressbookFrame.menuItem.editOwnData.toolTipText=Erlaubt das \u00c4ndern eigener Daten.
-AddressbookFrame.menuItem.addNewContact.text=Neue Adresse hinzuf\u00fcgen
-AddressbookFrame.menuItem.addNewContact.toolTipText=Eine neue Adresse hinzuf\u00fcgen.
-AddressbookFrame.dialog.addContact.title.text=Neue Adresse hinzuf\u00fcgen
-AddressbookFrame.main.title.text=Adressen auflisten
-AddressbookFrame.gender.text=Anrede:
-AddressbookFrame.gender.toolTipText=W\u00e4hlen Sie die Anrede aus.
-AddressbookFrame.surname.text=Vorname:
-AddressbookFrame.surname.toolTipText=Geben Sie den Vornamen ein.
-AddressbookFrame.familyName.text=Nachname:
-AddressbookFrame.familyName.toolTipText=Geben Sie den Nachnamen ein.
-AddressbookFrame.street.text=Stra\u00dfe:
-AddressbookFrame.street.toolTipText=Geben Sie die Stra\u00dfe ein.
-AddressbookFrame.number.text=Hausnummer:
-AddressbookFrame.number.toolTipText=Geben Sie die Hausnummer ein.
-AddressbookFrame.zip.text=PLZ:
-AddressbookFrame.zip.toolTipText=Geben Sie die Postleitzahl ein.
-AddressbookFrame.city.text=Stadt:
-AddressbookFrame.city.toolTipText=Geben Sie die Stadt ein.
-AddressbookFrame.emailAddress.text=Email-Adresse:
-AddressbookFrame.emailAddress.toolTipText=Geben Sie die Email-Adresse ein.
-AddressbookFrame.phoneNumber.text=Telefon:
-AddressbookFrame.phoneNumber.toolTipText=Geben Sie die Telefonnummer ein.
-AddressbookFrame.cellphoneNumber.text=Mobil:
-AddressbookFrame.cellphoneNumber.toolTipText=Geben Sie die Handynummer ein.
-AddressbookFrame.faxNumber.text=Fax:
-AddressbookFrame.faxNumber.toolTipText=Geben Sie die Faxnummer ein.
-AddressbookFrame.comment.text=Anmerkungen:
-AddressbookFrame.comment.toolTipText=Geben Sie eine Anmerkung (Freifeld) ein.
-GENDER_UNKNOWN=Unbekannt
-GENDER_MALE=Herr
-GENDER_FEMALE=Frau
-GENDER_COMPANY=Firma
-ContactManager.columnName.gender.text=Anrede
-ContactManager.columnName.surname.text=Vorname
-ContactManager.columnName.familyName.text=Nachname
-ContactManager.columnName.street.text=Strasse
-ContactManager.columnName.houseNumber.text=Hausnummer
-ContactManager.columnName.zipCode.text=Postleitzahl
-ContactManager.columnName.city.text=Stadt
+++ /dev/null
-# Copyright (C) 2015 Roland Haeder
-#
-# 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
-# (at your option) 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/>.
-AddressbookFrame.border.name.title.text=Gender, surname, family name:
-AddressbookFrame.border.address.title.text=Address:
-AddressbookFrame.border.other.title.text=Other data:
-AddressbookFrame.button.addAddress.text=Add address
-AddressbookFrame.button.cancel.text=Cancel
-AddressbookFrame.menu.file.text=File
-AddressbookFrame.menu.addressbook.text=Addressbook
-AddressbookFrame.statusLabel.initializing.text=Initializing ...
-AddressbookFrame.statusLabel.done.text=Done.
-AddressbookFrame.statusLabel.shutdown.text=Shuttting down ...
-AddressbookFrame.menuItem.exitProgram.toolTipText=Exits the program and saves all data.
-AddressbookFrame.menuItem.exitProgram.text=Exit program
-AddressbookFrame.menuItem.addOwnData.text=Add own address
-AddressbookFrame.menuItem.addOwnData.toolTipText=Allows the user to add own address data
-AddressbookFrame.menuItem.editOwnData.text=Edit own data
-AddressbookFrame.menuItem.editOwnData.toolTipText=Allows the user to edit own address data
-AddressbookFrame.menuItem.addNewContact.text=Add new address
-AddressbookFrame.menuItem.addNewContact.toolTipText=Add a new address.
-AddressbookFrame.dialog.addContact.title.text=Add new address
-AddressbookFrame.main.title.text=List addresses
-AddressbookFrame.gender.text=Gender:
-AddressbookFrame.gender.toolTipText=Choose gender.
-AddressbookFrame.surname.text=Surname:
-AddressbookFrame.surname.toolTipText=Enter surname.
-AddressbookFrame.familyName.text=Family name:
-AddressbookFrame.familyName.toolTipText=Enter family name.
-AddressbookFrame.street.text=Street:
-AddressbookFrame.street.toolTipText=Enter street.
-AddressbookFrame.number.text=Number:
-AddressbookFrame.number.toolTipText=Enter number.
-AddressbookFrame.zip.text=ZIP:
-AddressbookFrame.zip.toolTipText=Enter zip code.
-AddressbookFrame.city.text=City:
-AddressbookFrame.city.toolTipText=Enter city.
-AddressbookFrame.emailAddress.text=Email address:
-AddressbookFrame.emailAddress.toolTipText=Enter email address.
-AddressbookFrame.phoneNumber.text=Phone:
-AddressbookFrame.phoneNumber.toolTipText=Enter phone number.
-AddressbookFrame.cellphoneNumber.text=Mobile:
-AddressbookFrame.cellphoneNumber.toolTipText=Enter mobile number.
-AddressbookFrame.faxNumber.text=Fax:
-AddressbookFrame.faxNumber.toolTipText=Enter fax number.
-AddressbookFrame.comment.text=Note:
-AddressbookFrame.comment.toolTipText=Enter a note (free field).
-GENDER_UNKNOWN=Unknown
-GENDER_MALE=Mr.
-GENDER_FEMALE=Mrs.
-GENDER_COMPANY=Company
-ContactManager.columnName.gender.text=Gender
-ContactManager.columnName.surname.text=Surname
-ContactManager.columnName.familyName.text=Family name
-ContactManager.columnName.street.text=Street
-ContactManager.columnName.houseNumber.text=House number
-ContactManager.columnName.zipCode.text=ZIP code
-ContactManager.columnName.city.text=City