+/*
+ * 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 org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.mxchange.addressbook.application.Application;
+import org.mxchange.addressbook.client.Client;
+import org.mxchange.addressbook.manager.contact.ManageableContact;
+
+/**
+ *
+ * @author Roland Haeder
+ */
+public class AddressbookFrame extends javax.swing.JFrame implements ClientFrame {
+ /**
+ * Class' logger
+ */
+ private final Logger LOG;
+
+ /**
+ * Client instance
+ */
+ private final Client client;
+
+ /**
+ * Initialize object
+ */
+ {
+ LOG = LogManager.getLogger(this);
+ }
+
+ /**
+ * Creates an instance of this frame with a client instance
+ * @param client
+ */
+ public AddressbookFrame (final Client client) {
+ // Debug line
+ this.getLogger().debug("Initializing Swing frame ...");
+
+ // Init components
+ initComponents();
+
+ // Set client here
+ this.client = client;
+ }
+
+ @Override
+ public Application getApplication () {
+ throw new UnsupportedOperationException("Not implemented.");
+ }
+
+ @Override
+ public final Client getClient () {
+ return this.client;
+ }
+
+ @Override
+ public ManageableContact getContactManager () {
+ throw new UnsupportedOperationException("Not implemented.");
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ @SuppressWarnings ("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 400, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 300, Short.MAX_VALUE)
+ );
+
+ pack();
+ }// </editor-fold>//GEN-END:initComponents
+
+ /**
+ * Initializes the frame
+ */
+ @Override
+ public void initFrame (final Client client) {
+ /*
+ * Set the Nimbus look and feel
+ */
+ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
+ /*
+ * If Nimbus (introduced in Java SE 6) is not available, stay with the
+ * default look and feel. For details see
+ * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
+ */
+ try {
+ for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
+ if ("Nimbus".equals(info.getName())) {
+ javax.swing.UIManager.setLookAndFeel(info.getClassName());
+ break;
+ }
+ }
+ } catch (final ClassNotFoundException ex) {
+ this.getLogger().catching(ex);
+ } catch (final InstantiationException ex) {
+ this.getLogger().catching(ex);
+ } catch (final IllegalAccessException ex) {
+ this.getLogger().catching(ex);
+ } catch (final javax.swing.UnsupportedLookAndFeelException ex) {
+ this.getLogger().catching(ex);
+ }
+ //</editor-fold>
+
+ // Debug line
+ this.getLogger().debug("Displaying form ...");
+
+ /*
+ * Create and display the form
+ */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ @Override
+ public void run () {
+ new AddressbookFrame(client).setVisible(true);
+ }
+ });
+ }
+
+ /**
+ * Getter for logger
+ *
+ * @return Logger
+ */
+ protected final Logger getLogger () {
+ return this.LOG;
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ // End of variables declaration//GEN-END:variables
+}