aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2009-05-01 14:24:36 +0000
committerYana Stamcheva <yana@jitsi.org>2009-05-01 14:24:36 +0000
commit13f35596483ef7c6192345cf837bcee5decf7b0b (patch)
treee917c0482b4dccd03b62ff0e4742b869eb01503b /src/net/java/sip
parent5979d209953dc2be14af0d482768aba788b2086f (diff)
downloadjitsi-13f35596483ef7c6192345cf837bcee5decf7b0b.zip
jitsi-13f35596483ef7c6192345cf837bcee5decf7b0b.tar.gz
jitsi-13f35596483ef7c6192345cf837bcee5decf7b0b.tar.bz2
Continuing work on issue #630 Borderless UI, by reducing the minimal size of the chat write area and storing the current divider position.
Diffstat (limited to 'src/net/java/sip')
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java42
-rw-r--r--src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java57
2 files changed, 93 insertions, 6 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
index eb7b84f..6a39e99 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
@@ -9,6 +9,8 @@ package net.java.sip.communicator.impl.gui.main.chat;
import java.awt.*;
import java.awt.Container;
import java.awt.event.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.io.*;
import java.util.*;
@@ -113,12 +115,24 @@ public class ChatPanel
this.sendPanel = new ChatSendPanel(this);
this.writeMessagePanel = new ChatWritePanel(this);
- Dimension writeMessagePanelSize = new Dimension(500, 100);
- this.writeMessagePanel.setMinimumSize(writeMessagePanelSize);
- this.writeMessagePanel.setPreferredSize(writeMessagePanelSize);
+
+ int chatAreaSize = ConfigurationManager.getChatWriteAreaSize();
+
+ Dimension writeMessagePanelDefaultSize;
+ if (chatAreaSize > 0)
+ writeMessagePanelDefaultSize = new Dimension(500, chatAreaSize);
+ else
+ writeMessagePanelDefaultSize = new Dimension(500, 100);
+
+ Dimension writeMessagePanelMinSize = new Dimension(500, 45);
+ this.writeMessagePanel.setMinimumSize(writeMessagePanelMinSize);
+ this.writeMessagePanel.setPreferredSize(writeMessagePanelDefaultSize);
this.messagePane.setBorder(null);
this.messagePane.setOpaque(false);
+ this.messagePane.addPropertyChangeListener(
+ new DividerLocationListener());
+
this.messagePane.setResizeWeight(1.0D);
this.messagePane.setBottomComponent(writeMessagePanel);
@@ -143,7 +157,7 @@ public class ChatPanel
this.chatContactListPanel.setPreferredSize(chatContactPanelSize);
this.chatContactListPanel.setOpaque(false);
- topSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
+ topSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
topSplitPane.setBorder(null); // remove default borders
topSplitPane.setOneTouchExpandable(true);
topSplitPane.setOpaque(false);
@@ -1561,4 +1575,24 @@ public class ChatPanel
{
return unreadMessageNumber;
}
+
+ /**
+ * Stores the current divider position.
+ */
+ private class DividerLocationListener implements PropertyChangeListener
+ {
+ public void propertyChange(PropertyChangeEvent evt)
+ {
+ if (evt.getPropertyName()
+ .equals(JSplitPane.DIVIDER_LOCATION_PROPERTY))
+ {
+ int dividerLocation = (Integer) evt.getNewValue();
+ int writeAreaSize = messagePane.getHeight() - dividerLocation
+ - messagePane.getDividerSize();
+
+ ConfigurationManager
+ .setChatWriteAreaSize(writeAreaSize);
+ }
+ }
+ }
}
diff --git a/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java b/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java
index 8853c9f..1d2680b 100644
--- a/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java
+++ b/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java
@@ -31,7 +31,7 @@ public class ConfigurationManager
private static boolean isShowOffline = true;
private static boolean isApplicationVisible = true;
-
+
private static boolean isQuitWarningShown = true;
private static boolean isSendTypingNotifications;
@@ -46,6 +46,8 @@ public class ConfigurationManager
private static int chatHistorySize;
+ private static int chatWriteAreaSize;
+
private static int windowTransparency;
private static boolean isTransparentWindowEnabled;
@@ -233,6 +235,24 @@ public class ConfigurationManager
.intValue();
}
+ // Load the "CHAT_WRITE_AREA_SIZE" property.
+ String chatWriteAreaSizeStringProperty =
+ "net.java.sip.communicator.impl.gui.CHAT_WRITE_AREA_SIZE";
+ String chatWriteAreaSizeString
+ = configService.getString(chatWriteAreaSizeStringProperty);
+
+ if(chatWriteAreaSizeString == null)
+ chatWriteAreaSizeString =
+ GuiActivator.getResources().
+ getSettingsString(chatWriteAreaSizeStringProperty);
+
+ if(chatWriteAreaSizeString != null
+ && chatWriteAreaSizeString.length() > 0)
+ {
+ chatWriteAreaSize
+ = new Integer(chatWriteAreaSizeString).intValue();
+ }
+
// Load the "isTransparentWindowEnabled" property.
String isTransparentWindowEnabledProperty =
"impl.gui.IS_TRANSPARENT_WINDOW_ENABLED";
@@ -495,6 +515,16 @@ public class ConfigurationManager
}
/**
+ * Returns the preferred height of the chat write area.
+ *
+ * @return the preferred height of the chat write area.
+ */
+ public static int getChatWriteAreaSize()
+ {
+ return chatWriteAreaSize;
+ }
+
+ /**
* Returns <code>true</code> if transparent windows are enabled,
* <code>false</code> otherwise.
*
@@ -670,6 +700,21 @@ public class ConfigurationManager
}
/**
+ * Updates the "net.java.sip.communicator.impl.gui.CHAT_WRITE_AREA_SIZE"
+ * property through the <tt>ConfigurationService</tt>.
+ *
+ * @param size the new size to set
+ */
+ public static void setChatWriteAreaSize(int size)
+ {
+ chatWriteAreaSize = size;
+
+ configService.setProperty(
+ "net.java.sip.communicator.impl.gui.CHAT_WRITE_AREA_SIZE",
+ Integer.toString(chatWriteAreaSize));
+ }
+
+ /**
* Saves a chat room through the <tt>ConfigurationService</tt>.
*
* @param protocolProvider the protocol provider to which the chat room
@@ -996,11 +1041,19 @@ public class ConfigurationManager
"service.gui.MESSAGE_HISTORY_SIZE"))
{
String chatHistorySizeString = (String) evt.getNewValue();
-
+
chatHistorySize
= new Integer(chatHistorySizeString).intValue();
}
else if (evt.getPropertyName().equals(
+ "net.java.sip.communicator.impl.gui.CHAT_WRITE_AREA_SIZE"))
+ {
+ String chatWriteAreaSizeString = (String) evt.getNewValue();
+
+ chatWriteAreaSize
+ = new Integer(chatWriteAreaSizeString).intValue();
+ }
+ else if (evt.getPropertyName().equals(
"impl.gui.IS_TRANSPARENT_WINDOW_ENABLED"))
{
String isTransparentString = (String) evt.getNewValue();