Delays the creation of AddContactWizard for the purposed of UIServiceImpl's ExportedWindows because the mentioned creation is slow.

cusax-fix
Lyubomir Marinov 18 years ago
parent 12d4da369a
commit 23ec0f5dd9

@ -371,10 +371,8 @@ public boolean getExitOnMainWindowClose()
*/
public void initExportedWindows()
{
AddContactWizard addContactWizard = new AddContactWizard(mainFrame);
registerExportedWindow(configurationFrame);
registerExportedWindow(addContactWizard);
registerExportedWindow(new AddContactWizardExportedWindow(mainFrame));
}
/**

@ -14,7 +14,6 @@
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
@ -26,8 +25,7 @@
*/
public class AddContactWizard
extends Wizard
implements WizardListener,
ExportedWindow
implements WizardListener
{
private Logger logger = Logger.getLogger(AddContactWizard.class.getName());
@ -210,37 +208,6 @@ public void setVisible(boolean isVisible)
super.setVisible(false);
}
/**
* Implements the <tt>ExportedWindow.getIdentifier()</tt> method.
*/
public WindowID getIdentifier()
{
return ExportedWindow.ADD_CONTACT_WINDOW;
}
/**
* This dialog could not be minimized.
*/
public void minimize()
{
}
/**
* This dialog could not be maximized.
*/
public void maximize()
{
}
/**
* Implements the <tt>ExportedWindow.bringToFront()</tt> method. Brings this
* window to front.
*/
public void bringToFront()
{
this.toFront();
}
/**
* Returns the main application window.
*
@ -250,13 +217,4 @@ public MainFrame getMainFrame()
{
return mainFrame;
}
/**
* The source of the window
* @return the source of the window
*/
public Object getSource()
{
return this;
}
}

@ -0,0 +1,120 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.main.contactlist.addcontact;
import java.awt.Window;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.service.gui.*;
/**
* Implements <code>ExportedWindow</code> for the purposes of delaying the
* initialization of an associated <code>AddContactWizard</code> instance
* because it is slow.
*
* @author Lubomir Marinov
*/
public class AddContactWizardExportedWindow
implements ExportedWindow
{
/**
* The argument required by the <code>AddContactWizard</code> constructor.
*/
private final MainFrame mainFrame;
/**
* The <code>AddContactWizard</code> adapted by this instance.
*/
private Window wizard;
/**
* Initializes a new <code>AddContactWizardExportedWindow</code> which is to
* delay the initialization of a <code>AddContactWizard</code> with a
* specific <code>MainFrame</code>.
*
* @param mainFrame the argument required by the
* <code>AddContactWizard</code> constructor
*/
public AddContactWizardExportedWindow(MainFrame mainFrame)
{
this.mainFrame = mainFrame;
}
public void bringToFront()
{
getWizard().toFront();
}
public WindowID getIdentifier()
{
return ExportedWindow.ADD_CONTACT_WINDOW;
}
public Object getSource()
{
return getWizard();
}
/**
* Gets the <code>AddContactWizard</code> being adapted by this instance and
* creates it if it hasn't already been created.
*
* @return the <code>AddContactWizard</code> adapted by this instance
*/
private Window getWizard()
{
if (wizard == null)
{
wizard = new AddContactWizard(mainFrame);
}
return wizard;
}
public boolean isFocused()
{
return getWizard().isFocused();
}
public boolean isVisible()
{
return getWizard().isVisible();
}
/**
* Does nothing because the dialog associated with this instance doesn't
* support maximizing.
*/
public void maximize()
{
// The dialog cannot be maximized.
}
/**
* Does nothing because the dialog associated with this instance doesn't
* support minimizing.
*/
public void minimize()
{
// The dialog cannot be minimized.
}
public void setLocation(int x, int y)
{
getWizard().setLocation(x, y);
}
public void setSize(int width, int height)
{
getWizard().setSize(width, height);
}
public void setVisible(boolean isVisible)
{
getWizard().setVisible(isVisible);
}
}
Loading…
Cancel
Save