コード例 #1
0
  private void setupPage(int index) {
    String html = getHTMLString(pages.get(index));

    html = replaceVariables(html);
    htmlPanel.setHTMLString(html, base);
    setupActionPanelKeys(index);
    regionsContainer.removeRegionContent(Region.SOUTH);

    // setup views
    regionsContainer.setRegionContent(Region.CENTER, htmlPanel);
    if (duration == 0) {
      regionsContainer.setRegionContent(Region.SOUTH, actionPanel);
    }

    regionsContainer.setRegionContentVisibility(Region.CENTER, true);
    regionsContainer.setRegionContentVisibility(Region.SOUTH, true);

    // enable the actions
    if (duration == 0) {
      actionPanel.enableActionPanel();
    }
    currentIndex = index;

    // start timer
    if (timeoutHandler != null) {
      timeoutHandler.startTimeout(getExecutionContext());
    }
  }
コード例 #2
0
  private void initComponents() {
    // question panel
    htmlPanel = new HTMLPanel();

    // action panel
    actionPanel = new KeyActionPanel();
    actionPanel.addActionPanelListener(this);
  }
コード例 #3
0
 private void doCleanup() {
   if (timeoutHandler != null) {
     timeoutHandler.cancelTimeout();
   }
   actionPanel.disableActionPanel();
   regionsContainer.removeRegionContent(Region.SOUTH);
   regionsContainer.removeRegionContent(Region.CENTER);
 }
コード例 #4
0
  private void setupActionPanelKeys(int index) {
    actionPanel.removeKeys();
    Messages messages = context.getExecutionData().getModule().getMessages();

    if (index > 0) {
      actionPanel.addKey(
          KeyEvent.VK_LEFT,
          messages.getString("AbstractHTMLExecutable.keyActionPanel.labelBack"),
          -1);
      actionPanel.addKey(
          KeyEvent.VK_RIGHT,
          messages.getString("AbstractHTMLExecutable.keyActionPanel.labelNext"),
          1);
    } else {
      actionPanel.addKey(
          KeyEvent.VK_RIGHT,
          messages.getString("AbstractHTMLExecutable.keyActionPanel.labelNext"),
          1);
    }
    actionPanel.validate();
  }
コード例 #5
0
  /** Called when action panel gets triggered */
  public void actionTriggered(ActionPanel source, Object actionValue) {
    int newIndex = 0;
    int addIndex = (Integer) actionValue;
    actionPanel.disableActionPanel();
    // increment the displayed image
    if (currentIndex + addIndex >= 0) {
      newIndex = currentIndex + addIndex;
    }

    // setup next instruction / finish executable
    if (newIndex < getPagesCount()) {
      setupPage(newIndex);
      return;
    } else {
      if (getFinishExecutionLock()) {
        cancelExecutionAWT();
        doCleanup();
        finishExecution();
      }
      return;
    }
  }
コード例 #6
0
 protected void cancelExecutionAWT() {
   actionPanel.disableActionPanel();
 }