2 * Copyright (C) 2015 Roland Haeder
\r
4 * This program is free software: you can redistribute it and/or modify
\r
5 * it under the terms of the GNU General Public License as published by
\r
6 * the Free Software Foundation, either version 3 of the License, or
\r
7 * (at your option) any later version.
\r
9 * This program is distributed in the hope that it will be useful,
\r
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 * GNU General Public License for more details.
\r
14 * You should have received a copy of the GNU General Public License
\r
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
\r
17 package org.mxchange.addressbook.client.gui;
\r
19 import javax.swing.JFrame;
\r
20 import org.mxchange.addressbook.BaseFrameworkSystem;
\r
21 import org.mxchange.addressbook.FrameAlreadyInitializedException;
\r
22 import org.mxchange.addressbook.application.AddressbookApplication;
\r
23 import org.mxchange.addressbook.client.Client;
\r
27 * @author Roland Haeder
\r
29 public class AddressbookFrame extends BaseFrameworkSystem implements ClientFrame {
\r
34 private static ClientFrame self;
\r
37 * Singelton getter for this frame instance.
\r
39 * @param client Client instance
\r
40 * @return Returns a singelton instance of this frame
\r
42 public static final ClientFrame getSelfInstance (final Client client) {
\r
44 if (!(self instanceof ClientFrame)) {
\r
45 // Create new instance
\r
46 self = new AddressbookFrame(client);
\r
56 private final JFrame frame;
\r
59 * Whether this frame has been initialized
\r
61 private boolean isInitialized;
\r
64 * Creates an instance of this frame with a client instance
\r
67 private AddressbookFrame (final Client client) {
\r
69 this.getLogger().debug("Initializing Swing frame ...");
\r
71 // Set frame instance
\r
72 this.frame = new JFrame(AddressbookApplication.printableTitle());
\r
75 this.setClient(client);
\r
79 public void setVisible (final boolean visible) {
\r
80 throw new UnsupportedOperationException("Not supported yet.");
\r
86 * @param client Client instance
\r
89 public void setupFrame (final Client client) {
\r
90 // Has the user entered own data?
\r
91 if (this.getClient().getContactManager().isOwnContactAdded()) {
\r
93 this.getLogger().debug("Disabling menus: isOwnContactAdded()=false");
\r
95 // Not entered yet, so enable menu
\r
96 //addOwnData.setEnabled(false);
\r
100 //statusLabel.setText(bundle.getString("AddressbookFrame.status.done.text"));
\r
104 * Initalizes this frame. Having initComponents() exposed (publicly
\r
105 * accessible) means that any other object can initialize components which
\r
106 * you may not want.
\r
108 * @throws org.mxchange.addressbook.FrameAlreadyInitializedException If this method has been called twice
\r
111 public void initFrame () throws FrameAlreadyInitializedException {
\r
112 // Has this frame been initialized?
\r
113 if (this.isInitialized) {
\r
115 throw new FrameAlreadyInitializedException();
\r
119 this.initComponents();
\r
122 this.isInitialized = true;
\r
126 * Initialize components
\r
128 private void initComponents () {
\r