+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
- <NonVisualComponents>
- <Menu class="javax.swing.JMenuBar" name="menuBar">
- <Properties>
- <Property name="name" type="java.lang.String" value="menuBar" noResource="true"/>
- </Properties>
- <SubComponents>
- <Menu class="javax.swing.JMenu" name="mainMenu">
- <Properties>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/mxchange/addressbook/client/gui/Bundle.properties" key="AddressbookFrame.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
- </Property>
- <Property name="focusable" type="boolean" value="false"/>
- <Property name="name" type="java.lang.String" value="" noResource="true"/>
- </Properties>
- <SubComponents>
- <MenuItem class="javax.swing.JMenuItem" name="exitProgram">
- <Properties>
- <Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
- <KeyStroke key="Alt+X"/>
- </Property>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/mxchange/addressbook/localization/bundle.properties" key="AddressbookFrame.exitProgram.text_1" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
- </Property>
- <Property name="name" type="java.lang.String" value="exitProgram" noResource="true"/>
- </Properties>
- <Events>
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exitProgramActionPerformed"/>
- </Events>
- </MenuItem>
- </SubComponents>
- </Menu>
- <Menu class="javax.swing.JMenu" name="addressbookMenu">
- <Properties>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/mxchange/addressbook/localization/bundle.properties" key="AddressbookFrame.addressbookMenu.text_1" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
- </Property>
- <Property name="name" type="java.lang.String" value="addressbookMenu" noResource="true"/>
- </Properties>
- <SubComponents>
- <MenuItem class="javax.swing.JMenuItem" name="addOwnData">
- <Properties>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/mxchange/addressbook/client/gui/Bundle.properties" key="AddressbookFrame.addOwn.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
- </Property>
- <Property name="name" type="java.lang.String" value="addOwn" noResource="true"/>
- </Properties>
- <AccessibilityProperties>
- <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/mxchange/addressbook/localization/bundle.properties" key="AddressbookFrame.addOwnData.AccessibleContext.accessibleName_1" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
- </Property>
- </AccessibilityProperties>
- <Events>
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addOwnDataActionPerformed"/>
- </Events>
- </MenuItem>
- </SubComponents>
- </Menu>
- </SubComponents>
- </Menu>
- </NonVisualComponents>
- <Properties>
- <Property name="defaultCloseOperation" type="int" value="0"/>
- <Property name="title" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
- <Connection code="AddressbookApplication.printableTitle()" type="code"/>
- </Property>
- <Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
- <Color id="Standardcursor"/>
- </Property>
- <Property name="name" type="java.lang.String" value="main" noResource="true"/>
- </Properties>
- <SyntheticProperties>
- <SyntheticProperty name="menuBar" type="java.lang.String" value="menuBar"/>
- <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
- <SyntheticProperty name="generateCenter" type="boolean" value="false"/>
- </SyntheticProperties>
- <Events>
- <EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="exitProgram"/>
- <EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="windowClosing"/>
- </Events>
- <AuxValues>
- <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
- <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
- <AuxValue name="FormSettings_formBundle" type="java.lang.String" value="org/mxchange/addressbook/localization/bundle"/>
- <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="false"/>
- <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
- <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
- <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
- <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
- <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
- <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
- </AuxValues>
-
- <Layout>
- <DimensionLayout dim="0">
- <Group type="103" groupAlignment="0" attributes="0">
- <Component id="statusPanel" max="32767" attributes="0"/>
- <Component id="listAddressesPanel" alignment="0" pref="700" max="32767" attributes="0"/>
- <Component id="toolBar" alignment="0" max="32767" attributes="0"/>
- </Group>
- </DimensionLayout>
- <DimensionLayout dim="1">
- <Group type="103" groupAlignment="0" attributes="0">
- <Group type="102" alignment="1" attributes="0">
- <Component id="toolBar" min="-2" pref="25" max="-2" attributes="0"/>
- <EmptySpace max="-2" attributes="0"/>
- <Component id="listAddressesPanel" min="-2" max="-2" attributes="0"/>
- <EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
- <Component id="statusPanel" min="-2" pref="23" max="-2" attributes="0"/>
- </Group>
- </Group>
- </DimensionLayout>
- </Layout>
- <SubComponents>
- <Container class="javax.swing.JPanel" name="statusPanel">
- <Properties>
- <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
- <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
- <EtchetBorder>
- <Color PropertyName="highlight" blue="c0" green="c0" id="lightGray" palette="1" red="c0" type="palette"/>
- <Color PropertyName="shadow" blue="99" green="99" red="99" type="rgb"/>
- </EtchetBorder>
- </Border>
- </Property>
- <Property name="autoscrolls" type="boolean" value="true"/>
- <Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
- <Color id="Standardcursor"/>
- </Property>
- <Property name="focusable" type="boolean" value="false"/>
- <Property name="name" type="java.lang.String" value="status" noResource="true"/>
- </Properties>
- <AccessibilityProperties>
- <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/mxchange/addressbook/client/gui/Bundle.properties" key="AddressbookFrame.status.AccessibleContext.accessibleName" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
- </Property>
- <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/mxchange/addressbook/client/gui/Bundle.properties" key="AddressbookFrame.status.AccessibleContext.accessibleDescription" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
- </Property>
- </AccessibilityProperties>
-
- <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
- <Property name="axis" type="int" value="0"/>
- </Layout>
- <SubComponents>
- <Component class="javax.swing.JLabel" name="statusLabel">
- <Properties>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/mxchange/addressbook/localization/bundle.properties" key="AddressbookFrame.statusLabel.text_1" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
- </Property>
- <Property name="horizontalTextPosition" type="int" value="2"/>
- <Property name="name" type="java.lang.String" value="statusLabel" noResource="true"/>
- </Properties>
- </Component>
- </SubComponents>
- </Container>
- <Container class="javax.swing.JScrollPane" name="listAddressesPanel">
- <Properties>
- <Property name="name" type="java.lang.String" value="listAddressesPanel" noResource="true"/>
- </Properties>
- <AuxValues>
- <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
- </AuxValues>
-
- <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
- <SubComponents>
- <Component class="javax.swing.JTable" name="addressesTable">
- <Properties>
- <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
- <Connection code="new AddressTableModel(this.getClient())" type="code"/>
- </Property>
- <Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
- <TableColumnModel selectionModel="2"/>
- </Property>
- <Property name="columnSelectionAllowed" type="boolean" value="true"/>
- <Property name="fillsViewportHeight" type="boolean" value="true"/>
- <Property name="focusable" type="boolean" value="false"/>
- <Property name="name" type="java.lang.String" value="addressesTable" noResource="true"/>
- <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
- <TableHeader reorderingAllowed="true" resizingAllowed="true"/>
- </Property>
- </Properties>
- </Component>
- </SubComponents>
- </Container>
- <Container class="javax.swing.JToolBar" name="toolBar">
- <Properties>
- <Property name="floatable" type="boolean" value="false"/>
- <Property name="rollover" type="boolean" value="true"/>
- <Property name="name" type="java.lang.String" value="toolBar" noResource="true"/>
- </Properties>
-
- <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
- </Container>
- </SubComponents>
-</Form>
-/*
- * 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.Color;
-import java.awt.Cursor;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.util.ResourceBundle;
-import javax.swing.BorderFactory;
-import javax.swing.BoxLayout;
-import javax.swing.GroupLayout;
-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.JToolBar;
-import javax.swing.KeyStroke;
-import javax.swing.LayoutStyle;
-import javax.swing.ListSelectionModel;
-import javax.swing.SwingConstants;
-import javax.swing.UIManager;
-import javax.swing.WindowConstants;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.mxchange.addressbook.application.AddressbookApplication;
-import org.mxchange.addressbook.application.Application;
-import org.mxchange.addressbook.client.Client;
-import org.mxchange.addressbook.manager.contact.ManageableContact;
-import org.mxchange.addressbook.model.address.AddressTableModel;
-
-/**
- *
- * @author Roland Haeder
- */
-public class AddressbookFrame extends javax.swing.JFrame implements ClientFrame {
- /**
- * Class' logger
- */
- private final Logger LOG;
-
- /**
- * Client instance
- */
- private final Client client;
-
- /**
- * Own instance
- */
- private static ClientFrame self;
-
- /**
- * Bundle instance
- */
- private final ResourceBundle bundle;
-
- /**
- * Initialize object
- */
- {
- LOG = LogManager.getLogger(this);
- bundle = ResourceBundle.getBundle("org/mxchange/addressbook/localization/bundle"); // NOI18N
- }
-
- /**
- * Creates an instance of this frame with a client instance
- * @param client
- */
- private AddressbookFrame (final Client client) {
- // Debug line
- this.getLogger().debug("Initializing Swing frame ...");
-
- // 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.");
- }
-
- @Override
- public void initFrame () {
- // Init components
- this.initComponents();
- }
-
- /**
- * 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() {
-
- statusPanel = new JPanel();
- statusLabel = new JLabel();
- listAddressesPanel = new JScrollPane();
- addressesTable = new JTable();
- toolBar = new JToolBar();
- menuBar = new JMenuBar();
- mainMenu = new JMenu();
- exitProgram = new JMenuItem();
- addressbookMenu = new JMenu();
- addOwnData = new JMenuItem();
-
- setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
- setTitle(AddressbookApplication.printableTitle());
- setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
- setName("main"); // NOI18N
- addWindowListener(new WindowAdapter() {
- public void windowClosed(WindowEvent evt) {
- exitProgram(evt);
- }
- public void windowClosing(WindowEvent evt) {
- AddressbookFrame.this.windowClosing(evt);
- }
- });
-
- statusPanel.setBorder(BorderFactory.createEtchedBorder(Color.lightGray, new Color(153, 153, 153)));
- statusPanel.setAutoscrolls(true);
- statusPanel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
- statusPanel.setFocusable(false);
- statusPanel.setName("status"); // NOI18N
- statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.X_AXIS));
-
- ResourceBundle bundle = ResourceBundle.getBundle("org/mxchange/addressbook/localization/bundle"); // NOI18N
- statusLabel.setText(bundle.getString("AddressbookFrame.statusLabel.text_1")); // NOI18N
- statusLabel.setHorizontalTextPosition(SwingConstants.LEFT);
- statusLabel.setName("statusLabel"); // NOI18N
- statusPanel.add(statusLabel);
-
- listAddressesPanel.setName("listAddressesPanel"); // NOI18N
-
- addressesTable.setModel(new AddressTableModel(this.getClient()));
- addressesTable.setColumnSelectionAllowed(true);
- addressesTable.setFillsViewportHeight(true);
- addressesTable.setFocusable(false);
- addressesTable.setName("addressesTable"); // NOI18N
- listAddressesPanel.setViewportView(addressesTable);
- addressesTable.getColumnModel().getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
-
- toolBar.setFloatable(false);
- toolBar.setRollover(true);
- toolBar.setName("toolBar"); // NOI18N
-
- menuBar.setName("menuBar"); // NOI18N
-
- ResourceBundle bundle1 = ResourceBundle.getBundle("org/mxchange/addressbook/client/gui/Bundle"); // NOI18N
- mainMenu.setText(bundle1.getString("AddressbookFrame.text")); // NOI18N
- mainMenu.setFocusable(false);
- mainMenu.setName(""); // NOI18N
-
- exitProgram.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK));
- exitProgram.setText(bundle.getString("AddressbookFrame.exitProgram.text_1")); // NOI18N
- exitProgram.setName("exitProgram"); // NOI18N
- exitProgram.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- exitProgramActionPerformed(evt);
- }
- });
- mainMenu.add(exitProgram);
-
- menuBar.add(mainMenu);
-
- addressbookMenu.setText(bundle.getString("AddressbookFrame.addressbookMenu.text_1")); // NOI18N
- addressbookMenu.setName("addressbookMenu"); // NOI18N
-
- addOwnData.setText(bundle1.getString("AddressbookFrame.addOwn.text")); // NOI18N
- addOwnData.setName("addOwn"); // NOI18N
- addOwnData.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- addOwnDataActionPerformed(evt);
- }
- });
- addressbookMenu.add(addOwnData);
- addOwnData.getAccessibleContext().setAccessibleName(bundle.getString("AddressbookFrame.addOwnData.AccessibleContext.accessibleName_1")); // NOI18N
-
- menuBar.add(addressbookMenu);
-
- setJMenuBar(menuBar);
-
- GroupLayout layout = new GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(statusPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(listAddressesPanel, GroupLayout.DEFAULT_SIZE, 700, Short.MAX_VALUE)
- .addComponent(toolBar, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- );
- layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(toolBar, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(listAddressesPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addGap(1, 1, 1)
- .addComponent(statusPanel, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE))
- );
-
- statusPanel.getAccessibleContext().setAccessibleName(bundle1.getString("AddressbookFrame.status.AccessibleContext.accessibleName")); // NOI18N
- statusPanel.getAccessibleContext().setAccessibleDescription(bundle1.getString("AddressbookFrame.status.AccessibleContext.accessibleDescription")); // NOI18N
-
- pack();
- }// </editor-fold>//GEN-END:initComponents
-
- private void exitProgramActionPerformed(ActionEvent evt) {//GEN-FIRST:event_exitProgramActionPerformed
- // Close application instance
- dispose();
- }//GEN-LAST:event_exitProgramActionPerformed
-
- private void addOwnDataActionPerformed(ActionEvent evt) {//GEN-FIRST:event_addOwnDataActionPerformed
- // Asks the user to enter own data
- this.getClient().getContactManager().doEnterOwnData();
- }//GEN-LAST:event_addOwnDataActionPerformed
-
- private void windowClosing(WindowEvent evt) {//GEN-FIRST:event_windowClosing
- // TODO add your handling code here:
- dispose();
- }//GEN-LAST:event_windowClosing
-
- private void exitProgram(WindowEvent evt) {//GEN-FIRST:event_exitProgram
- // TODO add your handling code here:
- this.getClient().getApplication().doShutdown();
- }//GEN-LAST:event_exitProgram
-
- /**
- * Setups the frame
- *
- * @param client Client instance
- */
- @Override
- public void setupFrame (final Client client) {
- // Has the user entered own data?
- if (this.getClient().getContactManager().isOwnContactAdded()) {
- // Debug message
- this.getLogger().debug("Disabling menus: isOwnContactAdded()=false");
-
- // Not entered yet, so enable menu
- addOwnData.setEnabled(false);
- }
-
- /*
- * 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 (UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
- if ("Nimbus".equals(info.getName())) {
- 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>
-
- // All done here
- statusLabel.setText(bundle.getString("AddressbookFrame.status.done.text"));
-
- // Debug line
- this.getLogger().debug("Displaying form ...");
-
- /*
- * Create and display the form
- */
- java.awt.EventQueue.invokeLater(new Runnable() {
- @Override
- public void run () {
- AddressbookFrame.getSelfInstance(client).setVisible(true);
- }
- });
- }
-
- /**
- * Singelton getter for this frame instance.
- *
- * @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;
- }
-
- /**
- * Getter for logger
- *
- * @return Logger
- */
- protected final Logger getLogger () {
- return this.LOG;
- }
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private JMenuItem addOwnData;
- private JMenu addressbookMenu;
- private JTable addressesTable;
- private JMenuItem exitProgram;
- private JScrollPane listAddressesPanel;
- private JMenu mainMenu;
- private JMenuBar menuBar;
- private JLabel statusLabel;
- private JPanel statusPanel;
- private JToolBar toolBar;
- // End of variables declaration//GEN-END:variables
-}
+/*\r
+ * Copyright (C) 2015 Roland Haeder\r
+ *\r
+ * This program is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package org.mxchange.addressbook.client.gui;\r
+\r
+import javax.swing.JFrame;\r
+import org.mxchange.addressbook.BaseFrameworkSystem;\r
+import org.mxchange.addressbook.FrameAlreadyInitializedException;\r
+import org.mxchange.addressbook.application.AddressbookApplication;\r
+import org.mxchange.addressbook.client.Client;\r
+\r
+/**\r
+ *\r
+ * @author Roland Haeder\r
+ */\r
+public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame {\r
+\r
+ /**\r
+ * Own instance\r
+ */\r
+ private static ClientFrame self;\r
+\r
+ /**\r
+ * Singelton getter for this frame instance.\r
+ *\r
+ * @param client Client instance\r
+ * @return Returns a singelton instance of this frame\r
+ */\r
+ public static final ClientFrame getSelfInstance (final Client client) {\r
+ // Is it set?\r
+ if (!(self instanceof ClientFrame)) {\r
+ // Create new instance\r
+ self = new AddressbookFrame(client);\r
+ }\r
+ \r
+ // Return instance\r
+ return self;\r
+ }\r
+\r
+ /**\r
+ * Frame instance\r
+ */\r
+ private final JFrame frame;\r
+\r
+ /**\r
+ * Whether this frame has been initialized\r
+ */\r
+ private boolean isInitialized;\r
+\r
+ /**\r
+ * Creates an instance of this frame with a client instance\r
+ * @param client\r
+ */\r
+ private AddressbookFrame (final Client client) {\r
+ // Debug line\r
+ this.getLogger().debug("Initializing Swing frame ...");\r
+\r
+ // Set frame instance\r
+ this.frame = new JFrame(AddressbookApplication.printableTitle());\r
+\r
+ // Set client here\r
+ this.setClient(client);\r
+ }\r
+\r
+ @Override\r
+ public void setVisible (final boolean visible) {\r
+ throw new UnsupportedOperationException("Not supported yet.");\r
+ }\r
+\r
+ /**\r
+ * Setups the frame\r
+ * \r
+ * @param client Client instance\r
+ */\r
+ @Override\r
+ public void setupFrame (final Client client) {\r
+ // Has the user entered own data?\r
+ if (this.getClient().getContactManager().isOwnContactAdded()) {\r
+ // Debug message\r
+ this.getLogger().debug("Disabling menus: isOwnContactAdded()=false");\r
+\r
+ // Not entered yet, so enable menu\r
+ //addOwnData.setEnabled(false);\r
+ }\r
+\r
+ // All done here\r
+ //statusLabel.setText(bundle.getString("AddressbookFrame.status.done.text"));\r
+ }\r
+\r
+ /**\r
+ * Initalizes this frame. Having initComponents() exposed (publicly\r
+ * accessible) means that any other object can initialize components which\r
+ * you may not want.\r
+ * \r
+ * @throws org.mxchange.addressbook.FrameAlreadyInitializedException If this method has been called twice\r
+ */\r
+ @Override\r
+ public void initFrame () throws FrameAlreadyInitializedException {\r
+ // Has this frame been initialized?\r
+ if (this.isInitialized) {\r
+ // Throw exception\r
+ throw new FrameAlreadyInitializedException();\r
+ }\r
+\r
+ // Init components\r
+ this.initComponents();\r
+\r
+ // Set flag\r
+ this.isInitialized = true;\r
+ }\r
+\r
+ /**\r
+ * Initialize components\r
+ */\r
+ private void initComponents () {\r
+ }\r
+\r
+}\r