예제 #1
0
  @Override
  public boolean init() {
    String strMethod = "init()";

    if (!super.init()) {
      MySystem.s_printOutError(this, strMethod, "failed");
      return false;
    }

    if (this._btnHelpSource_ == null) {
      MySystem.s_printOutError(this, strMethod, "nil this._btnHelpSource_");
      return false;
    }

    if (!((BESHelpJHAbstract) this._btnHelpSource_).init()) {
      MySystem.s_printOutError(this, strMethod, "failed");
      return false;
    }

    if (this._btnHelpTrack_ != null) {
      if (!((BESHelpJHAbstract) this._btnHelpTrack_).init()) {
        MySystem.s_printOutError(this, strMethod, "failed");
        return false;
      }
    }

    // ending
    return true;
  }
  private boolean _assignValues(File fle) {
    String strMethod = "_assignValues(fle)";

    if (fle == null) {
      MySystem.s_printOutError(this, strMethod, "nil fle");
      return false;
    }

    // --
    // allow overwriting
    // --

    if (super._tfdCurSelection_ == null) {
      MySystem.s_printOutError(this, strMethod, "nil super._tfdCurSelection_");
      return false;
    }

    super._tfdCurSelection_.setText(fle.getAbsolutePath());
    super._setSelectedValue_(true);

    if (super._btnClearSelection_ == null) {
      MySystem.s_printOutError(this, strMethod, "nil super._btnClearSelection_");
      return false;
    }

    super._btnClearSelection_.setEnabled(true);

    // --
    // ending
    return true;
  }
  protected void _showDialog_() {
    String strMethod = "_showDialog_()";

    String[] strsTypeFileShkCur = _getTypeFileShkCur();

    if (strsTypeFileShkCur == null)
      MySystem.s_printOutExit(this, strMethod, "nil strsTypeFileShkCur");

    String strFileDesc = _getDescFileShkCur();

    if (strFileDesc == null) MySystem.s_printOutExit(this, strMethod, "nil strFileDesc");

    // ----

    File fle = null;

    String strButtonTextOk = "Save file";

    fle =
        S_FileChooserUI.s_getSaveFile(
            super._frmParent_,
            strButtonTextOk,
            strsTypeFileShkCur,
            strFileDesc,
            com.google.code.p.keytooliui.ktl.io.S_FileExtensionUI.f_s_strDirNameDefaultShk);

    if (fle == null) {
      // cancelled
      return;
    }

    if (!_assignValues(fle))
      MySystem.s_printOutExit(this, strMethod, "failed, fle.getName()=" + fle.getName());
  }
  private boolean _assignValues(File fle) {
    String strMethod = "_assignValues(fle)";

    if (fle == null) {
      MySystem.s_printOutError(this, strMethod, "nil fle");
      return false;
    }

    if (!fle.exists()) {
      MySystem.s_printOutWarning(
          this, strMethod, "! fle.exists(), fle.getAbsolutePath()=" + fle.getAbsolutePath());

      String strBody = fle.getAbsolutePath();
      strBody += ":\nDirectory not found.";

      OPAbstract.s_showDialogWarning(super._frmParent_, strBody);

      return true;
    }

    if (!fle.isDirectory()) // statement should never be reached!!!
    {
      MySystem.s_printOutWarning(
          this, strMethod, "! fle.isDirectory(), fle.getAbsolutePath()=" + fle.getAbsolutePath());

      String strBody = fle.getAbsolutePath();
      strBody += ":\n  not a directory.";

      OPAbstract.s_showDialogWarning(super._frmParent_, strBody);

      return true;
    }

    if (super._tfdCurSelection_ == null) {
      MySystem.s_printOutError(this, strMethod, "nil super._tfdCurSelection_");
      return false;
    }

    super._tfdCurSelection_.setText(fle.getAbsolutePath());
    super._setSelectedValue_(true);

    if (!_enableButtonsSelectionDone_()) {
      MySystem.s_printOutError(this, strMethod, "failed");
      return false;
    }

    // --
    // ending
    return true;
  }
