|
|
|
|
@ -44,48 +44,48 @@
|
|
|
|
|
/**
|
|
|
|
|
* The <tt>AccountsConfigurationForm</tt> is the form where the user
|
|
|
|
|
* could create, modify or delete an account.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @author Yana Stamcheva
|
|
|
|
|
*/
|
|
|
|
|
public class AccountsConfigurationForm extends JPanel
|
|
|
|
|
implements ConfigurationForm,
|
|
|
|
|
ActionListener,
|
|
|
|
|
public class AccountsConfigurationForm extends JPanel
|
|
|
|
|
implements ConfigurationForm,
|
|
|
|
|
ActionListener,
|
|
|
|
|
ServiceListener {
|
|
|
|
|
|
|
|
|
|
private JScrollPane tablePane = new JScrollPane();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JTable accountsTable = new JTable();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel rightPanel = new JPanel(new BorderLayout());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel buttonsPanel = new JPanel(new GridLayout(0, 1, 8, 8));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JButton newButton = new JButton(Messages.getString("new"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JButton modifyButton = new JButton(Messages.getString("modify"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JButton removeButton = new JButton(Messages.getString("remove"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ExtendedTableModel tableModel = new ExtendedTableModel();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MainFrame mainFrame;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates an instance of <tt>AccountsConfigurationForm</tt>.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @param mainFrame the main application window
|
|
|
|
|
*/
|
|
|
|
|
public AccountsConfigurationForm(MainFrame mainFrame) {
|
|
|
|
|
super(new BorderLayout());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.mainFrame = mainFrame;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GuiActivator.bundleContext.addServiceListener(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.tableInit();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.buttonsPanelInit();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.add(tablePane, BorderLayout.CENTER);
|
|
|
|
|
this.add(rightPanel, BorderLayout.EAST);
|
|
|
|
|
}
|
|
|
|
|
@ -97,42 +97,42 @@ private void buttonsPanelInit() {
|
|
|
|
|
this.newButton.addActionListener(this);
|
|
|
|
|
this.modifyButton.addActionListener(this);
|
|
|
|
|
this.removeButton.addActionListener(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.buttonsPanel.add(newButton);
|
|
|
|
|
this.buttonsPanel.add(modifyButton);
|
|
|
|
|
this.buttonsPanel.add(removeButton);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.rightPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
|
|
|
|
this.rightPanel.add(buttonsPanel, BorderLayout.NORTH);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes the accounts table.
|
|
|
|
|
*/
|
|
|
|
|
private void tableInit() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
accountsTable.setRowHeight(22);
|
|
|
|
|
accountsTable.setSelectionMode(
|
|
|
|
|
ListSelectionModel.SINGLE_SELECTION);
|
|
|
|
|
accountsTable.setSelectionModel(new DefaultListSelectionModel());
|
|
|
|
|
accountsTable.setSelectionModel(new DefaultListSelectionModel());
|
|
|
|
|
accountsTable.setShowHorizontalLines(false);
|
|
|
|
|
accountsTable.setShowVerticalLines(false);
|
|
|
|
|
accountsTable.setModel(tableModel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tableModel.addColumn("id");
|
|
|
|
|
tableModel.addColumn(Messages.getString("protocol"));
|
|
|
|
|
tableModel.addColumn(Messages.getString("account"));
|
|
|
|
|
|
|
|
|
|
TableColumnModel columnModel = accountsTable.getColumnModel();
|
|
|
|
|
|
|
|
|
|
TableColumnModel columnModel = accountsTable.getColumnModel();
|
|
|
|
|
columnModel.removeColumn(columnModel.getColumn(0));
|
|
|
|
|
columnModel.getColumn(0)
|
|
|
|
|
.setCellRenderer(new LabelTableCellRenderer());
|
|
|
|
|
columnModel.getColumn(1)
|
|
|
|
|
.setCellRenderer(new LabelTableCellRenderer());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.tablePane.getViewport().add(accountsTable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the title of this configuration form.
|
|
|
|
|
* @return the title of this configuration form.
|
|
|
|
|
@ -147,7 +147,7 @@ public String getTitle() {
|
|
|
|
|
*/
|
|
|
|
|
public byte[] getIcon() {
|
|
|
|
|
return ImageLoader.getImageInBytes(
|
|
|
|
|
ImageLoader.QUICK_MENU_ADD_ICON);
|
|
|
|
|
ImageLoader.QUICK_MENU_ADD_ICON);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -165,29 +165,29 @@ public Object getForm() {
|
|
|
|
|
*/
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
JButton sourceButton = (JButton)e.getSource();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sourceButton.equals(newButton)) {
|
|
|
|
|
AccountRegWizardContainerImpl wizard
|
|
|
|
|
= (AccountRegWizardContainerImpl)GuiActivator.getUIService()
|
|
|
|
|
.getAccountRegWizardContainer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard.setTitle(
|
|
|
|
|
Messages.getString("accountRegistrationWizard"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard.setLocation(
|
|
|
|
|
Toolkit.getDefaultToolkit().getScreenSize().width/2
|
|
|
|
|
Toolkit.getDefaultToolkit().getScreenSize().width/2
|
|
|
|
|
- 250,
|
|
|
|
|
Toolkit.getDefaultToolkit().getScreenSize().height/2
|
|
|
|
|
Toolkit.getDefaultToolkit().getScreenSize().height/2
|
|
|
|
|
- 100
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard.showModalDialog();
|
|
|
|
|
}
|
|
|
|
|
else if (sourceButton.equals(modifyButton)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -201,14 +201,14 @@ else if (sourceButton.equals(modifyButton)) {
|
|
|
|
|
public void serviceChanged(ServiceEvent event) {
|
|
|
|
|
Object service = GuiActivator.bundleContext
|
|
|
|
|
.getService(event.getServiceReference());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// we don't care if the source service is not a protocol provider
|
|
|
|
|
if (! (service instanceof ProtocolProviderService)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProtocolProviderService pps = (ProtocolProviderService) service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (event.getType() == ServiceEvent.REGISTERED)
|
|
|
|
|
{
|
|
|
|
|
String pName = pps.getProtocolName();
|
|
|
|
|
@ -216,9 +216,9 @@ public void serviceChanged(ServiceEvent event) {
|
|
|
|
|
protocolLabel.setText(pName);
|
|
|
|
|
protocolLabel.setIcon(
|
|
|
|
|
new ImageIcon(Constants.getProtocolIcon(pName)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tableModel.addRow(new Object[]{pps, protocolLabel,
|
|
|
|
|
pps.getAccountID().getAccountUserID()});
|
|
|
|
|
pps.getAccountID().getUserID()});
|
|
|
|
|
}
|
|
|
|
|
else if (event.getType() == ServiceEvent.UNREGISTERING)
|
|
|
|
|
{
|
|
|
|
|
|