Resolve Issue 519 and minor cosmetic changes to NewStatusMessageDialog

cusax-fix
Alan Kelly 17 years ago
parent aba1600a31
commit d438d334d7

@ -206,6 +206,7 @@ service.gui.NEW=&New
service.gui.NEW_ACCOUNT=Add &new account
service.gui.NEW_MESSAGE=New message
service.gui.NEW_NAME=New name
service.gui.NEW_STATUS_MESSAGE=New status message
service.gui.NO=No
service.gui.NO_AVAILABLE_ROOMS=The list of rooms for this server is currently not available.
service.gui.NO_MESSAGE=No message

@ -86,6 +86,7 @@ private void init()
this.infoArea.setEditable(false);
this.infoArea.setLineWrap(true);
this.infoArea.setWrapStyleWord(true);
this.infoArea.setOpaque(false);
this.dataPanel.add(messageLabel, BorderLayout.WEST);

@ -27,37 +27,31 @@ public class NewStatusMessageDialog
{
private Logger logger = Logger.getLogger(NewStatusMessageDialog.class);
private JPanel messagePanel = new TransparentPanel(new BorderLayout());
private JLabel messageLabel = new JLabel(
Resources.getString("service.gui.NEW_STATUS_MESSAGE"));
SystrayActivator.getResources().getI18NString(
"service.gui.NEW_STATUS_MESSAGE"));
private JTextField messageTextField = new JTextField();
private JPanel dataPanel = new TransparentPanel(new BorderLayout(5, 5));
private JTextArea infoLabel = new JTextArea(
Resources.getString("service.gui.STATUS_MESSAGE_INFO"));
private JTextArea infoArea = new JTextArea(
SystrayActivator.getResources().getI18NString(
"service.gui.STATUS_MESSAGE_INFO"));
private JLabel infoTitleLabel = new JLabel(
Resources.getString("service.gui.NEW_STATUS_MESSAGE"));
private JLabel iconLabel = new JLabel(
Resources.getImage("newStatusMessageIcon"));
SystrayActivator.getResources().getI18NString(
"service.gui.NEW_STATUS_MESSAGE"));
private JPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1));
private JPanel rightPanel = new TransparentPanel(new BorderLayout());
private JButton okButton = new JButton(Resources.getString("service.gui.OK"));
private JButton okButton
= new JButton(SystrayActivator.getResources().getI18NString("service.gui.OK"));
private JButton cancelButton = new JButton(
Resources.getString("service.gui.CANCEL"));
SystrayActivator.getResources().getI18NString("service.gui.CANCEL"));
private JPanel buttonsPanel =
new TransparentPanel(new FlowLayout(FlowLayout.RIGHT));
private JPanel mainPanel = new TransparentPanel(new BorderLayout());
private JPanel buttonsPanel = new TransparentPanel(new FlowLayout(FlowLayout.RIGHT));
private ProtocolProviderService protocolProvider;
@ -70,9 +64,8 @@ public NewStatusMessageDialog (ProtocolProviderService protocolProvider)
{
this.protocolProvider = protocolProvider;
this.setSize(new Dimension(520, 270));
this.init();
pack();
}
/**
@ -81,15 +74,17 @@ public NewStatusMessageDialog (ProtocolProviderService protocolProvider)
*/
private void init()
{
this.setTitle(Resources.getString("service.gui.NEW_STATUS_MESSAGE"));
this.setTitle(SystrayActivator.getResources()
.getI18NString("service.gui.NEW_STATUS_MESSAGE"));
this.getRootPane().setDefaultButton(okButton);
this.setPreferredSize(new Dimension(500, 200));
this.iconLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 10));
this.infoLabel.setEditable(false);
this.infoArea.setEditable(false);
this.infoArea.setLineWrap(true);
this.infoArea.setWrapStyleWord(true);
this.infoArea.setOpaque(false);
this.dataPanel.add(messageLabel, BorderLayout.WEST);
@ -100,19 +95,36 @@ private void init()
infoTitleLabel.getFont().deriveFont(Font.BOLD, 18.0f));
this.labelsPanel.add(infoTitleLabel);
this.labelsPanel.add(infoLabel);
this.labelsPanel.add(infoArea);
this.labelsPanel.add(dataPanel);
this.rightPanel.add(labelsPanel, BorderLayout.NORTH);
this.messagePanel.add(iconLabel, BorderLayout.WEST);
this.messagePanel.add(rightPanel, BorderLayout.CENTER);
JPanel messagePanel = new TransparentPanel(new GridBagLayout());
GridBagConstraints messagePanelConstraints = new GridBagConstraints();
messagePanelConstraints.anchor = GridBagConstraints.NORTHWEST;
messagePanelConstraints.fill = GridBagConstraints.NONE;
messagePanelConstraints.gridx = 0;
messagePanelConstraints.gridy = 0;
messagePanelConstraints.insets = new Insets(5, 0, 5, 10);
messagePanelConstraints.weightx = 0;
messagePanelConstraints.weighty = 0;
messagePanel
.add(new ImageCanvas(Resources
.getImage("service.gui.icons.RENAME_DIALOG_ICON").getImage()),
messagePanelConstraints);
messagePanelConstraints.anchor = GridBagConstraints.NORTH;
messagePanelConstraints.fill = GridBagConstraints.HORIZONTAL;
messagePanelConstraints.gridx = 1;
messagePanelConstraints.insets = new Insets(0, 0, 0, 0);
messagePanelConstraints.weightx = 1;
messagePanel.add(labelsPanel, messagePanelConstraints);
this.okButton.setName("ok");
this.cancelButton.setName("cancel");
this.okButton.setMnemonic(Resources.getMnemonic("service.gui.OK"));
this.cancelButton.setMnemonic(Resources.getMnemonic("cancel"));
this.okButton.setMnemonic(
SystrayActivator.getResources().getI18nMnemonic("service.gui.OK"));
this.cancelButton.setMnemonic(
SystrayActivator.getResources().getI18nMnemonic("service.gui.CANCEL"));
this.okButton.addActionListener(this);
this.cancelButton.addActionListener(this);
@ -120,10 +132,23 @@ private void init()
this.buttonsPanel.add(okButton);
this.buttonsPanel.add(cancelButton);
this.mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 0, 10));
this.mainPanel.add(messagePanel, BorderLayout.NORTH);
this.mainPanel.add(buttonsPanel, BorderLayout.SOUTH);
JPanel mainPanel = new TransparentPanel(new GridBagLayout());
mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 0, 10));
GridBagConstraints mainPanelConstraints = new GridBagConstraints();
mainPanelConstraints.anchor = GridBagConstraints.NORTH;
mainPanelConstraints.fill = GridBagConstraints.BOTH;
mainPanelConstraints.gridx = 0;
mainPanelConstraints.gridy = 0;
mainPanelConstraints.weightx = 1;
mainPanelConstraints.weighty = 1;
mainPanel.add(messagePanel, mainPanelConstraints);
mainPanelConstraints.anchor = GridBagConstraints.SOUTHEAST;
mainPanelConstraints.fill = GridBagConstraints.NONE;
mainPanelConstraints.gridy = 1;
mainPanelConstraints.weightx = 0;
mainPanelConstraints.weighty = 0;
mainPanel.add(buttonsPanel, mainPanelConstraints);
this.getContentPane().add(mainPanel);
}
@ -154,13 +179,8 @@ public void requestFocusInFiled()
this.messageTextField.requestFocus();
}
protected void close(boolean isEscaped)
{
cancelButton.doClick();
}
/**
* This class allow to use a thread to change the presence status.
* This class allow to use a thread to change the presence status message.
*/
private class PublishStatusMessageThread extends Thread
{
@ -229,4 +249,9 @@ else if (e1.getErrorCode()
}
}
}
protected void close(boolean isEscaped)
{
cancelButton.doClick();
}
}

