📄 shellregistry.java
字号:
/*
* LumaQQ - Java QQ Client
*
* Copyright (C) 2004 luma <stubma@163.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package edu.tsinghua.lumaqq.ui.tool;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import edu.tsinghua.lumaqq.models.ClusterModel;
import edu.tsinghua.lumaqq.models.FriendModel;
import edu.tsinghua.lumaqq.ui.CheckUpdateShell;
import edu.tsinghua.lumaqq.ui.ReceiveIMWindow;
import edu.tsinghua.lumaqq.ui.ReceiveSMSShell;
import edu.tsinghua.lumaqq.ui.SendClusterIMWindow;
import edu.tsinghua.lumaqq.ui.SendIMWindow;
import edu.tsinghua.lumaqq.ui.SystemMessageListShell;
import edu.tsinghua.lumaqq.ui.config.cluster.ClusterInfoWindow;
import edu.tsinghua.lumaqq.ui.config.face.FaceWindow;
import edu.tsinghua.lumaqq.ui.config.sys.SystemOptionWindow;
import edu.tsinghua.lumaqq.ui.config.user.UserInfoWindow;
import edu.tsinghua.lumaqq.ui.wizard.WizardWindow;
/**
* 保存窗口的打开状态,保存窗口和好友的关系,避免打开多个相同窗口
*
* @author luma
*/
public class ShellRegistry {
// 存放当前已经打开的查看消息窗口
private Map rimwMap;
// 存放当前已经打开的发送消息窗口
private Map simwMap;
// 存放当前已经打开的用户资料查看窗口
private Map uiwMap;
// 存放当前已经打开的群资料查看窗口
private Map ciwMap;
// 存放当前已经打开的群消息发送窗口
private Map scimwMap;
// 存发当前已经打开的短消息发送窗口
private Map ssmsMap;
// 不为null表示系统消息列表窗口已经打开
private SystemMessageListShell systemMessageListShell;
// 不为null表示搜索窗口已经打开
private WizardWindow searchWizard;
// 不为null表示创建群窗口已经打开
private WizardWindow clusterWizard;
// 不为null表示系统设置窗口已经打开
private SystemOptionWindow systemOptionWindow;
// 不为null表示短消息查看窗口已经打开
private ReceiveSMSShell receiveSMSShell;
// 不为null表示检测更新窗口已经打开
private CheckUpdateShell checkUpdateShell;
// 不为null表示表情管理窗口已经打开
private FaceWindow faceWindow;
public ShellRegistry() {
rimwMap = new Hashtable();
simwMap = new Hashtable();
uiwMap = new Hashtable();
ciwMap = new Hashtable();
scimwMap = new Hashtable();
ssmsMap = new Hashtable();
}
/**
* 移除一个查看消息窗口项
*
* @param f
* 好友model
* @return
* 查看消息窗口
*/
public ReceiveIMWindow removeReceiveIMWindow(FriendModel f) {
return (ReceiveIMWindow)rimwMap.remove(f);
}
/**
* 检查好友是否有查看消息窗口打开
*
* @param f
* 好友model
* @return
* true表示好友f有一个查看消息窗口处于打开状态
*/
public boolean hasReceiveIMWindow(FriendModel f) {
return rimwMap.containsKey(f);
}
/**
* @param f
* 好友model
* @return
* 查看消息窗口对象
*/
public ReceiveIMWindow getReceiveIMWindow(FriendModel f) {
return (ReceiveIMWindow)rimwMap.get(f);
}
/**
* 注册查看消息窗口
*
* @param f
* 好友model
* @param rms
* 查看消息窗口对象
*/
public void addReceiveIMWindow(FriendModel f, ReceiveIMWindow rms) {
rimwMap.put(f, rms);
}
/**
* 检查是否存在好友的发送消息窗口
*
* @param f
* 好友model
* @return
* true表示存在
*/
public boolean hasSendIMWindow(FriendModel f) {
return simwMap.containsKey(f);
}
/**
* @param f
* 好友model
* @return
* 发送消息窗口
*/
public SendIMWindow getSendIMWindow(FriendModel f) {
return (SendIMWindow)simwMap.get(f);
}
/**
* 添加一个发送消息窗口
*
* @param f
* 好友model
* @param sms
* 发送消息窗口
*/
public void addSendIMWindow(FriendModel f, SendIMWindow sms) {
simwMap.put(f, sms);
}
/**
* 删除一个发送消息窗口
*
* @param f
* 好友model
* @return
* 发送消息窗口
*/
public SendIMWindow removeSendIMWindow(FriendModel f) {
return (SendIMWindow)simwMap.remove(f);
}
/**
* 检查是否存在好友的资料窗口
*
* @param f
* 好友model
* @return
* true表示存在
*/
public boolean hasUserInfoWindow(FriendModel f) {
return uiwMap.containsKey(f);
}
/**
* 检查是否存在好友的资料窗口
*
* @param qq
* 好友QQ号
* @return
* true表示存在
*/
public boolean hasUserInfoWindow(Integer qq) {
return uiwMap.containsKey(qq);
}
/**
* @param f
* 好友model
* @return
* 资料窗口
*/
public UserInfoWindow getUserInfoWindow(FriendModel f) {
return (UserInfoWindow)uiwMap.get(f);
}
/**
* @param qq
* 好友QQ号
* @return
* 资料窗口
*/
public UserInfoWindow getUserInfoWindow(Integer qq) {
return (UserInfoWindow)uiwMap.get(qq);
}
/**
* 添加一个资料窗口
*
* @param f
* 好友model
* @param uis
* 资料窗口
*/
public void addUserInfoWindow(FriendModel f, UserInfoWindow uis) {
uiwMap.put(f, uis);
}
/**
* 删除一个资料窗口
*
* @param f
* 好友model
* @return
* 好友资料窗口
*/
public UserInfoWindow removeUserInfoWindow(FriendModel f) {
return (UserInfoWindow)uiwMap.remove(f);
}
/**
* 移除一个群资料窗口
*
* @param c
* 群model
* @return
* 群资料窗口
*/
public ClusterInfoWindow removeClusterInfoWindow(ClusterModel c) {
return (ClusterInfoWindow)ciwMap.remove(c);
}
/**
* 检查是否有群资料窗口打开
*
* @param c
* 群model
* @return
* true表示好友f有一个查看消息窗口处于打开状态
*/
public boolean hasClusterInfoWindow(ClusterModel c) {
return ciwMap.containsKey(c);
}
/**
* @param c
* 群model
* @return
* 群资料窗口
*/
public ClusterInfoWindow getClusterInfoWindow(ClusterModel c) {
return (ClusterInfoWindow)ciwMap.get(c);
}
/**
* 注册群资料窗口
*
* @param c
* 群model
* @param cis
* 群资料窗口
*/
public void addClusterInfoWindow(ClusterModel c, ClusterInfoWindow cis) {
ciwMap.put(c, cis);
}
/**
* 移除一个群发送消息窗口项
*
* @param c
* 群model
* @return
* 群发送消息窗口
*/
public SendClusterIMWindow removeSendClusterIMWindow(ClusterModel c) {
return (SendClusterIMWindow)scimwMap.remove(c);
}
/**
* @return
* 当前打开的群信息窗口model遍历器
*/
public Iterator getSendClusterIMWindowModelIterator() {
return scimwMap.keySet().iterator();
}
/**
* 检查是否有群发送消息窗口打开
*
* @param c
* 群model
* @return
* true表示群c有一个群发送消息窗口处于打开状态
*/
public boolean hasSendClusterIMWindow(ClusterModel c) {
return scimwMap.containsKey(c);
}
/**
* @param c
* 群model
* @return
* 群发送消息窗口
*/
public SendClusterIMWindow getSendClusterIMWindow(ClusterModel c) {
return (SendClusterIMWindow)scimwMap.get(c);
}
/**
* 注册群发送消息窗口
*
* @param c
* 群model
* @param scimw
* 群发送消息窗口
*/
public void addSendClusterIMWindow(ClusterModel c, SendClusterIMWindow scimw) {
scimwMap.put(c, scimw);
}
/**
* @return
* true表示系统消息列表窗口当前已经打开
*/
public boolean isSystemMessageListShellOpened() {
return systemMessageListShell != null;
}
/**
* 注册系统消息列表窗口
*
* @param smls
* 系统消息列表窗口对象
*/
public void registerSystemMessageListShell(SystemMessageListShell smls) {
this.systemMessageListShell = smls;
}
/**
* 注销系统消息列表窗口
*/
public void deregisterSystemMessageListShell() {
this.systemMessageListShell = null;
}
/**
* @return
* 系统消息列表窗口
*/
public SystemMessageListShell getSystemMessageListShell() {
return systemMessageListShell;
}
/**
* @return
* true表示搜索窗口当前已经打开
*/
public boolean isSearchWizardOpened() {
return searchWizard != null;
}
/**
* 注册搜索窗口
*
* @param ss
* 搜索窗口对象
*/
public void registerSearchWizard(WizardWindow ss) {
this.searchWizard = ss;
}
/**
* 注销搜索窗口
*/
public void deregisterSearchWizard() {
this.searchWizard = null;
}
/**
* @return
* 搜索窗口
*/
public WizardWindow getSearchWizard() {
return searchWizard;
}
/**
* @return
* true表示创建群窗口当前已经打开
*/
public boolean isClusterWizardOpened() {
return clusterWizard != null;
}
/**
* 注册创建群窗口
*
* @param wizard
* 创建群窗口对象
*/
public void registerClusterWizard(WizardWindow wizard) {
this.clusterWizard = wizard;
}
/**
* 注销创建群窗口
*/
public void deregisterClusterWizard() {
this.clusterWizard = null;
}
/**
* @return
* 创建群窗口
*/
public WizardWindow getClusterWizard() {
return clusterWizard;
}
/**
* @return
* true表示系统设置窗口当前已经打开
*/
public boolean isSystemOptionWindowOpened() {
return systemOptionWindow != null;
}
/**
* 注册系统设置窗口
*
* @param sos
* 系统设置窗口对象
*/
public void registerSystemOptionWindow(SystemOptionWindow sos) {
this.systemOptionWindow = sos;
}
/**
* 注销系统设置窗口
*/
public void deregisterSystemOptionWindow() {
this.systemOptionWindow = null;
}
/**
* @return
* 系统设置窗口
*/
public SystemOptionWindow getSystemOptionWindow() {
return systemOptionWindow;
}
/**
* @return
* true表示短消息查看窗口当前已经打开
*/
public boolean isReceiveSMSShellOpened() {
return receiveSMSShell != null;
}
/**
* 注册短消息查看窗口
*
* @param rsms
* 短消息查看窗口对象
*/
public void registerReceiveSMSShell(ReceiveSMSShell rsms) {
this.receiveSMSShell = rsms;
}
/**
* 注销短消息查看窗口
*/
public void deregisterReceiveSMSShell() {
this.receiveSMSShell = null;
}
/**
* @return
* 短消息查看窗口
*/
public ReceiveSMSShell getReceiveSMSShell() {
return receiveSMSShell;
}
/**
* @return
* true表示检测更新窗口当前已经打开
*/
public boolean isCheckUpdateShellOpened() {
return checkUpdateShell != null;
}
/**
* 注册检测更新窗口
*
* @param cus
* 检测更新窗口对象
*/
public void registerCheckUpdateShell(CheckUpdateShell cus) {
this.checkUpdateShell = cus;
}
/**
* 注销检测更新窗口
*/
public void deregisterCheckUpdateShell() {
this.checkUpdateShell = null;
}
/**
* @return
* 检测更新窗口
*/
public CheckUpdateShell getCheckUpdateShell() {
return checkUpdateShell;
}
/**
* @return
* 表情管理窗口
*/
public FaceWindow getFaceWindow() {
return faceWindow;
}
/**
* @return
* true表示表情管理窗口已经打开
*/
public boolean isFaceWindowOpened() {
return faceWindow != null;
}
/**
* 注册表情管理窗口
*
* @param fw
*/
public void registerFaceWindow(FaceWindow fw) {
this.faceWindow = fw;
}
/**
* 注销表情管理窗口
*/
public void deregisterFaceWindow() {
this.faceWindow = null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -