📄 smsmanager.java
字号:
/*
* Created on 2004-8-18
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package com.gctech.smsmanage;
import org.apache.log4j.PropertyConfigurator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import EDU.oswego.cs.dl.util.concurrent.ThreadedExecutor;
import com.gctech.sms.platform.Constants;
import com.gctech.sms.platform.Server;
import com.gctech.smsmanage.handler.StartGateWay;
import com.gctech.util.net.ConcurrentServer;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
/**
* <p>Title:</p>
* <p>Description:</p>
* <p>Copyright: Copyright (c) Gctech 2004-8-18</p>
* <p>Company: 吉芙德资讯有限公司</p>
*
* @version 1.0
* @author liyi
*
*/
public class SMSManager {
private static Text text_15;
private static Text text_14;
private static Text text_13;
private static Text text_12;
private static Text text_11;
private static Text text_10;
private static Table table;
private static Text text_9;
private static Text text_8;
private static Text text_7;
private static Text text_6;
private static Text text_5;
private static Text text_4;
private static Text text_3;
private static Text text_2;
private static Text text_1;
private static Text text;
private static Tree tree;
private static Group top_layer;
private static Group cmpp_layer;
private static Group gateway_layer;
private static Group service_layer;
private static Composite content;
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell();
shell.setSize(600, 450);
shell.setLayout(new FillLayout());
final StackLayout stackLayout = new StackLayout();
shell.setText("短信管理平台");
{
Menu menubar = new Menu(shell, SWT.BAR);
shell.setMenuBar(menubar);
{
final MenuItem menuItem = new MenuItem(menubar, SWT.CASCADE);
menuItem.setText("文件");
{
Menu popupmenu = new Menu(menuItem);
menuItem.setMenu(popupmenu);
{
final MenuItem menuItem_1 =
new MenuItem(popupmenu, SWT.NONE);
menuItem_1.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
CreateGatewayDialog dialog = new CreateGatewayDialog(shell);
dialog.open();
}
});
menuItem_1.setText("添加网关");
}
{
final MenuItem menuItem_1 =
new MenuItem(popupmenu, SWT.NONE);
menuItem_1.setText("添加服务");
}
{
new MenuItem(popupmenu, SWT.SEPARATOR);
}
{
final MenuItem menuItem_1 =
new MenuItem(popupmenu, SWT.NONE);
menuItem_1
.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
shell.close();
}
});
menuItem_1.setText("退出");
}
}
}
{
final MenuItem menuItem = new MenuItem(menubar, SWT.CASCADE);
menuItem.setText("工具");
{
Menu popupmenu = new Menu(menuItem);
menuItem.setMenu(popupmenu);
{
final MenuItem menuItem_1 =
new MenuItem(popupmenu, SWT.NONE);
menuItem_1
.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
MessageSenderDialog dialog =
new MessageSenderDialog(shell);
dialog.open();
}
});
menuItem_1.setText("发短信");
}
{
new MenuItem(popupmenu, SWT.SEPARATOR);
}
{
final MenuItem menuItem_1 =
new MenuItem(popupmenu, SWT.NONE);
menuItem_1
.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
UnSubscribeDialog dialog =
new UnSubscribeDialog(shell);
dialog.open();
}
});
menuItem_1.setText("反向取消");
}
{
final MenuItem menuItem_1 =
new MenuItem(popupmenu, SWT.NONE);
menuItem_1.setText("反向定购");
}
}
}
{
final MenuItem menuItem = new MenuItem(menubar, SWT.CASCADE);
menuItem.setText("帮助");
{
Menu popupmenu = new Menu(menuItem);
menuItem.setMenu(popupmenu);
{
final MenuItem menuItem_1 =
new MenuItem(popupmenu, SWT.NONE);
menuItem_1
.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
VersionDialog dialog = new VersionDialog(shell);
dialog.open();
}
});
menuItem_1.setText("关于");
}
}
}
}
{
final Composite composite = new Composite(shell, SWT.NONE);
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
composite.setLayout(gridLayout);
{
final Group group = new Group(composite, SWT.NONE);
group.setLayout(new FillLayout(SWT.HORIZONTAL));
final GridData gridData =
new GridData(GridData.VERTICAL_ALIGN_FILL);
gridData.heightHint = 370;
gridData.widthHint = 150;
gridData.verticalSpan = 2;
group.setLayoutData(gridData);
{
tree = new Tree(group, SWT.BORDER);
tree.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TreeItem[] t = tree.getSelection();
if (t[0].getText().equals("网关")) {
System.out.println("网关");
stackLayout.topControl = gateway_layer;
content.layout();
}
if (t[0].getText().equals("服务")) {
System.out.println("服务");
stackLayout.topControl = service_layer;
content.layout();
}
if (t[0].getText().equals("平台")) {
System.out.println("平台");
stackLayout.topControl = top_layer;
content.layout();
}
if (t[0].getText().equals("移动")) {
System.out.println("移动");
stackLayout.topControl = cmpp_layer;
content.layout();
}
}
});
TreeItem platform = new TreeItem(tree, SWT.NONE);
platform.setText("平台");
TreeItem moSvc = new TreeItem(platform, SWT.NONE, 0);
moSvc.setText("服务");
TreeItem gateway = new TreeItem(tree, SWT.NONE);
gateway.setText("网关");
TreeItem cmpp = new TreeItem(gateway, SWT.NONE);
cmpp.setText("移动");
TreeItem scgp = new TreeItem(gateway, SWT.NONE, 0);
scgp.setText("联通");
TreeItem cngp = new TreeItem(gateway, SWT.NONE, 0);
cngp.setText("网通");
TreeItem log = new TreeItem(tree, SWT.NONE, 2);
log.setText("日志");
TreeItem debug = new TreeItem(log, SWT.NONE);
debug.setText("调试");
TreeItem warn = new TreeItem(log, SWT.NONE, 0);
warn.setText("警告");
TreeItem erro = new TreeItem(log, SWT.NONE, 0);
erro.setText("错误");
}
}
{
content = new Composite(composite, SWT.NONE);
content.setLayout(stackLayout);
content.setLayoutData(new GridData(GridData.FILL_BOTH));
{
top_layer = new Group(content, SWT.NONE);
top_layer.setLayout(new GridLayout());
{
final Group top_group = new Group(top_layer, SWT.NONE);
final GridData gridData =
new GridData(GridData.FILL_HORIZONTAL);
gridData.heightHint = 150;
top_group.setLayoutData(gridData);
final GridLayout gridLayout_1 = new GridLayout();
gridLayout_1.numColumns = 4;
top_group.setLayout(gridLayout_1);
{
final Label label = new Label(top_group, SWT.NONE);
label.setText("运行时间:");
}
{
final Label label = new Label(top_group, SWT.NONE);
label.setText("32小时13分30秒");
}
{
final Label label = new Label(top_group, SWT.NONE);
label.setText("开始时间");
}
{
final Label label = new Label(top_group, SWT.NONE);
label.setText("2004年8月16日14点");
}
{
final Label label = new Label(top_group, SWT.NONE);
label.setText("线程数");
}
{
final Label label = new Label(top_group, SWT.NONE);
label.setText("12");
}
{
final Label label = new Label(top_group, SWT.NONE);
label.setText("启动服务");
}
{
final Label label = new Label(top_group, SWT.NONE);
label.setText("5");
}
{
final Composite composite_2 =
new Composite(top_group, SWT.NONE);
final GridData gridData_1 =
new GridData(
GridData.GRAB_HORIZONTAL
| GridData.HORIZONTAL_ALIGN_END
| GridData.GRAB_VERTICAL
| GridData.VERTICAL_ALIGN_END);
gridData_1.horizontalSpan = 4;
composite_2.setLayoutData(gridData_1);
final GridLayout gridLayout_2 = new GridLayout();
gridLayout_2.numColumns = 4;
composite_2.setLayout(gridLayout_2);
{
final Button button =
new Button(composite_2, SWT.NONE);
button
.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Server.getInstance().shutdown();
}
});
button.setText("停止");
}
{
final Button button =
new Button(composite_2, SWT.NONE);
button
.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Server.getInstance().restart();
}
});
button.setText("重启");
}
{
final Button button =
new Button(composite_2, SWT.NONE);
button
.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
PropertyConfigurator.configureAndWatch(
"./conf/server.properties");
System.out.println(
"Starting Server.....");
//启动服务器,启动必须的资源,线程池,连接池等。
String[] args =
{ "./conf/server.properties" };
Server.getInstance().init(
"./conf/server.properties");
//启动管理服务
int port = Constants.ADMIN_PORT;
if (args.length == 2)
port = Integer.parseInt(args[1]);
ConcurrentServer server =
new ConcurrentServer(
port,
"AdminService",
"com.gctech.sms.platform.AdminService",
new ThreadedExecutor());
Thread t = new Thread(server);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -