Search in sources :

Example 1 with IPublish

use of com.cas.sim.tis.view.control.IPublish in project TeachingInSimulation by ScOrPiOzzy.

the class PreviewQuestionPaper method publish.

@FXML
private void publish() {
    // 判断当前是否有考核正在进行
    if (Session.get(Session.KEY_LIBRARY_PUBLISH_ID) != null) {
        AlertUtil.showAlert(AlertType.WARNING, MsgUtil.getMessage("alert.warning.examing"));
        return;
    }
    // 创建考核记录
    List<Class> classes = SpringUtil.getBean(ClassAction.class).findClassesByTeacher(Session.get(Session.KEY_LOGIN_ID));
    Dialog<Integer> dialog = new Dialog<>();
    dialog.setDialogPane(new ClassSelectDialog(classes));
    dialog.setTitle(MsgUtil.getMessage("class.dialog.select"));
    dialog.setPrefSize(652, 420);
    dialog.showAndWait().ifPresent(cid -> {
        if (cid == null) {
            return;
        }
        try {
            Integer publishId = SpringUtil.getBean(LibraryPublishAction.class).publishLibraryToClass(rid, cid);
            // 记录当前考核发布编号
            Session.set(Session.KEY_LIBRARY_PUBLISH_ID, publishId);
            // 添加考核进行时菜单
            PageController controller = SpringUtil.getBean(PageController.class);
            ILeftContent content = controller.getLeftMenu();
            if (content instanceof IPublish) {
                ((IPublish) content).publish(publishId);
            }
        } catch (Exception e) {
            e.printStackTrace();
            AlertUtil.showAlert(AlertType.ERROR, e.getMessage());
        }
    });
}
Also used : IPublish(com.cas.sim.tis.view.control.IPublish) ClassAction(com.cas.sim.tis.action.ClassAction) LibraryPublishAction(com.cas.sim.tis.action.LibraryPublishAction) PageController(com.cas.sim.tis.view.controller.PageController) ClassSelectDialog(com.cas.sim.tis.view.control.imp.classes.ClassSelectDialog) Dialog(com.cas.sim.tis.view.control.imp.dialog.Dialog) ClassSelectDialog(com.cas.sim.tis.view.control.imp.classes.ClassSelectDialog) Class(com.cas.sim.tis.entity.Class) ILeftContent(com.cas.sim.tis.view.control.ILeftContent) IOException(java.io.IOException) FXML(javafx.fxml.FXML)

Aggregations

ClassAction (com.cas.sim.tis.action.ClassAction)1 LibraryPublishAction (com.cas.sim.tis.action.LibraryPublishAction)1 Class (com.cas.sim.tis.entity.Class)1 ILeftContent (com.cas.sim.tis.view.control.ILeftContent)1 IPublish (com.cas.sim.tis.view.control.IPublish)1 ClassSelectDialog (com.cas.sim.tis.view.control.imp.classes.ClassSelectDialog)1 Dialog (com.cas.sim.tis.view.control.imp.dialog.Dialog)1 PageController (com.cas.sim.tis.view.controller.PageController)1 IOException (java.io.IOException)1 FXML (javafx.fxml.FXML)1