diff --git a/build.properties b/build.properties index e7e65e1590dff95f5263de8c4d066dc8bd95343e..253f4c132dc9b4d26c9936a81277a255e39fe9a4 100644 --- a/build.properties +++ b/build.properties @@ -1,51 +1,52 @@ -source.. = src/ -output.. = bin/ -bin.includes = plugin.xml,\ - META-INF/,\ - .,\ - lib/commons-codec-1.13.jar,\ - lib/commons-collections4-4.4.jar,\ - lib/commons-lang3-3.9.jar,\ - lib/commons-logging-1.2.jar,\ - lib/commons-math3-3.6.1.jar,\ - lib/dom4j-2.1.1.jar,\ - lib/druid-1.1.9.jar,\ - lib/hamcrest-core-1.3.jar,\ - lib/jcommon-1.0.23.jar,\ - lib/jfreechart-1.0.19-experimental.jar,\ - lib/jfreechart-1.0.19-swt.jar,\ - lib/jfreechart-1.0.19.jar,\ - lib/jfreesvg-2.0.jar,\ - lib/junit-4.12.jar,\ - lib/log4j-1.2.17.jar,\ - lib/log4j-api-2.11.1.jar,\ - lib/log4j-core-2.11.1.jar,\ - lib/log4j-slf4j-impl-2.11.1.jar,\ - lib/mybatis-3.4.6.jar,\ - lib/mybatis-spring-1.3.1.jar,\ - lib/poi-4.1.1.jar,\ - lib/poi-ooxml-4.1.1.jar,\ - lib/poi-ooxml-schemas-4.1.1.jar,\ - lib/poi-scratchpad-4.1.1.jar,\ - lib/RXTXcomm.jar,\ - lib/servlet.jar,\ - lib/spring-aop-5.0.0.RELEASE.jar,\ - lib/spring-aspects-5.0.0.RELEASE.jar,\ - lib/spring-beans-5.0.0.RELEASE.jar,\ - lib/spring-context-5.0.0.RELEASE.jar,\ - lib/spring-context-indexer-5.0.0.RELEASE.jar,\ - lib/spring-context-support-5.0.0.RELEASE.jar,\ - lib/spring-core-5.0.0.RELEASE.jar,\ - lib/spring-expression-5.0.0.RELEASE.jar,\ - lib/spring-instrument-5.0.0.RELEASE.jar,\ - lib/spring-jcl-5.0.0.RELEASE.jar,\ - lib/spring-jdbc-5.0.0.RELEASE.jar,\ - lib/spring-jms-5.0.0.RELEASE.jar,\ - lib/spring-messaging-5.0.0.RELEASE.jar,\ - lib/spring-orm-5.0.0.RELEASE.jar,\ - lib/spring-oxm-5.0.0.RELEASE.jar,\ - lib/spring-test-5.0.0.RELEASE.jar,\ - lib/spring-tx-5.0.0.RELEASE.jar,\ - lib/sqlite-jdbc-3.23.1.jar,\ - lib/swtgraphics2d.jar,\ - lib/xmlbeans-3.1.0.jar +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + lib/commons-codec-1.13.jar,\ + lib/commons-collections4-4.4.jar,\ + lib/commons-lang3-3.9.jar,\ + lib/commons-logging-1.2.jar,\ + lib/commons-math3-3.6.1.jar,\ + lib/dom4j-2.1.1.jar,\ + lib/druid-1.1.9.jar,\ + lib/hamcrest-core-1.3.jar,\ + lib/jcommon-1.0.23.jar,\ + lib/jfreechart-1.0.19-experimental.jar,\ + lib/jfreechart-1.0.19-swt.jar,\ + lib/jfreechart-1.0.19.jar,\ + lib/jfreesvg-2.0.jar,\ + lib/junit-4.12.jar,\ + lib/log4j-1.2.17.jar,\ + lib/log4j-api-2.11.1.jar,\ + lib/log4j-core-2.11.1.jar,\ + lib/log4j-slf4j-impl-2.11.1.jar,\ + lib/mybatis-3.4.6.jar,\ + lib/mybatis-spring-1.3.1.jar,\ + lib/poi-4.1.1.jar,\ + lib/poi-ooxml-4.1.1.jar,\ + lib/poi-ooxml-schemas-4.1.1.jar,\ + lib/poi-scratchpad-4.1.1.jar,\ + lib/RXTXcomm.jar,\ + lib/servlet.jar,\ + lib/spring-aop-5.0.0.RELEASE.jar,\ + lib/spring-aspects-5.0.0.RELEASE.jar,\ + lib/spring-beans-5.0.0.RELEASE.jar,\ + lib/spring-context-5.0.0.RELEASE.jar,\ + lib/spring-context-indexer-5.0.0.RELEASE.jar,\ + lib/spring-context-support-5.0.0.RELEASE.jar,\ + lib/spring-core-5.0.0.RELEASE.jar,\ + lib/spring-expression-5.0.0.RELEASE.jar,\ + lib/spring-instrument-5.0.0.RELEASE.jar,\ + lib/spring-jcl-5.0.0.RELEASE.jar,\ + lib/spring-jdbc-5.0.0.RELEASE.jar,\ + lib/spring-jms-5.0.0.RELEASE.jar,\ + lib/spring-messaging-5.0.0.RELEASE.jar,\ + lib/spring-orm-5.0.0.RELEASE.jar,\ + lib/spring-oxm-5.0.0.RELEASE.jar,\ + lib/spring-test-5.0.0.RELEASE.jar,\ + lib/spring-tx-5.0.0.RELEASE.jar,\ + lib/sqlite-jdbc-3.23.1.jar,\ + lib/swtgraphics2d.jar,\ + lib/xmlbeans-3.1.0.jar,\ + plugin_customization.ini +source.. = src/ diff --git a/icons/application/Courses_128px.png b/icons/application/Courses_128px.png new file mode 100644 index 0000000000000000000000000000000000000000..3cc7394c3c850d047f1346808f70f2ad63a9a491 Binary files /dev/null and b/icons/application/Courses_128px.png differ diff --git a/icons/application/Courses_16px.png b/icons/application/Courses_16px.png new file mode 100644 index 0000000000000000000000000000000000000000..8343b1564fb111dac3b0d1c2c00497401c176d43 Binary files /dev/null and b/icons/application/Courses_16px.png differ diff --git a/icons/application/Courses_24px.png b/icons/application/Courses_24px.png new file mode 100644 index 0000000000000000000000000000000000000000..fdfa2d8912871dca8fa769d147355d7c982a91df Binary files /dev/null and b/icons/application/Courses_24px.png differ diff --git a/icons/application/Courses_32px.png b/icons/application/Courses_32px.png new file mode 100644 index 0000000000000000000000000000000000000000..d317af147072c2572b0bcf55ad6f36aaf4f5d36c Binary files /dev/null and b/icons/application/Courses_32px.png differ diff --git a/icons/application/Courses_48px.png b/icons/application/Courses_48px.png new file mode 100644 index 0000000000000000000000000000000000000000..aa44a3f77045a3671ece76f7d1d1d0a2a472e519 Binary files /dev/null and b/icons/application/Courses_48px.png differ diff --git a/icons/application/Courses_64px.png b/icons/application/Courses_64px.png new file mode 100644 index 0000000000000000000000000000000000000000..f97d16d42aea9d49cfbaf7a1a7655b451a881ecf Binary files /dev/null and b/icons/application/Courses_64px.png differ diff --git a/icons/application/Courses_72px.png b/icons/application/Courses_72px.png new file mode 100644 index 0000000000000000000000000000000000000000..c18c9f4f0c0e6e0faa4bbdcc6d7f829fe80010dc Binary files /dev/null and b/icons/application/Courses_72px.png differ diff --git a/icons/application/Courses_96px.png b/icons/application/Courses_96px.png new file mode 100644 index 0000000000000000000000000000000000000000..cb3b3400083531befe3dd01fb6330c72e74bc2d8 Binary files /dev/null and b/icons/application/Courses_96px.png differ diff --git a/icons/toolbar/excel_16px.png b/icons/toolbar/excel_16px.png new file mode 100644 index 0000000000000000000000000000000000000000..74e5313a1cd347639184858acabb7cab262dc0ed Binary files /dev/null and b/icons/toolbar/excel_16px.png differ diff --git a/icons/toolbar/export_16px.png b/icons/toolbar/export_16px.png new file mode 100644 index 0000000000000000000000000000000000000000..9ea5e09fead0c645a34fae3a70f9720ab2770e7c Binary files /dev/null and b/icons/toolbar/export_16px.png differ diff --git a/icons/toolbar/import_16px.png b/icons/toolbar/import_16px.png new file mode 100644 index 0000000000000000000000000000000000000000..d2259c6998e79177acea9b60fc076a34b77dd4f0 Binary files /dev/null and b/icons/toolbar/import_16px.png differ diff --git a/plugin.xml b/plugin.xml index 47610cfa016dabb2ba43a4fc105589bf4fc26d2c..24fedf6e71700c772e44ce54983945f5d7fe886d 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,62 +1,126 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin_customization.ini b/plugin_customization.ini new file mode 100644 index 0000000000000000000000000000000000000000..333fab9da760c08792618efc88d4a4c7a17b2fc3 --- /dev/null +++ b/plugin_customization.ini @@ -0,0 +1 @@ +org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = true diff --git a/splash.bmp b/splash.bmp new file mode 100644 index 0000000000000000000000000000000000000000..7645ad2afcc6ab0d2b5b02859ff77e038c2c4542 Binary files /dev/null and b/splash.bmp differ diff --git a/src/cn/edu/hit/education/action/AddNewCourseAction.java b/src/cn/edu/hit/education/action/AddNewCourseAction.java index dc3a630a23779b40a1034d3ba144a570d541316f..4771ca1ae62c8ba08908bd1727c7a1973e54c36b 100644 --- a/src/cn/edu/hit/education/action/AddNewCourseAction.java +++ b/src/cn/edu/hit/education/action/AddNewCourseAction.java @@ -1,44 +1,44 @@ -package cn.edu.hit.education.action; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -import cn.edu.hit.education.dialog.AddNewCourseDialog; -import cn.edu.hit.education.service.ICourseService; -import cn.edu.hit.education.service.IScheduleService; -import educationschedule.Activator; -import educationschedule.Application; - -public class AddNewCourseAction extends Action { - IScheduleService scheduleService = (IScheduleService)Application.applicationContext.getBean("scheduleServiceImpl"); - ICourseService courseService = (ICourseService)Application.applicationContext.getBean("courseServiceImpl"); - private TableViewer tableViewer; - /** - * @wbp.parser.entryPoint - */ - public AddNewCourseAction(TableViewer tableViewer){ - this.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/toolbar/add_course_16px.png")); - this.setToolTipText("ӿγ"); - this.setText("ӿγ"); - - this.tableViewer = tableViewer; - } - - @Override - public void run() { - // TODO Auto-generated method stub - Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - AddNewCourseDialog dlg = new AddNewCourseDialog(parentShell); - if(IDialogConstants.OK_ID == dlg.open()){ - - } - super.run(); - } - - - -} +package cn.edu.hit.education.action; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import cn.edu.hit.education.dialog.AddNewCourseDialog; +import cn.edu.hit.education.service.ICourseService; +import cn.edu.hit.education.service.IScheduleService; +import educationschedule.Activator; +import educationschedule.Application; + +public class AddNewCourseAction extends Action { + IScheduleService scheduleService = (IScheduleService)Application.applicationContext.getBean("scheduleServiceImpl"); + ICourseService courseService = (ICourseService)Application.applicationContext.getBean("courseServiceImpl"); + private TableViewer tableViewer; + /** + * @wbp.parser.entryPoint + */ + public AddNewCourseAction(TableViewer tableViewer){ + this.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/toolbar/add_course_16px.png")); + this.setToolTipText("添加新的课程"); + this.setText("添加课程"); + + this.tableViewer = tableViewer; + } + + @Override + public void run() { + // TODO Auto-generated method stub + Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + AddNewCourseDialog dlg = new AddNewCourseDialog(parentShell); + if(IDialogConstants.OK_ID == dlg.open()){ + + } + super.run(); + } + + + +} diff --git a/src/cn/edu/hit/education/action/CodeCourseAction.java b/src/cn/edu/hit/education/action/CodeCourseAction.java index 14639b7d07911602c541ee527e0226d9cc11e0f1..e86c69980c150181620055bb91dae56ba5e7b609 100644 --- a/src/cn/edu/hit/education/action/CodeCourseAction.java +++ b/src/cn/edu/hit/education/action/CodeCourseAction.java @@ -1,28 +1,28 @@ -package cn.edu.hit.education.action; - -import org.eclipse.jface.action.Action; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -import cn.edu.hit.education.utils.CourseUtil; -import educationschedule.Activator; - -public class CodeCourseAction extends Action { - /** - * @wbp.parser.entryPoint - */ - public CodeCourseAction(){ - this.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/toolbar/course_code_16px.png")); - this.setToolTipText("γ"); - this.setText("γ"); - } - - @Override - public void run() { - // TODO Auto-generated method stub - CourseUtil.codeCourse(); - super.run(); - } - - - -} +package cn.edu.hit.education.action; + +import org.eclipse.jface.action.Action; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import cn.edu.hit.education.utils.CourseUtil; +import educationschedule.Activator; + +public class CodeCourseAction extends Action { + /** + * @wbp.parser.entryPoint + */ + public CodeCourseAction(){ + this.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/toolbar/course_code_16px.png")); + this.setToolTipText("编码课程"); + this.setText("编码课程"); + } + + @Override + public void run() { + // TODO Auto-generated method stub + CourseUtil.codeCourse(); + super.run(); + } + + + +} diff --git a/src/cn/edu/hit/education/action/ExportAction.java b/src/cn/edu/hit/education/action/ExportAction.java new file mode 100644 index 0000000000000000000000000000000000000000..5d8ab25f273828d55bed4fb71c5604184144cedf --- /dev/null +++ b/src/cn/edu/hit/education/action/ExportAction.java @@ -0,0 +1,206 @@ +package cn.edu.hit.education.action; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.poi.hssf.usermodel.DVConstraint; +import org.apache.poi.hssf.usermodel.HSSFDataValidation; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.util.CellRangeAddressList; +import org.eclipse.jface.action.Action; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import cn.edu.hit.education.pojo.Course; +import cn.edu.hit.education.pojo.Property; +import cn.edu.hit.education.pojo.Specialty; +import cn.edu.hit.education.service.ICourseService; +import cn.edu.hit.education.service.IPropertyService; +import educationschedule.Activator; +import educationschedule.Application; + +public class ExportAction extends Action { + ICourseService courseService = (ICourseService)Application.applicationContext.getBean("courseServiceImpl"); + IPropertyService propertyService = (IPropertyService)Application.applicationContext.getBean("propertyServiceImpl"); + + public ExportAction(){ + this.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/toolbar/export_16px.png")); + this.setToolTipText("�����γ�"); + this.setText("�����γ�"); + } + + @Override + public void run() { + // TODO Auto-generated method stub + Specialty specialty = new Specialty(); + specialty.setName("导出课程"); + + Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + FileDialog fileDialog = new FileDialog(parentShell,SWT.SAVE); + fileDialog.setFilterExtensions(new String[]{"*.xls"}); + String filename ; + filename = fileDialog.open(); + if(filename != null){ + List properties = propertyService.queryAllProperty(); + List strProperties = new ArrayList(); + if(properties != null && properties.size() > 0){ + for (Property property : properties) { + strProperties.add(property.getName()); + } + } + List strUnit = new ArrayList(); + strUnit.add("时"); + strUnit.add("周"); + List strImportant = new ArrayList(); + strImportant.add("是"); + strImportant.add("否"); + List strSelected = new ArrayList(); + strSelected.add("必修课"); + strSelected.add("选修课"); + List strMethod = new ArrayList(); + strMethod.add("集中"); + strMethod.add("分散"); + strMethod.add("项目"); + List strClassroom = new ArrayList(); + strClassroom.add("授课"); + strClassroom.add("讲座"); + + List courses = courseService.queryAllCourse(); + + try { + test(filename,specialty, + String.join(",", strProperties),String.join(",", strImportant), + String.join(",", strUnit), String.join(",",strSelected), + String.join(",",strMethod), String.join(",",strClassroom), + courses); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + super.run(); + } + + public void test(String filename,Specialty specialty, + String strProperties,String strImportant, + String strUnit,String strSelected, + String strMethod,String strClassRoom, + List courses) throws IOException { + HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); + HSSFSheet sheet = hssfWorkbook.createSheet(); + HSSFRow row = sheet.createRow(0); + row.createCell(0).setCellValue("专业名称"); + row.createCell(1).setCellValue("课程性质"); + row.createCell(2).setCellValue("课程名称"); + row.createCell(3).setCellValue("课程学分"); + row.createCell(4).setCellValue("是否核心"); + row.createCell(5).setCellValue("课程编号"); + row.createCell(6).setCellValue("课程学时"); + row.createCell(7).setCellValue("理论学时"); + row.createCell(8).setCellValue("实验学时"); + row.createCell(9).setCellValue("学时单位"); + row.createCell(10).setCellValue("课程选修"); + row.createCell(11).setCellValue("授课类型"); + row.createCell(12).setCellValue("授课方式"); + row.createCell(13).setCellValue("开始时间"); + row.createCell(14).setCellValue("结束时间"); + row.createCell(15).setCellValue("课程备注"); + + ////////////////////////////////////////////////// + String colProperty = "KCXZ"; //课程性质 + Map boxMapProperty = new HashMap<>(); + boxMapProperty.put(colProperty, strProperties); + HSSFDataValidation dataValidationProperty = createBox(colProperty, boxMapProperty , 1 , courses.size()+1 , 1 , 1); + if(dataValidationProperty != null) { + sheet.addValidationData(dataValidationProperty); + } + ////////////////////////////////////////////////// + String colImportant = "KSZY"; + Map boxMapImportant = new HashMap<>(); + boxMapImportant.put(colImportant, strImportant); + HSSFDataValidation dataValidationImportant = createBox(colImportant, boxMapImportant , 1 , courses.size()+1 , 4 , 4); + if(dataValidationImportant != null) { + sheet.addValidationData(dataValidationImportant); + } + ////////////////////////////////////////////////// + String colUnit = "KSDW"; + Map boxMapUnit = new HashMap<>(); + boxMapUnit.put(colUnit, strUnit); + HSSFDataValidation dataValidationUnit = createBox(colUnit, boxMapUnit , 1 , courses.size()+1 , 9 , 9); + if(dataValidationUnit != null) { + sheet.addValidationData(dataValidationUnit); + } + ////////////////////////////////////////////////// + String colSelected = "KCXX"; + Map boxMapSelected = new HashMap<>(); + boxMapSelected.put(colSelected, strSelected); + HSSFDataValidation dataValidationSelected = createBox(colSelected, boxMapSelected , 1 , courses.size()+1 , 10 , 10); + if(dataValidationSelected != null) { + sheet.addValidationData(dataValidationSelected); + } + ////////////////////////////////////////////////// + String colMethod = "SKLX"; + Map boxMapMethod = new HashMap<>(); + boxMapMethod.put(colMethod, strMethod); + HSSFDataValidation dataValidationMethod = createBox(colMethod, boxMapMethod , 1 , courses.size()+1 , 11 , 11); + if(dataValidationMethod != null) { + sheet.addValidationData(dataValidationMethod); + } + /////////////////////////////////////////////////// + String colClassroom = "SKFS"; + Map boxMapClassroom = new HashMap<>(); + boxMapClassroom.put(colClassroom, strClassRoom); + HSSFDataValidation dataValidationClassroom = createBox(colClassroom, boxMapClassroom , 1 , courses.size()+1 , 12 , 12); + if(dataValidationClassroom != null) { + sheet.addValidationData(dataValidationClassroom); + } + /////////////////////////////////////////////////// + for (int i = 0;i < courses.size();i++) { + Course theCourse = courses.get(i); + HSSFRow newRow = sheet.createRow(i + 1); + newRow.createCell(0).setCellValue(specialty.getName()); + newRow.createCell(2).setCellValue(theCourse.getName()); + newRow.createCell(3).setCellValue(String.valueOf(theCourse.getCredits())); + newRow.createCell(5).setCellValue(theCourse.getNumber()); + newRow.createCell(6).setCellValue(String.valueOf(theCourse.getPeriod())); + newRow.createCell(7).setCellValue(String.valueOf(theCourse.getTheoretical())); + newRow.createCell(8).setCellValue(String.valueOf(theCourse.getExperiment())); + newRow.createCell(13).setCellValue("1"); + newRow.createCell(14).setCellValue("16"); + newRow.createCell(15).setCellValue(""); + } + /////////////////////////////////////////////////// + FileOutputStream out = new FileOutputStream(filename); + hssfWorkbook.write(out); + out.close(); + } + + public HSSFDataValidation createBox(String col, Map boxMap, + int firstRow, int lastRow, int firstCol, int lastCol) { + HSSFDataValidation dataValidation = null; + String cols = ""; + if(null != boxMap.get(col)) { + cols = boxMap.get(col); + } + if(cols.length() > 0 && null != cols) { + String str[] = cols.split(","); + CellRangeAddressList cas = new CellRangeAddressList(firstRow , lastRow , firstCol , lastCol); + DVConstraint dvConstraint = DVConstraint.createExplicitListConstraint(str); + dataValidation = new HSSFDataValidation(cas, dvConstraint); + } + return dataValidation; + } + + + +} diff --git a/src/cn/edu/hit/education/action/ImportAction.java b/src/cn/edu/hit/education/action/ImportAction.java new file mode 100644 index 0000000000000000000000000000000000000000..cc5e1a60efef7e7de0caaef1e259e45223ac5a5d --- /dev/null +++ b/src/cn/edu/hit/education/action/ImportAction.java @@ -0,0 +1,39 @@ +package cn.edu.hit.education.action; + +import org.eclipse.jface.action.Action; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import cn.edu.hit.education.service.ICourseService; +import educationschedule.Activator; +import educationschedule.Application; + +public class ImportAction extends Action { + ICourseService courseService = (ICourseService)Application.applicationContext.getBean("courseServiceImpl"); + + public ImportAction(){ + this.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/toolbar/import_16px.png")); + this.setToolTipText("导入课程"); + this.setText("导出课程"); + } + + @Override + public void run() { + // TODO Auto-generated method stub + Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + FileDialog fileDialog = new FileDialog(parentShell,SWT.OPEN); + fileDialog.setFilterExtensions(new String[]{"*.xls"}); + String filename ; + filename = fileDialog.open(); + if(filename != null){ + System.out.println(filename); + } + super.run(); + } + + + +} diff --git a/src/cn/edu/hit/education/action/StatisticalScheduleAction.java b/src/cn/edu/hit/education/action/StatisticalScheduleAction.java index 31636492d48ec84e5f374e13a54b02ec390240c1..313cef933bbfde30e904685ba2431b84ae2dd693 100644 --- a/src/cn/edu/hit/education/action/StatisticalScheduleAction.java +++ b/src/cn/edu/hit/education/action/StatisticalScheduleAction.java @@ -1,30 +1,30 @@ -package cn.edu.hit.education.action; - -import org.eclipse.jface.action.Action; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -import cn.edu.hit.education.service.ICourseService; -import cn.edu.hit.education.service.IScheduleService; -import educationschedule.Activator; -import educationschedule.Application; - -public class StatisticalScheduleAction extends Action { - IScheduleService scheduleService = (IScheduleService)Application.applicationContext.getBean("scheduleServiceImpl"); - ICourseService courseService = (ICourseService)Application.applicationContext.getBean("courseServiceImpl"); - - public StatisticalScheduleAction(){ - this.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/toolbar/statistics_32px.png")); - this.setToolTipText("ܿγ"); - this.setText("ܿγ"); - } - - @Override - public void run() { - // TODO Auto-generated method stub - scheduleService.statisticsSchedule(1,1); - super.run(); - } - - - -} +package cn.edu.hit.education.action; + +import org.eclipse.jface.action.Action; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import cn.edu.hit.education.service.ICourseService; +import cn.edu.hit.education.service.IScheduleService; +import educationschedule.Activator; +import educationschedule.Application; + +public class StatisticalScheduleAction extends Action { + IScheduleService scheduleService = (IScheduleService)Application.applicationContext.getBean("scheduleServiceImpl"); + ICourseService courseService = (ICourseService)Application.applicationContext.getBean("courseServiceImpl"); + + public StatisticalScheduleAction(){ + this.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/toolbar/statistics_32px.png")); + this.setToolTipText("汇总方案"); + this.setText("汇总方案"); + } + + @Override + public void run() { + // TODO Auto-generated method stub + scheduleService.statisticsSchedule(1,1); + super.run(); + } + + + +} diff --git a/src/cn/edu/hit/education/dialog/LoginDialog.java b/src/cn/edu/hit/education/dialog/LoginDialog.java index 580020daec42dd0a5d207e91c736498ade53698c..d67590415d91ae1a4972d90eb05f492ddbd11d42 100644 --- a/src/cn/edu/hit/education/dialog/LoginDialog.java +++ b/src/cn/edu/hit/education/dialog/LoginDialog.java @@ -1,154 +1,153 @@ -/** - * Copyright © 2018 HIT akeil. Tech Ltd. All rights reserved. - * - * 功能描述: - * @Package: com.akeil.ui.dialogs - * @author: snow - * @date: 2018年6月27日 上午8:19:59 - */ -package cn.edu.hit.education.dialog; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.IMessageProvider; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - - -/** - * Copyright: Copyright (c) 2018 HIT akeil - * - * @ClassName: LicenseDialog.java - * @Description: 该类的功能描述 - * - * @version: v1.0.0 - * @author: snow - * @date: 2018年6月27日 上午8:19:59 - * - * Modification History: Date Author Version Description - * ---------------------------------------------------------* 2018年6月27日 - * snow v1.0.0 修改原因 - */ -public class LoginDialog extends TitleAreaDialog { - private Text textPassword; - private Text textUsername; - - public LoginDialog(Shell parentShell) { - super(parentShell); - // TODO Auto-generated constructor stub - } - - @Override - protected void configureShell(Shell newShell) { - // TODO 自动生成的方法存根 - super.configureShell(newShell); - newShell.setText("登录系统"); - } - - @Override - protected Control createDialogArea(Composite parent) { - // TODO Auto-generated method stub - Composite composite = (Composite) super.createDialogArea(parent); - // 自定义要创建的内容 - - createContentPane(composite); - return composite; - } - - private void createContentPane(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - //gd_composite.widthHint = 174; - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); - // 采用三列的GridLayout - Label label_remark; - - composite.setLayout(new FormLayout()); - - final Label label_name = new Label(composite, SWT.NONE); - final FormData formData = new FormData(); - formData.top = new FormAttachment(0, 27); - formData.left = new FormAttachment(0, 10); - formData.right = new FormAttachment(0, 60); - label_name.setLayoutData(formData); - label_name.setText("系统用户"); - - textUsername = new Text(composite, SWT.BORDER); - final FormData fd_textUsername = new FormData(); - fd_textUsername.top = new FormAttachment(0, 25); - fd_textUsername.left = new FormAttachment(label_name, 5); - fd_textUsername.right = new FormAttachment(100, -38); - textUsername.setLayoutData(fd_textUsername); - - textPassword = new Text(composite, SWT.BORDER | SWT.PASSWORD); - fd_textUsername.bottom = new FormAttachment(textPassword, -24); - textPassword.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - //cec110f7fd2deb32d36bb868239b0e3c - checkValid(); - } - }); - final FormData fd_textPassword = new FormData(); - fd_textPassword.bottom = new FormAttachment(100, -41); - fd_textPassword.right = new FormAttachment(100, -38); - fd_textPassword.top = new FormAttachment(0, 75); - fd_textPassword.left = new FormAttachment(0, 65); - textPassword.setLayoutData(fd_textPassword); - label_remark = new Label(composite, SWT.NONE); - formData.bottom = new FormAttachment(label_remark, -25); - final FormData formData_3 = new FormData(); - formData_3.left = new FormAttachment(0, 30); - formData_3.right = new FormAttachment(textPassword, -5); - formData_3.bottom = new FormAttachment(100, -125); - formData_3.top = new FormAttachment(0, 78); - label_remark.setLayoutData(formData_3); - label_remark.setText("密码"); - - Label label = new Label(composite, SWT.NONE); - FormData fd_label = new FormData(); - fd_label.top = new FormAttachment(label_name, 25); - fd_label.left = new FormAttachment(label_name, 0, SWT.LEFT); - label.setLayoutData(fd_label); - label.setText("用户密码"); - - - this.setTitle("请输入系统用户名和密码"); - this.setMessage("系统用户名和密码",IMessageProvider.INFORMATION); - } - - public Text getText_remark() { - return textPassword; - } - - public void setText_remark(Text text_remark) { - this.textPassword = text_remark; - } - - public Text getText_name() { - return textUsername; - } - - public void setText_name(Text text_name) { - this.textUsername = text_name; - } - - protected void checkValid(){ - } - - @Override - protected Point getInitialSize() { - // TODO 自动生成的方法存根 - return new Point(360,300); - } - -} +/** + * Copyright © 2018 HIT akeil. Tech Ltd. All rights reserved. + * + * 功能描述: + * @Package: com.akeil.ui.dialogs + * @author: snow + * @date: 2018年6月27日 上午8:19:59 + */ +package cn.edu.hit.education.dialog; + +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + + +/** + * Copyright: Copyright (c) 2018 HIT akeil + * + * @ClassName: LicenseDialog.java + * @Description: 该类的功能描述 + * + * @version: v1.0.0 + * @author: snow + * @date: 2018年6月27日 上午8:19:59 + * + * Modification History: Date Author Version Description + * ---------------------------------------------------------* 2018年6月27日 + * snow v1.0.0 修改原因 + */ +public class LoginDialog extends TitleAreaDialog { + private Text textPassword; + private Text textUsername; + + public LoginDialog(Shell parentShell) { + super(parentShell); + // TODO Auto-generated constructor stub + } + + @Override + protected void configureShell(Shell newShell) { + // TODO 自动生成的方法存根 + super.configureShell(newShell); + newShell.setText("登录系统"); + } + + @Override + protected Control createDialogArea(Composite parent) { + // TODO Auto-generated method stub + Composite composite = (Composite) super.createDialogArea(parent); + // 自定义要创建的内容 + + createContentPane(composite); + return composite; + } + + private void createContentPane(Composite parent) { + Composite composite = new Composite(parent, SWT.NULL); + //gd_composite.widthHint = 174; + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + // 采用三列的GridLayout + Label label_remark; + + composite.setLayout(new FormLayout()); + + final Label label_name = new Label(composite, SWT.NONE); + final FormData formData = new FormData(); + formData.top = new FormAttachment(0, 28); + formData.left = new FormAttachment(0, 44); + label_name.setLayoutData(formData); + label_name.setText("系统用户"); + + textUsername = new Text(composite, SWT.BORDER); + formData.right = new FormAttachment(100, -260); + final FormData fd_textUsername = new FormData(); + fd_textUsername.top = new FormAttachment(0, 25); + fd_textUsername.left = new FormAttachment(label_name, 6); + fd_textUsername.right = new FormAttachment(100, -38); + textUsername.setLayoutData(fd_textUsername); + + textPassword = new Text(composite, SWT.BORDER | SWT.PASSWORD); + fd_textUsername.bottom = new FormAttachment(textPassword, -24); + textPassword.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + //cec110f7fd2deb32d36bb868239b0e3c + checkValid(); + } + }); + final FormData fd_textPassword = new FormData(); + fd_textPassword.left = new FormAttachment(textUsername, 0, SWT.LEFT); + fd_textPassword.right = new FormAttachment(100, -38); + fd_textPassword.bottom = new FormAttachment(100, -41); + fd_textPassword.top = new FormAttachment(0, 75); + textPassword.setLayoutData(fd_textPassword); + label_remark = new Label(composite, SWT.NONE); + final FormData formData_3 = new FormData(); + formData_3.right = new FormAttachment(textPassword, -40); + formData_3.left = new FormAttachment(0, 30); + formData_3.bottom = new FormAttachment(100, -125); + formData_3.top = new FormAttachment(0, 78); + label_remark.setLayoutData(formData_3); + label_remark.setText("密码"); + + Label label = new Label(composite, SWT.NONE); + FormData fd_label = new FormData(); + fd_label.top = new FormAttachment(label_name, 33); + fd_label.left = new FormAttachment(label_name, 0, SWT.LEFT); + label.setLayoutData(fd_label); + label.setText("用户密码"); + + + this.setTitle("请输入系统用户名和密码"); + this.setMessage("系统用户名和密码",IMessageProvider.INFORMATION); + } + + public Text getText_remark() { + return textPassword; + } + + public void setText_remark(Text text_remark) { + this.textPassword = text_remark; + } + + public Text getText_name() { + return textUsername; + } + + public void setText_name(Text text_name) { + this.textUsername = text_name; + } + + protected void checkValid(){ + } + + @Override + protected Point getInitialSize() { + // TODO 自动生成的方法存根 + return new Point(360,300); + } + +} diff --git a/src/cn/edu/hit/education/utils/CourseUtil.java b/src/cn/edu/hit/education/utils/CourseUtil.java index caff6d1f4c775ff2c06fa87660e4b03e72d3f143..91e6ca9a3c66728e090ff028c802ec9a7f4ed8d9 100644 --- a/src/cn/edu/hit/education/utils/CourseUtil.java +++ b/src/cn/edu/hit/education/utils/CourseUtil.java @@ -1,105 +1,88 @@ -/** - *

title StatisticsUtil.java

- *

package cn.edu.hit.education.utils

- *

description TODO

- *

copyright ҵѧ(C) 2019

- *

company ҵѧAS&MT

- *

author ѩ jinxuesong@163.com

- *

date 2021422 11:28:52

- *

version v1.0

- * - * Modification History: - * Date Author Version Discription - * ----------------------------------------------------------------------------------- - * 2021422 ѩ 1.0 1.0 - * Why & What is modified: <޸ԭ> - */ -package cn.edu.hit.education.utils; - -import java.text.DecimalFormat; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; - -import cn.edu.hit.education.pojo.Course; -import cn.edu.hit.education.pojo.Property; -import cn.edu.hit.education.service.ICourseService; -import cn.edu.hit.education.service.IPropertyService; -import educationschedule.Application; - -/** - *

- * classname StatisticsUtil - *

- *

- * description TODO - *

- *

- * author ѩ jinxuesong@163.com - *

- *

- * date 2021422 11:28:52 - *

- */ -public class CourseUtil { - public static void codeCourse() { - DecimalFormat df = new DecimalFormat("00"); - ICourseService courseService = (ICourseService) Application.applicationContext - .getBean("courseServiceImpl"); - IPropertyService propertyService = (IPropertyService) Application.applicationContext - .getBean("propertyServiceImpl"); - - propertyService.clearPropertyNum(); - - List courses = courseService.queryAllCourse(); - Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - - try { - - IRunnableWithProgress runnable = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - //List courses = courseService.queryAllCourse(); - monitor.beginTask("ʼִпγԶ......", courses.size()); - String strCourseCode = ""; - if (courses != null && courses.size() > 0) { - for (Course course : courses) { - strCourseCode = ""; - if (monitor.isCanceled()) // ʱǷѡ˶Իġȡť - return;// жϴ - - Property property = propertyService.queryPropertyById(course.getPropertyId()); - strCourseCode += property.getCode(); - strCourseCode += df.format(9); - strCourseCode += String.valueOf(1); - strCourseCode += df.format(property.getNum() + 1); - course.setNumber(strCourseCode); - - property.setNum(property.getNum() + 1); - propertyService.update(property); - - courseService.update(course); - monitor.worked(1); - } - } - monitor.done();// ǰ - } - }; - try { - // һԻ򣬲runnable - // һƼΪtrueΪfalseUI߳潫һͣ͸С - // ڶtrueԻġȡťЧ - new ProgressMonitorDialog(parentShell) - .run(true, true, runnable); - } catch (Exception e2) { - e2.printStackTrace(); - } - } catch (Exception e) { - - } - - } -} +/** + *

title �� StatisticsUtil.java

+ *

package �� cn.edu.hit.education.utils

+ *

description ��TODO

+ *

copyright �� ��������ҵ��ѧ(C) 2019

+ *

company �� ��������ҵ��ѧAS&MT

+ *

author �� ��ѩ�� jinxuesong@163.com

+ *

date �� 2021��4��22�� ����11:28:52

+ *

version �� v1.0

+ * + * Modification History: + * Date Author Version Discription + * ----------------------------------------------------------------------------------- + * 2021��4��22�� ��ѩ�� 1.0 1.0 + * Why & What is modified: <�޸�ԭ������> + */ +package cn.edu.hit.education.utils; + +import java.text.DecimalFormat; +import java.util.List; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; + +import cn.edu.hit.education.pojo.Course; +import cn.edu.hit.education.pojo.Property; +import cn.edu.hit.education.service.ICourseService; +import cn.edu.hit.education.service.IPropertyService; +import educationschedule.Application; + +public class CourseUtil { + public static void codeCourse() { + DecimalFormat df = new DecimalFormat("00"); + ICourseService courseService = (ICourseService) Application.applicationContext + .getBean("courseServiceImpl"); + IPropertyService propertyService = (IPropertyService) Application.applicationContext + .getBean("propertyServiceImpl"); + + propertyService.clearPropertyNum(); + + List courses = courseService.queryAllCourse(); + Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + + try { + + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) { + //List courses = courseService.queryAllCourse(); + monitor.beginTask("开始编码课程......", courses.size()); + String strCourseCode = ""; + if (courses != null && courses.size() > 0) { + for (Course course : courses) { + strCourseCode = ""; + if (monitor.isCanceled()) + return; + + Property property = propertyService.queryPropertyById(course.getPropertyId()); + strCourseCode += property.getCode(); + strCourseCode += df.format(9); + strCourseCode += String.valueOf(1); + strCourseCode += df.format(property.getNum() + 1); + course.setNumber(strCourseCode); + + property.setNum(property.getNum() + 1); + propertyService.update(property); + + courseService.update(course); + monitor.worked(1); + } + } + monitor.done(); + } + }; + try { + new ProgressMonitorDialog(parentShell) + .run(true, true, runnable); + } catch (Exception e2) { + e2.printStackTrace(); + } + } catch (Exception e) { + + } + + } +} diff --git a/src/cn/edu/hit/education/utils/StatisticsUtil.java b/src/cn/edu/hit/education/utils/StatisticsUtil.java index fa69f9f94c93502b68257576b4e462a31856874d..07ec2b9835fd88c7c9d2e977795dcfe666550483 100644 --- a/src/cn/edu/hit/education/utils/StatisticsUtil.java +++ b/src/cn/edu/hit/education/utils/StatisticsUtil.java @@ -1,256 +1,250 @@ -/** -*

title StatisticsUtil.java

-*

package cn.edu.hit.education.utils

-*

description TODO

-*

copyright ҵѧ(C) 2019

-*

company ҵѧAS&MT

-*

author ѩ jinxuesong@163.com

-*

date 2021422 11:28:52

-*

version v1.0

-* -* Modification History: -* Date Author Version Discription -* ----------------------------------------------------------------------------------- -* 2021422 ѩ 1.0 1.0 -* Why & What is modified: <޸ԭ> -*/ -package cn.edu.hit.education.utils; - -import java.util.ArrayList; -import java.util.List; - -import cn.edu.hit.education.pojo.Course; -import cn.edu.hit.education.pojo.ExCourse; - -/** - *

classname StatisticsUtil

- *

description TODO

- *

author ѩ jinxuesong@163.com

- *

date 2021422 11:28:52

- */ -public class StatisticsUtil { - public static void processCourseScheduleData(List courses){ - double sum_credicts = 0; - double sum_credicts_centralize_hour = 0; - double sum_periods_centralize_hour = 0; - double sum_theoretical_centralize_hour = 0; - double sum_experiment_centralize_hour = 0; - - double sum_credicts_centralize_week = 0; - double sum_periods_centralize_week = 0; - double sum_theoretical_centralize_week = 0; - double sum_experiment_centralize_week = 0; - - double sum_credicts_sparse_hour = 0; - double sum_periods_sparse_hour = 0; - double sum_theoretical_sparse_hour = 0; - double sum_experiment_sparse_hour = 0; - - double sum_credicts_sparse_week = 0; - double sum_periods_sparse_week = 0; - double sum_theoretical_sparse_week = 0; - double sum_experiment_sparse_week = 0; - - if(courses != null && courses.size() > 0){ - for (Course course : courses) { - sum_credicts += (course.getCredits() == null ? 0 : course.getCredits()); - - if(course.getUnit() == null || course.getUnit().trim().equals("ʱ")){ - if(course.getMethod().trim().equals("ɢ")){ - sum_credicts_sparse_hour += course.getCredits(); - sum_periods_sparse_hour += (course.getPeriod() == null ? 0 : course.getPeriod()); - sum_theoretical_sparse_hour += (course.getTheoretical() == null ? 0 : course.getTheoretical()); - sum_experiment_sparse_hour += (course.getExperiment() == null ? 0 : course.getExperiment()); - }else{ - sum_credicts_centralize_hour += course.getCredits(); - sum_periods_centralize_hour += (course.getPeriod() == null ? 0 : course.getPeriod()); - sum_theoretical_centralize_hour += (course.getTheoretical() == null ? 0 : course.getTheoretical()); - sum_experiment_centralize_hour += (course.getExperiment() == null ? 0 : course.getExperiment()); - } - }else if(course.getUnit().trim().equals("")){ - if(course.getMethod().trim().equals("ɢ")){ - sum_credicts_sparse_week += course.getCredits(); - sum_periods_sparse_week += (course.getPeriod() == null ? 0 : course.getPeriod()); - sum_theoretical_sparse_week += (course.getTheoretical() == null ? 0 : course.getTheoretical()); - sum_experiment_sparse_week += (course.getExperiment() == null ? 0 : course.getExperiment()); - }else{ - sum_credicts_centralize_week += course.getCredits(); - sum_periods_centralize_week += (course.getPeriod() == null ? 0 : course.getPeriod()); - sum_theoretical_centralize_week += (course.getTheoretical() == null ? 0 : course.getTheoretical()); - sum_experiment_centralize_week += (course.getExperiment() == null ? 0 : course.getExperiment()); - } - - }else{ - - } - } - - Course sum = new Course(); - sum.setName("С [ڿΣʱ]"); - sum.setCredits(sum_credicts_centralize_hour); - sum.setPeriod(sum_periods_centralize_hour); - sum.setTheoretical(sum_theoretical_centralize_hour); - sum.setExperiment(sum_experiment_centralize_hour); - sum.setUnit("ʱ"); - sum.setMethod(""); - courses.add(sum); - - sum = new Course(); - sum.setName("С [ڿΣ]"); - sum.setCredits(sum_credicts_centralize_week); - sum.setPeriod(sum_periods_centralize_week); - sum.setTheoretical(sum_theoretical_centralize_week); - sum.setExperiment(sum_experiment_centralize_week); - sum.setUnit(""); - sum.setMethod(""); - courses.add(sum); - - sum = new Course(); - sum.setName("С [ɢڿΣʱ]"); - sum.setCredits(sum_credicts_sparse_hour); - sum.setPeriod(sum_periods_sparse_hour); - sum.setTheoretical(sum_theoretical_sparse_hour); - sum.setExperiment(sum_experiment_sparse_hour); - sum.setUnit("ʱ"); - sum.setMethod("ɢ"); - courses.add(sum); - - sum = new Course(); - sum.setName("С [ɢڿΣ]"); - sum.setCredits(sum_credicts_sparse_week); - sum.setPeriod(sum_periods_sparse_week); - sum.setTheoretical(sum_theoretical_sparse_week); - sum.setExperiment(sum_experiment_sparse_week); - sum.setUnit(""); - sum.setMethod("ɢ"); - courses.add(sum); - - sum = new Course(); - sum.setName("С "); - sum.setCredits(sum_credicts); - courses.add(sum); - } - } - - public static void processCourseInformationData(List courses){ - double sum_credicts = 0; - double sum_credicts_centralize_hour = 0; - double sum_periods_centralize_hour = 0; - double sum_theoretical_centralize_hour = 0; - double sum_experiment_centralize_hour = 0; - - double sum_credicts_centralize_week = 0; - double sum_periods_centralize_week = 0; - double sum_theoretical_centralize_week = 0; - double sum_experiment_centralize_week = 0; - - double sum_credicts_sparse_hour = 0; - double sum_periods_sparse_hour = 0; - double sum_theoretical_sparse_hour = 0; - double sum_experiment_sparse_hour = 0; - - double sum_credicts_sparse_week = 0; - double sum_periods_sparse_week = 0; - double sum_theoretical_sparse_week = 0; - double sum_experiment_sparse_week = 0; - - if(courses != null && courses.size() > 0){ - for (ExCourse course : courses) { - if(course.getOpened() == 0) - continue; - - sum_credicts += (course.getCredits() == null ? 0 : course.getCredits()); - - if(course.getUnit() == null || course.getUnit().trim().equals("ʱ")){ - if(course.getMethod().trim().equals("ɢ")){ - sum_credicts_sparse_hour += course.getCredits(); - sum_periods_sparse_hour += (course.getPeriod() == null ? 0 : course.getPeriod()); - sum_theoretical_sparse_hour += (course.getTheoretical() == null ? 0 : course.getTheoretical()); - sum_experiment_sparse_hour += (course.getExperiment() == null ? 0 : course.getExperiment()); - }else{ - sum_credicts_centralize_hour += course.getCredits(); - sum_periods_centralize_hour += (course.getPeriod() == null ? 0 : course.getPeriod()); - sum_theoretical_centralize_hour += (course.getTheoretical() == null ? 0 : course.getTheoretical()); - sum_experiment_centralize_hour += (course.getExperiment() == null ? 0 : course.getExperiment()); - } - }else if(course.getUnit().trim().equals("")){ - if(course.getMethod().trim().equals("ɢ")){ - sum_credicts_sparse_week += course.getCredits(); - sum_periods_sparse_week += (course.getPeriod() == null ? 0 : course.getPeriod()); - sum_theoretical_sparse_week += (course.getTheoretical() == null ? 0 : course.getTheoretical()); - sum_experiment_sparse_week += (course.getExperiment() == null ? 0 : course.getExperiment()); - }else{ - sum_credicts_centralize_week += course.getCredits(); - sum_periods_centralize_week += (course.getPeriod() == null ? 0 : course.getPeriod()); - sum_theoretical_centralize_week += (course.getTheoretical() == null ? 0 : course.getTheoretical()); - sum_experiment_centralize_week += (course.getExperiment() == null ? 0 : course.getExperiment()); - } - - }else{ - - } - } - - ExCourse sum = new ExCourse(); - sum.setName("С [ڿΣʱ]"); - sum.setCredits(sum_credicts_centralize_hour); - sum.setPeriod(sum_periods_centralize_hour); - sum.setTheoretical(sum_theoretical_centralize_hour); - sum.setExperiment(sum_experiment_centralize_hour); - sum.setUnit("ʱ"); - sum.setMethod(""); - courses.add(sum); - - sum = new ExCourse(); - sum.setName("С [ڿΣ]"); - sum.setCredits(sum_credicts_centralize_week); - sum.setPeriod(sum_periods_centralize_week); - sum.setTheoretical(sum_theoretical_centralize_week); - sum.setExperiment(sum_experiment_centralize_week); - sum.setUnit(""); - sum.setMethod(""); - courses.add(sum); - - sum = new ExCourse(); - sum.setName("С [ɢڿΣʱ]"); - sum.setCredits(sum_credicts_sparse_hour); - sum.setPeriod(sum_periods_sparse_hour); - sum.setTheoretical(sum_theoretical_sparse_hour); - sum.setExperiment(sum_experiment_sparse_hour); - sum.setUnit("ʱ"); - sum.setMethod("ɢ"); - courses.add(sum); - - sum = new ExCourse(); - sum.setName("С [ɢڿΣ]"); - sum.setCredits(sum_credicts_sparse_week); - sum.setPeriod(sum_periods_sparse_week); - sum.setTheoretical(sum_theoretical_sparse_week); - sum.setExperiment(sum_experiment_sparse_week); - sum.setUnit(""); - sum.setMethod("ɢ"); - courses.add(sum); - - sum = new ExCourse(); - sum.setName("С "); - sum.setCredits(sum_credicts); - courses.add(sum); - } - } - - public static void printTotal(List courses){ - if(courses.size() > 5){ - List subs = new ArrayList(); - - subs.add(courses.get(courses.size() - 5)); - subs.add(courses.get(courses.size() - 4)); - subs.add(courses.get(courses.size() - 3)); - subs.add(courses.get(courses.size() - 2)); - subs.add(courses.get(courses.size() - 1)); - - for (Course course : subs) { - System.out.println(course.getCredits() + "/" + course.getPeriod()); - } - } - } -} +/** +*

title �� StatisticsUtil.java

+*

package �� cn.edu.hit.education.utils

+*

description ��TODO

+*

copyright �� ��������ҵ��ѧ(C) 2019

+*

company �� ��������ҵ��ѧAS&MT

+*

author �� ��ѩ�� jinxuesong@163.com

+*

date �� 2021��4��22�� ����11:28:52

+*

version �� v1.0

+* +* Modification History: +* Date Author Version Discription +* ----------------------------------------------------------------------------------- +* 2021��4��22�� ��ѩ�� 1.0 1.0 +* Why & What is modified: <�޸�ԭ������> +*/ +package cn.edu.hit.education.utils; + +import java.util.ArrayList; +import java.util.List; + +import cn.edu.hit.education.pojo.Course; +import cn.edu.hit.education.pojo.ExCourse; + +public class StatisticsUtil { + public static void processCourseScheduleData(List courses){ + double sum_credicts = 0; + double sum_credicts_centralize_hour = 0; + double sum_periods_centralize_hour = 0; + double sum_theoretical_centralize_hour = 0; + double sum_experiment_centralize_hour = 0; + + double sum_credicts_centralize_week = 0; + double sum_periods_centralize_week = 0; + double sum_theoretical_centralize_week = 0; + double sum_experiment_centralize_week = 0; + + double sum_credicts_sparse_hour = 0; + double sum_periods_sparse_hour = 0; + double sum_theoretical_sparse_hour = 0; + double sum_experiment_sparse_hour = 0; + + double sum_credicts_sparse_week = 0; + double sum_periods_sparse_week = 0; + double sum_theoretical_sparse_week = 0; + double sum_experiment_sparse_week = 0; + + if(courses != null && courses.size() > 0){ + for (Course course : courses) { + sum_credicts += (course.getCredits() == null ? 0 : course.getCredits()); + + if(course.getUnit() == null || course.getUnit().trim().equals("时")){ + if(course.getMethod().trim().equals("分散")){ + sum_credicts_sparse_hour += course.getCredits(); + sum_periods_sparse_hour += (course.getPeriod() == null ? 0 : course.getPeriod()); + sum_theoretical_sparse_hour += (course.getTheoretical() == null ? 0 : course.getTheoretical()); + sum_experiment_sparse_hour += (course.getExperiment() == null ? 0 : course.getExperiment()); + }else{ + sum_credicts_centralize_hour += course.getCredits(); + sum_periods_centralize_hour += (course.getPeriod() == null ? 0 : course.getPeriod()); + sum_theoretical_centralize_hour += (course.getTheoretical() == null ? 0 : course.getTheoretical()); + sum_experiment_centralize_hour += (course.getExperiment() == null ? 0 : course.getExperiment()); + } + }else if(course.getUnit().trim().equals("周")){ + if(course.getMethod().trim().equals("分散")){ + sum_credicts_sparse_week += course.getCredits(); + sum_periods_sparse_week += (course.getPeriod() == null ? 0 : course.getPeriod()); + sum_theoretical_sparse_week += (course.getTheoretical() == null ? 0 : course.getTheoretical()); + sum_experiment_sparse_week += (course.getExperiment() == null ? 0 : course.getExperiment()); + }else{ + sum_credicts_centralize_week += course.getCredits(); + sum_periods_centralize_week += (course.getPeriod() == null ? 0 : course.getPeriod()); + sum_theoretical_centralize_week += (course.getTheoretical() == null ? 0 : course.getTheoretical()); + sum_experiment_centralize_week += (course.getExperiment() == null ? 0 : course.getExperiment()); + } + + }else{ + + } + } + + Course sum = new Course(); + sum.setName("小 计[集中,时]"); + sum.setCredits(sum_credicts_centralize_hour); + sum.setPeriod(sum_periods_centralize_hour); + sum.setTheoretical(sum_theoretical_centralize_hour); + sum.setExperiment(sum_experiment_centralize_hour); + sum.setUnit("时"); + sum.setMethod("集中"); + courses.add(sum); + + sum = new Course(); + sum.setName("小 计[集中,周]"); + sum.setCredits(sum_credicts_centralize_week); + sum.setPeriod(sum_periods_centralize_week); + sum.setTheoretical(sum_theoretical_centralize_week); + sum.setExperiment(sum_experiment_centralize_week); + sum.setUnit("周"); + sum.setMethod("集中"); + courses.add(sum); + + sum = new Course(); + sum.setName("小 计[分散,时]"); + sum.setCredits(sum_credicts_sparse_hour); + sum.setPeriod(sum_periods_sparse_hour); + sum.setTheoretical(sum_theoretical_sparse_hour); + sum.setExperiment(sum_experiment_sparse_hour); + sum.setUnit("时"); + sum.setMethod("分散"); + courses.add(sum); + + sum = new Course(); + sum.setName("小 计[分散,时]"); + sum.setCredits(sum_credicts_sparse_week); + sum.setPeriod(sum_periods_sparse_week); + sum.setTheoretical(sum_theoretical_sparse_week); + sum.setExperiment(sum_experiment_sparse_week); + sum.setUnit("周"); + sum.setMethod("分散"); + courses.add(sum); + + sum = new Course(); + sum.setName("小 计"); + sum.setCredits(sum_credicts); + courses.add(sum); + } + } + + public static void processCourseInformationData(List courses){ + double sum_credicts = 0; + double sum_credicts_centralize_hour = 0; + double sum_periods_centralize_hour = 0; + double sum_theoretical_centralize_hour = 0; + double sum_experiment_centralize_hour = 0; + + double sum_credicts_centralize_week = 0; + double sum_periods_centralize_week = 0; + double sum_theoretical_centralize_week = 0; + double sum_experiment_centralize_week = 0; + + double sum_credicts_sparse_hour = 0; + double sum_periods_sparse_hour = 0; + double sum_theoretical_sparse_hour = 0; + double sum_experiment_sparse_hour = 0; + + double sum_credicts_sparse_week = 0; + double sum_periods_sparse_week = 0; + double sum_theoretical_sparse_week = 0; + double sum_experiment_sparse_week = 0; + + if(courses != null && courses.size() > 0){ + for (ExCourse course : courses) { + if(course.getOpened() == 0) + continue; + + sum_credicts += (course.getCredits() == null ? 0 : course.getCredits()); + + if(course.getUnit() == null || course.getUnit().trim().equals("时")){ + if(course.getMethod().trim().equals("分散")){ + sum_credicts_sparse_hour += course.getCredits(); + sum_periods_sparse_hour += (course.getPeriod() == null ? 0 : course.getPeriod()); + sum_theoretical_sparse_hour += (course.getTheoretical() == null ? 0 : course.getTheoretical()); + sum_experiment_sparse_hour += (course.getExperiment() == null ? 0 : course.getExperiment()); + }else{ + sum_credicts_centralize_hour += course.getCredits(); + sum_periods_centralize_hour += (course.getPeriod() == null ? 0 : course.getPeriod()); + sum_theoretical_centralize_hour += (course.getTheoretical() == null ? 0 : course.getTheoretical()); + sum_experiment_centralize_hour += (course.getExperiment() == null ? 0 : course.getExperiment()); + } + }else if(course.getUnit().trim().equals("周")){ + if(course.getMethod().trim().equals("分散")){ + sum_credicts_sparse_week += course.getCredits(); + sum_periods_sparse_week += (course.getPeriod() == null ? 0 : course.getPeriod()); + sum_theoretical_sparse_week += (course.getTheoretical() == null ? 0 : course.getTheoretical()); + sum_experiment_sparse_week += (course.getExperiment() == null ? 0 : course.getExperiment()); + }else{ + sum_credicts_centralize_week += course.getCredits(); + sum_periods_centralize_week += (course.getPeriod() == null ? 0 : course.getPeriod()); + sum_theoretical_centralize_week += (course.getTheoretical() == null ? 0 : course.getTheoretical()); + sum_experiment_centralize_week += (course.getExperiment() == null ? 0 : course.getExperiment()); + } + + }else{ + + } + } + + ExCourse sum = new ExCourse(); + sum.setName("小 计[集中,时]"); + sum.setCredits(sum_credicts_centralize_hour); + sum.setPeriod(sum_periods_centralize_hour); + sum.setTheoretical(sum_theoretical_centralize_hour); + sum.setExperiment(sum_experiment_centralize_hour); + sum.setUnit("时"); + sum.setMethod("集中"); + courses.add(sum); + + sum = new ExCourse(); + sum.setName("小 计[集中,周]"); + sum.setCredits(sum_credicts_centralize_week); + sum.setPeriod(sum_periods_centralize_week); + sum.setTheoretical(sum_theoretical_centralize_week); + sum.setExperiment(sum_experiment_centralize_week); + sum.setUnit("周"); + sum.setMethod("集中"); + courses.add(sum); + + sum = new ExCourse(); + sum.setName("小 计[分散,时]"); + sum.setCredits(sum_credicts_sparse_hour); + sum.setPeriod(sum_periods_sparse_hour); + sum.setTheoretical(sum_theoretical_sparse_hour); + sum.setExperiment(sum_experiment_sparse_hour); + sum.setUnit("时"); + sum.setMethod("分散"); + courses.add(sum); + + sum = new ExCourse(); + sum.setName("小 计[分散,时]"); + sum.setCredits(sum_credicts_sparse_week); + sum.setPeriod(sum_periods_sparse_week); + sum.setTheoretical(sum_theoretical_sparse_week); + sum.setExperiment(sum_experiment_sparse_week); + sum.setUnit("周"); + sum.setMethod("分散"); + courses.add(sum); + + sum = new ExCourse(); + sum.setName("小 计"); + sum.setCredits(sum_credicts); + courses.add(sum); + } + } + + public static void printTotal(List courses){ + if(courses.size() > 5){ + List subs = new ArrayList(); + + subs.add(courses.get(courses.size() - 5)); + subs.add(courses.get(courses.size() - 4)); + subs.add(courses.get(courses.size() - 3)); + subs.add(courses.get(courses.size() - 2)); + subs.add(courses.get(courses.size() - 1)); + + for (Course course : subs) { + System.out.println(course.getCredits() + "/" + course.getPeriod()); + } + } + } +} diff --git a/src/cn/edu/hit/education/view/CourseInformationView.java b/src/cn/edu/hit/education/view/CourseInformationView.java index bdaa562420fdd661157ee8e28ee4997110dde041..ce25b16aaf96313c92d236badca4cde6310fcd4a 100644 --- a/src/cn/edu/hit/education/view/CourseInformationView.java +++ b/src/cn/edu/hit/education/view/CourseInformationView.java @@ -34,6 +34,8 @@ import org.springframework.stereotype.Component; import cn.edu.hit.education.action.AddNewCourseAction; import cn.edu.hit.education.action.CodeCourseAction; +import cn.edu.hit.education.action.ExportAction; +import cn.edu.hit.education.action.ImportAction; import cn.edu.hit.education.contentprovider.CourseInformationContentProvider; import cn.edu.hit.education.labelprovider.CourseInformationLabelProvider; import cn.edu.hit.education.pojo.Course; @@ -80,6 +82,8 @@ public class CourseInformationView extends ViewPart { private IAction addCourseAction = null; private IAction codeCourseAction = null; + private IAction importAction = null; + private IAction exportAction = null; public CourseInformationView() { } @@ -172,7 +176,7 @@ public class CourseInformationView extends ViewPart { MenuItem modifyItem = new MenuItem(contextMenu, SWT.None); modifyItem.setEnabled(false); - modifyItem.setText("Ƴ"); + modifyItem.setText("去除"); TableViewerColumn tableViewerColumn_6 = new TableViewerColumn(tableViewer, SWT.NONE); TableColumn tblclmnNewColumn_1 = tableViewerColumn_6.getColumn(); @@ -182,13 +186,10 @@ public class CourseInformationView extends ViewPart { TableColumn tblclmnNewColumn_2 = new TableColumn(table, SWT.NONE); tblclmnNewColumn_2.setWidth(100); tblclmnNewColumn_2.setText("\u662F\u5426\u5F00\u8BFE"); - // modifyItem.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, - // "icons/view/modify_16px.png").createImage()); modifyItem.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { - // TODO Զɵķ TableItem[] selections = table.getSelection(); Shell parentShell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); @@ -205,13 +206,11 @@ public class CourseInformationView extends ViewPart { } } - //refreshData(); } } @Override public void widgetDefaultSelected(SelectionEvent e) { - // TODO Զɵķ } }); @@ -244,19 +243,22 @@ public class CourseInformationView extends ViewPart { @Override public void setFocus() { - // TODO Զɵķ } private void makeActions(){ addCourseAction = new AddNewCourseAction(tableViewer); codeCourseAction = new CodeCourseAction(); + importAction = new ImportAction(); + exportAction = new ExportAction(); } private void initializeToolBar() { IToolBarManager toolbarManager = getViewSite().getActionBars().getToolBarManager(); toolbarManager.add(addCourseAction); toolbarManager.add(codeCourseAction); + toolbarManager.add(importAction); + toolbarManager.add(exportAction); } private List queryCourseByProperty(Specialty specialty,Property property) { @@ -275,7 +277,7 @@ public class CourseInformationView extends ViewPart { //refreshData(); } else { MessageDialog.openConfirm(PlatformUI.getWorkbench().getDisplay() - .getActiveShell(), "ʾ", "̱Ѱſγ̣"); + .getActiveShell(), "��ʾ", "���̱����Ѱ������ſγ̣�"); } } diff --git a/src/cn/edu/hit/education/view/CourseScheduleView.java b/src/cn/edu/hit/education/view/CourseScheduleView.java index f95b0e5014a5d4527d0a4e1488037f45ce9349cb..54a1fec2626fbd0cf0537e4ed7f97a5a10983949 100644 --- a/src/cn/edu/hit/education/view/CourseScheduleView.java +++ b/src/cn/edu/hit/education/view/CourseScheduleView.java @@ -133,14 +133,11 @@ public class CourseScheduleView extends ViewPart { MenuItem modifyItem = new MenuItem(contextMenu, SWT.None); modifyItem.setEnabled(false); - modifyItem.setText("Ƴ"); - // modifyItem.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, - // "icons/view/modify_16px.png").createImage()); + modifyItem.setText("去除"); modifyItem.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { - // TODO Զɵķ TableItem[] selections = table.getSelection(); Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); if (selections.length > 0) { @@ -163,8 +160,6 @@ public class CourseScheduleView extends ViewPart { @Override public void widgetDefaultSelected(SelectionEvent e) { - // TODO Զɵķ - } }); @@ -191,7 +186,6 @@ public class CourseScheduleView extends ViewPart { @Override public void setFocus() { - // TODO Զɵķ } @@ -221,7 +215,7 @@ public class CourseScheduleView extends ViewPart { refreshData(); } else { MessageDialog.openConfirm(PlatformUI.getWorkbench().getDisplay() - .getActiveShell(), "ʾ", "̱Ѱſγ̣"); + .getActiveShell(), "提示", "培养方案表格中已安排该课程!"); } } diff --git a/src/educationschedule/ApplicationActionBarAdvisor.java b/src/educationschedule/ApplicationActionBarAdvisor.java index b8ec9657809b65aa6d0f52ac3efdd0351d1dbcf2..b745ae013bcc2d382c5d07c49df54098f9954bde 100644 --- a/src/educationschedule/ApplicationActionBarAdvisor.java +++ b/src/educationschedule/ApplicationActionBarAdvisor.java @@ -31,7 +31,6 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor { @Override protected void makeActions(IWorkbenchWindow window) { - // TODO Զɵķ statisticalAction = new StatisticalScheduleAction(); //addCourseAction = new AddNewCourseAction(); super.makeActions(window); @@ -39,7 +38,6 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor { @Override protected void fillCoolBar(ICoolBarManager coolBar) { - // TODO Զɵķ super.fillCoolBar(coolBar); IToolBarManager toolbar = new ToolBarManager(coolBar.getStyle()); coolBar.add(toolbar); diff --git a/src/educationschedule/ApplicationWorkbenchWindowAdvisor.java b/src/educationschedule/ApplicationWorkbenchWindowAdvisor.java index e341646a21665bb71f1cac57412a254f5e4e9fa4..a973923edbcc5131b9ef64e86b3ea02879717050 100644 --- a/src/educationschedule/ApplicationWorkbenchWindowAdvisor.java +++ b/src/educationschedule/ApplicationWorkbenchWindowAdvisor.java @@ -22,6 +22,6 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { configurer.setInitialSize(new Point(800, 600)); configurer.setShowCoolBar(true); configurer.setShowStatusLine(true); - configurer.setTitle(""); + configurer.setTitle("培养方案管理"); } }