mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
SPARK-1072 - Add an option to make chat window always stay on top
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@11089 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
committed by
michael.will
parent
74858c23ba
commit
d803081453
@ -378,18 +378,18 @@ public final class MainWindow extends ChatFrame implements ActionListener {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
if (alwaysOnTopItem.isSelected())
|
||||
{
|
||||
SettingsManager.getLocalPreferences().setAlwaysOnTop(true);
|
||||
SettingsManager.getLocalPreferences().setMainWindowAlwaysOnTop(true);
|
||||
MainWindow.getInstance().setAlwaysOnTop(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SettingsManager.getLocalPreferences().setAlwaysOnTop(false);
|
||||
SettingsManager.getLocalPreferences().setMainWindowAlwaysOnTop(false);
|
||||
MainWindow.getInstance().setAlwaysOnTop(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (SettingsManager.getLocalPreferences().isAlwaysOnTop())
|
||||
if (SettingsManager.getLocalPreferences().isMainWindowAlwaysOnTop())
|
||||
{
|
||||
alwaysOnTopItem.setSelected(true);
|
||||
this.setAlwaysOnTop(true);
|
||||
|
||||
@ -10,36 +10,80 @@
|
||||
|
||||
package org.jivesoftware.spark.ui;
|
||||
|
||||
import org.jivesoftware.MainWindow;
|
||||
import org.jivesoftware.Spark;
|
||||
import org.jivesoftware.spark.SparkManager;
|
||||
import org.jivesoftware.spark.util.GraphicUtils;
|
||||
import org.jivesoftware.sparkimpl.plugin.layout.LayoutSettings;
|
||||
import org.jivesoftware.sparkimpl.plugin.layout.LayoutSettingsManager;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowFocusListener;
|
||||
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
|
||||
import org.jivesoftware.MainWindow;
|
||||
import org.jivesoftware.Spark;
|
||||
import org.jivesoftware.resource.Res;
|
||||
import org.jivesoftware.spark.SparkManager;
|
||||
import org.jivesoftware.spark.util.GraphicUtils;
|
||||
import org.jivesoftware.spark.util.ResourceUtils;
|
||||
import org.jivesoftware.sparkimpl.plugin.layout.LayoutSettings;
|
||||
import org.jivesoftware.sparkimpl.plugin.layout.LayoutSettingsManager;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
|
||||
/**
|
||||
* The Window used to display the ChatRoom container.
|
||||
*/
|
||||
public class ChatFrame extends JFrame implements WindowFocusListener {
|
||||
|
||||
private static final long serialVersionUID = -7789413067818105293L;
|
||||
private long inactiveTime;
|
||||
|
||||
private boolean focused;
|
||||
|
||||
|
||||
private JMenuBar chatWindowBar;
|
||||
private JMenu optionMenu;
|
||||
private JCheckBoxMenuItem alwaysOnTopItem;
|
||||
private ChatFrame chatFrame;
|
||||
/**
|
||||
* Creates default ChatFrame.
|
||||
*/
|
||||
public ChatFrame() {
|
||||
|
||||
chatFrame = this;
|
||||
chatWindowBar = new JMenuBar();
|
||||
optionMenu = new JMenu();
|
||||
ResourceUtils.resButton(optionMenu, Res.getString("menuitem.chatframe.option"));
|
||||
|
||||
alwaysOnTopItem = new JCheckBoxMenuItem();
|
||||
ResourceUtils.resButton(alwaysOnTopItem, Res.getString("menuitem.always.on.top"));
|
||||
alwaysOnTopItem.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
if (alwaysOnTopItem.isSelected())
|
||||
{
|
||||
SettingsManager.getLocalPreferences().setChatWindowAlwaysOnTop(true);
|
||||
chatFrame.setAlwaysOnTop(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SettingsManager.getLocalPreferences().setChatWindowAlwaysOnTop(false);
|
||||
chatFrame.setAlwaysOnTop(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (SettingsManager.getLocalPreferences().isChatWindowAlwaysOnTop())
|
||||
{
|
||||
alwaysOnTopItem.setSelected(true);
|
||||
chatFrame.setAlwaysOnTop(true);
|
||||
}
|
||||
|
||||
optionMenu.add(alwaysOnTopItem);
|
||||
chatWindowBar.add(optionMenu);
|
||||
setJMenuBar(chatWindowBar);
|
||||
setIconImage(SparkManager.getApplicationImage().getImage());
|
||||
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
|
||||
@ -817,14 +817,23 @@ public class LocalPreferences {
|
||||
return props.getProperty("videoDevice",null);
|
||||
}
|
||||
|
||||
public boolean isAlwaysOnTop() {
|
||||
public boolean isMainWindowAlwaysOnTop() {
|
||||
return getBoolean("alwaysOnTop", false);
|
||||
}
|
||||
|
||||
public void setAlwaysOnTop(boolean onTop) {
|
||||
setBoolean("alwaysOnTop", onTop);
|
||||
public void setMainWindowAlwaysOnTop(boolean onTop) {
|
||||
setBoolean("MainWindowAlwaysOnTop", onTop);
|
||||
}
|
||||
|
||||
public boolean isChatWindowAlwaysOnTop() {
|
||||
return getBoolean("ChatFrameAlwaysOnTop", false);
|
||||
}
|
||||
|
||||
public void setChatWindowAlwaysOnTop(boolean onTop) {
|
||||
setBoolean("ChatWindowAlwaysOnTop", onTop);
|
||||
}
|
||||
|
||||
|
||||
private boolean getBoolean(String property, boolean defaultValue) {
|
||||
return Boolean.parseBoolean(props.getProperty(property, Boolean
|
||||
.toString(defaultValue)));
|
||||
|
||||
@ -529,6 +529,8 @@ menuitem.create.room = Create or Join Room
|
||||
menuitem.expand.all.groups = Expand all Groups
|
||||
menuitem.collapse.all.groups = Collapse all Groups
|
||||
|
||||
menuitem.chatframe.option = Options
|
||||
|
||||
message = Message
|
||||
message.account.create = Create a new chat account.
|
||||
message.account.created = New account has been created.
|
||||
|
||||
@ -709,6 +709,8 @@ menuitem.create.room = Raum erstellen oder beitreten
|
||||
menuitem.expand.all.groups = <EFBFBD>ffne alle Gruppen
|
||||
menuitem.collapse.all.groups = Schlie<EFBFBD>e alle Gruppen
|
||||
|
||||
menuitem.chatframe.option = Einstellungen
|
||||
|
||||
tree.conference.services = Konferenzen
|
||||
tree.users.in.room = Teilnehmer im Raum
|
||||
|
||||
|
||||
Reference in New Issue
Block a user