mirror of https://github.com/sipwise/jitsi.git
parent
66564519b4
commit
ef52168563
@ -0,0 +1,172 @@
|
|||||||
|
/*
|
||||||
|
* 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.plugin.icqaccregwizz;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.GridLayout;
|
||||||
|
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.BoxLayout;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JCheckBox;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JPasswordField;
|
||||||
|
import javax.swing.JTextArea;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import javax.swing.event.DocumentEvent;
|
||||||
|
import javax.swing.event.DocumentListener;
|
||||||
|
|
||||||
|
import net.java.sip.communicator.service.gui.WizardContainer;
|
||||||
|
import net.java.sip.communicator.service.gui.WizardPage;
|
||||||
|
|
||||||
|
public class FirstWizardPage extends JPanel
|
||||||
|
implements WizardPage, DocumentListener {
|
||||||
|
|
||||||
|
public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
|
||||||
|
|
||||||
|
private JPanel uinPassPanel = new JPanel(new BorderLayout(10, 10));
|
||||||
|
|
||||||
|
private JPanel labelsPanel = new JPanel(new GridLayout(0, 1, 10, 10));
|
||||||
|
|
||||||
|
private JPanel valuesPanel = new JPanel(new GridLayout(0, 1, 10, 10));
|
||||||
|
|
||||||
|
private JLabel uinLabel = new JLabel(Resources.getString("uin"));
|
||||||
|
|
||||||
|
private JLabel passLabel = new JLabel(Resources.getString("password"));
|
||||||
|
|
||||||
|
private JTextField uinField = new JTextField();
|
||||||
|
|
||||||
|
private JPasswordField passField = new JPasswordField();
|
||||||
|
|
||||||
|
private JCheckBox rememberPassBox = new JCheckBox(
|
||||||
|
Resources.getString("rememberPassword"));
|
||||||
|
|
||||||
|
private JPanel registerPanel = new JPanel(new GridLayout(0, 1));
|
||||||
|
|
||||||
|
private JPanel buttonPanel = new JPanel(
|
||||||
|
new FlowLayout(FlowLayout.CENTER));
|
||||||
|
|
||||||
|
private JTextArea registerArea = new JTextArea(
|
||||||
|
Resources.getString("registerNewAccountText"));
|
||||||
|
|
||||||
|
private JButton registerButton = new JButton(
|
||||||
|
Resources.getString("registerNewAccount"));
|
||||||
|
|
||||||
|
private JPanel mainPanel = new JPanel();
|
||||||
|
|
||||||
|
private IcqAccountRegistration registration;
|
||||||
|
|
||||||
|
private WizardContainer wizardContainer;
|
||||||
|
|
||||||
|
public FirstWizardPage(IcqAccountRegistration registration,
|
||||||
|
WizardContainer wizardContainer) {
|
||||||
|
|
||||||
|
super(new BorderLayout());
|
||||||
|
|
||||||
|
this.wizardContainer = wizardContainer;
|
||||||
|
|
||||||
|
this.registration = registration;
|
||||||
|
|
||||||
|
this.setPreferredSize(new Dimension(300, 150));
|
||||||
|
|
||||||
|
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
|
||||||
|
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
this.uinField.getDocument().addDocumentListener(this);
|
||||||
|
|
||||||
|
labelsPanel.add(uinLabel);
|
||||||
|
labelsPanel.add(passLabel);
|
||||||
|
|
||||||
|
valuesPanel.add(uinField);
|
||||||
|
valuesPanel.add(passField);
|
||||||
|
|
||||||
|
uinPassPanel.add(labelsPanel, BorderLayout.WEST);
|
||||||
|
uinPassPanel.add(valuesPanel, BorderLayout.CENTER);
|
||||||
|
uinPassPanel.add(rememberPassBox, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
uinPassPanel.setBorder(BorderFactory
|
||||||
|
.createTitledBorder(Resources.getString("uinAndPassword")));
|
||||||
|
|
||||||
|
mainPanel.add(uinPassPanel);
|
||||||
|
|
||||||
|
this.buttonPanel.add(registerButton);
|
||||||
|
|
||||||
|
this.registerArea.setLineWrap(true);
|
||||||
|
this.registerArea.setWrapStyleWord(true);
|
||||||
|
|
||||||
|
this.registerPanel.add(registerArea);
|
||||||
|
this.registerPanel.add(buttonPanel);
|
||||||
|
|
||||||
|
this.registerPanel.setBorder(BorderFactory
|
||||||
|
.createTitledBorder(Resources.getString("registerNewAccount")));
|
||||||
|
|
||||||
|
mainPanel.add(registerPanel);
|
||||||
|
|
||||||
|
this.add(mainPanel, BorderLayout.NORTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getIdentifier() {
|
||||||
|
return FIRST_PAGE_IDENTIFIER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getNextPageIdentifier() {
|
||||||
|
return WizardPage.SUMMARY_PAGE_IDENTIFIER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getBackPageIdentifier() {
|
||||||
|
return WizardPage.DEFAULT_PAGE_IDENTIFIER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getWizardForm() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pageHiding() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pageShown() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pageShowing() {
|
||||||
|
this.setNextButtonAccordingToUIN();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pageNext() {
|
||||||
|
registration.setUin(uinField.getText());
|
||||||
|
registration.setPassword(passField.getPassword().toString());
|
||||||
|
registration.setRememberPassword(rememberPassBox.isSelected());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pageBack() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setNextButtonAccordingToUIN() {
|
||||||
|
if (uinField.getText() == null || uinField.getText().equals("")) {
|
||||||
|
wizardContainer.setNextFinishButtonEnabled(false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wizardContainer.setNextFinishButtonEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertUpdate(DocumentEvent e) {
|
||||||
|
this.setNextButtonAccordingToUIN();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeUpdate(DocumentEvent e) {
|
||||||
|
this.setNextButtonAccordingToUIN();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changedUpdate(DocumentEvent e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* 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.plugin.icqaccregwizz;
|
||||||
|
|
||||||
|
import net.java.sip.communicator.service.gui.AccountRegistrationWizardContainer;
|
||||||
|
import net.java.sip.communicator.service.gui.UIService;
|
||||||
|
import net.java.sip.communicator.service.gui.WizardContainer;
|
||||||
|
|
||||||
|
import org.osgi.framework.BundleActivator;
|
||||||
|
import org.osgi.framework.BundleContext;
|
||||||
|
import org.osgi.framework.ServiceReference;
|
||||||
|
|
||||||
|
public class IcqAccRegWizzActivator implements BundleActivator {
|
||||||
|
|
||||||
|
public void start(BundleContext bundleContext) throws Exception {
|
||||||
|
ServiceReference uiServiceRef = bundleContext
|
||||||
|
.getServiceReference(UIService.class.getName());
|
||||||
|
|
||||||
|
UIService uiService
|
||||||
|
= (UIService) bundleContext.getService(uiServiceRef);
|
||||||
|
|
||||||
|
AccountRegistrationWizardContainer wizardContainer
|
||||||
|
= uiService.getAccountRegWizardContainer();
|
||||||
|
|
||||||
|
IcqAccountRegistrationWizard icqWizard
|
||||||
|
= new IcqAccountRegistrationWizard(wizardContainer);
|
||||||
|
|
||||||
|
wizardContainer.addAccountRegistrationWizard(icqWizard);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stop(BundleContext bundleContext) throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* 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.plugin.icqaccregwizz;
|
||||||
|
|
||||||
|
public class IcqAccountRegistration {
|
||||||
|
|
||||||
|
private String uin;
|
||||||
|
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
private boolean rememberPassword;
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRememberPassword() {
|
||||||
|
return rememberPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRememberPassword(boolean rememberPassword) {
|
||||||
|
this.rememberPassword = rememberPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUin() {
|
||||||
|
return uin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUin(String uin) {
|
||||||
|
this.uin = uin;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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.plugin.icqaccregwizz;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Hashtable;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import net.java.sip.communicator.service.gui.AccountRegistrationWizard;
|
||||||
|
import net.java.sip.communicator.service.gui.AccountRegistrationWizardContainer;
|
||||||
|
import net.java.sip.communicator.service.gui.WizardContainer;
|
||||||
|
|
||||||
|
public class IcqAccountRegistrationWizard implements AccountRegistrationWizard {
|
||||||
|
|
||||||
|
private FirstWizardPage firstWizardPage;
|
||||||
|
|
||||||
|
private ArrayList pages = new ArrayList();
|
||||||
|
|
||||||
|
private IcqAccountRegistration registration
|
||||||
|
= new IcqAccountRegistration();
|
||||||
|
|
||||||
|
public IcqAccountRegistrationWizard(WizardContainer wizardContainer) {
|
||||||
|
firstWizardPage = new FirstWizardPage(registration, wizardContainer);
|
||||||
|
|
||||||
|
pages.add(firstWizardPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getIcon() {
|
||||||
|
return Resources.getImage(Resources.ICQ_LOGO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProtocolName() {
|
||||||
|
return Resources.getString("protocolName");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProtocolDescription() {
|
||||||
|
return Resources.getString("protocolDescription");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Iterator getPages() {
|
||||||
|
return pages.iterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Iterator getSummary() {
|
||||||
|
Hashtable summaryTable = new Hashtable();
|
||||||
|
|
||||||
|
summaryTable.put("UIN", registration.getUin());
|
||||||
|
summaryTable.put("Remember password",
|
||||||
|
new Boolean(registration.isRememberPassword()));
|
||||||
|
|
||||||
|
return summaryTable.entrySet().iterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finish() {
|
||||||
|
System.out.println("FINISH!!!!!!!!!!!!!!!!!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* 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.plugin.icqaccregwizz;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.MissingResourceException;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
import net.java.sip.communicator.util.Logger;
|
||||||
|
/**
|
||||||
|
* The Messages class manages the access to the internationalization
|
||||||
|
* properties files.
|
||||||
|
* @author Yana Stamcheva
|
||||||
|
*/
|
||||||
|
public class Resources {
|
||||||
|
|
||||||
|
private static Logger log = Logger.getLogger(Resources.class);
|
||||||
|
|
||||||
|
private static final String BUNDLE_NAME
|
||||||
|
= "net.java.sip.communicator.plugin.icqaccregwizz.resources";
|
||||||
|
|
||||||
|
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
|
||||||
|
.getBundle(BUNDLE_NAME);
|
||||||
|
|
||||||
|
public static ImageID ICQ_LOGO = new ImageID("protocolIcon");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an internationalized string corresponding to the given key.
|
||||||
|
* @param key The key of the string.
|
||||||
|
* @return An internationalized string corresponding to the given key.
|
||||||
|
*/
|
||||||
|
public static String getString(String key) {
|
||||||
|
try {
|
||||||
|
return RESOURCE_BUNDLE.getString(key);
|
||||||
|
|
||||||
|
} catch (MissingResourceException e) {
|
||||||
|
|
||||||
|
return '!' + key + '!';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads an image from a given image identifier.
|
||||||
|
* @param imageID The identifier of the image.
|
||||||
|
* @return The image for the given identifier.
|
||||||
|
*/
|
||||||
|
public static byte[] getImage(ImageID imageID) {
|
||||||
|
byte[] image = new byte[100000];
|
||||||
|
|
||||||
|
String path = Resources.getString(imageID.getId());
|
||||||
|
try {
|
||||||
|
Resources.class.getClassLoader()
|
||||||
|
.getResourceAsStream(path).read(image);
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("Failed to load image:" + path, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the Image Identifier.
|
||||||
|
*/
|
||||||
|
public static class ImageID {
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private ImageID(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* 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.plugin.icqaccregwizz;
|
||||||
|
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import net.java.sip.communicator.service.gui.WizardPage;
|
||||||
|
|
||||||
|
public class SecondWizardPage extends JPanel
|
||||||
|
implements WizardPage {
|
||||||
|
|
||||||
|
public static final String SECOND_PAGE_IDENTIFIER = "SecondPageIdentifier";
|
||||||
|
|
||||||
|
public Object getIdentifier() {
|
||||||
|
return SECOND_PAGE_IDENTIFIER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getNextPageIdentifier() {
|
||||||
|
return FINISH_PAGE_IDENTIFIER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getBackPageIdentifier() {
|
||||||
|
return FirstWizardPage.FIRST_PAGE_IDENTIFIER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getWizardForm() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pageHiding() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pageShown() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pageShowing() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pageNext() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pageBack() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
Bundle-Activator: net.java.sip.communicator.plugin.icqaccregwizz.IcqAccRegWizzActivator
|
||||||
|
Bundle-Name: ICQ account registration wizard
|
||||||
|
Bundle-Description: ICQ account registration wizard.
|
||||||
|
Bundle-Vendor: sip-communicator.org
|
||||||
|
Bundle-Version: 0.0.1
|
||||||
|
Import-Package: org.osgi.framework,
|
||||||
|
net.java.sip.communicator.util,
|
||||||
|
net.java.sip.communicator.service.configuration,
|
||||||
|
net.java.sip.communicator.service.configuration.event,
|
||||||
|
net.java.sip.communicator.service.protocol,
|
||||||
|
net.java.sip.communicator.service.protocol.icqconstants,
|
||||||
|
net.java.sip.communicator.service.protocol.event,
|
||||||
|
net.java.sip.communicator.service.contactlist,
|
||||||
|
net.java.sip.communicator.service.contactlist.event,
|
||||||
|
net.java.sip.communicator.service.gui,
|
||||||
|
net.java.sip.communicator.service.gui.event,
|
||||||
|
javax.swing,
|
||||||
|
javax.swing.event,
|
||||||
|
javax.swing.table,
|
||||||
|
javax.swing.text,
|
||||||
|
javax.swing.text.html,
|
||||||
|
javax.accessibility,
|
||||||
|
javax.swing.plaf,
|
||||||
|
javax.swing.plaf.metal,
|
||||||
|
javax.swing.plaf.basic,
|
||||||
|
javax.imageio,
|
||||||
|
javax.swing.filechooser,
|
||||||
|
javax.swing.tree,
|
||||||
|
javax.swing.undo,
|
||||||
|
javax.swing.event,
|
||||||
|
javax.swing.border
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
protocolName=ICQ
|
||||||
|
protocolDescription=The AOL ICQ service protocol
|
||||||
|
uin=ICQ UIN:
|
||||||
|
password=Password:
|
||||||
|
rememberPassword=Remember password
|
||||||
|
uinAndPassword=UIN and Password
|
||||||
|
registerNewAccount=Register new account
|
||||||
|
registerNewAccountText=In case you don't have an ICQ account, click on this button to create a new one.
|
||||||
|
|
||||||
|
protocolIcon=net/java/sip/communicator/plugin/icqaccregwizz/resources/Icq.png
|
||||||
|
After Width: | Height: | Size: 6.2 KiB |
Loading…
Reference in new issue