예제 #5
0
  protected TBMainAbstract(
      String strHelpID,
      ActionListener actListenerParent,
      // javax.help.HelpBroker hbrHelpStandard,
      int intOrientation,
      javax.swing.ImageIcon
          iinFrameFloatable, // should be used once bug fixed "setFloatable(true), see below
      boolean blnDoHelpOnItem,
      boolean blnFloatable) {
    super(intOrientation, iinFrameFloatable, strHelpID, blnFloatable);

    String strMethod = "TBMainAbstract(...)";

    try {
      this._btnHelpSource_ = new BESHelpJHSource();

      if (blnDoHelpOnItem) {
        this._btnHelpTrack_ = new BESHelpJHTrack();
      }
    } catch (NullPointerException excNullPointer) {
      excNullPointer.printStackTrace();
      MySystem.s_printOutExit(this, strMethod, "excNullPointerCaught");
    }

    this._btnExit_ = new BESExit24(actListenerParent);

    if (actListenerParent != null) super._btnPrint_ = new BESPrint24(actListenerParent);
  }
  /** grouping PKCS7-[XXX]-[XXX] files */
  private boolean _addGroup() {
    String strMethod = "_addGroup()";

    // adding radioButtons/labelChecks for selecting in between JAR, and JHR, and RCR files

    if (this._btnTypeFileShkDer == null) {
      MySystem.s_printOutError(this, strMethod, "nil this._btnTypeFileShk[xxx]");
      return false;
    }

    // ----

    ButtonGroup bgp = new ButtonGroup();
    // bgp.add(this._btnTypeFileShkPkcs7);

    if (this._btnTypeFileShkPem != null) bgp.add(this._btnTypeFileShkPem);

    bgp.add(this._btnTypeFileShkDer);

    if (bgp.getButtonCount() < 2) {
      this._btnTypeFileShkDer.setEnabled(false);
    }

    // selecting first button
    this._btnTypeFileShkDer.setSelected(true);

    // else label: done at construction time

    // --
    JPanel pnlTypeFileShk = new JPanel();
    pnlTypeFileShk.setLayout(new BoxLayout(pnlTypeFileShk, BoxLayout.Y_AXIS));
    pnlTypeFileShk.add(this._btnTypeFileShkDer); // default

    if (this._btnTypeFileShkPem != null) pnlTypeFileShk.add(this._btnTypeFileShkPem);

    // --
    if (super._pnl_ == null) {
      MySystem.s_printOutError(this, strMethod, "nil super._pnl_");
      return false;
    }

    super._pnl_.add(pnlTypeFileShk);

    // ending
    return true;
  }
  // could be redefined in subclasses
  protected boolean _enableButtonsSelectionDone_() {
    String strMethod = "_enableButtonsSelectionDone_()";

    if (super._btnClearSelection_ == null) {
      MySystem.s_printOutError(this, strMethod, "nil super._btnClearSelection_");
      return false;
    }

    super._btnClearSelection_.setEnabled(true);

    return true;
  }
예제 #8
0
  protected boolean _addButtonAboutAppli_() {
    String strMethod = "_addButtonAboutAppli_()";

    if (this._btnAboutAppli_ == null) {
      MySystem.s_printOutError(this, strMethod, "nil this._btnAboutAppli_");
      return false;
    }

    add(this._btnAboutAppli_);

    // ending
    return true;
  }
  public boolean init() {
    String strMethod = "init()";

    if (!super.init()) {
      MySystem.s_printOutError(this, strMethod, "failed");
      return false;
    }

    if (this._btnTypeFileShkPem != null) {
      if (!this._btnTypeFileShkPem.init()) return false;
    }

    if (!this._btnTypeFileShkDer.init()) return false;

    if (!_addGroup()) {
      MySystem.s_printOutError(this, strMethod, "failed");
      return false;
    }

    // ending
    return true;
  }
  protected void _showDialog_() {
    String strMethod = "_showDialog_()";
    String strButtonTextOk = "Open directory";

    File fle = S_FileChooserAbs.s_getOpenDir(super._frmParent_, strButtonTextOk);

    if (fle == null) {
      // cancelled
      return;
    }

    if (!_assignValues(fle))
      MySystem.s_printOutExit(this, strMethod, "failed, fle.getName()=" + fle.getName());
  }
예제 #11
0
  protected boolean _addButtonExit_() {
    String strMethod = "_addButtonExit_()";

    add(Box.createHorizontalGlue());
    add(Box.createVerticalGlue());

    if (this._btnExit_ == null) {
      MySystem.s_printOutError(this, strMethod, "nil this._btnExit");
      return false;
    }

    add(this._btnExit_);
    // this._addSeparator_();
    return true;
  }
예제 #12
0
  /** MEMO: bln alaways true, method called once the help frame has been successfully loaded */
  public boolean setEnabledHelpOffline(boolean bln) {
    String strMethod = "setEnabledHelpOffline(bln)";

    if (this._btnHelpSource_ == null) {
      MySystem.s_printOutError(this, strMethod, "nil this._btnHelpSource_");
      return false;
    }

    this._btnHelpSource_.setEnabled(bln);

    if (this._btnHelpTrack_ != null) {
      this._btnHelpTrack_.setEnabled(bln);
    }

    return true;
  }
  private String _getDescFileShkCur() {
    String strMethod = "_getDescFileShkCur()";

    if (this._btnTypeFileShkPem != null) {
      if (this._btnTypeFileShkPem.isSelected()) {
        return this._btnTypeFileShkPem.getFileDesc();
      }
    }

    if (this._btnTypeFileShkDer.isSelected()) {
      return this._btnTypeFileShkDer.getFileDesc();
    }

    // ----
    // error
    MySystem.s_printOutError(this, strMethod, "failed");
    return null;
  }
예제 #14
0
  /*
      memo: two buttons!
  */
  protected boolean _addButtonHelp_() {
    String strMethod = "_addButtonHelp_()";

    if (this._btnHelpSource_ == null) {
      MySystem.s_printOutError(this, strMethod, "nil this._btnHelpSource_");
      return false;
    }

    add(this._btnHelpSource_);

    if (this._btnHelpTrack_ != null) {
      add(this._btnHelpTrack_);
    }

    if (this._btnHelpOnlineHome_ != null) {
      add(this._btnHelpOnlineHome_);
    }

    // ending
    return true;
  }