From b1624a643fa3011ae56cf3e259dbd236e775f301 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 28 Jul 2015 08:40:01 +0200 Subject: [PATCH] =?utf8?q?Introduced=20initNamePanel()=20+=20added=20enter?= =?utf8?q?ing=20surname,=20family=20name=20and=20displays=20gender.=20Well?= =?utf8?q?,=20this=20doesn't=20look=20okay=20...=20Signed-off-by:Roland=20?= =?utf8?q?H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../client/gui/AddressbookFrame.java | 137 +++++++++++------- .../backend/csv/Base64CsvDatabaseBackend.java | 1 + .../localization/bundle_de_DE.properties | 6 +- .../localization/bundle_en_US.properties | 5 +- 4 files changed, 93 insertions(+), 56 deletions(-) diff --git a/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java b/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java index b3bcab4..bf0810d 100644 --- a/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java +++ b/Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java @@ -272,7 +272,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame this.addContact.setAutoRequestFocus(true); // Initial dimension - this.addContact.setSize(400, 300); + this.addContact.setSize(500, 400); /* * Add listener which asks for confirmation, if data has been entered @@ -282,58 +282,8 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame */ // Init 3 panels: - // 1) Panel "name" input boxes - JPanel namePanel = new JPanel(); - namePanel.setLayout(new BoxLayout(namePanel, BoxLayout.Y_AXIS)); - - // Set border to titled version - namePanel.setBorder(new TitledBorder(this.generateBorderTitle("name"))); - - // Add some input boxes for "name" panel - JComboBox gender = new JComboBox<>(new DefaultComboBoxModel()); - - // Panel for gender - JPanel gPanel = new JPanel(); - gPanel.setLayout(new GridLayout(1, 2)); - - // Set tooltip text - gPanel.setToolTipText(this.getBundle().getString("AddressbookFrame.gender.tooltipText")); - - // Gender text field - JLabel gLabel = new JLabel(this.getBundle().getString("AddressbookFrame.gender.text")); - - // Add both to gender panel - gPanel.add(gLabel); - gPanel.add(gender); - - // Add panel to north of "name" panel - namePanel.add(gPanel, BorderLayout.NORTH); - - // Panel for surname - JPanel sPanel = new JPanel(); - sPanel.setLayout(new GridLayout(1, 2)); - - // Set too tip text - sPanel.setToolTipText(this.getBundle().getString("AddressbookFrame.surname.tooltipText")); - - // New label for surname is not needed - JLabel sLabel = new JLabel(this.getBundle().getString("AddressbookFrame.surname.text")); - - // And input box - JTextField surname = new JTextField(20); - - // Add both to surname panel - sPanel.add(sLabel); - sPanel.add(surname); - - // Add surname panel to "name" panel - namePanel.add(sPanel, BorderLayout.CENTER); - - // Finally add panel to dialog - this.addContact.add(namePanel); - - // Only for developing: - /* DEBUG: */ this.addContact.setVisible(true); + // 1) "Name" panel + initNamePanel(); } /** @@ -478,6 +428,87 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame this.frame.add(menuBar, BorderLayout.NORTH); } + /** + * Initializes name panel + */ + private void initNamePanel () { + // 1) Panel "name" input boxes + JPanel namePanel = new JPanel(); + namePanel.setLayout(new BoxLayout(namePanel, BoxLayout.Y_AXIS)); + + // Set border to titled version + namePanel.setBorder(new TitledBorder(this.generateBorderTitle("name"))); + + // Get all genders + Gender[] genders = Gender.values(); + + // Init gender combo box + JComboBox gender = new JComboBox<>(new DefaultComboBoxModel<>(genders)); + + // Panel for gender + JPanel gPanel = new JPanel(); + gPanel.setLayout(new GridLayout(1, 2)); + + // Set tooltip text + gPanel.setToolTipText(this.getBundle().getString("AddressbookFrame.gender.tooltipText")); + + // Gender text field + JLabel gLabel = new JLabel(this.getBundle().getString("AddressbookFrame.gender.text")); + + // 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)); + + // Set too tip text + sPanel.setToolTipText(this.getBundle().getString("AddressbookFrame.surname.tooltipText")); + + // New label for surname is not needed + JLabel sLabel = new JLabel(this.getBundle().getString("AddressbookFrame.surname.text")); + + // And input box + JTextField surname = new JTextField(20); + + // Add both to surname panel + sPanel.add(sLabel); + sPanel.add(surname); + + // Add surname panel to "name" panel + namePanel.add(sPanel); + + // Panel for surname + JPanel fPanel = new JPanel(); + fPanel.setLayout(new GridLayout(1, 2)); + + // Set too tip text + fPanel.setToolTipText(this.getBundle().getString("AddressbookFrame.familyName.tooltipText")); + + // New label for surname is not needed + JLabel fLabel = new JLabel(this.getBundle().getString("AddressbookFrame.familyName.text")); + + // And input box + JTextField familyName = new JTextField(20); + + // Add both to surname panel + fPanel.add(fLabel); + fPanel.add(familyName); + + // Add family namepanel to "name" panel + namePanel.add(fPanel); + + // Finally add panel to dialog + this.addContact.add(namePanel); + + // Only for developing: + /* DEBUG: */ this.addContact.setVisible(true); + } + /** * Initialize other dialogs (e.g. "Add contact") */ 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 9efa657..2715b5e 100644 --- a/Addressbook/src/org/mxchange/addressbook/database/backend/csv/Base64CsvDatabaseBackend.java +++ b/Addressbook/src/org/mxchange/addressbook/database/backend/csv/Base64CsvDatabaseBackend.java @@ -526,6 +526,7 @@ public class Base64CsvDatabaseBackend extends BaseDatabaseBackend implements Csv String input = null; try { + // Read single line String base64 = this.getStorageFile().readLine(); // Decode BASE-64 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 7cc24c1..9fbe609 100644 --- a/Addressbook/src/org/mxchange/addressbook/localization/bundle_de_DE.properties +++ b/Addressbook/src/org/mxchange/addressbook/localization/bundle_de_DE.properties @@ -14,23 +14,25 @@ # along with this program. If not, see . 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.menu.addressbook.text=Adressbuch 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.dialog.addContact.title.text=Neue Adresse hinzuf\u00fcgen AddressbookFrame.main.title.text=Adressen auflisten -AddressbookFrame.border.name.title.text=Anrede, Vorname, Nachname +AddressbookFrame.border.name.title.text=Anrede, Vorname, Nachname: 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. 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 8fce7b5..1bb83cd 100644 --- a/Addressbook/src/org/mxchange/addressbook/localization/bundle_en_US.properties +++ b/Addressbook/src/org/mxchange/addressbook/localization/bundle_en_US.properties @@ -14,22 +14,25 @@ # along with this program. If not, see . 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.addressbookMenu.text=Addressbook 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.dialog.addContact.title.text=Add new address AddressbookFrame.main.title.text=List addresses +AddressbookFrame.border.name.title.text=Gender, surname, family name: 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. BaseContact.gender.unknown.text=Unknown BaseContact.gender.male.text=Mr. BaseContact.gender.female.text=Mrs. -- 2.39.5