Package ch.tatool.module

Examples of ch.tatool.module.ModuleSchedulerMessage


            lastSessionDate.setTime(lastSession.getStartTime());
        } else {
            lastSessionDate.set(Calendar.YEAR, 1900);
        }
        ModuleSchedulerMessage message = new ModuleSchedulerMessageImpl();
       
        if (getMaxSessions() > 0 && numSessions >= getMaxSessions()) {
          message.setSessionStartAllowed(false);
          message.setMessageTitle("General.title");
          message.setMessageText(messages.getString("ModuleScheduler.DailyModuleScheduler.errorMessage.maxSessions"));
          return message;
        } else if (!lastSessionDate.before(todayDate)) {
          message.setSessionStartAllowed(false);
          Calendar currentDate = new GregorianCalendar();
          int hours = (23 - currentDate.get(Calendar.HOUR_OF_DAY));
          int minutes = (60 - currentDate.get(Calendar.MINUTE));
          String errorString = messages.getString("ModuleScheduler.DailyModuleScheduler.errorMessage.sameDay");
          errorString = errorString.replace("%hours", String.valueOf(hours));
          errorString = errorString.replace("%minutes", String.valueOf(minutes));
          message.setMessageTitle("General.title");
          message.setMessageText(errorString);
            return message;
        } else {
          message.setSessionStartAllowed(true);
            return message;
        }
    }
View Full Code Here


  private void startModule() {
    ModuleScheduler moduleScheduler = module.getModuleScheduler();
   
    if (moduleScheduler != null) {
      moduleScheduler.setMessages(messages);
      ModuleSchedulerMessage message;
      message = moduleScheduler.isSessionStartAllowed(module);
     
      if (message.isSessionStartAllowed()) {
        startModuleButton.setEnabled(false);
        executor = executionService.createExecutor(module);
        executionService.startExecution(executor, false);
      } else {
        JOptionPane.showMessageDialog(this,
              message.getMessageText(),
              message.getMessageTitle(), JOptionPane.INFORMATION_MESSAGE);
      }
    } else {
      // if we don't have a scheduler, allow the start of the module
      executor = executionService.createExecutor(module);
      executionService.startExecution(executor, false);
View Full Code Here

     */
    public boolean canExecute(Module module) {
        // check whether we are allowed to create a new session
        ModuleScheduler moduleScheduler = module.getModuleScheduler();
        if (moduleScheduler != null) {
          ModuleSchedulerMessage message = moduleScheduler.isSessionStartAllowed(module);
          return message.isSessionStartAllowed();
        } else {
          return true;
        }
    }
View Full Code Here

        } else {
            lastSessionDate.set(Calendar.YEAR, 1900);
        }
       
       
        ModuleSchedulerMessage message = new ModuleSchedulerMessageImpl();

        if (lastSessionDate.before(todayDate)) {
          message.setSessionStartAllowed(true);
            return message;
        } else if (!lastSessionDate.before(todayDate)) {
          message.setSessionStartAllowed(false);
          message.setMessageTitle("Tatool");
          int hours = (23 - lastSessionDate.get(Calendar.HOUR_OF_DAY));
          int minutes = (60 - lastSessionDate.get(Calendar.MINUTE));
          StringBuilder mb = new StringBuilder();
          mb.append("Sie haben heute bereits eine Einheit absolviert.\n");
          mb.append("Dieses Modul erlaubt nur eine Einheit pro Tag.\n");
          mb.append("Sie k�nnen die n�chste Einheit in " + hours + " Stunden und " + minutes + " Minuten starten.");
          message.setMessageText(mb.toString());
            return message;
        } else if (numSessions < 26) {
          message.setSessionStartAllowed(false);
          message.setMessageTitle("Tatool");
          message.setMessageText("Sie d�rfen nur 26 Einheiten von diesem Modul absolvieren.");
          return message;
        }
       
        // Allow a total of 26 session and only one session a day (before and after midnight)
        if (lastSessionDate.before(todayDate) && numSessions < 26) {
View Full Code Here

     */
    public boolean canExecute(Module module) {
        // check whether we are allowed to create a new session
        ModuleScheduler moduleScheduler = module.getModuleScheduler();
        if (moduleScheduler != null) {
          ModuleSchedulerMessage message = moduleScheduler.isSessionStartAllowed(module);
          return message.isSessionStartAllowed();
        } else {
          return true;
        }
    }
View Full Code Here

    }
  }

  private void startModule() {
    ModuleScheduler moduleScheduler = module.getModuleScheduler();
    ModuleSchedulerMessage message;
   
    if (moduleScheduler != null) {
      message = moduleScheduler.isSessionStartAllowed(module);
     
      if (message.isSessionStartAllowed()) {
        startModuleButton.setEnabled(false);
        executor = executionService.createExecutor(module);
        executionService.startExecution(executor, false);
      } else {
        JOptionPane.showMessageDialog(this,
              message.getMessageText(),
              message.getMessageTitle(), JOptionPane.INFORMATION_MESSAGE);
      }
    } else {
      // if we don't have a scheduler, allow the start of the module
      executor = executionService.createExecutor(module);
      executionService.startExecution(executor, false);
View Full Code Here

    }
  }

  private void startModule() {
    ModuleScheduler moduleScheduler = module.getModuleScheduler();
    ModuleSchedulerMessage message;
   
    if (moduleScheduler != null) {
      message = moduleScheduler.isSessionStartAllowed(module);
     
      if (message.isSessionStartAllowed()) {
        startModuleButton.setEnabled(false);
        executor = executionService.createExecutor(module);
        executionService.startExecution(executor, false);
      } else {
        JOptionPane.showMessageDialog(this,
              message.getMessageText(),
              message.getMessageTitle(), JOptionPane.INFORMATION_MESSAGE);
      }
    } else {
      // if we don't have a scheduler, allow the start of the module
      executor = executionService.createExecutor(module);
      executionService.startExecution(executor, false);
View Full Code Here

TOP

Related Classes of ch.tatool.module.ModuleSchedulerMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.