📄 memberdatadialog.java
字号:
//参加工作时间
new Label(baseDataGroup,SWT.NONE).setText("工作时间");
workStartText = new Text(baseDataGroup,SWT.BORDER);
workStartText.setLayoutData(createGridData(150));
workStartText.setText("0000-00-00");
//两个占位标签
createOccupation(baseDataGroup,2);
//第二个分组
Group otherDataGroup = new Group(topComp,SWT.NONE);
otherDataGroup.setText("其它基本信息");
otherDataGroup.setLayout(new GridLayout(8,false));
otherDataGroup.setLayoutData(new RowData(600,100));
//是否中科院士
new Label(otherDataGroup,SWT.NONE).setText("是否中科院院士");
isZkyAcademicianCombo = new Combo(otherDataGroup,SWT.NONE);
isZkyAcademicianCombo.add("是");
isZkyAcademicianCombo.add("否");
isZkyAcademicianCombo.select(0);
//是否工程院院士
new Label(otherDataGroup,SWT.NONE).setText("是否工程院院士");
isGcyAcademicianCombo = new Combo(otherDataGroup,SWT.NONE);
isGcyAcademicianCombo.add("是");
isGcyAcademicianCombo.add("否");
isGcyAcademicianCombo.select(0);
//是否享受政府特殊津贴
new Label(otherDataGroup,SWT.NONE).setText("是否享受政府特殊津贴");
isAllowanceCombo = new Combo(otherDataGroup,SWT.NONE);
isAllowanceCombo.add("是");
isAllowanceCombo.add("否");
isAllowanceCombo.select(0);
//是否国家(省)级突出贡献专家
new Label(otherDataGroup,SWT.NONE).setText("是否突出贡献专家");
isContributeCombo = new Combo(otherDataGroup,SWT.NONE);
isContributeCombo.add("是");
isContributeCombo.add("否");
isContributeCombo.select(0);
//获得专业资格证书
new Label(otherDataGroup,SWT.NONE).setText("获得专业资格证书");
certificateText = new Text(otherDataGroup,SWT.BORDER);
certificateText.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL,5));
//两个占位标签
createOccupation(otherDataGroup,2);
//担任学会组织的职务
new Label(otherDataGroup,SWT.NONE).setText("担任社团组织、\n学会组织的职务");
academyDutyText = new Text(otherDataGroup,SWT.BORDER);
academyDutyText.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL,5));
return topComp;
}
/**
* "熟悉专业及其代表作"的面板生成方法
*/
private Composite createMagnumOpusComp(Composite rightComp){
Composite topComp = new Composite(rightComp,SWT.NONE);
topComp.setLayout(new RowLayout());
Group magnumOpusGroup = new Group(topComp,SWT.NONE);
magnumOpusGroup.setText("熟悉专业及其代表作");
magnumOpusGroup.setLayoutData(new RowData(600,350));
magnumOpusText = new Text(magnumOpusGroup,SWT.BORDER|SWT.V_SCROLL|SWT.H_SCROLL|SWT.MULTI);
magnumOpusText.setBounds(10, 50, 570, 300);
return topComp;
}
/**
* "近五年从事的主要研究项目"面板的生成方法
*/
private Composite createProjectsComp(Composite rightComp){
Composite topComp = new Composite(rightComp,SWT.NONE);
topComp.setLayout(new RowLayout());
Group projectsGroup = new Group(topComp,SWT.NONE);
projectsGroup.setText("近五年从事的主要研究项目");
projectsGroup.setLayoutData(new RowData(600,350));
projectsText = new Text(projectsGroup,SWT.BORDER|SWT.V_SCROLL|SWT.H_SCROLL|SWT.MULTI);
projectsText.setBounds(10, 50, 570, 300);
return topComp;
}
/**
* "主要获奖情况"面板的生成方法
*/
private Composite createEncouragementComp(Composite rightComp){
Composite topComp = new Composite(rightComp,SWT.NONE);
topComp.setLayout(new RowLayout());
Group encouragementGroup = new Group(topComp,SWT.NONE);
encouragementGroup.setText("主要获奖情况");
encouragementGroup.setLayoutData(new RowData(600,350));
encouragementText = new Text(encouragementGroup,SWT.BORDER|SWT.V_SCROLL|SWT.H_SCROLL|SWT.MULTI);
encouragementText.setBounds(10, 50, 570, 300);
return topComp;
}
/**
* "评定"面板的生成方法
*/
private Composite createCommentComp(Composite rightComp){
Composite topComp = new Composite(rightComp,SWT.NONE);
topComp.setLayout(new GridLayout(2,false));
Group beCompetentForGroup = new Group(topComp,SWT.NONE);
beCompetentForGroup.setText("能胜任哪些方面的工作");
beCompetentForGroup.setLayoutData(createGridData(GridData.FILL_BOTH,2));
beCompetentForText = new Text(beCompetentForGroup,SWT.BORDER|SWT.V_SCROLL|SWT.H_SCROLL|SWT.MULTI);
beCompetentForText.setBounds(10, 20, 570, 150);
Group workAttitudeGroup = new Group(topComp,SWT.NONE);
workAttitudeGroup.setText("所在单位意见");
workAttitudeGroup.setLayoutData(createGridData(GridData.FILL_BOTH,1));
workAttitudeText = new Text(workAttitudeGroup,SWT.BORDER|SWT.V_SCROLL|SWT.H_SCROLL|SWT.MULTI);
workAttitudeText.setBounds(10, 20, 270, 150);
Group gljAttitudeGroup = new Group(topComp,SWT.NONE);
gljAttitudeGroup.setText("广东省通信管理局意见");
gljAttitudeGroup.setLayoutData(createGridData(GridData.FILL_BOTH,1));
gljAttitudeText = new Text(gljAttitudeGroup,SWT.BORDER|SWT.V_SCROLL|SWT.H_SCROLL|SWT.MULTI);
gljAttitudeText.setBounds(10, 20, 270, 150);
return topComp;
}
/**
* 单击"确定"按钮将执行
*/
protected void buttonPressed(int buttonId){
if(buttonId == IDialogConstants.OK_ID){
if(member == null) member = new Member();
member.setName(nameText.getText()==null?"":nameText.getText());
member.setSex(sexCombo.getSelectionIndex()==0?true:false);
String str = new String();
if(birthdayText.getText() == "")
str = "0000-00-00";
else
str = birthdayText.getText().toString();
member.setBirthday(stringToDate(str));
member.setProvince(provinceText.getText()==null?"":provinceText.getText());
member.setPeople(peopleText.getText()==null?"":peopleText.getText());
member.setParty(partyText.getText()==null?"":partyText.getText());
member.setProfessionalTitle(professionalTitleText.getText()==null?"":professionalTitleText.getText());
member.setDegree(degreeText.getText()==null?"":degreeText.getText());
member.setEducation(educationText.getText()==null?"":educationText.getText());
member.setDuty(dutyText.getText()==null?"":dutyText.getText());
member.setAdress(adressText.getText()==null?"":adressText.getText());
member.setZip(zipText.getText()==null?"":zipText.getText());
member.setWorkPlace(workPlaceText.getText()==null?"":workPlaceText.getText());
member.setWorkPhone(workPhoneText.getText()==null?"":workPhoneText.getText());
member.setHomePhome(homePhoneText.getText()==null?"":homePhoneText.getText());
member.setEmail(emailText.getText()==null?"":emailText.getText());
member.setMobilePhone(mobilePhoneText.getText()==null?"":mobilePhoneText.getText());
member.setLearnSpecialty(learnSpecialtyText.getText()==null?"":learnSpecialtyText.getText());
member.setWorkSpecialty(workSpecialtyText.getText()==null?"":workSpecialtyText.getText());
member.setSchool(schoolText.getText()==null?"":schoolText.getText());
if(workStartText.getText() == "")
str = "0000-00-00";
else
str = workStartText.getText().toString();
member.setWorkStart(stringToDate(str));
member.setIsZkyAcademician(isZkyAcademicianCombo.getSelectionIndex()==0?true:false);
member.setIsGcyAcademician(isGcyAcademicianCombo.getSelectionIndex()==0?true:false);
member.setIsAllowance(isAllowanceCombo.getSelectionIndex()==0?true:false);
member.setIsContribute(isContributeCombo.getSelectionIndex()==0?true:false);
member.setCertificate(certificateText.getText()==null?"":certificateText.getText());
member.setAcademyDuty(academyDutyText.getText()==null?"":academyDutyText.getText());
member.setCommittee(committeeText.getText()==null?"":committeeText.getText());
member.setMagnumOpus(magnumOpusText.getText()==null?"":magnumOpusText.getText());
member.setProjects(projectsText.getText()==null?"":projectsText.getText());
member.setEncouragement(encouragementText.getText()==null?"":encouragementText.getText());
member.setBeCompetentFor(beCompetentForText.getText()==null?"":beCompetentForText.getText());
member.setWorkAttitude(workAttitudeText.getText()==null?"":workAttitudeText.getText());
member.setGljAttitude(gljAttitudeText.getText()==null?"":gljAttitudeText.getText());
member.setWorkTime(workTimeText.getText()==null?"":workTimeText.getText());
}
//如果单击导出excel,则执行
if(buttonId == APPLY_ID){
exportExcel();
}
super.buttonPressed(buttonId);
}
//将个人资料导出excel的方法
private void exportExcel(){
try{
String ls_path = System.getProperty("user.dir");
FileInputStream fileln = new FileInputStream(ls_path + "\\workbook.xls");
POIFSFileSystem fs = new POIFSFileSystem(fileln);
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
//姓名
HSSFRow row = sheet.getRow(2);
HSSFCell cell = row.getCell((short)1);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getName());
//性别
cell = row.getCell((short)3);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getSex()?"男":"女");
//籍贯
cell = row.getCell((short)5);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getProvince());
//民族
row = sheet.getRow(3);
cell = row.getCell((short)1);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getPeople());
//党派
cell = row.getCell((short)3);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getParty());
//职称
cell = row.getCell((short)5);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getProfessionalTitle());
//学位
row = sheet.getRow(4);
cell = row.getCell((short)1);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getDegree());
//学历
cell = row.getCell((short)3);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getEducation());
//职务
cell = row.getCell((short)5);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getDuty());
//委员会
cell = row.getCell((short)8);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getCommittee());
//通信地址
row = sheet.getRow(5);
cell = row.getCell((short)2);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getAdress());
//邮编
cell = row.getCell((short)7);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getZip());
//工作单位
row = sheet.getRow(6);
cell = row.getCell((short)2);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getWorkPlace());
//出生年月
cell = row.getCell((short)7);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(dateToString(member.getBirthday()));
//办公电话
row = sheet.getRow(7);
cell = row.getCell((short)1);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getWorkPhone());
//住宅电话
cell = row.getCell((short)5);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getHomePhone());
//电子邮件
row = sheet.getRow(8);
cell = row.getCell((short)1);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getEmail());
//手机
cell = row.getCell((short)7);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getMobilePhone());
//所学专业
row = sheet.getRow(9);
cell = row.getCell((short)1);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getLearnSpecialty());
//现在从事专业及时间
cell = row.getCell((short)6);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getWorkSpecialty() + " " + member.getWorkTime());
//毕业院校
row = sheet.getRow(10);
cell = row.getCell((short)1);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getSchool());
//参加工作时间
cell = row.getCell((short)6);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(dateToString(member.getWorkStart()));
//是否中科院院士
row = sheet.getRow(11);
cell = row.getCell((short)1);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getIsZkyAcademician()?"是":"否");
//是否工程院院士
cell = row.getCell((short)3);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getIsGcyAcademician()?"是":"否");
//是否享受津贴
cell = row.getCell((short)5);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getIsAllowance()?"是":"否");
//是否劳模
cell = row.getCell((short)8);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getIsContribute()?"是":"否");
//证书
row = sheet.getRow(13);
cell = row.getCell((short)3);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getCertificate());
//学会职务
row = sheet.getRow(14);
cell = row.getCell((short)3);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getAcademyDuty());
//代表作
row = sheet.getRow(17);
cell = row.getCell((short)0);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getMagnumOpus());
//近五年项目
row = sheet.getRow(49);
cell = row.getCell((short)0);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getProjects());
//主要获奖情况
row = sheet.getRow(96);
cell = row.getCell((short)0);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getEncouragement());
//能胜任哪方面的工作
row = sheet.getRow(121);
cell = row.getCell((short)4);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getBeCompetentFor());
//单位意见
row = sheet.getRow(130);
cell = row.getCell((short)0);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getWorkAttitude());
//管理局意见
cell = row.getCell((short)4);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(member.getGljAttitude());
FileOutputStream fileOut = new FileOutputStream(ls_path + "\\workbook.xls");
wb.write(fileOut);
fileOut.close();
try{
Runtime.getRuntime().exec("cmd /c start " + ls_path + "\\workbook.xls");
}catch(IOException e){e.printStackTrace();}
}catch(IOException e){e.printStackTrace();}
}
// STRING到日期
public static java.sql.Date stringToDate(String dateStr)
{
return java.sql.Date.valueOf(dateStr);
}
// 日期到STRING
public static String dateToString(java.sql.Date datee)
{
return datee.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -