mirror of https://github.com/sipwise/jitsi.git
parent
e65aa79111
commit
b9dbe01882
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* 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.customcontrols.events;
|
||||
|
||||
/*
|
||||
* The content of this file was based on code borrowed from David Bismut,
|
||||
* davidou@mageos.com Intern, SETLabs, Infosys Technologies Ltd. May 2004 - Jul
|
||||
* 2004 Ecole des Mines de Nantes, France
|
||||
*/
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.EventListener;
|
||||
/**
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public interface CloseListener extends EventListener {
|
||||
public void closeOperation(MouseEvent e);
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* 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.customcontrols.events;
|
||||
|
||||
/*
|
||||
* The following code is borrowed from David Bismut, davidou@mageos.com Intern,
|
||||
* SETLabs, Infosys Technologies Ltd. May 2004 - Jul 2004 Ecole des Mines de
|
||||
* Nantes, France
|
||||
*/
|
||||
|
||||
import java.awt.Event;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class CloseTabbedPaneEvent extends Event {
|
||||
|
||||
private String description;
|
||||
|
||||
private MouseEvent e;
|
||||
|
||||
private int overTabIndex;
|
||||
|
||||
public CloseTabbedPaneEvent(MouseEvent e, String description,
|
||||
int overTabIndex) {
|
||||
super(null, 0, null);
|
||||
this.e = e;
|
||||
this.description = description;
|
||||
this.overTabIndex = overTabIndex;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public MouseEvent getMouseEvent() {
|
||||
return e;
|
||||
}
|
||||
|
||||
public int getOverTabIndex() {
|
||||
return overTabIndex;
|
||||
}
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* 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.customcontrols.events;
|
||||
|
||||
/*
|
||||
* The following code borrowed from David Bismut, davidou@mageos.com Intern,
|
||||
* SETLabs, Infosys Technologies Ltd. May 2004 - Jul 2004 Ecole des Mines de
|
||||
* Nantes, France
|
||||
*/
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.EventListener;
|
||||
/**
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public interface DoubleClickListener extends EventListener {
|
||||
public void doubleClickOperation(MouseEvent e);
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* 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.customcontrols.events;
|
||||
|
||||
/*
|
||||
* The following code borrowed from David Bismut, davidou@mageos.com Intern,
|
||||
* SETLabs, Infosys Technologies Ltd. May 2004 - Jul 2004 Ecole des Mines de
|
||||
* Nantes, France
|
||||
*/
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.EventListener;
|
||||
/**
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public interface MaxListener extends EventListener {
|
||||
public void maxOperation(MouseEvent e);
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* 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.customcontrols.events;
|
||||
|
||||
/*
|
||||
* The following code borrowed from David Bismut, davidou@mageos.com Intern,
|
||||
* SETLabs, Infosys Technologies Ltd. May 2004 - Jul 2004 Ecole des Mines de
|
||||
* Nantes, France
|
||||
*/
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.EventListener;
|
||||
/**
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public interface PopupOutsideListener extends EventListener {
|
||||
public void popupOutsideOperation(MouseEvent e);
|
||||
}
|
||||
@ -1,464 +0,0 @@
|
||||
/*
|
||||
* 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.customcontrols.wizard;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.beans.*;
|
||||
import java.util.*;
|
||||
import java.net.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
|
||||
/**
|
||||
* This class implements a basic wizard dialog, where the programmer can
|
||||
* insert one or more Components to act as panels. These panels can be navigated
|
||||
* through arbitrarily using the 'Next' or 'Back' buttons, or the dialog itself
|
||||
* can be closed using the 'Cancel' button. Note that even though the dialog
|
||||
* uses a CardLayout manager, the order of the panels is not linear. Each panel
|
||||
* determines at runtime what its next and previous panel will be.
|
||||
*/
|
||||
public class Wizard extends WindowAdapter implements PropertyChangeListener {
|
||||
|
||||
/**
|
||||
* Indicates that the 'Finish' button was pressed to close the dialog.
|
||||
*/
|
||||
public static final int FINISH_RETURN_CODE = 0;
|
||||
/**
|
||||
* Indicates that the 'Cancel' button was pressed to close the dialog, or
|
||||
* the user pressed the close box in the corner of the window.
|
||||
*/
|
||||
public static final int CANCEL_RETURN_CODE = 1;
|
||||
/**
|
||||
* Indicates that the dialog closed due to an internal error.
|
||||
*/
|
||||
public static final int ERROR_RETURN_CODE = 2;
|
||||
|
||||
/**
|
||||
* The String-based action command for the 'Next' button.
|
||||
*/
|
||||
public static final String NEXT_BUTTON_ACTION_COMMAND
|
||||
= "NextButtonActionCommand";
|
||||
/**
|
||||
* The String-based action command for the 'Back' button.
|
||||
*/
|
||||
public static final String BACK_BUTTON_ACTION_COMMAND
|
||||
= "BackButtonActionCommand";
|
||||
/**
|
||||
* The String-based action command for the 'Cancel' button.
|
||||
*/
|
||||
public static final String CANCEL_BUTTON_ACTION_COMMAND
|
||||
= "CancelButtonActionCommand";
|
||||
|
||||
|
||||
/**
|
||||
* The i18n text used for the buttons. Loaded from a property resource
|
||||
* file.
|
||||
*/
|
||||
static String BACK_TEXT;
|
||||
static String NEXT_TEXT;
|
||||
static String FINISH_TEXT;
|
||||
static String CANCEL_TEXT;
|
||||
|
||||
/**
|
||||
* The image icons used for the buttons. Filenames are loaded from a
|
||||
* property resource file.
|
||||
*/
|
||||
static Icon BACK_ICON;
|
||||
static Icon NEXT_ICON;
|
||||
static Icon FINISH_ICON;
|
||||
static Icon CANCEL_ICON;
|
||||
|
||||
|
||||
private WizardModel wizardModel;
|
||||
private WizardController wizardController;
|
||||
private JDialog wizardDialog;
|
||||
|
||||
private JPanel cardPanel;
|
||||
private CardLayout cardLayout;
|
||||
private JButton backButton;
|
||||
private JButton nextButton;
|
||||
private JButton cancelButton;
|
||||
|
||||
private int returnCode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor. This method creates a new WizardModel object and
|
||||
* passes it into the overloaded constructor.
|
||||
*/
|
||||
public Wizard() {
|
||||
this((Frame)null);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method accepts a java.awt.Dialog object as the javax.swing.JDialog's
|
||||
* parent.
|
||||
* @param owner The java.awt.Dialog object that is the owner of this dialog.
|
||||
*/
|
||||
public Wizard(Dialog owner) {
|
||||
wizardModel = new WizardModel();
|
||||
wizardDialog = new JDialog(owner);
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method accepts a java.awt.Frame object as the javax.swing.JDialog's
|
||||
* parent.
|
||||
* @param owner The java.awt.Frame object that is the owner of the
|
||||
* javax.swing.JDialog.
|
||||
*/
|
||||
public Wizard(Frame owner) {
|
||||
wizardModel = new WizardModel();
|
||||
wizardDialog = new JDialog(owner);
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of the JDialog that this class created.This is useful
|
||||
* in the event that you want to change any of the JDialog parameters
|
||||
* manually.
|
||||
* @return The JDialog instance that this class created.
|
||||
*/
|
||||
public JDialog getDialog() {
|
||||
return wizardDialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the owner of the generated javax.swing.JDialog.
|
||||
* @return The owner (java.awt.Frame or java.awt.Dialog) of the
|
||||
* javax.swing.JDialog generated
|
||||
* by this class.
|
||||
*/
|
||||
public Component getOwner() {
|
||||
return wizardDialog.getOwner();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title of the generated javax.swing.JDialog.
|
||||
* @param s The title of the dialog.
|
||||
*/
|
||||
public void setTitle(String s) {
|
||||
wizardDialog.setTitle(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current title of the generated dialog.
|
||||
* @return The String-based title of the generated dialog.
|
||||
*/
|
||||
public String getTitle() {
|
||||
return wizardDialog.getTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the modality of the generated javax.swing.JDialog.
|
||||
* @param b the modality of the dialog
|
||||
*/
|
||||
public void setModal(boolean b) {
|
||||
wizardDialog.setModal(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the modality of the dialog.
|
||||
* @return A boolean indicating whether or not the generated
|
||||
* javax.swing.JDialog is modal.
|
||||
*/
|
||||
public boolean isModal() {
|
||||
return wizardDialog.isModal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convienence method that displays a modal wizard dialog and blocks until
|
||||
* the dialog has completed.
|
||||
* @return Indicates how the dialog was closed. Compare this value against
|
||||
* the RETURN_CODE constants at the beginning of the class.
|
||||
*/
|
||||
public int showModalDialog() {
|
||||
|
||||
wizardDialog.setModal(true);
|
||||
wizardDialog.pack();
|
||||
wizardDialog.setVisible(true);
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current model of the wizard dialog.
|
||||
* @return A WizardModel instance, which serves as the model for the
|
||||
* wizard dialog.
|
||||
*/
|
||||
public WizardModel getModel() {
|
||||
return wizardModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Component as a panel for the wizard dialog by registering its
|
||||
* WizardPanelDescriptor object. Each panel is identified by a unique
|
||||
* Object-based identifier (often a String), which can be used by the
|
||||
* setCurrentPanel() method to display the panel at runtime.
|
||||
* @param id An Object-based identifier used to identify the
|
||||
* WizardPanelDescriptor object.
|
||||
* @param panel The WizardPanelDescriptor object which contains helpful
|
||||
* information about the panel.
|
||||
*/
|
||||
public void registerWizardPanel(Object id, WizardPanelDescriptor panel) {
|
||||
|
||||
// Add the incoming panel to our JPanel display that is managed by
|
||||
// the CardLayout layout manager.
|
||||
|
||||
cardPanel.add(panel.getPanelComponent(), id);
|
||||
|
||||
// Set a callback to the current wizard.
|
||||
|
||||
panel.setWizard(this);
|
||||
|
||||
// Place a reference to it in the model.
|
||||
|
||||
wizardModel.registerPanel(id, panel);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the panel identified by the object passed in. This is the same
|
||||
* Object-based identified used when registering the panel.
|
||||
* @param id The Object-based identifier of the panel to be displayed.
|
||||
*/
|
||||
public void setCurrentPanel(Object id) {
|
||||
|
||||
// Get the hashtable reference to the panel that should
|
||||
// be displayed. If the identifier passed in is null, then close
|
||||
// the dialog.
|
||||
|
||||
if (id == null)
|
||||
close(ERROR_RETURN_CODE);
|
||||
|
||||
WizardPanelDescriptor oldPanelDescriptor
|
||||
= wizardModel.getCurrentPanelDescriptor();
|
||||
if (oldPanelDescriptor != null)
|
||||
oldPanelDescriptor.aboutToHidePanel();
|
||||
|
||||
wizardModel.setCurrentPanel(id);
|
||||
wizardModel.getCurrentPanelDescriptor().aboutToDisplayPanel();
|
||||
|
||||
// Show the panel in the dialog.
|
||||
|
||||
cardLayout.show(cardPanel, id.toString());
|
||||
wizardModel.getCurrentPanelDescriptor().displayingPanel();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to listen for property change events from the model and
|
||||
* update the dialog's graphical components as necessary.
|
||||
* @param evt PropertyChangeEvent passed from the model to signal that one
|
||||
* of its properties has changed value.
|
||||
*/
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
|
||||
if (evt.getPropertyName().equals(
|
||||
WizardModel.CURRENT_PANEL_DESCRIPTOR_PROPERTY)) {
|
||||
wizardController.resetButtonsToPanelRules();
|
||||
} else if (evt.getPropertyName().equals(
|
||||
WizardModel.NEXT_FINISH_BUTTON_TEXT_PROPERTY)) {
|
||||
nextButton.setText(evt.getNewValue().toString());
|
||||
} else if (evt.getPropertyName().equals(
|
||||
WizardModel.BACK_BUTTON_TEXT_PROPERTY)) {
|
||||
backButton.setText(evt.getNewValue().toString());
|
||||
} else if (evt.getPropertyName().equals(
|
||||
WizardModel.CANCEL_BUTTON_TEXT_PROPERTY)) {
|
||||
cancelButton.setText(evt.getNewValue().toString());
|
||||
} else if (evt.getPropertyName().equals(
|
||||
WizardModel.NEXT_FINISH_BUTTON_ENABLED_PROPERTY)) {
|
||||
nextButton.setEnabled(((Boolean)evt.getNewValue()).booleanValue());
|
||||
} else if (evt.getPropertyName().equals(
|
||||
WizardModel.BACK_BUTTON_ENABLED_PROPERTY)) {
|
||||
backButton.setEnabled(((Boolean)evt.getNewValue()).booleanValue());
|
||||
} else if (evt.getPropertyName().equals(
|
||||
WizardModel.CANCEL_BUTTON_ENABLED_PROPERTY)) {
|
||||
cancelButton.setEnabled(((Boolean)evt.getNewValue()).booleanValue());
|
||||
} else if (evt.getPropertyName().equals(
|
||||
WizardModel.NEXT_FINISH_BUTTON_ICON_PROPERTY)) {
|
||||
nextButton.setIcon((Icon)evt.getNewValue());
|
||||
} else if (evt.getPropertyName().equals(
|
||||
WizardModel.BACK_BUTTON_ICON_PROPERTY)) {
|
||||
backButton.setIcon((Icon)evt.getNewValue());
|
||||
} else if (evt.getPropertyName().equals(
|
||||
WizardModel.CANCEL_BUTTON_ICON_PROPERTY)) {
|
||||
cancelButton.setIcon((Icon)evt.getNewValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the last return code set by the dialog.
|
||||
* @return An integer that identifies how the dialog was closed. See the
|
||||
* RETURN_CODE constants of this class for possible values.
|
||||
*/
|
||||
public int getReturnCode() {
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mirrors the WizardModel method of the same name.
|
||||
* @return A boolean indicating if the button is enabled.
|
||||
*/
|
||||
public boolean getBackButtonEnabled() {
|
||||
return wizardModel.getBackButtonEnabled().booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Mirrors the WizardModel method of the same name.
|
||||
* @param newValue The new enabled status of the button.
|
||||
*/
|
||||
public void setBackButtonEnabled(boolean newValue) {
|
||||
wizardModel.setBackButtonEnabled(new Boolean(newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mirrors the WizardModel method of the same name.
|
||||
* @return A boolean indicating if the button is enabled.
|
||||
*/
|
||||
public boolean getNextFinishButtonEnabled() {
|
||||
return wizardModel.getNextFinishButtonEnabled().booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Mirrors the WizardModel method of the same name.
|
||||
* @param newValue The new enabled status of the button.
|
||||
*/
|
||||
public void setNextFinishButtonEnabled(boolean newValue) {
|
||||
wizardModel.setNextFinishButtonEnabled(new Boolean(newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mirrors the WizardModel method of the same name.
|
||||
* @return A boolean indicating if the button is enabled.
|
||||
*/
|
||||
public boolean getCancelButtonEnabled() {
|
||||
return wizardModel.getCancelButtonEnabled().booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Mirrors the WizardModel method of the same name.
|
||||
* @param newValue The new enabled status of the button.
|
||||
*/
|
||||
public void setCancelButtonEnabled(boolean newValue) {
|
||||
wizardModel.setCancelButtonEnabled(new Boolean(newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the dialog and sets the return code to the integer parameter.
|
||||
* @param code The return code.
|
||||
*/
|
||||
void close(int code) {
|
||||
WizardPanelDescriptor oldPanelDescriptor
|
||||
= wizardModel.getCurrentPanelDescriptor();
|
||||
if (oldPanelDescriptor != null)
|
||||
oldPanelDescriptor.aboutToHidePanel();
|
||||
|
||||
returnCode = code;
|
||||
wizardDialog.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes the components for the wizard dialog: it creates
|
||||
* a JDialog as a CardLayout panel surrounded by a small amount of space on
|
||||
* each side, as well as three buttons at the bottom.
|
||||
*/
|
||||
|
||||
private void initComponents() {
|
||||
|
||||
wizardModel.addPropertyChangeListener(this);
|
||||
wizardController = new WizardController(this);
|
||||
|
||||
wizardDialog.getContentPane().setLayout(new BorderLayout());
|
||||
wizardDialog.addWindowListener(this);
|
||||
|
||||
/*
|
||||
* Create the outer wizard panel, which is responsible for three
|
||||
* buttons: Next, Back, and Cancel. It is also responsible a JPanel
|
||||
* above them that uses a CardLayout layout manager to display multiple
|
||||
* panels in the same spot.
|
||||
*/
|
||||
|
||||
JPanel buttonPanel = new JPanel();
|
||||
JSeparator separator = new JSeparator();
|
||||
Box buttonBox = new Box(BoxLayout.X_AXIS);
|
||||
|
||||
cardPanel = new JPanel();
|
||||
cardPanel.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
|
||||
|
||||
cardLayout = new CardLayout();
|
||||
cardPanel.setLayout(cardLayout);
|
||||
|
||||
backButton = new JButton();
|
||||
nextButton = new JButton();
|
||||
cancelButton = new JButton();
|
||||
|
||||
backButton.setActionCommand(BACK_BUTTON_ACTION_COMMAND);
|
||||
nextButton.setActionCommand(NEXT_BUTTON_ACTION_COMMAND);
|
||||
cancelButton.setActionCommand(CANCEL_BUTTON_ACTION_COMMAND);
|
||||
|
||||
backButton.addActionListener(wizardController);
|
||||
nextButton.addActionListener(wizardController);
|
||||
cancelButton.addActionListener(wizardController);
|
||||
|
||||
// Create the buttons with a separator above them, then place them
|
||||
// on the east side of the panel with a small amount of space between
|
||||
// the back and the next button, and a larger amount of space between
|
||||
// the next button and the cancel button.
|
||||
|
||||
buttonPanel.setLayout(new BorderLayout());
|
||||
buttonPanel.add(separator, BorderLayout.NORTH);
|
||||
|
||||
buttonBox.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
|
||||
buttonBox.add(backButton);
|
||||
buttonBox.add(Box.createHorizontalStrut(10));
|
||||
buttonBox.add(nextButton);
|
||||
buttonBox.add(Box.createHorizontalStrut(30));
|
||||
buttonBox.add(cancelButton);
|
||||
|
||||
buttonPanel.add(buttonBox, java.awt.BorderLayout.EAST);
|
||||
|
||||
wizardDialog.getContentPane().add(
|
||||
buttonPanel, java.awt.BorderLayout.SOUTH);
|
||||
wizardDialog.getContentPane().add(
|
||||
cardPanel, java.awt.BorderLayout.CENTER);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* If the user presses the close box on the dialog's window, treat it
|
||||
* as a cancel.
|
||||
* @param e The event passed in from AWT.
|
||||
*/
|
||||
|
||||
public void windowClosing(WindowEvent e) {
|
||||
returnCode = CANCEL_RETURN_CODE;
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
try {
|
||||
PropertyResourceBundle resources = (PropertyResourceBundle)
|
||||
ResourceBundle.getBundle(
|
||||
"net.java.sip.communicator.impl.gui.main.customcontrols.wizard.wizard");
|
||||
|
||||
BACK_TEXT = (String)(resources.getObject("backButtonText"));
|
||||
NEXT_TEXT = (String)(resources.getObject("nextButtonText"));
|
||||
CANCEL_TEXT = (String)(resources.getObject("cancelButtonText"));
|
||||
FINISH_TEXT = (String)(resources.getObject("finishButtonText"));
|
||||
} catch (MissingResourceException mre) {
|
||||
System.out.println(mre);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,132 +0,0 @@
|
||||
/*
|
||||
* 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.customcontrols.wizard;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
* This class is responsible for reacting to events generated by pushing any
|
||||
* of the three buttons, 'Next', 'Previous', and 'Cancel.' Based on what
|
||||
* button is pressed, the controller will update the model to show a new panel
|
||||
* and reset the state of the buttons as necessary.
|
||||
*/
|
||||
public class WizardController implements ActionListener {
|
||||
|
||||
private Wizard wizard;
|
||||
|
||||
/**
|
||||
* This constructor accepts a reference to the Wizard component that created
|
||||
* it, which it uses to update the button components and access the
|
||||
* WizardModel.
|
||||
* @param w A callback to the Wizard component that created this controller.
|
||||
*/
|
||||
public WizardController(Wizard w) {
|
||||
wizard = w;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calling method for the action listener interface. This class listens for
|
||||
* actions performed by the buttons in the Wizard class, and calls methods
|
||||
* below to determine the correct course of action.
|
||||
* @param evt The ActionEvent that occurred.
|
||||
*/
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
||||
if (evt.getActionCommand().equals(
|
||||
Wizard.CANCEL_BUTTON_ACTION_COMMAND))
|
||||
cancelButtonPressed();
|
||||
else if (evt.getActionCommand().equals(
|
||||
Wizard.BACK_BUTTON_ACTION_COMMAND))
|
||||
backButtonPressed();
|
||||
else if (evt.getActionCommand().equals(
|
||||
Wizard.NEXT_BUTTON_ACTION_COMMAND))
|
||||
nextButtonPressed();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the wizard by specifying the appropriate return code, when user
|
||||
* has pressed the "Cancel" button.
|
||||
*/
|
||||
private void cancelButtonPressed() {
|
||||
wizard.close(Wizard.CANCEL_RETURN_CODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* If it is a finishable panel, closes the dialog. Otherwise, gets the
|
||||
* ID that the current panel identifies as the next panel, and displays
|
||||
* the panel that it's identifying.
|
||||
*/
|
||||
private void nextButtonPressed() {
|
||||
|
||||
WizardModel model = wizard.getModel();
|
||||
WizardPanelDescriptor descriptor = model.getCurrentPanelDescriptor();
|
||||
|
||||
Object nextPanelDescriptor = descriptor.getNextPanelDescriptor();
|
||||
|
||||
if (nextPanelDescriptor
|
||||
instanceof WizardPanelDescriptor.FinishIdentifier) {
|
||||
wizard.close(Wizard.FINISH_RETURN_CODE);
|
||||
} else {
|
||||
wizard.setCurrentPanel(nextPanelDescriptor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the descriptor that the current panel identifies as the previous
|
||||
* panel, and displays the panel that it's identifying.
|
||||
*/
|
||||
private void backButtonPressed() {
|
||||
|
||||
WizardModel model = wizard.getModel();
|
||||
WizardPanelDescriptor descriptor = model.getCurrentPanelDescriptor();
|
||||
|
||||
Object backPanelDescriptor = descriptor.getBackPanelDescriptor();
|
||||
wizard.setCurrentPanel(backPanelDescriptor);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the buttons to support the original panel rules, including
|
||||
* whether the next or back buttons are enabled or disabled, or if
|
||||
* the panel is finishable. If the panel in question has another panel
|
||||
* behind it, enables the back button. Otherwise, disables it. If the
|
||||
* panel in question has one or more panels in front of it, enables the
|
||||
* next button. Otherwise, disables it.
|
||||
*/
|
||||
void resetButtonsToPanelRules() {
|
||||
|
||||
WizardModel model = wizard.getModel();
|
||||
WizardPanelDescriptor descriptor = model.getCurrentPanelDescriptor();
|
||||
|
||||
model.setCancelButtonText(Wizard.CANCEL_TEXT);
|
||||
|
||||
model.setBackButtonText(Wizard.BACK_TEXT);
|
||||
|
||||
if (descriptor.getBackPanelDescriptor() != null)
|
||||
model.setBackButtonEnabled(Boolean.TRUE);
|
||||
else
|
||||
model.setBackButtonEnabled(Boolean.FALSE);
|
||||
|
||||
if (descriptor.getNextPanelDescriptor() != null)
|
||||
model.setNextFinishButtonEnabled(Boolean.TRUE);
|
||||
else
|
||||
model.setNextFinishButtonEnabled(Boolean.FALSE);
|
||||
|
||||
if (descriptor.getNextPanelDescriptor()
|
||||
instanceof WizardPanelDescriptor.FinishIdentifier) {
|
||||
model.setNextFinishButtonText(Wizard.FINISH_TEXT);
|
||||
} else {
|
||||
model.setNextFinishButtonText(Wizard.NEXT_TEXT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,389 +0,0 @@
|
||||
/*
|
||||
* 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.customcontrols.wizard;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.swing.Icon;
|
||||
|
||||
/**
|
||||
* The model for the Wizard component, which tracks the text, icons, and
|
||||
* enabled state of each of the buttons, as well as the current panel that
|
||||
* is displayed. Note that the model, in its current form, is not intended
|
||||
* to be subclassed.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
|
||||
|
||||
public class WizardModel {
|
||||
|
||||
/**
|
||||
* Identification string for the current panel.
|
||||
*/
|
||||
public static final String CURRENT_PANEL_DESCRIPTOR_PROPERTY
|
||||
= "currentPanelDescriptorProperty";
|
||||
|
||||
/**
|
||||
* Property identification String for the Back button's text
|
||||
*/
|
||||
public static final String BACK_BUTTON_TEXT_PROPERTY
|
||||
= "backButtonTextProperty";
|
||||
/**
|
||||
* Property identification String for the Back button's icon
|
||||
*/
|
||||
public static final String BACK_BUTTON_ICON_PROPERTY
|
||||
= "backButtonIconProperty";
|
||||
/**
|
||||
* Property identification String for the Back button's enabled state
|
||||
*/
|
||||
public static final String BACK_BUTTON_ENABLED_PROPERTY
|
||||
= "backButtonEnabledProperty";
|
||||
|
||||
/**
|
||||
* Property identification String for the Next button's text
|
||||
*/
|
||||
public static final String NEXT_FINISH_BUTTON_TEXT_PROPERTY
|
||||
= "nextButtonTextProperty";
|
||||
/**
|
||||
* Property identification String for the Next button's icon
|
||||
*/
|
||||
public static final String NEXT_FINISH_BUTTON_ICON_PROPERTY
|
||||
= "nextButtonIconProperty";
|
||||
/**
|
||||
* Property identification String for the Next button's enabled state
|
||||
*/
|
||||
public static final String NEXT_FINISH_BUTTON_ENABLED_PROPERTY
|
||||
= "nextButtonEnabledProperty";
|
||||
|
||||
/**
|
||||
* Property identification String for the Cancel button's text
|
||||
*/
|
||||
public static final String CANCEL_BUTTON_TEXT_PROPERTY
|
||||
= "cancelButtonTextProperty";
|
||||
/**
|
||||
* Property identification String for the Cancel button's icon
|
||||
*/
|
||||
public static final String CANCEL_BUTTON_ICON_PROPERTY
|
||||
= "cancelButtonIconProperty";
|
||||
/**
|
||||
* Property identification String for the Cancel button's enabled state
|
||||
*/
|
||||
public static final String CANCEL_BUTTON_ENABLED_PROPERTY
|
||||
= "cancelButtonEnabledProperty";
|
||||
|
||||
private WizardPanelDescriptor currentPanel;
|
||||
|
||||
private HashMap panelHashmap;
|
||||
|
||||
private HashMap buttonTextHashmap;
|
||||
private HashMap buttonIconHashmap;
|
||||
private HashMap buttonEnabledHashmap;
|
||||
|
||||
private PropertyChangeSupport propertyChangeSupport;
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public WizardModel() {
|
||||
|
||||
panelHashmap = new HashMap();
|
||||
|
||||
buttonTextHashmap = new HashMap();
|
||||
buttonIconHashmap = new HashMap();
|
||||
buttonEnabledHashmap = new HashMap();
|
||||
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently displayed WizardPanelDescriptor.
|
||||
* @return The currently displayed WizardPanelDescriptor
|
||||
*/
|
||||
WizardPanelDescriptor getCurrentPanelDescriptor() {
|
||||
return currentPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the WizardPanelDescriptor in the model using the
|
||||
* Object-identifier specified.
|
||||
* @param id Object-based identifier
|
||||
* @param descriptor WizardPanelDescriptor that describes the panel
|
||||
*/
|
||||
void registerPanel(Object id, WizardPanelDescriptor descriptor) {
|
||||
|
||||
// Place a reference to it in a hashtable so we can access it later
|
||||
// when it is about to be displayed.
|
||||
|
||||
panelHashmap.put(id, descriptor);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current panel to that identified by the Object passed in.
|
||||
* @param id Object-based panel identifier
|
||||
* @return boolean indicating success or failure
|
||||
*/
|
||||
boolean setCurrentPanel(Object id) {
|
||||
|
||||
// First, get the hashtable reference to the panel that should
|
||||
// be displayed.
|
||||
|
||||
WizardPanelDescriptor nextPanel =
|
||||
(WizardPanelDescriptor)panelHashmap.get(id);
|
||||
|
||||
// If we couldn't find the panel that should be displayed, return
|
||||
// false.
|
||||
|
||||
if (nextPanel == null)
|
||||
throw new WizardPanelNotFoundException();
|
||||
|
||||
WizardPanelDescriptor oldPanel = currentPanel;
|
||||
currentPanel = nextPanel;
|
||||
|
||||
if (oldPanel != currentPanel) {
|
||||
firePropertyChange(CURRENT_PANEL_DESCRIPTOR_PROPERTY,
|
||||
oldPanel, currentPanel);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text for the Back button.
|
||||
* @return the text for the Back button.
|
||||
*/
|
||||
Object getBackButtonText() {
|
||||
return buttonTextHashmap.get(BACK_BUTTON_TEXT_PROPERTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text for the back button.
|
||||
* @param newText The text to set.
|
||||
*/
|
||||
void setBackButtonText(Object newText) {
|
||||
|
||||
Object oldText = getBackButtonText();
|
||||
if (!newText.equals(oldText)) {
|
||||
buttonTextHashmap.put(BACK_BUTTON_TEXT_PROPERTY, newText);
|
||||
firePropertyChange(BACK_BUTTON_TEXT_PROPERTY, oldText, newText);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text for the Next/Finish button.
|
||||
* @return the text for the Next/Finish button.
|
||||
*/
|
||||
Object getNextFinishButtonText() {
|
||||
return buttonTextHashmap.get(NEXT_FINISH_BUTTON_TEXT_PROPERTY);
|
||||
}
|
||||
|
||||
void setNextFinishButtonText(Object newText) {
|
||||
|
||||
Object oldText = getNextFinishButtonText();
|
||||
if (!newText.equals(oldText)) {
|
||||
buttonTextHashmap.put(NEXT_FINISH_BUTTON_TEXT_PROPERTY, newText);
|
||||
firePropertyChange(NEXT_FINISH_BUTTON_TEXT_PROPERTY,
|
||||
oldText, newText);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text for the Cancel button.
|
||||
* @return the text for the Cancel button.
|
||||
*/
|
||||
Object getCancelButtonText() {
|
||||
return buttonTextHashmap.get(CANCEL_BUTTON_TEXT_PROPERTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text for the Cancel button.
|
||||
* @param newText The text to set.
|
||||
*/
|
||||
void setCancelButtonText(Object newText) {
|
||||
|
||||
Object oldText = getCancelButtonText();
|
||||
if (!newText.equals(oldText)) {
|
||||
buttonTextHashmap.put(CANCEL_BUTTON_TEXT_PROPERTY, newText);
|
||||
firePropertyChange(CANCEL_BUTTON_TEXT_PROPERTY, oldText, newText);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon for the Back button.
|
||||
* @return the icon for the Back button.
|
||||
*/
|
||||
Icon getBackButtonIcon() {
|
||||
return (Icon)buttonIconHashmap.get(BACK_BUTTON_ICON_PROPERTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the icon for the Back button.
|
||||
* @param newIcon The new icon to set.
|
||||
*/
|
||||
void setBackButtonIcon(Icon newIcon) {
|
||||
|
||||
Object oldIcon = getBackButtonIcon();
|
||||
if (!newIcon.equals(oldIcon)) {
|
||||
buttonIconHashmap.put(BACK_BUTTON_ICON_PROPERTY, newIcon);
|
||||
firePropertyChange(BACK_BUTTON_ICON_PROPERTY, oldIcon, newIcon);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon for the Next/Finish button.
|
||||
* @return the icon for the Next/Finish button.
|
||||
*/
|
||||
Icon getNextFinishButtonIcon() {
|
||||
return (Icon)buttonIconHashmap.get(NEXT_FINISH_BUTTON_ICON_PROPERTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the icon for the Next/Finish button.
|
||||
* @param newIcon The new icon to set.
|
||||
*/
|
||||
public void setNextFinishButtonIcon(Icon newIcon) {
|
||||
|
||||
Object oldIcon = getNextFinishButtonIcon();
|
||||
if (!newIcon.equals(oldIcon)) {
|
||||
buttonIconHashmap.put(NEXT_FINISH_BUTTON_ICON_PROPERTY, newIcon);
|
||||
firePropertyChange(NEXT_FINISH_BUTTON_ICON_PROPERTY,
|
||||
oldIcon, newIcon);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon for the Cancel button.
|
||||
* @return the icon for the Cancel button.
|
||||
*/
|
||||
Icon getCancelButtonIcon() {
|
||||
return (Icon)buttonIconHashmap.get(CANCEL_BUTTON_ICON_PROPERTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the icon for the Cancel button.
|
||||
* @param newIcon The new icon to set.
|
||||
*/
|
||||
void setCancelButtonIcon(Icon newIcon) {
|
||||
Icon oldIcon = getCancelButtonIcon();
|
||||
if (!newIcon.equals(oldIcon)) {
|
||||
buttonIconHashmap.put(CANCEL_BUTTON_ICON_PROPERTY, newIcon);
|
||||
firePropertyChange(CANCEL_BUTTON_ICON_PROPERTY, oldIcon, newIcon);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the Back button is enabled.
|
||||
* @return <code>true</code> if the Back button is enabled,
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
Boolean getBackButtonEnabled() {
|
||||
return (Boolean)buttonEnabledHashmap.get(
|
||||
BACK_BUTTON_ENABLED_PROPERTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables the Back button.
|
||||
* @param newValue <code>true</code> to enable the Back button,
|
||||
* <code>false</code> to disable it.
|
||||
*/
|
||||
void setBackButtonEnabled(Boolean newValue) {
|
||||
|
||||
Boolean oldValue = getBackButtonEnabled();
|
||||
if (newValue != oldValue) {
|
||||
buttonEnabledHashmap.put(BACK_BUTTON_ENABLED_PROPERTY, newValue);
|
||||
firePropertyChange(BACK_BUTTON_ENABLED_PROPERTY,
|
||||
oldValue, newValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the Next/Finish button is enabled.
|
||||
* @return <code>true</code> if the Next/Finish button is enabled,
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
Boolean getNextFinishButtonEnabled() {
|
||||
return (Boolean)buttonEnabledHashmap.get(
|
||||
NEXT_FINISH_BUTTON_ENABLED_PROPERTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables the Next/Finish button.
|
||||
* @param newValue <code>true</code> to enable the Next/Finish button,
|
||||
* <code>false</code> to disable it.
|
||||
*/
|
||||
void setNextFinishButtonEnabled(Boolean newValue) {
|
||||
|
||||
Boolean oldValue = getNextFinishButtonEnabled();
|
||||
if (newValue != oldValue) {
|
||||
buttonEnabledHashmap.put(
|
||||
NEXT_FINISH_BUTTON_ENABLED_PROPERTY, newValue);
|
||||
firePropertyChange(NEXT_FINISH_BUTTON_ENABLED_PROPERTY,
|
||||
oldValue, newValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the Cancel button is enabled.
|
||||
* @return <code>true</code> if the Cancel button is enabled,
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
Boolean getCancelButtonEnabled() {
|
||||
return (Boolean)buttonEnabledHashmap.get(
|
||||
CANCEL_BUTTON_ENABLED_PROPERTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables the Cancel button.
|
||||
* @param newValue <code>true</code> to enable the Cancel button,
|
||||
* <code>false</code> to disable it.
|
||||
*/
|
||||
void setCancelButtonEnabled(Boolean newValue) {
|
||||
|
||||
Boolean oldValue = getCancelButtonEnabled();
|
||||
if (newValue != oldValue) {
|
||||
buttonEnabledHashmap.put(CANCEL_BUTTON_ENABLED_PROPERTY, newValue);
|
||||
firePropertyChange(CANCEL_BUTTON_ENABLED_PROPERTY,
|
||||
oldValue, newValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a <tt>PropertyChangeListener</tt>
|
||||
* @param p The <tt>PropertyChangeListener</tt> to add.
|
||||
*/
|
||||
public void addPropertyChangeListener(PropertyChangeListener p) {
|
||||
propertyChangeSupport.addPropertyChangeListener(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a <tt>PropertyChangeListener</tt>
|
||||
* @param p The <tt>PropertyChangeListener</tt> to remove.
|
||||
*/
|
||||
public void removePropertyChangeListener(PropertyChangeListener p) {
|
||||
propertyChangeSupport.removePropertyChangeListener(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Informs all<tt>PropertyChangeListener</tt>s that the a given property
|
||||
* has changed.
|
||||
* @param propertyName The name of the property.
|
||||
* @param oldValue The old property value.
|
||||
* @param newValue The new property value.
|
||||
*/
|
||||
protected void firePropertyChange(String propertyName,
|
||||
Object oldValue, Object newValue) {
|
||||
propertyChangeSupport.firePropertyChange(propertyName,
|
||||
oldValue, newValue);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,170 +0,0 @@
|
||||
/*
|
||||
* 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.customcontrols.wizard;
|
||||
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
|
||||
/**
|
||||
* A base descriptor class used to reference a Component panel for the Wizard,
|
||||
* as well as provide general rules as to how the panel should behave.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class WizardPanelDescriptor {
|
||||
|
||||
private static final String DEFAULT_PANEL_IDENTIFIER
|
||||
= "defaultPanelIdentifier";
|
||||
|
||||
/**
|
||||
* Identifier returned by getNextPanelDescriptor() to indicate that this
|
||||
* is the last panel and the text of the 'Next' button should change to
|
||||
* 'Finish'.
|
||||
*/
|
||||
public static final FinishIdentifier FINISH = new FinishIdentifier();
|
||||
|
||||
private Wizard wizard;
|
||||
private Component targetPanel;
|
||||
private Object panelIdentifier;
|
||||
|
||||
/**
|
||||
* Default constructor. The id and the Component panel must be set
|
||||
* separately.
|
||||
*/
|
||||
public WizardPanelDescriptor() {
|
||||
panelIdentifier = DEFAULT_PANEL_IDENTIFIER;
|
||||
targetPanel = new JPanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts both the Object-based identifier and a
|
||||
* reference to the Component class which makes up the panel.
|
||||
* @param id Object-based identifier
|
||||
* @param panel A class which extends java.awt.Component that will be
|
||||
* inserted as a panel into the wizard dialog.
|
||||
*/
|
||||
public WizardPanelDescriptor(Object id, Component panel) {
|
||||
panelIdentifier = id;
|
||||
targetPanel = panel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns to java.awt.Component that serves as the actual panel.
|
||||
* @return A reference to the java.awt.Component that serves as the panel
|
||||
*/
|
||||
public final Component getPanelComponent() {
|
||||
return targetPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the panel's component as a class that extends java.awt.Component
|
||||
* @param panel java.awt.Component which serves as the wizard panel
|
||||
*/
|
||||
public final void setPanelComponent(Component panel) {
|
||||
targetPanel = panel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unique Object-based identifier for this panel descriptor.
|
||||
* @return The Object-based identifier
|
||||
*/
|
||||
public final Object getPanelDescriptorIdentifier() {
|
||||
return panelIdentifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Object-based identifier for this panel. The identifier must be unique
|
||||
* from all the other identifiers in the panel.
|
||||
* @param id Object-based identifier for this panel.
|
||||
*/
|
||||
public final void setPanelDescriptorIdentifier(Object id) {
|
||||
panelIdentifier = id;
|
||||
}
|
||||
|
||||
final void setWizard(Wizard w) {
|
||||
wizard = w;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the Wizard component.
|
||||
* @return The Wizard class hosting this descriptor.
|
||||
*/
|
||||
public final Wizard getWizard() {
|
||||
return wizard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the current WizardModel for this Wizard component.
|
||||
* @return The current WizardModel for this Wizard component.
|
||||
*/
|
||||
public WizardModel getWizardModel() {
|
||||
return wizard.getModel();
|
||||
}
|
||||
|
||||
// Override this method to provide an Object-based identifier
|
||||
// for the next panel.
|
||||
|
||||
/**
|
||||
* Override this class to provide the Object-based identifier of the panel
|
||||
* that the user should traverse to when the Next button is pressed. Note
|
||||
* that this method is only called when the button is actually pressed, so
|
||||
* that the panel can change the next panel's identifier dynamically at
|
||||
* runtime if necessary. Return null if the button should be disabled.
|
||||
* Returns FinishIdentfier if the button text should change to 'Finish' and
|
||||
* the dialog should end.
|
||||
* @return Object-based identifier.
|
||||
*/
|
||||
public Object getNextPanelDescriptor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Override this method to provide an Object-based identifier
|
||||
// for the previous panel.
|
||||
|
||||
/**
|
||||
* Override this class to provide the Object-based identifier of the panel
|
||||
* that the user should traverse to when the Back button is pressed. Note
|
||||
* that this method is only called when the button is actually pressed,
|
||||
* so that the panel can change the previous panel's identifier dynamically
|
||||
* at runtime if necessary. Return null if the button should be disabled.
|
||||
* @return Object-based identifier
|
||||
*/
|
||||
public Object getBackPanelDescriptor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to provide functionality that will be performed
|
||||
* just before the panel is to be displayed.
|
||||
*/
|
||||
public void aboutToDisplayPanel() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to perform functionality when the panel itself is
|
||||
* displayed.
|
||||
*/
|
||||
public void displayingPanel() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to perform functionality just before the panel is
|
||||
* to be hidden.
|
||||
*/
|
||||
public void aboutToHidePanel() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
static class FinishIdentifier {
|
||||
public static final String ID = "FINISH";
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* 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.customcontrols.wizard;
|
||||
|
||||
/**
|
||||
* A <tt>RuntimeException</tt>, which is thrown if the wizard doesn't find
|
||||
* the panel corresponding to a given <tt>WizardPanelDescriptor</tt>.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class WizardPanelNotFoundException extends RuntimeException {
|
||||
|
||||
public WizardPanelNotFoundException() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
#
|
||||
# wizard.properties
|
||||
#
|
||||
|
||||
backButtonText=Back
|
||||
nextButtonText=Next
|
||||
cancelButtonText=Cancel
|
||||
finishButtonText=Finish
|
||||
Loading…
Reference in new issue