diff options
author | hristoterezov <hristo@jitsi.org> | 2013-08-30 17:28:16 +0300 |
---|---|---|
committer | hristoterezov <hristo@jitsi.org> | 2013-08-30 17:28:16 +0300 |
commit | ec87356241687a502257ecc2ae8c3d39fed30bb4 (patch) | |
tree | dc70f80058a6932a5b6b6d733836fa9a127bb765 /src | |
parent | aba708837dd32417242b0174c1bad0a72cd8ba51 (diff) | |
download | jitsi-ec87356241687a502257ecc2ae8c3d39fed30bb4.zip jitsi-ec87356241687a502257ecc2ae8c3d39fed30bb4.tar.gz jitsi-ec87356241687a502257ecc2ae8c3d39fed30bb4.tar.bz2 |
Changes the subject fields layout in the change nickname chat room dialog. Removes "Set Subject" checkbox. Adds "Set Subject" label to expand the subject field. Adds "Subject" tip text in the subject field.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomWrapper.java | 104 |
1 files changed, 55 insertions, 49 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomWrapper.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomWrapper.java index d1d8e7b..51f10bc 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomWrapper.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomWrapper.java @@ -10,6 +10,7 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; +import javax.swing.border.*; import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.customcontrols.*; @@ -348,9 +349,7 @@ public class ChatRoomWrapper getChatRoomID(), "userNickName", nickName); } - String[] joinOptions = {nickName, - (reasonDialog.isSubjectCheckboxChecked()? - reasonDialog.getSubject() : null)}; + String[] joinOptions = {nickName, reasonDialog.getSubject()}; return joinOptions; } @@ -359,16 +358,21 @@ public class ChatRoomWrapper */ private class ChatRoomJoinOptionsDialog extends ChatOperationReasonDialog { + /** + * Text field for the subject. + */ + private SIPCommTextField subject = new SIPCommTextField(GuiActivator + .getResources().getI18NString("service.gui.SUBJECT")); + /** - * Checkbox that hides or displays the subject field. + * Label that hides and shows the subject fields panel on click. */ - private JCheckBox setSubject = new SIPCommCheckBox(GuiActivator - .getResources().getI18NString("service.gui.SET_SUBJECT")); + private JLabel cmdExpandSubjectFields; - /** - * Text field for the subject. + /** + * Panel that holds the subject fields. */ - private JTextField subject = new JTextField(); + private JPanel subjectFieldsPannel = new JPanel(new BorderLayout()); /** * Adds the subject fields to dialog. Sets action listeners. @@ -390,37 +394,50 @@ public class ChatRoomWrapper message, showReasonLabel, disableOKIfReasonIsEmpty); - subject.setVisible(false); - if(!dontDisplaySubjectFields) + + if(dontDisplaySubjectFields) + return; + + JPanel subjectPanel = new JPanel(new BorderLayout()); + subjectPanel.setOpaque(false); + subjectPanel.setBorder( + BorderFactory.createEmptyBorder(10, 0, 0, 0)); + + subjectFieldsPannel.setBorder( + BorderFactory.createEmptyBorder(10, 30, 0, 0)); + subjectFieldsPannel.setOpaque(false); + subjectFieldsPannel.add(subject, BorderLayout.CENTER); + subjectFieldsPannel.setVisible(false); + subject.setFont(getFont().deriveFont(12f)); + + cmdExpandSubjectFields = new JLabel(); + cmdExpandSubjectFields.setBorder(new EmptyBorder(0, 5, 0, 0)); + cmdExpandSubjectFields.setIcon(GuiActivator.getResources() + .getImage("service.gui.icons.RIGHT_ARROW_ICON")); + cmdExpandSubjectFields.setText(GuiActivator + .getResources().getI18NString("service.gui.SET_SUBJECT")); + cmdExpandSubjectFields.addMouseListener(new MouseAdapter() { - JPanel subjectPannel = new JPanel(new BorderLayout()); - subjectPannel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - subjectPannel.setOpaque(false); - subjectPannel.add(setSubject, BorderLayout.NORTH); - subjectPannel.add(subject, BorderLayout.CENTER); - addToReasonFieldPannel(subjectPannel); - setSubject.addActionListener(this); - this.pack(); - } - } + @Override + public void mouseClicked(MouseEvent e) + { + cmdExpandSubjectFields.setIcon( + UtilActivator.getResources().getImage( + subjectFieldsPannel.isVisible() + ? "service.gui.icons.RIGHT_ARROW_ICON" + : "service.gui.icons.DOWN_ARROW_ICON")); - /** - * Handles the <tt>ActionEvent</tt>. - * - * @param e the <tt>ActionEvent</tt> that notified us - */ - public void actionPerformed(ActionEvent e) - { - if(e.getSource() instanceof JCheckBox) - { - subject.setVisible(setSubject.isSelected()); - this.pack(); - } - else - { - super.actionPerformed(e); - } - } + subjectFieldsPannel.setVisible( + !subjectFieldsPannel.isVisible()); + + pack(); + } + }); + subjectPanel.add(cmdExpandSubjectFields,BorderLayout.NORTH); + subjectPanel.add(subjectFieldsPannel,BorderLayout.CENTER); + addToReasonFieldPannel(subjectPanel); + this.pack(); + } /** * Returns the text entered in the subject field. @@ -431,16 +448,5 @@ public class ChatRoomWrapper { return subject.getText(); } - - /** - * Checks if the subject checkbox is checked or not. - * - * @return true if the checkbox is checked and false if the checkbox is - * not checked. - */ - public boolean isSubjectCheckboxChecked() - { - return setSubject.isSelected(); - } } } |