📄 groupmodel.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.models;
import edu.tsinghua.swt.models.AbstractNode;
/**
* <pre>
* 表示QQ的一个组,做为QQ model中的一个顶层元素
* 一个组有以下属性
* name: 组名称
* friendly: 表示这个组是否是一个好友组,取值为true或者false,注意都是字符串
* blacklist: 表示这个组是否是黑名单组,取值为true或者false
* upload: 表示上传分组的时候这个组是否需要上传
* cluster: 表示这是否是一个群组,取值为true或者false
* visible: 表示这个组是否显示出来,为true或者false
* onlineUser: 表示这个组里面的在线好友数,类型为Integer
* users: 表示这个组里面的好友总数,类型为Integer
* </pre>
*
* @author 马若劼
*/
/**
* <pre>
* </pre>
*
* @author 马若劼
*/
public class GroupModel extends AbstractNode implements IQQNode {
/**
* 构造函数
*/
public GroupModel(String name) {
super();
addProperty(NAME, name);
addProperty(FRIENDLY, "true");
addProperty(BLACKLIST, "false");
addProperty(VISIBLE, "true");
addProperty(UPLOAD, "true");
addProperty(CLUSTER, "false");
}
/**
* @return true表示这个组是群组
*/
public boolean isCluster() {
if(hasProperty(CLUSTER))
return "true".equals(getProperty(CLUSTER));
else
return false;
}
/**
* @return true表示这个是好友组
*/
public boolean isFriendly() {
if(hasProperty(FRIENDLY))
return "true".equals(getProperty(FRIENDLY));
else
return false;
}
/**
* @return true表示这是一个黑名单组
*/
public boolean isBlackList() {
if(hasProperty(BLACKLIST))
return "true".equals(getProperty(BLACKLIST));
else
return false;
}
/**
* @return true表示组可见
*/
public boolean isVisible() {
if(hasProperty(VISIBLE))
return "true".equals(getProperty(VISIBLE));
else
return false;
}
/**
* @return true表示该组需要上传
*/
public boolean needUpload() {
if(hasProperty(UPLOAD))
return "true".equals(getProperty(UPLOAD));
else
return false;
}
/**
* @return
* 在线好友数
*/
public int getOnlineUser() {
if(hasProperty(ONLINE_USER))
return ((Integer)getProperty(ONLINE_USER)).intValue();
else
return 0;
}
/**
* 设置在线好友数
*
* @param u
* 在线好友数
*/
public void setOnlineUser(int u) {
addProperty(ONLINE_USER, new Integer(u));
}
/**
* @return
* 组内好友总数
*/
public int getUsers() {
if(hasProperty(USERS))
return ((Integer)getProperty(USERS)).intValue();
else
return 0;
}
/**
* 设置好友总数
*
* @param u
* 好友总数
*/
public void setUsers(int u) {
addProperty(USERS, new Integer(u));
}
/**
* @return
* 组名称
*/
public String getName() {
if(hasProperty(NAME))
return (String)getProperty(NAME);
else
return "";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -