📄 clusterinfoshell.java
字号:
basicBanner.setBackground(bannerBackground);
basicBanner.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
FormData fd = new FormData();
fd.left = fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(0, 24);
basicBanner.setLayoutData(fd);
basicBanner.addPaintListener(new BannerPaintListener(LumaQQ.getResourceString("cluster.info.banner.basic")));
// 群号码标签
Label lblId = new Label(basic, SWT.NONE);
lblId.setBackground(panelBackground);
lblId.setText(LumaQQ.getResourceString("cluster.info.basic.id"));
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.right = new FormAttachment(20, 0);
fd.top = new FormAttachment(basicBanner, 5, SWT.BOTTOM);
lblId.setLayoutData(fd);
// 群号码文本框
textId = new Text(basic, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
textId.setBackground(panelBackground);
fd = new FormData();
fd.left = new FormAttachment(lblId, 3, SWT.RIGHT);
fd.right = new FormAttachment(60, 0);
fd.top = new FormAttachment(basicBanner, 5, SWT.BOTTOM);
textId.setLayoutData(fd);
// 头像按钮
btnFace = new ShutterLabel(basic, MySWT.HOVER | MySWT.FLAT | SWT.CENTER, null, null);
btnFace.setBackground(panelBackground);
btnFace.setShowSmallImage(false);
fd = new FormData();
fd.left = new FormAttachment(textId, 10, SWT.RIGHT);
fd.top = new FormAttachment(textId, 0, SWT.TOP);
btnFace.setLayoutData(fd);
btnFace.addMouseListener(
new MouseAdapter() {
public void mouseUp(MouseEvent e) {
if(iss == null || iss.isDisposed()) {
iss = new ImageSelectShell(shell);
iss.addShellListener(new FacePanelListener());
iss.setImageSize(32, 32);
iss.setMarginWidth(5);
iss.setMarginHeight(5);
iss.setHorizontalSpacing(5);
iss.setVerticalSpacing(5);
iss.setDimension(6, 6);
iss.addAllClusterFace();
iss.refresh();
Rectangle bound = btnFace.getBounds();
iss.setLocation(composites[BASIC].toDisplay(bound.x, bound.y + bound.height));
iss.open();
}
}
}
);
// 创建人标签
Label lblCreator = new Label(basic, SWT.NONE);
lblCreator.setBackground(panelBackground);
lblCreator.setText(LumaQQ.getResourceString("cluster.info.basic.creator"));
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.right = new FormAttachment(20, 0);
fd.top = new FormAttachment(basicBanner, 30, SWT.BOTTOM);
lblCreator.setLayoutData(fd);
// 创建人文本框
textCreator = new Text(basic, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
textCreator.setBackground(panelBackground);
fd = new FormData();
fd.left = new FormAttachment(lblCreator, 3, SWT.RIGHT);
fd.right = new FormAttachment(60, 0);
fd.top = new FormAttachment(basicBanner, 30, SWT.BOTTOM);
textCreator.setLayoutData(fd);
// 名称标签
Label lblName = new Label(basic, SWT.NONE);
lblName.setBackground(panelBackground);
lblName.setText(LumaQQ.getResourceString("cluster.info.basic.name"));
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.right = new FormAttachment(20, 0);
fd.top = new FormAttachment(basicBanner, 55, SWT.BOTTOM);
lblName.setLayoutData(fd);
// 名称文本框
textName = new Text(basic, SWT.SINGLE | SWT.BORDER);
textName.setBackground(controlBackground);
fd = new FormData();
fd.left = new FormAttachment(lblName, 3, SWT.RIGHT);
fd.right = new FormAttachment(60, 0);
fd.top = new FormAttachment(basicBanner, 55, SWT.BOTTOM);
textName.setLayoutData(fd);
// 分类标签
Label lblCategory = new Label(basic, SWT.NONE);
lblCategory.setBackground(panelBackground);
lblCategory.setText(LumaQQ.getResourceString("cluster.info.basic.category"));
fd = new FormData();
fd.left = new FormAttachment(60, 5);
fd.right = new FormAttachment(75, 0);
fd.top = new FormAttachment(basicBanner, 55, SWT.BOTTOM);
lblCategory.setLayoutData(fd);
// 分类下拉框
comboCategory = new CCombo(basic, SWT.BORDER | SWT.READ_ONLY);
comboCategory.add(LumaQQ.getResourceString("create.cluster.basic.category.classmate"));
comboCategory.add(LumaQQ.getResourceString("create.cluster.basic.category.friend"));
comboCategory.add(LumaQQ.getResourceString("create.cluster.basic.category.colleague"));
comboCategory.add(LumaQQ.getResourceString("create.cluster.basic.category.other"));
fd = new FormData();
fd.left = new FormAttachment(75, 5);
fd.right = new FormAttachment(100, -5);
fd.top = new FormAttachment(basicBanner, 55, SWT.BOTTOM);
comboCategory.setLayoutData(fd);
// 群内公告标签
Label lblNotice = new Label(basic, SWT.NONE);
lblNotice.setBackground(panelBackground);
lblNotice.setText(LumaQQ.getResourceString("cluster.info.basic.notice"));
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(basicBanner, 80, SWT.BOTTOM);
lblNotice.setLayoutData(fd);
// 公告文本框
textNotice = new Text(basic, SWT.MULTI | SWT.WRAP | SWT.BORDER);
textNotice.setBackground(controlBackground);
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.right = new FormAttachment(100, -5);
fd.top = new FormAttachment(lblNotice, 2, SWT.BOTTOM);
fd.bottom = new FormAttachment(lblNotice, 52, SWT.BOTTOM);
textNotice.setLayoutData(fd);
// 群简介标签
Label lblDescription = new Label(basic, SWT.NONE);
lblDescription.setBackground(panelBackground);
lblDescription.setText(LumaQQ.getResourceString("cluster.info.basic.description"));
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(textNotice, 2, SWT.BOTTOM);
lblDescription.setLayoutData(fd);
// 群简介文本框
textDescription = new Text(basic, SWT.MULTI | SWT.WRAP | SWT.BORDER);
textDescription.setBackground(controlBackground);
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.right = new FormAttachment(100, -5);
fd.top = new FormAttachment(lblDescription, 2, SWT.BOTTOM);
fd.bottom = new FormAttachment(lblDescription, 52, SWT.BOTTOM);
textDescription.setLayoutData(fd);
// 认证组
authGroup = new Group(basic, SWT.SHADOW_ETCHED_OUT);
authGroup.setText(LumaQQ.getResourceString("cluster.info.basic.group.auth"));
authGroup.setBackground(panelBackground);
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.right = new FormAttachment(100, -5);
fd.top = new FormAttachment(textDescription, 2, SWT.BOTTOM);
fd.bottom = new FormAttachment(100, -5);
authGroup.setLayoutData(fd);
authGroup.setLayout(new GridLayout());
// 不需要认证
radioNoAuth = new Button(authGroup, SWT.RADIO);
radioNoAuth.setBackground(panelBackground);
radioNoAuth.setText(LumaQQ.getResourceString("cluster.info.basic.no.auth"));
radioNoAuth.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
authType = QQ.QQ_CLUSTER_NO_AUTH;
}
}
);
// 需要认证
radioNeedAuth = new Button(authGroup, SWT.RADIO);
radioNeedAuth.setBackground(panelBackground);
radioNeedAuth.setText(LumaQQ.getResourceString("cluster.info.basic.need.auth"));
radioNeedAuth.setSelection(true);
radioNoAuth.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
authType = QQ.QQ_CLUSTER_NEED_AUTH;
}
}
);
// 不允许任何人加入
radioNoAdd = new Button(authGroup, SWT.RADIO);
radioNoAdd.setBackground(panelBackground);
radioNoAdd.setText(LumaQQ.getResourceString("cluster.info.basic.no.add"));
radioNoAuth.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
authType = QQ.QQ_CLUSTER_NO_ADD;
}
}
);
}
/**
* 初始化成员列表面板
*/
private void initMemberPanel() {
Composite member = createPanel();
member.setVisible(false);
composites[MEMBER] = member;
// 设置组成员按钮
btnSetMember = new Button(member, SWT.PUSH);
btnSetMember.setText(LumaQQ.getResourceString("cluster.info.member.button.set"));
FormData fd = new FormData();
fd.right = new FormAttachment(100, -5);
fd.top = new FormAttachment(0, 5);
btnSetMember.setLayoutData(fd);
btnSetMember.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if(fss.isVisible())
fss.setVisible(false);
else {
// 把当前表中的成员在fss中设置为已选择状态
TableItem[] tis = table.getItems();
for(int i = 0; i < tis.length; i++) {
FriendModel f = (FriendModel)tis[i].getData();
fss.select(f);
}
fss.setVisible(true);
}
}
});
// 加为好友按钮
btnAddFriend = new Button(member, SWT.PUSH);
btnAddFriend.setText(LumaQQ.getResourceString("cluster.info.member.button.add"));
fd = new FormData();
fd.right = new FormAttachment(btnSetMember, 0, SWT.LEFT);
fd.top = new FormAttachment(0, 5);
btnAddFriend.setLayoutData(fd);
btnAddFriend.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int index = table.getSelectionIndex();
if(index != -1) {
// 得到成员model
TableItem ti = table.getItem(index);
FriendModel f = (FriendModel)ti.getData();
// 找到第一个好友组的model
List list = main.model.find(main.friendlyMatcher);
if(list != null && list.size() > 0) {
GroupModel destModel = (GroupModel)list.get(0);
// 创建窗口
ReceiveSystemMessageShell rsms = new ReceiveSystemMessageShell(main);
rsms.setFriendModel(f);
rsms.open(ReceiveSystemMessageShell.ADD_MODE);
main.addFriend(f.getQQ(), destModel);
}
}
}
}
);
// 删除成员按钮
btnRemoveMember = new Button(member, SWT.PUSH);
btnRemoveMember.setText(LumaQQ.getResourceString("cluster.info.member.button.remove"));
fd = new FormData();
fd.right = new FormAttachment(btnAddFriend, 0, SWT.LEFT);
fd.top = new FormAttachment(0, 5);
btnRemoveMember.setLayoutData(fd);
btnRemoveMember.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int index = table.getSelectionIndex();
if(index != -1)
table.remove(index);
}
}
);
// 成员列表
table = new Table(member, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE);
fd = new FormData();
fd.top = new FormAttachment(btnSetMember, 3, SWT.BOTTOM);
fd.left = new FormAttachment(0, 5);
fd.right = fd.bottom = new FormAttachment(100, -5);
table.setLayoutData(fd);
table.addSelectionListener(
new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
// 设置删除成员按钮的使能状态,如果被选择的成员ID等于创建者ID,则禁止删除
TableItem ti = table.getItem(table.getSelectionIndex());
FriendModel f = (FriendModel)ti.getData();
ClusterInfo info = (ClusterInfo)c.getProperty("info");
btnRemoveMember.setEnabled(info.creator != f.getQQ());
}
public void widgetDefaultSelected(SelectionEvent e) {
// 得到当前双击的成员model,打开他的资料窗口
int index = table.getSelectionIndex();
if(index != -1) {
FriendModel f = (FriendModel)table.getItem(index).getData();
main.openUserInfoShell(f, false);
main.client.getUserInfo(f.getQQ());
}
}
}
);
// 添加表头
// QQ号
TableColumn tc = new TableColumn(table, SWT.LEFT);
tc.setText(LumaQQ.getResourceString("cluster.info.member.table.header.qq"));
tc.setWidth(100);
// 昵称
tc = new TableColumn(table, SWT.CENTER);
tc.setText(LumaQQ.getResourceString("cluster.info.member.table.header.nick"));
tc.setWidth(120);
// 性别
tc = new TableColumn(table, SWT.CENTER);
tc.setText(LumaQQ.getResourceString("cluster.info.member.table.header.gender"));
tc.setWidth(40);
// 年龄
tc = new TableColumn(table, SWT.CENTER);
tc.setText(LumaQQ.getResourceString("cluster.info.member.table.header.age"));
tc.setWidth(40);
table.setHeaderVisible(true);
// 成员选择窗口
fss = new FriendSelectShell(shell);
fss.setModel(main.model);
fss.addFriendSelectionListener(this);
}
/**
* 初始化消息设定面板
*/
private void initMessagePanel() {
Composite message = createPanel();
message.setVisible(false);
composites[MESSAGE] = message;
// 选项组
Group group = new Group(message, SWT.SHADOW_ETCHED_OUT);
group.setBackground(panelBackground);
group.setText(LumaQQ.getResourceString("cluster.info.message.group"));
FormData fd = new FormData();
fd.top = fd.left = new FormAttachment(0, 10);
fd.right = new FormAttachment(100, -10);
group.setLayoutData(fd);
group.setLayout(new GridLayout());
// 接收并提示
radioAccept = new Button(group, SWT.RADIO);
radioAccept.setBackground(panelBackground);
radioAccept.setText(LumaQQ.getResourceString("cluster.info.message.accept"));
radioAccept.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
messageOption = "accept";
}
}
);
// 自动弹出
radioEject = new Button(group, SWT.RADIO);
radioEject.setBackground(panelBackground);
radioEject.setText(LumaQQ.getResourceString("cluster.info.message.eject"));
radioEject.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
messageOption = "eject";
}
}
);
// 接收不提示,保存到记录
radioRecord = new Button(group, SWT.RADIO);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -