From 236c7c955aa1c7dee89da1e324cce33bf72a4d49 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 29 Jul 2015 14:05:37 +0200 Subject: [PATCH] =?utf8?q?A=20lot=20more=20improvements:=20=20-=20Added=20?= =?utf8?q?new=20MySQL=20backend=20class=20which=20is=20unfinished=20for=20?= =?utf8?q?now=20-=20Added=20missing=20@Override=20-=20Introduced=20abortPr?= =?utf8?q?ogramWithException()=20-=20Expanded=20menu=20with=20new=20entry?= =?utf8?q?=20-=20Introduced=20new=20methods=20for=20adding=20menu=20items?= =?utf8?q?=20and=20text=20fields=20with=20label=20and=20tool=20tip=20text?= =?utf8?q?=20-=20A=20lot=20more=20improvements=20Signed-off-by:Roland=20H?= =?utf8?q?=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../addressbook/BaseFrameworkSystem.java | 15 + .../application/AddressbookApplication.java | 2 +- .../client/gui/AddressbookFrame.java | 426 ++++++++++-------- .../addressbook/client/gui/ClientFrame.java | 3 + .../addressbook/client/gui/SwingClient.java | 4 +- .../database/backend/BaseDatabaseBackend.java | 53 +++ .../database/backend/DatabaseBackend.java | 17 + .../backend/csv/Base64CsvDatabaseBackend.java | 25 +- .../backend/mysql/MySqlDatabaseBackend.java | 76 ++++ .../frontend/BaseDatabaseFrontend.java | 35 +- .../contact/ContactDatabaseFrontend.java | 23 +- .../exceptions/BadTokenException.java | 11 +- .../UnhandledUserChoiceException.java | 4 + .../UnsupportedDatabaseBackendException.java | 48 ++ .../UnsupportedDatabaseDriverException.java} | 23 +- .../localization/bundle_de_DE.properties | 30 +- .../localization/bundle_en_US.properties | 28 +- 17 files changed, 590 insertions(+), 233 deletions(-) create mode 100644 Addressbook/src/org/mxchange/addressbook/database/backend/mysql/MySqlDatabaseBackend.java create mode 100644 Addressbook/src/org/mxchange/addressbook/exceptions/UnsupportedDatabaseBackendException.java rename Addressbook/src/org/mxchange/addressbook/{database/backend/csv/CsvBackend.java => exceptions/UnsupportedDatabaseDriverException.java} (56%) diff --git a/Addressbook/src/org/mxchange/addressbook/BaseFrameworkSystem.java b/Addressbook/src/org/mxchange/addressbook/BaseFrameworkSystem.java index 555d9ed7..b43b42b5 100644 --- a/Addressbook/src/org/mxchange/addressbook/BaseFrameworkSystem.java +++ b/Addressbook/src/org/mxchange/addressbook/BaseFrameworkSystem.java @@ -173,8 +173,23 @@ public class BaseFrameworkSystem implements FrameworkInterface { * @param key Key to return * @return Human-readable message */ + @Override public final String getMessageStringFromKey (final String key) { // Return message return this.getBundle().getString(key); } + + /** + * Aborts program with given exception + * + * @param throwable Any type of Throwable + */ + protected final void abortProgramWithException (final Throwable throwable) { + // Log exception ... + this.getLogger().catching(throwable); + + // .. and exit + System.exit(1); + + } } diff --git a/Addressbook/src/org/mxchange/addressbook/application/AddressbookApplication.java b/Addressbook/src/org/mxchange/addressbook/application/AddressbookApplication.java index 74715126..0898abe6 100644 --- a/Addressbook/src/org/mxchange/addressbook/application/AddressbookApplication.java +++ b/Addressbook/src/org/mxchange/addressbook/application/AddressbookApplication.java @@ -192,7 +192,7 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli // Ignore it } } - // --- Main loop ends here --- + // --- Main loop ends here --- // Debug message this.getLogger().debug("Main loop exit - shutting down ..."); //NOI18N diff --git a/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java b/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java index 4a7a9c8a..06d8d029 100644 --- a/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java +++ b/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java @@ -28,10 +28,10 @@ import java.text.MessageFormat; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.DefaultComboBoxModel; -import javax.swing.InputVerifier; +import javax.swing.JButton; import javax.swing.JComboBox; -import javax.swing.JComponent; import javax.swing.JDialog; +import javax.swing.JFormattedTextField; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; @@ -40,6 +40,7 @@ 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; @@ -112,12 +113,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame /** * Whether this frame has been initialized */ - private boolean isInitialized; - - /** - * Layout instance - */ - private GridLayout layout; + private boolean initialized; /** * Status label needs to be updated @@ -152,7 +148,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame // Is the "add contact" window visible? if (this.addContact.isVisible()) { // Something bad happened - throw new IllegalStateException("Window addContact is already visible."); + throw new IllegalStateException("Window addContact is already visible."); //NOI18N } // Disable main window @@ -258,7 +254,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame this.initComponents(); // Set flag - this.isInitialized = true; + this.initialized = true; // Trace message this.getLogger().trace("EXIT!"); //NOI18N @@ -272,7 +268,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame */ @Override public final boolean isInitialized () { - return this.isInitialized; + return this.initialized; } /** @@ -297,6 +293,32 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame this.getLogger().trace("EXIT!"); //NOI18N } + /** + * Adds a JTextField with label and tool tip to given panel + * + * @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().trace(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().trace("EXIT!"); //NOI18N + } + /** * Generates a title for borders * @@ -333,6 +355,36 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame * Initializes "add" and "cancel" buttons */ private void initAddCancelButtons () { + // Trace message + this.getLogger().trace("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().trace("EXIT!"); //NOI18N } /** @@ -340,7 +392,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame */ private void initAddContactDialog () { // Trace message - this.getLogger().trace("EXIT!"); //NOI18N + this.getLogger().trace("CALLED!"); //NOI18N // Instance dialog and set title this.addContact = new JDialog(); @@ -399,7 +451,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame // 3) "other" panel initOtherDataPanel(this.addContact); - // 4) "Add" and "Cancel" buttons + // 4) "Add" and "Cancel" buttons, combined they are unique for this dialog initAddCancelButtons(); // x)Only for developing: @@ -420,129 +472,38 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame // Panel "address" input boxes JPanel addressPanel = new JPanel(); - addressPanel.setLayout(new BoxLayout(addressPanel, BoxLayout.Y_AXIS)); + addressPanel.setLayout(new GridLayout(0, 4, 3, 3)); // Set border to titled version addressPanel.setBorder(new TitledBorder(this.generateBorderTitle("address"))); //NOI18N - // Init all elements: - // 1) Street and number together - JPanel streetNumberPanel = new JPanel(); - streetNumberPanel.setLayout(new GridLayout(1, 4, 5, 5)); - - // Label for street - JLabel streetLabel = new JLabel(this.getBundle().getString("AddressbookFrame.street.text")); - - // Init text field with label - JTextField street = new JTextField(20); - street.setToolTipText(this.getBundle().getString("AddressbookFrame.street.tooltipText")); - - // Add both to street panel - streetNumberPanel.add(streetLabel); - streetNumberPanel.add(street); + // 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 - JTextField number = new JTextField(4); - number.setToolTipText(this.getBundle().getString("AddressbookFrame.number.tooltipText")); - - // Add number verifier - number.setInputVerifier(new InputVerifier() { - - /** - * Method to verify that the entered data is a number. - * - * @param input Input to verify - * @return Whether the data is a number - */ - @Override - public boolean verify (final JComponent input) { - // Cast on text field - JTextField text = (JTextField) input; - - // Default is passed - boolean isValid = true; - - // Try to convert input text to a number - try { - int num = Integer.valueOf(text.getText()); - } catch (final NumberFormatException ex) { - // Didn't work - isValid = false; - } - - // Return status - return isValid; - } - }); + JFormattedTextField number = new JFormattedTextField(); + number.setToolTipText(this.getBundle().getString("AddressbookFrame.number.toolTipText")); // Add both to street panel - streetNumberPanel.add(numberLabel); - streetNumberPanel.add(number); - - // Add panel to address panel - addressPanel.add(streetNumberPanel); - - // 2) ZIP code and ccity name - JPanel zipCityPanel = new JPanel(); - zipCityPanel.setLayout(new GridLayout(1, 4, 5, 5)); + 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 - JTextField zip = new JTextField(20); - zip.setToolTipText(this.getBundle().getString("AddressbookFrame.zip.tooltipText")); - - // Add number verifier - zip.setInputVerifier(new InputVerifier() { - - /** - * Method to verify that the entered data is a number. - * - * @param input Input to verify - * @return Whether the data is a number - */ - @Override - public boolean verify (final JComponent input) { - // Cast on text field - JTextField text = (JTextField) input; - - // Default is passed - boolean isValid = true; - - // Try to convert input text to a number - try { - int num = Integer.valueOf(text.getText()); - } catch (final NumberFormatException ex) { - // Didn't work - isValid = false; - } - - // Return status - return isValid; - } - }); - - // Add both to street panel - zipCityPanel.add(zipLabel); - zipCityPanel.add(zip); - - // Label for street - JLabel cityLabel = new JLabel(this.getBundle().getString("AddressbookFrame.city.text")); - - // Init text field with label - JTextField city = new JTextField(20); - city.setToolTipText(this.getBundle().getString("AddressbookFrame.city.tooltipText")); + JFormattedTextField zip = new JFormattedTextField(); + zip.setToolTipText(this.getBundle().getString("AddressbookFrame.zip.toolTipText")); // Add both to street panel - zipCityPanel.add(cityLabel); - zipCityPanel.add(city); + addressPanel.add(zipLabel); + addressPanel.add(zip); - // Add panel to address panel - addressPanel.add(zipCityPanel); + // Add text field for city name + this.addTextFieldWithLabelToPanel(addressPanel, "city", 20); //NOI18N // Add panel to dialog dialog.add(addressPanel); @@ -608,6 +569,26 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame this.getLogger().trace("EXIT!"); //NOI18N } + /** + * Initializes a menu item instance with tool tip + * + * @param key Message key part + * @return A finished JMenuItem instance + */ + private JMenuItem initMenuItemWithTooltip (final String key) { + // Debug line + this.getLogger().trace(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().trace(MessageFormat.format("item={0} - EXIT!", item)); //NOI18N + + // Return it + return item; + } + /** * Initializes the menu system */ @@ -626,11 +607,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame // Add menu items: // 1.x) Exit program (should be last) - item = new JMenuItem(this.getBundle().getString("AddressbookFrame.menuItem.exitProgram.text")); - item.setToolTipText(this.getBundle().getString("AddressbookFrame.menuItem.exitProgram.toolTipText")); - - // Add listener to exit menu - item.addActionListener(new ActionListener() { + this.addMenuItem(menu, "exitProgram", new ActionListener() { //NOI18N /** * If the user has performed this action * @@ -642,9 +619,6 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame } }); - // Add item -> menu - menu.add(item); - // Add menu -> menu bar menuBar.add(menu); @@ -653,8 +627,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame menu = new JMenu(this.getBundle().getString("AddressbookFrame.menu.addressbook.text")); // 2.1) Add own data - this.addOwnItem = new JMenuItem(this.getBundle().getString("AddressbookFrame.menuItem.addOwnData.text")); - this.addOwnItem.setToolTipText(this.getBundle().getString("AddressbookFrame.menuItem.addOwnData.toolTipText")); + this.addOwnItem = this.initMenuItemWithTooltip("addOwnData"); //NOI18N // Add listener to exit menu this.addOwnItem.addActionListener(new ActionListener() { @@ -673,8 +646,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame menu.add(this.addOwnItem); // 2.2) Edit own data - this.editOwnItem = new JMenuItem(this.getBundle().getString("AddressbookFrame.menuItem.editOwnData.text")); - this.editOwnItem.setToolTipText(this.getBundle().getString("AddressbookFrame.menuItem.editOwnData.toolTipText")); + this.editOwnItem = this.initMenuItemWithTooltip("editOwnData"); //NOI18N // Add listener to exit menu this.editOwnItem.addActionListener(new ActionListener() { @@ -692,6 +664,20 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame // 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 + * + * @param e An instance of an ActionEvent class + */ + @Override + public void actionPerformed (final ActionEvent e) { + self.getClient().getContactManager().doAddOtherAddress(); + } + }); + // Add menu -> menu bar menuBar.add(menu); @@ -702,6 +688,30 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame this.getLogger().trace("EXIT!"); //NOI18N } + /** + * Adds a new menu item with given key to menu instance + * + * @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().trace(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().trace("EXIT!"); //NOI18N + } + /** * Initializes name panel * @@ -709,19 +719,15 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame */ private void initNameDataPanel (final JDialog dialog) { // Trace message - this.getLogger().trace("CALLED!"); //NOI18N + this.getLogger().trace(MessageFormat.format("dialog={0} - CALLED!", dialog)); //NOI18N // Panel "name" input boxes JPanel namePanel = new JPanel(); - namePanel.setLayout(new BoxLayout(namePanel, BoxLayout.Y_AXIS)); + namePanel.setLayout(new GridLayout(0, 2, 3, 3)); // Set border to titled version namePanel.setBorder(new TitledBorder(this.generateBorderTitle("name"))); //NOI18N - // Panel for gender - JPanel gPanel = new JPanel(); - gPanel.setLayout(new GridLayout(1, 2, 5, 5)); - // Gender text field JLabel gLabel = new JLabel(this.getBundle().getString("AddressbookFrame.gender.text")); @@ -730,50 +736,17 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame // Init gender combo box with tool tip JComboBox gender = new JComboBox<>(new DefaultComboBoxModel<>(genders)); - gender.setToolTipText(this.getBundle().getString("AddressbookFrame.gender.tooltipText")); + gender.setToolTipText(this.getBundle().getString("AddressbookFrame.gender.toolTipText")); // Add both to gender panel - gPanel.add(gLabel); - gPanel.add(gender); - - // Add gender panel to "name" panel - namePanel.add(gPanel); - - // Panel for surname - JPanel sPanel = new JPanel(); - sPanel.setLayout(new GridLayout(1, 2, 5, 5)); - - // New label for surname is not needed - JLabel sLabel = new JLabel(this.getBundle().getString("AddressbookFrame.surname.text")); - - // And input box wih tool tip - JTextField surname = new JTextField(20); - surname.setToolTipText(this.getBundle().getString("AddressbookFrame.surname.tooltipText")); - - // Add both to surname panel - sPanel.add(sLabel); - sPanel.add(surname); - - // Add surname panel to "name" panel - namePanel.add(sPanel); + namePanel.add(gLabel); + namePanel.add(gender); - // Panel for surname - JPanel fPanel = new JPanel(); - fPanel.setLayout(new GridLayout(1, 2)); + // Add text field for surname + this.addTextFieldWithLabelToPanel(namePanel, "surname", 20); //NOI18N - // New label for surname is not needed - JLabel fLabel = new JLabel(this.getBundle().getString("AddressbookFrame.familyName.text")); - - // And input box wih tool tip - JTextField familyName = new JTextField(20); - familyName.setToolTipText(this.getBundle().getString("AddressbookFrame.familyName.tooltipText")); - - // Add both to surname panel - fPanel.add(fLabel); - fPanel.add(familyName); - - // Add family namepanel to "name" panel - namePanel.add(fPanel); + // Add text field for family name + this.addTextFieldWithLabelToPanel(namePanel, "familyName", 20); //NOI18N // Finally add panel to dialog dialog.add(namePanel); @@ -790,15 +763,36 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame */ private void initOtherDataPanel (final JDialog dialog) { // Trace message - this.getLogger().trace("CALLED!"); //NOI18N + this.getLogger().trace(MessageFormat.format("dialog={0} - CALLED!", dialog)); //NOI18N // Panel "other" input boxes JPanel otherPanel = new JPanel(); - otherPanel.setLayout(new BoxLayout(otherPanel, BoxLayout.Y_AXIS)); - - // Set border to titled version + 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); @@ -901,4 +895,78 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame // Trace message this.getLogger().trace("EXIT!"); //NOI18N } + + /** + * Class for "add address" button + */ + private static class AddActionListener extends BaseFrameworkSystem implements ActionListener { + /** + * Dialog instance + */ + private final JDialog dialog; + + /** + * Frame (not JFrame) instance + */ + private final ClientFrame frame; + + /** + * Constructor for action listener + * + * @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 + * + * @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 BaseFrameworkSystem implements ActionListener { + /** + * Dialog instance + */ + private final JDialog dialog; + + /** + * Frame (not JFrame) instance + */ + private final ClientFrame frame; + + /** + * Constructor for action listener + * + * @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 + * + * @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. + } + } } diff --git a/Addressbook/src/org/mxchange/addressbook/client/gui/ClientFrame.java b/Addressbook/src/org/mxchange/addressbook/client/gui/ClientFrame.java index ce9b49f9..b68a3b72 100644 --- a/Addressbook/src/org/mxchange/addressbook/client/gui/ClientFrame.java +++ b/Addressbook/src/org/mxchange/addressbook/client/gui/ClientFrame.java @@ -70,5 +70,8 @@ public interface ClientFrame extends FrameworkInterface { */ public boolean isInitialized (); + /** + * Shuts down application + */ public void shutdownApplication (); } diff --git a/Addressbook/src/org/mxchange/addressbook/client/gui/SwingClient.java b/Addressbook/src/org/mxchange/addressbook/client/gui/SwingClient.java index 8bad87a7..2829d058 100644 --- a/Addressbook/src/org/mxchange/addressbook/client/gui/SwingClient.java +++ b/Addressbook/src/org/mxchange/addressbook/client/gui/SwingClient.java @@ -183,8 +183,8 @@ public class SwingClient extends BaseClient implements Client { // Init frame this.frame.init(); } catch (final FrameAlreadyInitializedException ex) { - this.getLogger().catching(ex); - System.exit(1); + // Abort program + this.abortProgramWithException(ex); } // Now start the frame diff --git a/Addressbook/src/org/mxchange/addressbook/database/backend/BaseDatabaseBackend.java b/Addressbook/src/org/mxchange/addressbook/database/backend/BaseDatabaseBackend.java index b992e613..5a666916 100644 --- a/Addressbook/src/org/mxchange/addressbook/database/backend/BaseDatabaseBackend.java +++ b/Addressbook/src/org/mxchange/addressbook/database/backend/BaseDatabaseBackend.java @@ -16,7 +16,12 @@ */ package org.mxchange.addressbook.database.backend; +import java.sql.Driver; +import java.sql.DriverManager; +import java.text.MessageFormat; +import java.util.Enumeration; import org.mxchange.addressbook.BaseFrameworkSystem; +import org.mxchange.addressbook.exceptions.UnsupportedDatabaseDriverException; /** * Generall database backend @@ -30,4 +35,52 @@ public class BaseDatabaseBackend extends BaseFrameworkSystem { */ protected BaseDatabaseBackend () { } + + /** + * Validates driver name and throws an exception if the driver is not valid + * + * @param driverName Driver name (e.g. "mysql") + * @throws org.mxchange.addressbook.exceptions.UnsupportedDatabaseDriverException If the given driver name cannot be solved into a driver instance + */ + protected void validateDriver (final String driverName) throws UnsupportedDatabaseDriverException { + // Trace message + this.getLogger().trace(MessageFormat.format("driverName={0} - CALLED!", driverName)); //NOI18N + + // Try to find the driver in driver list + Enumeration drivers = DriverManager.getDrivers(); + + // Default is not found + boolean isFound = false; + + // Search for it + while (drivers.hasMoreElements()) { + // Get element + Driver driver = drivers.nextElement(); + + // Debug message + this.getLogger().debug(MessageFormat.format("Driver {0} is installed.", driver)); //NOI18N + + // Get class name + String className = driver.getClass().getName(); + + // Is this wanted? + if (className.contains(driverName)) { + // Debug message + this.getLogger().debug("Found driver!"); //NOI18N + + // Found it + isFound = true; + break; + } + } + + // Is it found? + if (!isFound) { + // Throw exception + throw new UnsupportedDatabaseDriverException(driverName); + } + + // Trace message + this.getLogger().trace("EXIT!"); //NOI18N + } } diff --git a/Addressbook/src/org/mxchange/addressbook/database/backend/DatabaseBackend.java b/Addressbook/src/org/mxchange/addressbook/database/backend/DatabaseBackend.java index 1298c76c..405c53aa 100644 --- a/Addressbook/src/org/mxchange/addressbook/database/backend/DatabaseBackend.java +++ b/Addressbook/src/org/mxchange/addressbook/database/backend/DatabaseBackend.java @@ -17,8 +17,11 @@ package org.mxchange.addressbook.database.backend; import java.io.IOException; +import java.util.Iterator; import org.mxchange.addressbook.FrameworkInterface; +import org.mxchange.addressbook.contact.Contact; import org.mxchange.addressbook.database.storage.Storeable; +import org.mxchange.addressbook.exceptions.BadTokenException; /** * A generic interface for database frontends @@ -27,6 +30,11 @@ import org.mxchange.addressbook.database.storage.Storeable; */ public interface DatabaseBackend extends FrameworkInterface { + /** + * Tries a connection to the database + */ + public void connectToDatabase (); + /** * Shuts down this backend */ @@ -51,4 +59,13 @@ public interface DatabaseBackend extends FrameworkInterface { * @throws java.io.IOException From inner class */ public void store (final Storeable object) throws IOException; + + /** + * Gets an iterator for contacts + * + * @return Iterator for contacts + * @throws org.mxchange.addressbook.exceptions.BadTokenException If the CSV + * token is badly formulated + */ + public Iterator contactIterator () throws BadTokenException; } diff --git a/Addressbook/src/org/mxchange/addressbook/database/backend/csv/Base64CsvDatabaseBackend.java b/Addressbook/src/org/mxchange/addressbook/database/backend/csv/Base64CsvDatabaseBackend.java index 8f2bb199..20f8d1aa 100644 --- a/Addressbook/src/org/mxchange/addressbook/database/backend/csv/Base64CsvDatabaseBackend.java +++ b/Addressbook/src/org/mxchange/addressbook/database/backend/csv/Base64CsvDatabaseBackend.java @@ -31,6 +31,7 @@ import org.mxchange.addressbook.contact.Gender; import org.mxchange.addressbook.contact.book.BookContact; import org.mxchange.addressbook.contact.user.UserContact; import org.mxchange.addressbook.database.backend.BaseDatabaseBackend; +import org.mxchange.addressbook.database.backend.DatabaseBackend; import org.mxchange.addressbook.database.storage.Storeable; import org.mxchange.addressbook.database.storage.csv.StoreableCsv; import org.mxchange.addressbook.exceptions.BadTokenException; @@ -40,7 +41,7 @@ import org.mxchange.addressbook.exceptions.BadTokenException; * * @author Roland Haeder */ -public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements CsvBackend { +public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements DatabaseBackend { /** * Output stream for this storage engine @@ -78,6 +79,14 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv this.getLogger().debug(MessageFormat.format("Database for {0} has been initialized.", tableName)); //NOI18N } + /** + * This database backend does not need to connect + */ + @Override + public void connectToDatabase () { + // Empty body + } + /** * Gets an iterator for contacts * @@ -118,8 +127,8 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv // Close file this.getStorageFile().close(); } catch (final IOException ex) { - this.getLogger().catching(ex); - System.exit(1); + // Abort program + this.abortProgramWithException(ex); } // Trace message @@ -140,8 +149,8 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv this.getLogger().debug(MessageFormat.format("length={0}", length)); //NOI18N } catch (final IOException ex) { // Length cannot be determined - this.getLogger().catching(ex); - System.exit(1); + // Abort program + this.abortProgramWithException(ex); } // Return result @@ -161,8 +170,8 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv // Rewind underlaying database file this.getStorageFile().seek(0); } catch (final IOException ex) { - this.getLogger().catching(ex); - System.exit(1); + // Abort program + this.abortProgramWithException(ex); } // Trace message @@ -349,7 +358,7 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv // Verify token, it must have double-quotes on each side if ((!token.startsWith("\"")) || (!token.endsWith("\""))) { //NOI18N // Something bad was read - throw new BadTokenException(MessageFormat.format("Token {0} at position {1} has not double-quotes on both ends.", token, count)); //NOI18N + throw new BadTokenException(token, count); //NOI18N } // All fine, so remove it diff --git a/Addressbook/src/org/mxchange/addressbook/database/backend/mysql/MySqlDatabaseBackend.java b/Addressbook/src/org/mxchange/addressbook/database/backend/mysql/MySqlDatabaseBackend.java new file mode 100644 index 00000000..495c74bf --- /dev/null +++ b/Addressbook/src/org/mxchange/addressbook/database/backend/mysql/MySqlDatabaseBackend.java @@ -0,0 +1,76 @@ +/* + * 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 . + */ +package org.mxchange.addressbook.database.backend.mysql; + +import java.io.IOException; +import java.util.Iterator; +import org.mxchange.addressbook.contact.Contact; +import org.mxchange.addressbook.database.backend.BaseDatabaseBackend; +import org.mxchange.addressbook.database.backend.DatabaseBackend; +import org.mxchange.addressbook.database.storage.Storeable; +import org.mxchange.addressbook.exceptions.BadTokenException; +import org.mxchange.addressbook.exceptions.UnsupportedDatabaseDriverException; + +/** + * A backend class for MySQL connections + * + * @author Roland Haeder + */ +public class MySqlDatabaseBackend extends BaseDatabaseBackend implements DatabaseBackend { + /** + * Constructor with table name + * + * @param tableName Table to access + * @throws org.mxchange.addressbook.exceptions.UnsupportedDatabaseDriverException + */ + public MySqlDatabaseBackend (final String tableName) throws UnsupportedDatabaseDriverException { + // Validate driver + this.validateDriver("mysql"); //NOI18N + + // Now that the driver is there ... + } + + @Override + public void connectToDatabase () { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public Iterator contactIterator () throws BadTokenException { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public void doShutdown () { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public long length () { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public void rewind () { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public void store (final Storeable object) throws IOException { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } +} diff --git a/Addressbook/src/org/mxchange/addressbook/database/frontend/BaseDatabaseFrontend.java b/Addressbook/src/org/mxchange/addressbook/database/frontend/BaseDatabaseFrontend.java index 5b628470..56b9d707 100644 --- a/Addressbook/src/org/mxchange/addressbook/database/frontend/BaseDatabaseFrontend.java +++ b/Addressbook/src/org/mxchange/addressbook/database/frontend/BaseDatabaseFrontend.java @@ -19,6 +19,9 @@ package org.mxchange.addressbook.database.frontend; import org.mxchange.addressbook.BaseFrameworkSystem; import org.mxchange.addressbook.database.backend.DatabaseBackend; import org.mxchange.addressbook.database.backend.csv.Base64CsvDatabaseBackend; +import org.mxchange.addressbook.database.backend.mysql.MySqlDatabaseBackend; +import org.mxchange.addressbook.exceptions.UnsupportedDatabaseBackendException; +import org.mxchange.addressbook.exceptions.UnsupportedDatabaseDriverException; /** * General database frontend class @@ -58,13 +61,39 @@ public class BaseDatabaseFrontend extends BaseFrameworkSystem { /** * Initialize backend + * + * @throws org.mxchange.addressbook.exceptions.UnsupportedDatabaseBackendException If the backend is not supported */ - protected void initBackend () { + protected void initBackend () throws UnsupportedDatabaseBackendException { // Trace message this.getLogger().trace("CALLED!"); //NOI18N - // Instance backend - this.backend = new Base64CsvDatabaseBackend(this.getTableName()); + // Read property + // @TODO rewrite this to own properties file + String backendType = System.getProperty("org.mxchange.addressbook.database.backendType", "base64csv"); //NOI18N + + // Try it + try { + // Switch on backend type + switch (backendType) { + case "mysql": // MySQL backend, this requires more information //NOI18N + this.backend = new MySqlDatabaseBackend(this.getTableName()); + break; + + case "base64csv": // BASE64-encoded CSV rows //NOI18N + this.backend = new Base64CsvDatabaseBackend(this.getTableName()); + break; + + default: // Unsupported + throw new UnsupportedDatabaseBackendException(backendType); + } + + // Try to run a connect on it + this.backend.connectToDatabase(); + } catch (final UnsupportedDatabaseDriverException ex) { + // Continue to throw + throw new UnsupportedDatabaseBackendException(backendType, ex); + } // Trace message this.getLogger().trace("EXIT!"); //NOI18N diff --git a/Addressbook/src/org/mxchange/addressbook/database/frontend/contact/ContactDatabaseFrontend.java b/Addressbook/src/org/mxchange/addressbook/database/frontend/contact/ContactDatabaseFrontend.java index 30535fd2..85dcf153 100644 --- a/Addressbook/src/org/mxchange/addressbook/database/frontend/contact/ContactDatabaseFrontend.java +++ b/Addressbook/src/org/mxchange/addressbook/database/frontend/contact/ContactDatabaseFrontend.java @@ -21,10 +21,10 @@ import java.text.MessageFormat; import java.util.Iterator; import java.util.List; import org.mxchange.addressbook.contact.Contact; -import org.mxchange.addressbook.database.backend.csv.CsvBackend; import org.mxchange.addressbook.database.frontend.BaseDatabaseFrontend; import org.mxchange.addressbook.database.storage.Storeable; import org.mxchange.addressbook.exceptions.BadTokenException; +import org.mxchange.addressbook.exceptions.UnsupportedDatabaseBackendException; import org.mxchange.addressbook.manager.contact.ContactManager; /** @@ -68,8 +68,13 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con // Set "table" name this.setTableName("contacts"); //NOI18N - // Initalize backend - this.initBackend(); + try { + // Initalize backend + this.initBackend(); + } catch (final UnsupportedDatabaseBackendException ex) { + // Abort program + this.abortProgramWithException(ex); + } } /** @@ -114,8 +119,7 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con this.getBackend().store((Storeable) contact); } catch (final IOException ex) { // Should not happen? - this.getLogger().catching(ex); - System.exit(1); + this.abortProgramWithException(ex); } } @@ -132,19 +136,16 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con // Trace message this.getLogger().trace("CALLED!"); //NOI18N - // Get iterator and case it - CsvBackend backend = (CsvBackend) this.getBackend(); - // First rewind to beginning this.getBackend().rewind(); // Get backend iterator Iterator iterator = null; try { - iterator = backend.contactIterator(); + iterator = this.getBackend().contactIterator(); } catch (final BadTokenException ex) { - this.getLogger().catching(ex); - System.exit(1); + // Abort program + this.abortProgramWithException(ex); } // Read all entries diff --git a/Addressbook/src/org/mxchange/addressbook/exceptions/BadTokenException.java b/Addressbook/src/org/mxchange/addressbook/exceptions/BadTokenException.java index 0c3bcb81..c875171b 100644 --- a/Addressbook/src/org/mxchange/addressbook/exceptions/BadTokenException.java +++ b/Addressbook/src/org/mxchange/addressbook/exceptions/BadTokenException.java @@ -16,6 +16,8 @@ */ package org.mxchange.addressbook.exceptions; +import java.text.MessageFormat; + /** * This exception is thrown when a token has been badly formated. This may * happen when a CSV file is broken. @@ -24,8 +26,13 @@ package org.mxchange.addressbook.exceptions; */ public class BadTokenException extends Exception { - public BadTokenException (final String str) { - super(str); + /** + * Constructor with token and count + * @param token Token that is not valid + * @param count Count + */ + public BadTokenException (final String token, final int count) { + super(MessageFormat.format("Token {0} at position {1} has not double-quotes on both ends.", token, count)); } } diff --git a/Addressbook/src/org/mxchange/addressbook/exceptions/UnhandledUserChoiceException.java b/Addressbook/src/org/mxchange/addressbook/exceptions/UnhandledUserChoiceException.java index c14b9c49..24af4b25 100644 --- a/Addressbook/src/org/mxchange/addressbook/exceptions/UnhandledUserChoiceException.java +++ b/Addressbook/src/org/mxchange/addressbook/exceptions/UnhandledUserChoiceException.java @@ -24,6 +24,10 @@ package org.mxchange.addressbook.exceptions; */ public class UnhandledUserChoiceException extends Exception { + /** + * + * @param message + */ public UnhandledUserChoiceException (final String message) { super(message); } diff --git a/Addressbook/src/org/mxchange/addressbook/exceptions/UnsupportedDatabaseBackendException.java b/Addressbook/src/org/mxchange/addressbook/exceptions/UnsupportedDatabaseBackendException.java new file mode 100644 index 00000000..c7ac7c46 --- /dev/null +++ b/Addressbook/src/org/mxchange/addressbook/exceptions/UnsupportedDatabaseBackendException.java @@ -0,0 +1,48 @@ +/* + * 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 . + */ +package org.mxchange.addressbook.exceptions; + +import java.text.MessageFormat; + +/** + * An exception thrown when the given backend type is not valid + * + * @author Roland Haeder + */ +public class UnsupportedDatabaseBackendException extends Exception { + + /** + * + * @param backendType + */ + public UnsupportedDatabaseBackendException (final String backendType) { + // Call super constructor + super(MessageFormat.format("Backend {0} is not supported.", backendType)); //NOI18N + } + + /** + * Constructor with backend type and cause + * + * @param backendType Backend type + * @param cause + */ + public UnsupportedDatabaseBackendException (final String backendType, final Throwable cause) { + // Call super constructor + super(MessageFormat.format("Backend {0} is not supported.", backendType), cause); //NOI18N + } + +} diff --git a/Addressbook/src/org/mxchange/addressbook/database/backend/csv/CsvBackend.java b/Addressbook/src/org/mxchange/addressbook/exceptions/UnsupportedDatabaseDriverException.java similarity index 56% rename from Addressbook/src/org/mxchange/addressbook/database/backend/csv/CsvBackend.java rename to Addressbook/src/org/mxchange/addressbook/exceptions/UnsupportedDatabaseDriverException.java index ada432ea..2fa59210 100644 --- a/Addressbook/src/org/mxchange/addressbook/database/backend/csv/CsvBackend.java +++ b/Addressbook/src/org/mxchange/addressbook/exceptions/UnsupportedDatabaseDriverException.java @@ -14,25 +14,24 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.addressbook.database.backend.csv; +package org.mxchange.addressbook.exceptions; -import java.util.Iterator; -import org.mxchange.addressbook.contact.Contact; -import org.mxchange.addressbook.database.backend.DatabaseBackend; -import org.mxchange.addressbook.exceptions.BadTokenException; +import java.text.MessageFormat; /** + * Thrown when the given driver is not found * * @author Roland Haeder */ -public interface CsvBackend extends DatabaseBackend { +public class UnsupportedDatabaseDriverException extends Exception { /** - * Gets an iterator for contacts - * - * @return Iterator for contacts - * @throws org.mxchange.addressbook.exceptions.BadTokenException If the CSV - * token is badly formulated + * Default constructor with driver name + * @param driverName */ - public Iterator contactIterator () throws BadTokenException; + public UnsupportedDatabaseDriverException (final String driverName) { + // Call super method + super(MessageFormat.format("Database driver {0} is not found.", driverName)); + } + } diff --git a/Addressbook/src/org/mxchange/addressbook/localization/bundle_de_DE.properties b/Addressbook/src/org/mxchange/addressbook/localization/bundle_de_DE.properties index 4cf55790..dfd32fc2 100644 --- a/Addressbook/src/org/mxchange/addressbook/localization/bundle_de_DE.properties +++ b/Addressbook/src/org/mxchange/addressbook/localization/bundle_de_DE.properties @@ -16,33 +16,47 @@ 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.toolTipText=Beendet das Programm und speichert alle Einstellungen ab. 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.gender.toolTipText=W\u00e4hlen Sie die Anrede aus. AddressbookFrame.surname.text=Vorname: -AddressbookFrame.surname.tooltipText=Geben Sie den Vornamen ein. +AddressbookFrame.surname.toolTipText=Geben Sie den Vornamen ein. AddressbookFrame.familyName.text=Nachname: -AddressbookFrame.familyName.tooltipText=Geben Sie den Nachnamen ein. +AddressbookFrame.familyName.toolTipText=Geben Sie den Nachnamen ein. AddressbookFrame.street.text=Stra\u00dfe: -AddressbookFrame.street.tooltipText=Geben Sie die Stra\u00dfe ein. +AddressbookFrame.street.toolTipText=Geben Sie die Stra\u00dfe ein. AddressbookFrame.number.text=Hausnummer: -AddressbookFrame.number.tooltipText=Geben Sie die Hausnummer ein. +AddressbookFrame.number.toolTipText=Geben Sie die Hausnummer ein. AddressbookFrame.zip.text=PLZ: -AddressbookFrame.zip.tooltipText=Geben Sie die Postleitzahl ein. +AddressbookFrame.zip.toolTipText=Geben Sie die Postleitzahl ein. AddressbookFrame.city.text=Stadt: -AddressbookFrame.city.tooltipText=Geben Sie die Stadt ein. +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. BaseContact.gender.unknown.text=Unbekannt BaseContact.gender.male.text=Herr BaseContact.gender.female.text=Frau diff --git a/Addressbook/src/org/mxchange/addressbook/localization/bundle_en_US.properties b/Addressbook/src/org/mxchange/addressbook/localization/bundle_en_US.properties index 41261737..7e36fb57 100644 --- a/Addressbook/src/org/mxchange/addressbook/localization/bundle_en_US.properties +++ b/Addressbook/src/org/mxchange/addressbook/localization/bundle_en_US.properties @@ -16,6 +16,8 @@ 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 ... @@ -27,22 +29,34 @@ 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.gender.toolTipText=Choose gender. AddressbookFrame.surname.text=Surname: -AddressbookFrame.surname.tooltipText=Enter surname. +AddressbookFrame.surname.toolTipText=Enter surname. AddressbookFrame.familyName.text=Family name: -AddressbookFrame.familyName.tooltipText=Enter family name. +AddressbookFrame.familyName.toolTipText=Enter family name. AddressbookFrame.street.text=Street: -AddressbookFrame.street.tooltipText=Enter street. +AddressbookFrame.street.toolTipText=Enter street. AddressbookFrame.number.text=Number: -AddressbookFrame.number.tooltipText=Enter number. +AddressbookFrame.number.toolTipText=Enter number. AddressbookFrame.zip.text=ZIP: -AddressbookFrame.zip.tooltipText=Enter zip code. +AddressbookFrame.zip.toolTipText=Enter zip code. AddressbookFrame.city.text=City: -AddressbookFrame.city.tooltipText=Enter 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). BaseContact.gender.unknown.text=Unknown BaseContact.gender.male.text=Mr. BaseContact.gender.female.text=Mrs. -- 2.39.5