📄 publicdataeditor.java
字号:
/*
*编写者:陈冈
*高校经费测算系统--公共参数设置编辑器
*编写时间:2006-11-21
*/
package cn.edu.jfcs.ui;
import java.math.BigDecimal;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.internal.databinding.provisional.DataBindingContext;
import org.eclipse.jface.internal.databinding.provisional.description.Property;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ViewForm;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.part.EditorPart;
import org.hibernate.CacheMode;
import org.hibernate.Query;
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.Transaction;
import cn.edu.jfcs.model.PubData;
import cn.edu.jfcs.sys.CacheImage;
import cn.edu.jfcs.sys.DataBindingFactory;
import cn.edu.jfcs.sys.GetGridData;
import cn.edu.jfcs.sys.HibernateSessionFactory;
import cn.edu.jfcs.sys.IAppConstants;
import cn.edu.jfcs.sys.IImageKey;
import cn.edu.jfcs.sys.SetControlEnabled;
import cn.edu.jfcs.sys.SetTextEnabled;
import cn.edu.jfcs.sys.YearManager;
public class PublicDataEditor extends EditorPart {
// 全校本年应收金额
private Text rte;
// 全校本年实收金额
private Text mte;
// 年度拟拨付总额
private Text mt;
// 全校缴费率标准
private Text sjf;
// 学生经费分割比
private Text uper;
// 专业培养费分割比
private Text pper;
// 公共课经费分割比
private Text cper;
// 奖酬金比率
private Text jcjper;
// 学生困难补助比率
private Text xsknbzper;
// 学生活动经费比率
private Text xshdjfper;
// 学生奖学金比率
private Text xsjxjper;
// 教授A系数
private Text tb1;
// 教授B系数
private Text tb2;
// 教授C系数
private Text tb3;
// 教授D系数
private Text tb4;
// 副教授A系数
private Text tb5;
// 副教授B系数
private Text tb6;
// 讲师
private Text tb7;
// 助教
private Text tb8;
private PubData pubData;
private boolean isDirty = false;
private IWorkbenchAction saveAction;
private ToolItem saveData;
private Group group_1, group_2, group_3;
private int curYear = YearManager.getInstance().getMaxYear();
public PublicDataEditor() {
}
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
setSite(site);
setInput(input);
setPartName(getConfigurationElement().getAttribute("name") + "---"
+ curYear);
}
public void createPartControl(Composite parent) {
createContents(parent);
getPubData(curYear);
bindData(parent);
saveAction = ActionFactory.SAVE.create(getEditorSite()
.getWorkbenchWindow());
}
private void createContents(Composite parent) {
final ViewForm vf = new ViewForm(parent, SWT.FLAT | SWT.BORDER);
// 设置顶部右边工具栏
vf.setTopRight(createToolbarButtons(vf));
// 添加主体内容
vf.setContent(createGroupText(vf));
}
// 创建文本框
private Composite createGroupText(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(1, false));
Color foreColor = new Color(Display.getCurrent(), 0x00, 0x40, 0x80);
group_1 = new Group(composite, SWT.NONE);
GridData gd = new GridData(GridData.FILL_BOTH);
group_1.setLayoutData(gd);
group_1.setText("金额设置");
group_1.setForeground(foreColor);
final GridLayout gridLayout = new GridLayout(6, false);
gridLayout.marginRight = 10;
gridLayout.verticalSpacing = 10;
gridLayout.marginHeight = 10;
group_1.setLayout(gridLayout);
// 第1行
final Label label1 = new Label(group_1, SWT.NONE);
label1.setText("本年应收金额");
label1.setAlignment(SWT.RIGHT);
label1.setLayoutData(new GetGridData().getGridData(50, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
rte = new Text(group_1, SWT.BORDER | SWT.RIGHT);
rte.setLayoutData(new GetGridData().getGridData(60, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
new Label(group_1, SWT.None).setText("万元");
final Label label2 = new Label(group_1, SWT.NONE);
label2.setText("本年实收金额");
label2.setAlignment(SWT.RIGHT);
label2.setLayoutData(new GetGridData().getGridData(50, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
mte = new Text(group_1, SWT.BORDER | SWT.RIGHT);
mte.setLayoutData(new GetGridData().getGridData(60, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
new Label(group_1, SWT.None).setText("万元");
// 第2行
final Label label3 = new Label(group_1, SWT.NONE);
label3.setText("年度拟拨付总额");
label3.setAlignment(SWT.RIGHT);
label3.setLayoutData(new GetGridData().getGridData(50, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
mt = new Text(group_1, SWT.BORDER | SWT.RIGHT);
mt.setLayoutData(new GetGridData().getGridData(60, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
new Label(group_1, SWT.None).setText("万元");
final Label label4 = new Label(group_1, SWT.NONE);
label4.setText("全校缴费率标准");
label4.setAlignment(SWT.RIGHT);
label4.setLayoutData(new GetGridData().getGridData(50, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
sjf = new Text(group_1, SWT.BORDER | SWT.RIGHT);
sjf.setLayoutData(new GetGridData().getGridData(60, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
new Label(group_1, SWT.None).setText("%");
// 经费的划分与调整
group_2 = new Group(composite, SWT.NONE);
gd = new GridData(GridData.FILL_BOTH);
group_2.setLayoutData(gd);
group_2.setText("经费的划分与调整系数");
group_2.setForeground(foreColor);
group_2.setLayout(gridLayout);
// 第1行
final Label label5 = new Label(group_2, SWT.NONE);
label5.setText("学生经费分割比");
label5.setAlignment(SWT.RIGHT);
label5.setLayoutData(new GetGridData().getGridData(50, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
uper = new Text(group_2, SWT.BORDER | SWT.RIGHT);
uper.setLayoutData(new GetGridData().getGridData(60, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
new Label(group_2, SWT.None).setText("%");
final Label label6 = new Label(group_2, SWT.NONE);
label6.setText("专业培养费分割比");
label6.setAlignment(SWT.RIGHT);
label6.setLayoutData(new GetGridData().getGridData(50, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
pper = new Text(group_2, SWT.BORDER | SWT.RIGHT);
pper.setLayoutData(new GetGridData().getGridData(60, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
new Label(group_2, SWT.None).setText("%");
// 第2行
final Label label7 = new Label(group_2, SWT.NONE);
label7.setText("公共课经费分割比");
label7.setAlignment(SWT.RIGHT);
label7.setLayoutData(new GetGridData().getGridData(50, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
cper = new Text(group_2, SWT.BORDER | SWT.RIGHT);
cper.setLayoutData(new GetGridData().getGridData(60, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
new Label(group_2, SWT.None).setText("%");
final Label label8 = new Label(group_2, SWT.NONE);
label8.setText("奖酬金比率");
label8.setAlignment(SWT.RIGHT);
label8.setLayoutData(new GetGridData().getGridData(50, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
jcjper = new Text(group_2, SWT.BORDER | SWT.RIGHT);
jcjper.setLayoutData(new GetGridData().getGridData(60, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
new Label(group_2, SWT.None).setText("%");
// 第3行
final Label label9 = new Label(group_2, SWT.NONE);
label9.setText("学生困难补助比率");
label9.setAlignment(SWT.RIGHT);
label9.setLayoutData(new GetGridData().getGridData(50, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
xsknbzper = new Text(group_2, SWT.BORDER | SWT.RIGHT);
xsknbzper.setLayoutData(new GetGridData().getGridData(60, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
new Label(group_2, SWT.None).setText("%");
final Label label10 = new Label(group_2, SWT.NONE);
label10.setText("学生活动经费比率");
label10.setAlignment(SWT.RIGHT);
label10.setLayoutData(new GetGridData().getGridData(50, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
xshdjfper = new Text(group_2, SWT.BORDER | SWT.RIGHT);
xshdjfper.setLayoutData(new GetGridData().getGridData(60, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
new Label(group_2, SWT.None).setText("%");
// 第4行
final Label label11 = new Label(group_2, SWT.NONE);
label11.setText("学生奖学金比率");
label11.setAlignment(SWT.RIGHT);
label11.setLayoutData(new GetGridData().getGridData(50, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
xsjxjper = new Text(group_2, SWT.BORDER | SWT.RIGHT);
xsjxjper.setLayoutData(new GetGridData().getGridData(60, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
new Label(group_2, SWT.None).setText("%");
// 职称系数
group_3 = new Group(composite, SWT.NONE);
gd = new GridData(GridData.FILL_BOTH);
group_3.setLayoutData(gd);
group_3.setText("职称调整系数");
group_3.setForeground(foreColor);
group_3.setLayout(gridLayout);
// 第1行
final Label label12 = new Label(group_3, SWT.NONE);
label12.setText("教授A系数");
label12.setAlignment(SWT.RIGHT);
label12.setLayoutData(new GetGridData().getGridData(50, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
tb1 = new Text(group_3, SWT.BORDER | SWT.RIGHT);
tb1.setLayoutData(new GetGridData().getGridData(60, 0, 0, 0, 0,
GridData.FILL_HORIZONTAL, 0));
new Label(group_3, SWT.None).setText("");
final Label label13 = new Label(group_3, SWT.NONE);
label13.setText("教授B系数");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -