Search in sources :

Example 1 with ExamMessage

use of com.cas.sim.tis.message.ExamMessage in project TeachingInSimulation by ScOrPiOzzy.

the class ExamingMenuItem method showDialog.

private void showDialog() {
    Dialog<Boolean> dialog = new Dialog<>();
    dialog.setDialogPane(new ExamingDialog(publish));
    dialog.setTitle(MsgUtil.getMessage("class.dialog.modify"));
    dialog.setPrefSize(640, 380);
    dialog.showAndWait().ifPresent(finish -> {
        if (finish) {
            ExamMessage message = new ExamMessage();
            message.setPid(publish.getId());
            message.setType(ExamMessage.EXAM_OVER);
            SocketUtil.INSTENCE.send(message);
            ExamingMenuItem.this.setVisible(false);
            rotateTransition.stop();
            Session.set(Session.KEY_LIBRARY_PUBLISH_ID, null);
        }
    });
}
Also used : Dialog(com.cas.sim.tis.view.control.imp.dialog.Dialog) ExamMessage(com.cas.sim.tis.message.ExamMessage)

Example 2 with ExamMessage

use of com.cas.sim.tis.message.ExamMessage in project TeachingInSimulation by ScOrPiOzzy.

the class LibraryPublishServiceImpl method publishLibraryToClass.

@Override
public Integer publishLibraryToClass(LibraryPublish publish) {
    // 记录考核发布记录
    saveUseGeneratedKeys(publish);
    // 广播开始考核
    ExamMessage message = new ExamMessage();
    message.setPid(publish.getId());
    message.setType(ExamMessage.EXAM_START);
    // 筛选当前登陆人员
    List<HostedConnection> collection = new ArrayList<>();
    for (HostedConnection hostedConnection : serverConfig.getClients()) {
        if (publish.getClassId().equals(hostedConnection.getAttribute(Session.KEY_LOGIN_CLASSID.name()))) {
            collection.add(hostedConnection);
        }
    }
    serverConfig.getServer().broadcast(Filters.in(collection), message);
    return publish.getId();
}
Also used : ArrayList(java.util.ArrayList) HostedConnection(com.jme3.network.HostedConnection) ExamMessage(com.cas.sim.tis.message.ExamMessage)

Aggregations

ExamMessage (com.cas.sim.tis.message.ExamMessage)2 Dialog (com.cas.sim.tis.view.control.imp.dialog.Dialog)1 HostedConnection (com.jme3.network.HostedConnection)1 ArrayList (java.util.ArrayList)1