General config: put labels on top of the section to gain h-space

cusax-fix
Ingo Bauersachs 15 years ago
parent e4839632b4
commit 500005002f

@ -280,7 +280,7 @@ service.gui.LOGIN_INVALID_PROPERTIES_ERROR=Unable to log in with account: User n
service.gui.LOGOFF_NOT_SUCCEEDED=An error occurred while logging off with the following account: User name: {0}, Server name: {1}.
service.gui.LOW_QUALITY=Low quality
service.gui.MEMBER=member
service.gui.MESSAGE=Message:
service.gui.MESSAGE=Message
service.gui.MISSED_CALLS_TOOL_TIP=Missed calls from:
service.gui.MISSED_CALLS_MORE_TOOL_TIP= and {0} more
service.gui.MODERATOR=moderator
@ -427,7 +427,7 @@ service.gui.SPECIFY_SERVER=Please complete the server part of your account.
service.gui.SOUND_OFF=Turn sound off
service.gui.SOUND_ON=Turn sound on
service.gui.START_SHARING=Start sharing
service.gui.STATUS=Status:
service.gui.STATUS=Status
service.gui.STATUS_CHANGED_CHAT_MESSAGE=has become {0}
service.gui.STATUS_CHANGE_GENERAL_ERROR=Failed to change status for account: User name: {0}, Server name: {1}, due to a general error.
service.gui.STATUS_CHANGE_NETWORK_FAILURE=Failed to change status for account: User name: {0}, Server name: {1}, due to a network problem.
@ -748,7 +748,7 @@ plugin.facebookaccregwizz.USERNAME=Username:
plugin.facebookaccregwizz.USERNAME_AND_PASSWORD=Username and Password
# generalconfig
plugin.generalconfig.AUTO_START=Auto - start {0} when computer restarts or reboots
plugin.generalconfig.AUTO_START=Auto-start {0} when computer restarts or reboots
plugin.generalconfig.GROUP_CHAT_MESSAGES=Group chat messages in one window
plugin.generalconfig.LOG_HISTORY=Log chat history
plugin.generalconfig.SHOW_HISTORY=Show
@ -1078,7 +1078,7 @@ plugin.notificationconfig.RESTORE=Restore Defaults
plugin.notificationconfig.PLAY_SOUND=Play a sound:
plugin.notificationconfig.EXEC_PROG=Execute a program:
plugin.notificationconfig.DISPLAY_POPUP=Show a message in a pop-up window
plugin.notificationconfig.POPUP_NOTIF_HANDLER=Popup notifications type:
plugin.notificationconfig.POPUP_NOTIF_HANDLER=Popup notifications type
plugin.notificationconfig.SOUND_FILE=Sound file:
plugin.notificationconfig.PROGRAM_FILE=Program file:
plugin.notificationconfig.BROWSE_SOUND=Choose a sound file

@ -10,6 +10,7 @@
import java.util.*;
import javax.swing.*;
import javax.swing.border.*;
import net.java.sip.communicator.plugin.generalconfig.autoaway.*;
import net.java.sip.communicator.service.configuration.*;
@ -336,16 +337,37 @@ public static ResourceManagementService getResources()
* @param labelText the text of the label.
* @return the created label
*/
public static Component createConfigSectionComponent(String labelText)
public static JPanel createConfigSectionComponent(String labelText)
{
JLabel label = new JLabel(labelText);
label.setBorder(new EmptyBorder(0, 0, 0, 10));
label.setFont(label.getFont().deriveFont(Font.BOLD));
label.setAlignmentX(Component.RIGHT_ALIGNMENT);
JPanel parentPanel = new TransparentPanel(new BorderLayout());
parentPanel.add(label, BorderLayout.NORTH);
parentPanel.setPreferredSize(new Dimension(180, 25));
JPanel pnlSectionName = new TransparentPanel();
pnlSectionName.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx = c.gridy = 0;
c.anchor = GridBagConstraints.LINE_START;
c.gridwidth = 2;
pnlSectionName.add(label, c);
c.gridx = 2;
c.weightx = 1;
c.fill = GridBagConstraints.HORIZONTAL;
pnlSectionName.add(new JSeparator(), c);
JPanel pnlSection = new TransparentPanel()
{
@Override
public Component add(Component comp)
{
if(comp instanceof JComponent)
((JComponent)comp).setAlignmentX(LEFT_ALIGNMENT);
return super.add(comp);
}
};
pnlSection.setLayout(new BoxLayout(pnlSection, BoxLayout.Y_AXIS));
pnlSection.add(pnlSectionName);
return parentPanel;
return pnlSection;
}
}

