예제 #1
0
  /**
   * Displays the current step title, depending on the current step.
   *
   * @param i the number of the step
   */
  public final void refreshStepTitle(final int i) {
    // HelpButton
    this.bHelp.setHelpMessage(
        FileTools.readHelpMessage((TextsKeys.KEY_HELP_STEP + i), TextsKeys.MESSAGETYPE_MESSAGE),
        FileTools.readHelpMessage((TextsKeys.KEY_HELP_STEP + i), TextsKeys.MESSAGETYPE_TITLE));

    // Tooltips
    this.bHelp.setTooltip(
        FileTools.readHelpMessage(TextsKeys.KEY_HELP_STEP + i, TextsKeys.MESSAGETYPE_TOOLTIP));
    this.bLaunch.setToolTipText(FileTools.readElementText(TextsKeys.KEY_PROCESSTITLE + i));

    // Title
    this.titleStep.setText(FileTools.readElementText(TextsKeys.KEY_STEPTITLE + i));
    this.titleStep.repaint();

    // Enable or disable some buttons depending on the step
    if (i == AbstractBuildingsIslet.FIRST_STEP) {
      this.bBack.setEnabled(false);
    } else {
      this.bBack.setEnabled(true);
    }

    if (i == AbstractBuildingsIslet.SEVENTH_STEP) {
      this.bLaunch.setEnabled(false);
      this.bSave.setEnabled(true);
    } else {
      this.bLaunch.setEnabled(true);
      this.bSave.setEnabled(false);
    }

    if (i == AbstractBuildingsIslet.SIXTH_STEP) {
      this.bSave.setEnabled(true);
    }
  }
  /**
   * Launches the process of an islet and opens the new window.
   *
   * @param isletFile the file containing data of the islet to process.
   * @param biController the building islet controller which contains all needed data for the islet.
   */
  public final void launchIsletProcess(
      final File isletFile, final BuildingsIsletController biController) {
    // Launches the base change : the process 0.
    try {
      biController.launchProcess();
    } catch (WeirdResultException | WeirdPreviousResultsException e) {
      JOptionPane.showMessageDialog(
          isletSelectionController.getWindow(),
          e.getMessage(),
          FileTools.readInformationMessage(
              TextsKeys.KEY_ERROR_WEIRDRESULT, TextsKeys.MESSAGETYPE_TITLE),
          JOptionPane.ERROR_MESSAGE);
    }

    this.isletProcessController = new IsletProcessController(this, isletFile, biController);
    this.isletSelectionController.getWindow().setVisible(false);
  }
예제 #3
0
  /** Constructor. */
  public NavigationBarView() {
    // Layout
    this.pCentral.setLayout(new GridBagLayout());

    this.pCentral.add(
        this.bBack,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0,
            1,
            GridBagConstraints.PAGE_START,
            GridBagConstraints.NONE,
            new Insets(8, 8, 8, 8),
            0,
            5));

    this.pCentral.add(
        this.titleStep,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0,
            1,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(8, 8, 8, 8),
            0,
            5));

    this.pCentral.add(
        bHelp,
        new GridBagConstraints(
            2,
            0,
            1,
            1,
            0,
            1,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(8, 8, 8, 8),
            0,
            2));

    this.pCentral.add(
        this.bLaunch,
        new GridBagConstraints(
            3,
            0,
            1,
            1,
            0,
            1,
            GridBagConstraints.PAGE_START,
            GridBagConstraints.NONE,
            new Insets(8, 8, 8, 8),
            0,
            5));

    this.setLayout(new BorderLayout());
    this.add(this.bAbort, BorderLayout.WEST);
    this.add(this.pCentral, BorderLayout.CENTER);
    this.add(this.bSave, BorderLayout.EAST);
    this.setMinimumSize(new Dimension(100, 50));

    // Tooltips
    this.bLaunch.setToolTipText(FileTools.readElementText(TextsKeys.KEY_LAUNCHBUTTON));
    this.bBack.setToolTipText(FileTools.readElementText(TextsKeys.KEY_BACKBUTTON));
    this.bAbort.setToolTipText(FileTools.readElementText(TextsKeys.KEY_ABORTBUTTON));
    this.bSave.setToolTipText(FileTools.readElementText(TextsKeys.KEY_SAVERESULTBUTTON));

    // Refreshs the title and the HelpButton and enable the buttons LAUNCH
    // and previous process or not
    this.refreshStepTitle(AbstractBuildingsIslet.FIRST_STEP);
  }