@ -9,6 +9,7 @@
import net.java.sip.communicator.impl.systray.jdic.*;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.service.systray.*;
import net.java.sip.communicator.util.*;
@ -31,6 +32,8 @@ public class SystrayActivator
private static ConfigurationService configService;
private static ResourceManagementService resourcesService;
private static final Logger logger =
Logger.getLogger(SystrayActivator.class);
@ -40,7 +43,8 @@ public class SystrayActivator
* @param bc The execution context of the bundle being started.
* @throws Exception If
*/
public void start(BundleContext bc) throws Exception
public void start(BundleContext bc)
throws Exception
{
bundleContext = bc;
@ -74,7 +78,9 @@ public void start(BundleContext bc) throws Exception
* listeners, unregister all services registered by the bundle, and
* release all services used by the bundle.
*/
public void stop(BundleContext bc) throws Exception {
public void stop(BundleContext bc)
throws Exception
{
}
@ -116,4 +122,28 @@ public static UIService getUIService()
return uiService;
}
/**
* Returns the <tt>ResourceManagementService</tt>, through which we will
* access all resources.
*
* @return the <tt>ResourceManagementService</tt>, through which we will
* access all resources.
*/
public static ResourceManagementService getResources()
{
if (resourcesService == null)
{
ServiceReference serviceReference = bundleContext
.getServiceReference(ResourceManagementService.class.getName());
if(serviceReference == null)
return null;
resourcesService = (ResourceManagementService) bundleContext
.getService(serviceReference);
}
return resourcesService;
}
}

Loading…
Cancel
Save