@ -12,6 +12,7 @@
import java.util.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
import net.java.sip.communicator.plugin.generalconfig.autoaway.*;
@ -44,42 +45,52 @@ public GeneralConfigurationPanel()
super(new BorderLayout());
TransparentPanel mainPanel = new TransparentPanel();
BoxLayout boxLayout = new BoxLayout(mainPanel, BoxLayout.Y_AXIS);
mainPanel.setLayout(boxLayout);
this.add(mainPanel, BorderLayout.NORTH);
mainPanel.setBorder(new EmptyBorder(0, 0, 0, 10));
final JScrollPane scroller = new JScrollPane(mainPanel);
scroller.setOpaque(false);
scroller.getViewport().setOpaque(false);
scroller.setPreferredSize(new Dimension(500, 420));
scroller.setBorder(new EmptyBorder(0, 0, 0, 0));
this.add(scroller, BorderLayout.NORTH);
Component startupConfigPanel = createStartupConfigPanel();
if (startupConfigPanel != null)
{
mainPanel.add(startupConfigPanel);
mainPanel.add(Box.createVerticalStrut(10));
mainPanel.add(new JSeparator());
}
mainPanel.add(createMessageConfigPanel());
mainPanel.add(new JSeparator());
mainPanel.add(Box.createVerticalStrut(10));
mainPanel.add(new AutoAwayConfigurationPanel());
mainPanel.add(new JSeparator());
mainPanel.add(Box.createVerticalStrut(10));
Component notifConfigPanel = createNotificationConfigPanel();
if (notifConfigPanel != null)
{
mainPanel.add(notifConfigPanel);
mainPanel.add(Box.createVerticalStrut(4));
mainPanel.add(new JSeparator());
mainPanel.add(Box.createVerticalStrut(10));
}
mainPanel.add(createLocaleConfigPanel());
mainPanel.add(Box.createVerticalStrut(4));
mainPanel.add(new JSeparator());
mainPanel.add(Box.createVerticalStrut(10));
mainPanel.add(createCallConfigPanel());
mainPanel.add(Box.createVerticalStrut(10));
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
scroller.getVerticalScrollBar().setValue(0);
scroller.revalidate();
scroller.repaint();
}
});
}
/**
@ -99,8 +110,6 @@ private Component createAutoStartCheckBox()
{
final JCheckBox autoStartCheckBox = new SIPCommCheckBox();
autoStartCheckBox.setAlignmentX(JCheckBox.LEFT_ALIGNMENT);
String label = Resources.getString(
"plugin.generalconfig.AUTO_START",
new String[]{getApplicationName()});
@ -123,10 +132,8 @@ public void actionPerformed(ActionEvent e)
try
{
if(WindowsStartup.isStartupEnabled(getApplicationName()))
autoStartCheckBox.setSelected(true);
else
autoStartCheckBox.setSelected(false);
autoStartCheckBox.setSelected(
WindowsStartup.isStartupEnabled(getApplicationName()));
}
catch (Exception e)
{
@ -142,36 +149,18 @@ public void actionPerformed(ActionEvent e)
*/
private Component createMessageConfigPanel()
{
JPanel messagePanel = new TransparentPanel(new BorderLayout());
Component messageLabel
JPanel configPanel
= GeneralConfigPluginActivator.createConfigSectionComponent(
Resources.getString("service.gui.MESSAGE"));
JPanel configPanel = new TransparentPanel();
configPanel.setLayout(new BoxLayout(configPanel, BoxLayout.Y_AXIS));
configPanel.add(createGroupMessagesCheckbox());
configPanel.add(Box.createVerticalStrut(10));
configPanel.add(createHistoryPanel());
configPanel.add(Box.createVerticalStrut(10));
configPanel.add(createSendMessagePanel());
configPanel.add(Box.createVerticalStrut(10));
configPanel.add(createTypingNitificationsCheckBox());
configPanel.add(Box.createVerticalStrut(10));
configPanel.add(createBringToFrontCheckBox());
configPanel.add(Box.createVerticalStrut(10));
configPanel.add(createMultichatCheckbox());
configPanel.add(Box.createVerticalStrut(10));
messagePanel.add(messageLabel, BorderLayout.WEST);
messagePanel.add(configPanel);
return messagePanel;
return configPanel;
}
/**
@ -456,13 +445,10 @@ private Component createNotificationConfigPanel()
if (handlerRefs == null)
return null;
JPanel notifConfigPanel = new TransparentPanel(new BorderLayout());
notifConfigPanel.add(
GeneralConfigPluginActivator.createConfigSectionComponent(
JPanel notifConfigPanel = GeneralConfigPluginActivator.
createConfigSectionComponent(
Resources.getString(
"plugin.notificationconfig.POPUP_NOTIF_HANDLER")),
BorderLayout.WEST);
"plugin.notificationconfig.POPUP_NOTIF_HANDLER"));
final JComboBox notifConfigComboBox = new JComboBox();
@ -531,13 +517,9 @@ public void itemStateChanged(ItemEvent evt)
*/
private Component createLocaleConfigPanel()
{
JPanel localeConfigPanel = new TransparentPanel(new BorderLayout());
localeConfigPanel.add(
GeneralConfigPluginActivator.createConfigSectionComponent(
Resources.getString(
"plugin.generalconfig.DEFAULT_LANGUAGE") + ":"),
BorderLayout.WEST);
JPanel localeConfigPanel = GeneralConfigPluginActivator.
createConfigSectionComponent(
Resources.getString("plugin.generalconfig.DEFAULT_LANGUAGE"));
final JComboBox localesConfigComboBox = new JComboBox();
@ -578,7 +560,7 @@ public void actionPerformed(ActionEvent e)
}
}
});
localeConfigPanel.add(localesConfigComboBox, BorderLayout.CENTER);
localeConfigPanel.add(localesConfigComboBox);
String label = "* " +
Resources.getString(
@ -589,7 +571,7 @@ public void actionPerformed(ActionEvent e)
warnLabel.setFont(warnLabel.getFont().deriveFont(8));
warnLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0));
warnLabel.setHorizontalAlignment(JLabel.RIGHT);
localeConfigPanel.add(warnLabel, BorderLayout.SOUTH);
localeConfigPanel.add(warnLabel);
return localeConfigPanel;
}
@ -601,12 +583,9 @@ public void actionPerformed(ActionEvent e)
*/
private Component createCallConfigPanel()
{
JPanel callConfigPanel = new TransparentPanel(new BorderLayout());
callConfigPanel.add(
GeneralConfigPluginActivator.createConfigSectionComponent(
Resources.getString("service.gui.CALL") + ":"),
BorderLayout.WEST);
JPanel callConfigPanel = GeneralConfigPluginActivator.
createConfigSectionComponent(
Resources.getString("service.gui.CALL"));
callConfigPanel.add(createNormalizeNumberCheckBox());
@ -659,41 +638,15 @@ public void actionPerformed(ActionEvent e)
*/
public Component createStartupConfigPanel()
{
Component updateCheckBox = null;
Component autoStartCheckBox = null;
if (OSUtils.IS_WINDOWS)
{
autoStartCheckBox = createAutoStartCheckBox();
updateCheckBox = createUpdateCheckBox();
}
if (!OSUtils.IS_WINDOWS)
return null;
JPanel updateConfigPanel = null;
JPanel updateConfigPanel = GeneralConfigPluginActivator.
createConfigSectionComponent(
Resources.getString("plugin.generalconfig.STARTUP_CONFIG"));
if ((updateCheckBox != null) || (autoStartCheckBox != null))
{
updateConfigPanel = new TransparentPanel(new BorderLayout());
updateConfigPanel.add(
GeneralConfigPluginActivator.createConfigSectionComponent(
Resources.getString(
"plugin.generalconfig.STARTUP_CONFIG")
+ ":"),
BorderLayout.WEST);
if ((updateCheckBox != null) && (autoStartCheckBox != null))
{
JPanel checkBoxPanel
= new TransparentPanel(new GridLayout(0, 1));
checkBoxPanel.add(autoStartCheckBox);
checkBoxPanel.add(updateCheckBox);
updateConfigPanel.add(checkBoxPanel);
}
else if (updateCheckBox != null)
updateConfigPanel.add(updateCheckBox);
else if (autoStartCheckBox != null)
updateConfigPanel.add(autoStartCheckBox);
}
updateConfigPanel.add(createAutoStartCheckBox());
updateConfigPanel.add(createUpdateCheckBox());
return updateConfigPanel;
}
@ -719,7 +672,6 @@ public void actionPerformed(ActionEvent e)
}
});
updateCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);
updateCheckBox.setSelected(
GeneralConfigPluginActivator.getConfigurationService().getBoolean((
"net.java.sip.communicator.plugin.updatechecker.ENABLED"), true));

@ -39,12 +39,13 @@ public class AutoAwayConfigurationPanel
*/
public AutoAwayConfigurationPanel()
{
super(new BorderLayout());
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
add(GeneralConfigPluginActivator.createConfigSectionComponent(
Resources.getString("service.gui.STATUS")),
BorderLayout.WEST);
add(createMainPanel());
JPanel pnlSection = GeneralConfigPluginActivator.
createConfigSectionComponent(
Resources.getString("service.gui.STATUS"));
pnlSection.add(createMainPanel());
add(pnlSection);
initValues();
}

Loading…
Cancel
Save