]> git.mxchange.org Git - addressbook-lib.git/blobdiff - src/org/mxchange/addressbook/client/gui/AddressbookFrame.java
Prepared for upcoming rewrite:
[addressbook-lib.git] / src / org / mxchange / addressbook / client / gui / AddressbookFrame.java
index 05e123980458799189f35a486d30b36facc75881..bc09644749ed8eb6dca4b233e76ea9d16e045bef 100644 (file)
@@ -47,22 +47,25 @@ 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.BaseFrameworkSystem;
+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.
  *
  * @author Roland Haeder
  */
-public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame {
+public class AddressbookFrame extends BaseAddressbookSystem implements ClientFrame {
 
        /**
         * Own instance
@@ -133,7 +136,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        private AddressbookFrame (final Client client) {
                // Debug line
-               this.getLogger().trace(MessageFormat.format("client={0}: CALLED!", client)); //NOI18N
+               this.getLogger().logTrace(MessageFormat.format("client={0}: CALLED!", client)); //NOI18N
 
                // Set frame instance
                this.frame = new JFrame();
@@ -143,13 +146,13 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                this.setClient(client);
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        @Override
        public Contact doEnterOwnData () {
                // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
+               this.getLogger().logTrace("CALLED!"); //NOI18N
 
                // Is the "add contact" window visible?
                if (this.addContact.isVisible()) {
@@ -164,7 +167,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                this.addContact.setVisible(true);
 
                // Trace message
-               this.getLogger().trace("Returning null : EXIT!"); //NOI18N
+               this.getLogger().logTrace("Returning null : EXIT!"); //NOI18N
 
                // Return value is not supported
                return null;
@@ -176,13 +179,13 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
        @Override
        public void doShutdown () {
                // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
+               this.getLogger().logTrace("CALLED!"); //NOI18N
 
                // First only show shutdown status
                this.updateStatus("shutdown"); //NOI18N
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -191,7 +194,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
        @Override
        public void enableMainWindow () {
                // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
+               this.getLogger().logTrace("CALLED!"); //NOI18N
 
                // Enable it again
                this.frame.setEnabled(true);
@@ -200,7 +203,27 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                this.frame.requestFocus();
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               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.
        }
 
        /**
@@ -211,12 +234,12 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
        @Override
        public void setupFrame (final Client client) throws IOException {
                // Debug line
-               this.getLogger().trace(MessageFormat.format("client={0}: CALLED!", client)); //NOI18N
+               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().debug("Disabling menus: isOwnContactAdded()=false"); //NOI18N
+                       this.getLogger().logDebug("Disabling menus: isOwnContactAdded()=false"); //NOI18N
 
                        // Not entered yet, so disable "add" menu
                        this.addOwnItem.setEnabled(false);
@@ -232,7 +255,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                this.updateStatus("done"); //NOI18N
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -246,7 +269,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
        @Override
        public void init () throws FrameAlreadyInitializedException {
                // Debug line
-               this.getLogger().trace("CALLED!"); //NOI18N
+               this.getLogger().logTrace("CALLED!"); //NOI18N
 
                // Has this frame been initialized?
                if (this.isInitialized()) {
@@ -261,7 +284,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                this.initialized = true;
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -275,18 +298,23 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                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().trace("CALLED!"); //NOI18N
+               this.getLogger().logTrace("CALLED!"); //NOI18N
 
                // To do this, the frame must be initialized
                if (!this.isInitialized()) {
                        // Not initalized, so bad call
-                       this.getLogger().fatal("Bad call of shutdownApplication(). Please report this."); //NOI18N
+                       this.getLogger().logFatal("Bad call of shutdownApplication(). Please report this."); //NOI18N
                        return;
                }
 
@@ -299,7 +327,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                }
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -311,7 +339,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        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
+               this.getLogger().logTrace(MessageFormat.format("menu={0},key={1},listener={2} - CALLED!", menu, key, listener)); //NOI18N
 
                // New instance
                JMenuItem item = this.initMenuItemWithTooltip(key);
@@ -323,7 +351,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                menu.add(item);
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -335,7 +363,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        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
+               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
@@ -349,7 +377,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                panel.add(field);
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -389,7 +417,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        private void initAddCancelButtons () {
                // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
+               this.getLogger().logTrace("CALLED!"); //NOI18N
 
                // Init panel
                JPanel panel = new JPanel();
@@ -417,7 +445,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                this.addContact.add(panel);
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -425,7 +453,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        private void initAddContactDialog () {
                // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
+               this.getLogger().logTrace("CALLED!"); //NOI18N
 
                // Instance dialog and set title
                this.addContact = new JDialog();
@@ -493,7 +521,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                 */ this.addContact.setVisible(true);
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -503,7 +531,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        private void initAddressDataPanel (final JDialog dialog) {
                // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
+               this.getLogger().logTrace("CALLED!"); //NOI18N
 
                // Panel "address" input boxes
                JPanel addressPanel = new JPanel();
@@ -544,7 +572,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                dialog.add(addressPanel);
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -552,7 +580,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        private void initComponents () {
                // Debug line
-               this.getLogger().trace("CALLED!"); //NOI18N
+               this.getLogger().logTrace("CALLED!"); //NOI18N
 
                // Set default close operation
                this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@@ -601,7 +629,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                this.initOtherDialogs();
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -612,13 +640,13 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        private JMenuItem initMenuItemWithTooltip (final String key) {
                // Debug line
-               this.getLogger().trace(MessageFormat.format("key={0} - CALLED!", key)); //NOI18N
+               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().trace(MessageFormat.format("item={0} - EXIT!", item)); //NOI18N
+               this.getLogger().logTrace(MessageFormat.format("item={0} - EXIT!", item)); //NOI18N
 
                // Return it
                return item;
@@ -629,7 +657,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        private void initMenuSystem () {
                // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
+               this.getLogger().logTrace("CALLED!"); //NOI18N
 
                // Init menu bar, menu and item instances
                JMenuBar menuBar = new JMenuBar();
@@ -733,7 +761,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                this.frame.add(menuBar, BorderLayout.NORTH);
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -743,7 +771,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        private void initNameDataPanel (final JDialog dialog) {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("dialog={0} - CALLED!", dialog)); //NOI18N
+               this.getLogger().logTrace(MessageFormat.format("dialog={0} - CALLED!", dialog)); //NOI18N
 
                // Panel "name" input boxes
                JPanel namePanel = new JPanel();
@@ -776,7 +804,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                dialog.add(namePanel);
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -787,7 +815,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        private void initOtherDataPanel (final JDialog dialog) {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("dialog={0} - CALLED!", dialog)); //NOI18N
+               this.getLogger().logTrace(MessageFormat.format("dialog={0} - CALLED!", dialog)); //NOI18N
 
                // Panel "other" input boxes
                JPanel otherPanel = new JPanel();
@@ -821,7 +849,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                dialog.add(otherPanel);
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -829,14 +857,14 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        private void initOtherDialogs () {
                // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
+               this.getLogger().logTrace("CALLED!"); //NOI18N
 
                // Init other windows:
                // 1) Add contact
                initAddContactDialog();
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -844,7 +872,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        private void initStatusPanel () {
                // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
+               this.getLogger().logTrace("CALLED!"); //NOI18N
 
                // Init status label (which needs to be updated
                this.statusLabel = new JLabel();
@@ -860,7 +888,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                this.frame.add(panel, BorderLayout.SOUTH);
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -868,7 +896,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        private void initTable () {
                // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
+               this.getLogger().logTrace("CALLED!"); //NOI18N
 
                // Instance table model
                this.dataModel = new ContactTableModel(this.getClient().getManager());
@@ -901,7 +929,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
                this.frame.add(scroller, BorderLayout.CENTER);
 
                // Trace message
-               this.getLogger().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
@@ -911,19 +939,19 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
         */
        private void updateStatus (final String type) {
                // Trace message
-               this.getLogger().trace(MessageFormat.format("type={0} - CALLED!", type)); //NOI18N
+               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().trace("EXIT!"); //NOI18N
+               this.getLogger().logTrace("EXIT!"); //NOI18N
        }
 
        /**
         * Class for "add address" button
         */
-       private static class AddActionListener extends BaseFrameworkSystem implements ActionListener {
+       private static class AddActionListener extends BaseAddressbookSystem implements ActionListener {
 
                /**
                 * Dialog instance
@@ -961,7 +989,7 @@ public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame
        /**
         * Class for "cancel address" button
         */
-       private static class CancelActionListener extends BaseFrameworkSystem implements ActionListener {
+       private static class CancelActionListener extends BaseAddressbookSystem implements ActionListener {
 
                /**
                 * Dialog instance