?? publicdataeditor.java
字號:
/*
*編寫者:陳岡
*高校經(jīng)費測算系統(tǒng)--公共參數(shù)設(shè)置編輯器
*編寫時間: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 {
// 全校本年應(yīng)收金額
private Text rte;
// 全校本年實收金額
private Text mte;
// 年度擬撥付總額
private Text mt;
// 全校繳費率標準
private Text sjf;
// 學生經(jīng)費分割比
private Text uper;
// 專業(yè)培養(yǎng)費分割比
private Text pper;
// 公共課經(jīng)費分割比
private Text cper;
// 獎酬金比率
private Text jcjper;
// 學生困難補助比率
private Text xsknbzper;
// 學生活動經(jīng)費比率
private Text xshdjfper;
// 學生獎學金比率
private Text xsjxjper;
// 教授A系數(shù)
private Text tb1;
// 教授B系數(shù)
private Text tb2;
// 教授C系數(shù)
private Text tb3;
// 教授D系數(shù)
private Text tb4;
// 副教授A系數(shù)
private Text tb5;
// 副教授B系數(shù)
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);
// 設(shè)置頂部右邊工具欄
vf.setTopRight(createToolbarButtons(vf));
// 添加主體內(nèi)容
vf.setContent(createGroupText(vf));
}
// 創(chuàng)建文本框
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("金額設(shè)置");
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("本年應(yīng)收金額");
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("%");
// 經(jīng)費的劃分與調(diào)整
group_2 = new Group(composite, SWT.NONE);
gd = new GridData(GridData.FILL_BOTH);
group_2.setLayoutData(gd);
group_2.setText("經(jīng)費的劃分與調(diào)整系數(shù)");
group_2.setForeground(foreColor);
group_2.setLayout(gridLayout);
// 第1行
final Label label5 = new Label(group_2, SWT.NONE);
label5.setText("學生經(jīng)費分割比");
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("專業(yè)培養(yǎng)費分割比");
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("公共課經(jīng)費分割比");
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("學生活動經(jīng)費比率");
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("%");
// 職稱系數(shù)
group_3 = new Group(composite, SWT.NONE);
gd = new GridData(GridData.FILL_BOTH);
group_3.setLayoutData(gd);
group_3.setText("職稱調(diào)整系數(shù)");
group_3.setForeground(foreColor);
group_3.setLayout(gridLayout);
// 第1行
final Label label12 = new Label(group_3, SWT.NONE);
label12.setText("教授A系數(shù)");
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系數(shù)");
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -