diff options
Diffstat (limited to 'src/net/java/sip/communicator/plugin/zeroconfaccregwizz')
6 files changed, 0 insertions, 1143 deletions
diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java deleted file mode 100644 index 0f8815c..0000000 --- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/FirstWizardPage.java +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Jitsi, the OpenSource Java VoIP and Instant Messaging client. - * - * Copyright @ 2015 Atlassian Pty Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.java.sip.communicator.plugin.zeroconfaccregwizz; - -import java.awt.*; - -import javax.swing.*; -import javax.swing.event.*; - -import net.java.sip.communicator.service.gui.*; -import net.java.sip.communicator.service.protocol.*; -import net.java.sip.communicator.plugin.desktoputil.*; - -/** - * The <tt>FirstWizardPage</tt> is the page, where user could enter the user ID - * and the password of the account. - * - * @author Christian Vincenot - * @author Maxime Catelin - */ -public class FirstWizardPage - extends TransparentPanel - implements WizardPage, - DocumentListener -{ - /** - * Serial version UID. - */ - private static final long serialVersionUID = 0L; - - public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier"; - - private JPanel userPassPanel = new TransparentPanel(new BorderLayout(10, 10)); - - private JPanel labelsPanel = new TransparentPanel(); - - private JPanel valuesPanel = new TransparentPanel(); - - private JLabel userID = new JLabel( - Resources.getString("plugin.zeroaccregwizz.USERID")); - - /* TEMPORARY : HARD CODED !! Should be added to Resource */ - private JLabel firstLabel - = new JLabel(Resources.getString("plugin.zeroaccregwizz.FIRST_NAME")); - private JLabel lastLabel - = new JLabel(Resources.getString("plugin.zeroaccregwizz.LAST_NAME")); - private JLabel mailLabel - = new JLabel(Resources.getString("plugin.zeroaccregwizz.EMAIL")); - - private JPanel emptyPanel = new TransparentPanel(); - private JPanel emptyPanel2 = new TransparentPanel(); - private JPanel emptyPanel3 = new TransparentPanel(); - private JPanel emptyPanel4 = new TransparentPanel(); - - private JLabel userIDExampleLabel = new JLabel("Ex: Bill@microsoft"); - private JLabel firstExampleLabel = new JLabel("Ex: Bill"); - private JLabel lastExampleLabel = new JLabel("Ex: Gates"); - private JLabel mailExampleLabel = new JLabel("Ex: Bill@microsoft.com"); - - private JTextField userIDField = new TrimTextField(); - private JTextField firstField = new JTextField(); - private JTextField lastField = new JTextField(); - private JTextField mailField = new JTextField(); - - private JCheckBox rememberContacts = - new SIPCommCheckBox(Resources.getString( - "plugin.zeroaccregwizz.REMEMBER_CONTACTS")); - - private JPanel mainPanel = new TransparentPanel(); - - private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER; - - private ZeroconfAccountRegistrationWizard wizard; - - private boolean isCommitted = false; - - /** - * Creates an instance of <tt>FirstWizardPage</tt>. - * - * @param wizard the parent wizard - */ - public FirstWizardPage(ZeroconfAccountRegistrationWizard wizard) - { - - super(new BorderLayout()); - - this.wizard = wizard; - - mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); - - this.init(); - - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - - this.labelsPanel.setLayout( - new BoxLayout(labelsPanel, BoxLayout.Y_AXIS)); - - this.valuesPanel.setLayout( - new BoxLayout(valuesPanel, BoxLayout.Y_AXIS)); - } - - /** - * Initializes all panels, buttons, etc. - */ - private void init() - { - this.userIDField.getDocument().addDocumentListener(this); - this.firstField.getDocument().addDocumentListener(this); - this.rememberContacts.setSelected(false); - - // not used so disable it for the moment - this.rememberContacts.setEnabled(false); - - this.userIDExampleLabel.setForeground(Color.GRAY); - this.userIDExampleLabel.setFont( - userIDExampleLabel.getFont().deriveFont(8)); - this.emptyPanel.setMaximumSize(new Dimension(40, 35)); - this.userIDExampleLabel.setBorder( - BorderFactory.createEmptyBorder(0, 0, 8,0)); - - this.firstExampleLabel.setForeground(Color.GRAY); - this.firstExampleLabel.setFont( - firstExampleLabel.getFont().deriveFont(8)); - this.emptyPanel2.setMaximumSize(new Dimension(40, 35)); - this.firstExampleLabel.setBorder( - BorderFactory.createEmptyBorder(0, 0, 8,0)); - - this.lastExampleLabel.setForeground(Color.GRAY); - this.lastExampleLabel.setFont( - lastExampleLabel.getFont().deriveFont(8)); - this.emptyPanel3.setMaximumSize(new Dimension(40, 35)); - this.lastExampleLabel.setBorder( - BorderFactory.createEmptyBorder(0, 0, 8,0)); - - this.mailExampleLabel.setForeground(Color.GRAY); - this.mailExampleLabel.setFont( - mailExampleLabel.getFont().deriveFont(8)); - this.emptyPanel4.setMaximumSize(new Dimension(40, 35)); - this.mailExampleLabel.setBorder( - BorderFactory.createEmptyBorder(0, 0, 8,0)); - - labelsPanel.add(userID); - labelsPanel.add(emptyPanel); - labelsPanel.add(firstLabel); - labelsPanel.add(emptyPanel2); - labelsPanel.add(lastLabel); - labelsPanel.add(emptyPanel3); - labelsPanel.add(mailLabel); - - valuesPanel.add(userIDField); - valuesPanel.add(userIDExampleLabel); - valuesPanel.add(firstField); - valuesPanel.add(firstExampleLabel); - valuesPanel.add(lastField); - valuesPanel.add(lastExampleLabel); - valuesPanel.add(mailField); - valuesPanel.add(mailExampleLabel); - - userPassPanel.add(labelsPanel, BorderLayout.WEST); - userPassPanel.add(valuesPanel, BorderLayout.CENTER); - userPassPanel.add(rememberContacts, BorderLayout.SOUTH); - - userPassPanel.setBorder(BorderFactory.createTitledBorder( - Resources.getString("plugin.zeroaccregwizz.USERID_AND_PASSWORD"))); - - this.add(userPassPanel, BorderLayout.NORTH); - } - - /** - * Implements the <code>WizardPage.getIdentifier</code> to return - * this page identifier. - * - * @return the Identifier of the first page in this wizard. - */ - public Object getIdentifier() - { - return FIRST_PAGE_IDENTIFIER; - } - - /** - * Implements the <code>WizardPage.getNextPageIdentifier</code> to return - * the next page identifier - the summary page. - * - * @return the identifier of the page following this one. - */ - public Object getNextPageIdentifier() - { - return nextPageIdentifier; - } - - /** - * Implements the <code>WizardPage.getBackPageIdentifier</code> to return - * the back identifier. In this case it's null because this is the first - * wizard page. - * - * @return the identifier of the previous wizard page - */ - public Object getBackPageIdentifier() - { - return null; - } - - /** - * Implements the <code>WizardPage.getWizardForm</code> to return - * this panel. - * - * @return the component to be displayed in this wizard page. - */ - public Object getWizardForm() - { - return this; - } - - /** - * Before this page is displayed enables or disables the "Next" wizard - * button according to whether the UserID field is empty. - */ - public void pageShowing() - { - this.setNextButtonAccordingToUserID(); - } - - /** - * Saves the user input when the "Next" wizard buttons is clicked. - */ - public void commitPage() - { - ZeroconfAccountRegistration registration - = wizard.getRegistration(); - - String userID = userIDField.getText(); - - if(userID == null || userID.trim().length() == 0) - throw new IllegalStateException("No user ID provided."); - - registration.setUserID(userID); - registration.setFirst(firstField.getText()); - registration.setLast(lastField.getText()); - registration.setMail(mailField.getText()); - - registration.setRememberContacts(rememberContacts.isSelected()); - - nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER; - - isCommitted = true; - } - - /** - * Enables or disables the "Next" wizard button according to whether the - * User ID field is empty. - */ - private void setNextButtonAccordingToUserID() - { - if (userIDField.getText() == null || userIDField.getText().equals("")) - { - wizard.getWizardContainer().setNextFinishButtonEnabled(false); - } - else - { - wizard.getWizardContainer().setNextFinishButtonEnabled(true); - } - } - - /** - * Handles the <tt>DocumentEvent</tt> triggered when user types in the - * User ID field. Enables or disables the "Next" wizard button according to - * whether the User ID field is empty. - * - * @param event the event containing the update. - */ - public void insertUpdate(DocumentEvent event) - { - this.setNextButtonAccordingToUserID(); - } - - /** - * Handles the <tt>DocumentEvent</tt> triggered when user deletes letters - * from the UserID field. Enables or disables the "Next" wizard button - * according to whether the UserID field is empty. - * - * @param event the event containing the update. - */ - public void removeUpdate(DocumentEvent event) - { - this.setNextButtonAccordingToUserID(); - } - - /** - * Implemented from Wizard interface - * @param event Event that happened - */ - public void changedUpdate(DocumentEvent event) - { - } - - /** - * Created to - */ - public void pageHiding() - { - } - - /** - * Implemented from Wizard interface - */ - public void pageShown() - { - } - - /** - * Implemented from Wizard interface - */ - public void pageBack() - { - } - - /** - * Fills the UserID field in this panel with the data comming - * from the given protocolProvider. - * @param protocolProvider The <tt>ProtocolProviderService</tt> to load the - * data from. - */ - public void loadAccount(ProtocolProviderService protocolProvider) - { - AccountID accountID = protocolProvider.getAccountID(); - - this.userIDField.setEnabled(false); - this.userIDField.setText(accountID.getUserID()); - this.firstField.setText(accountID.getAccountPropertyString("first")); - this.lastField.setText(accountID.getAccountPropertyString("last")); - this.mailField.setText(accountID.getAccountPropertyString("mail")); - - boolean remember = accountID - .getAccountPropertyBoolean("rememberContacts", true); - if (remember) - this.rememberContacts.setSelected(true); - } - - public Object getSimpleForm() - { - JPanel simplePanel = new TransparentPanel(new BorderLayout(10, 10)); - - simplePanel.add(userID, BorderLayout.WEST); - simplePanel.add(userIDField, BorderLayout.CENTER); - - return simplePanel; - } - - public boolean isCommitted() - { - return isCommitted; - } -} diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/Resources.java b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/Resources.java deleted file mode 100644 index 83b6131..0000000 --- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/Resources.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Jitsi, the OpenSource Java VoIP and Instant Messaging client. - * - * Copyright @ 2015 Atlassian Pty Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.java.sip.communicator.plugin.zeroconfaccregwizz; - -import net.java.sip.communicator.service.resources.*; - -import org.jitsi.service.resources.*; - -/** - * The Resources class manages the access to the internationalization - * properties files and the images properties file. - * - * @author Christian Vincenot - * @author Maxime Catelin - */ -public class Resources -{ - private static ResourceManagementService resourcesService; - - public static ImageID ZEROCONF_LOGO - = new ImageID("service.protocol.zeroconf.ZEROCONF_16x16"); - - public static ImageID PAGE_IMAGE - = new ImageID("service.protocol.zeroconf.ZEROCONF_64x64"); - - /** - * 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) - { - return getResources().getI18NString(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) - { - return getResources().getImageInBytes(imageID.getId()); - } - - /** - * Returns the <tt>ResourceManagementService</tt>. - * - * @return the <tt>ResourceManagementService</tt>. - */ - public static ResourceManagementService getResources() - { - if (resourcesService == null) - resourcesService = - ResourceManagementServiceUtils - .getService(ZeroconfAccRegWizzActivator.bundleContext); - return resourcesService; - } -} diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccRegWizzActivator.java deleted file mode 100644 index 352796b..0000000 --- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccRegWizzActivator.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Jitsi, the OpenSource Java VoIP and Instant Messaging client. - * - * Copyright @ 2015 Atlassian Pty Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.java.sip.communicator.plugin.zeroconfaccregwizz; - -import java.util.*; - -import net.java.sip.communicator.service.gui.*; -import net.java.sip.communicator.service.protocol.*; -import net.java.sip.communicator.util.*; - -import org.osgi.framework.*; - -/** - * Registers the <tt>ZeroconfAccountRegistrationWizard</tt> in the UI Service. - * - * @author Christian Vincenot - * @author Maxime Catelin - */ -public class ZeroconfAccRegWizzActivator - implements BundleActivator -{ - private static final Logger logger = - Logger.getLogger(ZeroconfAccRegWizzActivator.class); - - /** - * A currently valid bundle context. - */ - public static BundleContext bundleContext; - - private static UIService uiService; - - /** - * Starts this bundle. - * @param bc the currently valid <tt>BundleContext</tt>. - */ - public void start(BundleContext bc) - { - if (logger.isInfoEnabled()) - logger.info("Loading zeroconf account wizard."); - - bundleContext = bc; - - ServiceReference uiServiceRef = bundleContext - .getServiceReference(UIService.class.getName()); - - uiService = (UIService) bundleContext.getService(uiServiceRef); - - WizardContainer wizardContainer - = uiService.getAccountRegWizardContainer(); - - ZeroconfAccountRegistrationWizard zeroconfWizard - = new ZeroconfAccountRegistrationWizard(wizardContainer); - - Hashtable<String, String> containerFilter - = new Hashtable<String, String>(); - - containerFilter.put( - ProtocolProviderFactory.PROTOCOL, - ProtocolNames.ZEROCONF); - - bundleContext.registerService( - AccountRegistrationWizard.class.getName(), - zeroconfWizard, - containerFilter); - - if (logger.isInfoEnabled()) - logger.info("Zeroconf account registration wizard [STARTED]."); - } - - /** - * Called when this bundle is stopped so the Framework can perform the - * bundle-specific activities necessary to stop the bundle. - * - * @param context The execution context of the bundle being stopped. - */ - public void stop(BundleContext context) - { - - } - - /** - * Returns the <tt>ProtocolProviderFactory</tt> for the Zeroconf protocol. - * @return the <tt>ProtocolProviderFactory</tt> for the Zeroconf protocol - */ - public static ProtocolProviderFactory getZeroconfProtocolProviderFactory() - { - ServiceReference[] serRefs = null; - String osgiFilter - = "(" - + ProtocolProviderFactory.PROTOCOL - + "=" - + ProtocolNames.ZEROCONF - + ")"; - - try - { - serRefs - = bundleContext.getServiceReferences( - ProtocolProviderFactory.class.getName(), - osgiFilter); - } - catch (InvalidSyntaxException ex) - { - logger.error(ex); - } - - return - (serRefs == null) - ? null - : (ProtocolProviderFactory) - bundleContext.getService(serRefs[0]); - } - - /** - * Returns the bundleContext that we received when we were started. - * @return a currently valid instance of a bundleContext. - */ - public BundleContext getBundleContext() - { - return bundleContext; - } - - /** - * Returns the <tt>UIService</tt>. - * - * @return the <tt>UIService</tt> - */ - public static UIService getUIService() - { - return uiService; - } -} diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistration.java b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistration.java deleted file mode 100644 index df4f6f5..0000000 --- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistration.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Jitsi, the OpenSource Java VoIP and Instant Messaging client. - * - * Copyright @ 2015 Atlassian Pty Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.java.sip.communicator.plugin.zeroconfaccregwizz; - -/** - * The <tt>ZeroconfAccountRegistration</tt> is used to store - * all user input data - * through the <tt>ZeroconfAccountRegistrationWizard</tt>. - * - * @author Christian Vincenot - * @author Maxime Catelin - */ -public class ZeroconfAccountRegistration -{ - private String userID; - private String first; - private String last; - private String mail; - private boolean rememberContacts; - - /** - * Returns the User ID of the zeroconf registration account. - * @return the User ID of the zeroconf registration account. - */ - public String getUserID() - { - return userID; - } - - /** - * Sets the user ID of the zeroconf registration account. - * @param userID the userID of the zeroconf registration account. - */ - public void setUserID(String userID) - { - this.userID = userID; - } - - /** - * Returns the password of the Zeroconf registration account. - * @return the password of the Zeroconf registration account. - */ - public String getFirst() - { - return first; - } - - /** - * Sets the password of the Zeroconf registration account. - * @param first first name - */ - public void setFirst(String first) - { - this.first = first; - } - - /** - * Returns <tt>true</tt> if password has to remembered, <tt>false</tt> - * otherwise. - * @return <tt>true</tt> if password has to remembered, <tt>false</tt> - * otherwise. - */ - public boolean isRememberContacts() - { - return rememberContacts; - } - - /** - * Sets the rememberPassword value of this Zeroconf account registration. - * @param rememberContacts true if we want to remember the - * contacts we meet, false otherwise - */ - public void setRememberContacts(boolean rememberContacts) - { - this.rememberContacts = rememberContacts; - } - - /** - * Returns the last name - * @return last name - */ - public String getLast() - { - return last; - } - - /** - * Sets the last name - * @param last last name - */ - public void setLast(String last) - { - this.last = last; - } - - /** - * Returns the mail address - * @return mail address - */ - public String getMail() - { - return mail; - } - - /** - * Sets the mail address - * @param mail mail address - */ - public void setMail(String mail) - { - this.mail = mail; - } - - -} diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java deleted file mode 100644 index 79f085f..0000000 --- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/ZeroconfAccountRegistrationWizard.java +++ /dev/null @@ -1,392 +0,0 @@ -/* - * Jitsi, the OpenSource Java VoIP and Instant Messaging client. - * - * Copyright @ 2015 Atlassian Pty Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.java.sip.communicator.plugin.zeroconfaccregwizz; - -import java.awt.*; -import java.util.*; - -import net.java.sip.communicator.service.gui.*; -import net.java.sip.communicator.service.protocol.*; -import net.java.sip.communicator.util.*; - -import org.osgi.framework.*; - -/** - * The <tt>ZeroconfAccountRegistrationWizard</tt> is an implementation of the - * <tt>AccountRegistrationWizard</tt> for the Zeroconf protocol. It allows - * the user to create and configure a new Zeroconf account. - * - * @author Christian Vincenot - * @author Maxime Catelin - */ -public class ZeroconfAccountRegistrationWizard - extends DesktopAccountRegistrationWizard -{ - private Logger logger - = Logger.getLogger(ZeroconfAccountRegistrationWizard.class); - - /** - * The first page of the zeroconf account registration wizard. - */ - private FirstWizardPage firstWizardPage; - - /** - * The object that we use to store details on an account that we will be - * creating. - */ - private ZeroconfAccountRegistration registration - = new ZeroconfAccountRegistration(); - - private ProtocolProviderService protocolProvider; - - /** - * Creates an instance of <tt>ZeroconfAccountRegistrationWizard</tt>. - * @param wizardContainer the wizard container, where this wizard - * is added - */ - public ZeroconfAccountRegistrationWizard(WizardContainer wizardContainer) - { - setWizardContainer(wizardContainer); - - wizardContainer - .setFinishButtonText(Resources.getString("service.gui.SIGN_IN")); - } - - /** - * Implements the <code>AccountRegistrationWizard.getIcon</code> method. - * Returns the icon to be used for this wizard. - * @return byte[] - */ - @Override - public byte[] getIcon() - { - return Resources.getImage(Resources.ZEROCONF_LOGO); - } - - /** - * Implements the <code>AccountRegistrationWizard.getPageImage</code> method. - * Returns the image used to decorate the wizard page - * - * @return byte[] the image used to decorate the wizard page - */ - @Override - public byte[] getPageImage() - { - return Resources.getImage(Resources.PAGE_IMAGE); - } - - /** - * Implements the <code>AccountRegistrationWizard.getProtocolName</code> - * method. Returns the protocol name for this wizard. - * @return String - */ - @Override - public String getProtocolName() - { - return Resources.getString("plugin.zeroaccregwizz.PROTOCOL_NAME"); - } - - /** - * Implements the <code>AccountRegistrationWizard.getProtocolDescription - * </code> method. Returns the description of the protocol for this wizard. - * @return String - */ - @Override - public String getProtocolDescription() - { - return Resources.getString("plugin.zeroaccregwizz.PROTOCOL_DESCRIPTION"); - } - - /** - * Returns the set of pages contained in this wizard. - * @return Iterator - */ - @Override - public Iterator<WizardPage> getPages() - { - java.util.List<WizardPage> pages = new ArrayList<WizardPage>(); - - // create new registration, our container needs the pages - // this means this is a new wizard and we must reset all data - // it will be invoked and when the wizard cleans and unregister - // our pages, but this fix don't hurt in this situation. - this.registration = new ZeroconfAccountRegistration(); - - firstWizardPage = new FirstWizardPage(this); - - pages.add(firstWizardPage); - - return pages.iterator(); - } - - /** - * Returns the set of data that user has entered through this wizard. - * @return Iterator - */ - @Override - public Iterator<Map.Entry<String, String>> getSummary() - { - Hashtable<String, String> summaryTable = new Hashtable<String, String>(); - - summaryTable.put("User ID", registration.getUserID()); - summaryTable.put("First Name", registration.getFirst()); - summaryTable.put("Last Name", registration.getLast()); - summaryTable.put("Mail Address", registration.getMail()); - summaryTable.put("Remember Bonjour contacts?", - Boolean.toString(registration.isRememberContacts())); - - return summaryTable.entrySet().iterator(); - } - - /** - * Defines the operations that will be executed when the user clicks on - * the wizard "Signin" button. - * - * @return the created <tt>ProtocolProviderService</tt> corresponding to the - * new account - * @throws OperationFailedException if the operation didn't succeed - */ - @Override - public ProtocolProviderService signin() - throws OperationFailedException - { - firstWizardPage.commitPage(); - - return signin(registration.getUserID(), null); - } - - /** - * Defines the operations that will be executed when the user clicks on - * the wizard "Signin" button. - * - * @param userName the user name to sign in with - * @param password the password to sign in with - * @return the created <tt>ProtocolProviderService</tt> corresponding to the - * new account - * @throws OperationFailedException if the operation didn't succeed - */ - @Override - public ProtocolProviderService signin(String userName, String password) - throws OperationFailedException - { - ProtocolProviderFactory factory - = ZeroconfAccRegWizzActivator.getZeroconfProtocolProviderFactory(); - - return this.installAccount(factory, - userName); - } - - /** - * Creates an account for the given user and password. - * - * @return the <tt>ProtocolProviderService</tt> for the new account. - * @param providerFactory the ProtocolProviderFactory which will create - * the account - * @param user the user identifier - */ - public ProtocolProviderService installAccount( - ProtocolProviderFactory providerFactory, - String user) - throws OperationFailedException - { - Hashtable<String, String> accountProperties - = new Hashtable<String, String>(); - - accountProperties.put(ProtocolProviderFactory.ACCOUNT_ICON_PATH, - "resources/images/protocol/zeroconf/zeroconf32x32.png"); - - accountProperties.put("first", registration.getFirst()); - accountProperties.put("last", registration.getLast()); - accountProperties.put("mail", registration.getMail()); - - accountProperties.put( - ProtocolProviderFactory.NO_PASSWORD_REQUIRED, - new Boolean(true).toString()); - - accountProperties.put("rememberContacts", - new Boolean(registration.isRememberContacts()).toString()); - - if (isModification()) - { - providerFactory.uninstallAccount(protocolProvider.getAccountID()); - this.protocolProvider = null; - setModification(false); - } - - try - { - AccountID accountID = providerFactory.installAccount( - user, accountProperties); - - ServiceReference serRef = providerFactory - .getProviderForAccount(accountID); - - protocolProvider = (ProtocolProviderService) - ZeroconfAccRegWizzActivator.bundleContext - .getService(serRef); - } - catch (IllegalStateException exc) - { - logger.warn(exc.getMessage()); - - throw new OperationFailedException( - "Account already exists.", - OperationFailedException.IDENTIFICATION_CONFLICT); - } - catch (Exception exc) - { - logger.warn(exc.getMessage()); - - throw new OperationFailedException( - "Failed to add account", - OperationFailedException.GENERAL_ERROR); - } - - - return protocolProvider; - } - - /** - * Fills the UserID and Password fields in this panel with the data coming - * from the given protocolProvider. - * @param protocolProvider The <tt>ProtocolProviderService</tt> to load the - * data from. - */ - @Override - public void loadAccount(ProtocolProviderService protocolProvider) - { - setModification(true); - - this.protocolProvider = protocolProvider; - - this.registration = new ZeroconfAccountRegistration(); - - this.firstWizardPage.loadAccount(protocolProvider); - } - - /** - * Returns the registration object, which will store all the data through - * the wizard. - * - * @return the registration object, which will store all the data through - * the wizard - */ - public ZeroconfAccountRegistration getRegistration() - { - return registration; - } - - /** - * Returns the size of this wizard. - * @return the size of this wizard - */ - @Override - public Dimension getSize() - { - return new Dimension(600, 500); - } - - /** - * Returns the identifier of the page to show first in the wizard. - * @return the identifier of the page to show first in the wizard. - */ - @Override - public Object getFirstPageIdentifier() - { - return firstWizardPage.getIdentifier(); - } - - /** - * Returns the identifier of the page to show last in the wizard. - * @return the identifier of the page to show last in the wizard. - */ - @Override - public Object getLastPageIdentifier() - { - return firstWizardPage.getIdentifier(); - } - - /** - * Returns the password label for the simplified account registration form. - * @return the password label for the simplified account registration form. - */ - public String getPasswordLabel() - { - return Resources.getString("service.gui.PASSWORD"); - } - - /** - * Returns the user name label for the simplified account registration - * form. - * - * @return the user name label for the simplified account registration - * form. - */ - public String getUserNameLabel() - { - return Resources.getString("userID"); - } - - /** - * Returns an example string, which should indicate to the user how the - * user name should look like. - * @return an example string, which should indicate to the user how the - * user name should look like. - */ - @Override - public String getUserNameExample() - { - return null; - } - - /** - * Indicates whether this wizard enables the simple "sign in" form shown - * when the user opens the application for the first time. The simple - * "sign in" form allows user to configure her account in one click, just - * specifying her username and password and leaving any other configuration - * as by default. - * @return <code>true</code> if the simple "Sign in" form is enabled or - * <code>false</code> otherwise. - */ - @Override - public boolean isSimpleFormEnabled() - { - return false; - } - - /** - * Returns a simple account registration form that would be the first form - * shown to the user. Only if the user needs more settings she'll choose - * to open the advanced wizard, consisted by all pages. - * - * @param isCreateAccount indicates if the simple form should be opened as - * a create account form or as a login form - * @return a simple account registration form - */ - @Override - public Object getSimpleForm(boolean isCreateAccount) - { - // when creating first wizard page, create and new - // AccountRegistration to avoid reusing old instances and - // data left from old registrations - this.registration = new ZeroconfAccountRegistration(); - - firstWizardPage = new FirstWizardPage(this); - return firstWizardPage.getSimpleForm(); - } -} diff --git a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/zeroconfaccregwizz.manifest.mf b/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/zeroconfaccregwizz.manifest.mf deleted file mode 100644 index 57a863b..0000000 --- a/src/net/java/sip/communicator/plugin/zeroconfaccregwizz/zeroconfaccregwizz.manifest.mf +++ /dev/null @@ -1,32 +0,0 @@ -Bundle-Activator: net.java.sip.communicator.plugin.zeroconfaccregwizz.ZeroconfAccRegWizzActivator -Bundle-Name: Zeroconf account registration wizard -Bundle-Description: Zeroconf account registration wizard. -Bundle-Vendor: jitsi.org -Bundle-Version: 0.0.1 -Bundle-SymbolicName: net.java.sip.communicator.plugin.zeroconfaccregwizz -Import-Package: org.osgi.framework, - net.java.sip.communicator.service.browserlauncher, - org.jitsi.service.configuration, - 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, - net.java.sip.communicator.service.protocol, - net.java.sip.communicator.service.protocol.event, - org.jitsi.service.resources, net.java.sip.communicator.service.resources, - net.java.sip.communicator.util, - net.java.sip.communicator.plugin.desktoputil, - 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.border |