Package de.chris_soft.utilities.swing.wizard

Examples of de.chris_soft.utilities.swing.wizard.WizardPanel


  private void addIntroductionPanelToWizard() {
    StringBuilder introText = new StringBuilder();
    introText.append("NanoDoA is a small document archive system for private use.");
    introText.append("\r\nPlease fill the following fields for configuration.");
    introText.append("\r\n\r\nThank you for using NanoDoA.");
    WizardPanel p1 = new WizardPanel(wizard, "Introduction");
    p1.addLabel(introText.toString());
  }
View Full Code Here


    WizardPanel p1 = new WizardPanel(wizard, "Introduction");
    p1.addLabel(introText.toString());
  }

  private void addMailPanelToWizard() {
    final WizardPanel p2 = new WizardPanel(wizard, "Mail document") {
      private static final long serialVersionUID = -1111708493729196988L;

      /**
       * @see de.chris_soft.utilities.swing.wizard.WizardPanel#isNextButtonEnabled()
       */
      @Override
      public boolean isNextButtonEnabled() {
        if (!Boolean.parseBoolean(wizard.getContent(PROP_KEY_SHALL_SEND_MAIL, "true"))) {
          return true;
        }
        if (!wizard.getContent(PROP_KEY_SENDER_MAIL_ADDRESS, "").contains("@")) {
          return false;
        }
        if (wizard.getContent(PROP_KEY_SENDER_MAIL_PW, "").length() == 0) {
          return false;
        }
        if (wizard.getContent(PROP_KEY_SENDER_MAIL_LOGIN, "").length() == 0) {
          return false;
        }
        if (wizard.getContent(PROP_KEY_SENDER_POP3_SERVER, "").length() == 0) {
          return false;
        }
        if (wizard.getContent(PROP_KEY_SENDER_SMTP_PORT, "").length() == 0) {
          return false;
        }
        if (wizard.getContent(PROP_KEY_SENDER_SMTP_SERVER, "").length() == 0) {
          return false;
        }
        if (!wizard.getContent(PROP_KEY_RECEIVER_MAIL_ADDRESS, "").contains("@")) {
          return false;
        }
        return true;
      }
    };

    // Set default values if missing.
    wizard.getContent(PROP_KEY_SHALL_SEND_MAIL, "true");
    wizard.getContent(PROP_KEY_SET_FULLTEXT_INTO_MAIL_BODY, "true");

    p2.addCheckBoxInput("Send mail per document", PROP_KEY_SHALL_SEND_MAIL, new WizardCheckBoxInputListener() {
      @Override
      public void checkInputChanged(String key, boolean checked) {
        p2.getComponentByName(PROP_KEY_SENDER_MAIL_ADDRESS).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_SENDER_MAIL_LOGIN).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_SENDER_MAIL_PW).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_SENDER_SMTP_PORT).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_SENDER_SMTP_SERVER).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_SENDER_POP3_SERVER).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_RECEIVER_MAIL_ADDRESS).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_SET_FULLTEXT_INTO_MAIL_BODY).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_ADD_DOCUMENT_AS_ATTACHMENT).setEnabled(checked);
      }
    });
    p2.addTextInput("Sender mail address", PROP_KEY_SENDER_MAIL_ADDRESS, new WizardTextInputListener() {
      @Override
      public void textInputChanged(String key, String textContent) {
        final String lowerContent = textContent.toLowerCase();
        ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_MAIL_LOGIN)).setText(textContent);
        if (lowerContent.endsWith("@googlemail.com") || lowerContent.endsWith("@gmail.com")) {
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_SMTP_SERVER)).setText("smtp.googlemail.com");
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_SMTP_PORT)).setText("587");
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_POP3_SERVER)).setText("pop.googlemail.com");
        }
        else if (lowerContent.contains("@gmx.")) {
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_SMTP_SERVER)).setText("mail.gmx.net");
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_SMTP_PORT)).setText("587");
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_POP3_SERVER)).setText("pop.gmx.net");
        }
        else if (lowerContent.endsWith("@aol.com")) {
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_SMTP_SERVER)).setText("smtp.de.aol.com");
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_SMTP_PORT)).setText("587");
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_POP3_SERVER)).setText("pop.aol.com");
          String onlyLoginName = lowerContent.substring(0, lowerContent.length() - 8);
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_MAIL_LOGIN)).setText(onlyLoginName);
        }
      }
    });
    p2.addTextInput("Sender mail login", PROP_KEY_SENDER_MAIL_LOGIN, null);
    p2.addTextInput("Sender mail password", PROP_KEY_SENDER_MAIL_PW, null);
    p2.addTextInput("Sender SMTP server", PROP_KEY_SENDER_SMTP_SERVER, null);
    p2.addTextInput("Sender SMTP port", PROP_KEY_SENDER_SMTP_PORT, null);
    p2.addTextInput("Sender POP3 server", PROP_KEY_SENDER_POP3_SERVER, null);
    p2.addTextInput("Receiver mail address", PROP_KEY_RECEIVER_MAIL_ADDRESS, null);
    p2.addCheckBoxInput("Set document full text into mail body", PROP_KEY_SET_FULLTEXT_INTO_MAIL_BODY, null);
    p2.addCheckBoxInput("Add PDF document as attachment", PROP_KEY_ADD_DOCUMENT_AS_ATTACHMENT, null);
  }
View Full Code Here

    p2.addCheckBoxInput("Set document full text into mail body", PROP_KEY_SET_FULLTEXT_INTO_MAIL_BODY, null);
    p2.addCheckBoxInput("Add PDF document as attachment", PROP_KEY_ADD_DOCUMENT_AS_ATTACHMENT, null);
  }

  private void addArchivePanelToWizard() {
    final WizardPanel p3 = new WizardPanel(wizard, "Archive") {
      private static final long serialVersionUID = 7026397794090207792L;

      @Override
      public boolean isNextButtonEnabled() {
        if (wizard.getContent(PROP_KEY_ARCHIVE_DIRECTORY_PATH, "").isEmpty()) {
          return false;
        }
        if (wizard.getContent(PROP_KEY_OBSERVE_DIRECTORIES, "").isEmpty()) {
          return false;
        }
        return true;
      }
    };

    p3.addDirectoryInput("Archive directory", PROP_KEY_ARCHIVE_DIRECTORY_PATH, null);
    p3.addDirectoryListInput("Directories to observe for documents", PROP_KEY_OBSERVE_DIRECTORIES, null);
  }
View Full Code Here

    p3.addDirectoryInput("Archive directory", PROP_KEY_ARCHIVE_DIRECTORY_PATH, null);
    p3.addDirectoryListInput("Directories to observe for documents", PROP_KEY_OBSERVE_DIRECTORIES, null);
  }

  private void addDocumentHttpServerPanelToWizard() {
    final WizardPanel p4 = new WizardPanel(wizard, "Document (HTTP) Server") {
      private static final long serialVersionUID = 7026397794090207792L;

      @Override
      public boolean isNextButtonEnabled() {
        if (!Boolean.parseBoolean(wizard.getContent(PROP_KEY_DOCUMENT_SERVER_SHALL_USE, "false"))) {
          return true;
        }
        if (wizard.getContent(PROP_KEY_DOCUMENT_SERVER_NAME, "").isEmpty()) {
          return false;
        }
        if (wizard.getContent(PROP_KEY_DOCUMENT_SERVER_PORT, "").isEmpty()) {
          return false;
        }
        return true;
      }
    };

    wizard.getContent(PROP_KEY_DOCUMENT_SERVER_SHALL_USE, "false");
    wizard.getContent(PROP_KEY_DOCUMENT_SERVER_NAME, "localhost");
    wizard.getContent(PROP_KEY_DOCUMENT_SERVER_PORT, "23871");
    wizard.getContent(PROP_KEY_DOCUMENT_SERVER_PASSWORD, "");

    p4.addCheckBoxInput("Use HTTP document server", PROP_KEY_DOCUMENT_SERVER_SHALL_USE, new WizardCheckBoxInputListener() {
      @Override
      public void checkInputChanged(String key, boolean checked) {
        p4.getComponentByName(PROP_KEY_DOCUMENT_SERVER_PORT).setEnabled(checked);
      }
    });
    p4.addTextInput("Server name (for mail usage, e.g.\"www.domainname.xyz\")", PROP_KEY_DOCUMENT_SERVER_NAME, null);
    p4.addTextInput("Server port", PROP_KEY_DOCUMENT_SERVER_PORT, null);
    p4.addPasswordInput("Password (for document retrieval)", PROP_KEY_DOCUMENT_SERVER_PASSWORD, null);
  }
View Full Code Here

  private void addIntroductionPanelToWizard() {
    StringBuilder introText = new StringBuilder();
    introText.append("NanoDoA is a small document archive system for private use.");
    introText.append("\r\nPlease fill the following fields for configuration.");
    introText.append("\r\n\r\nThank you for using NanoDoA.");
    WizardPanel p1 = new WizardPanel(wizard, "Introduction");
    p1.addLabel(introText.toString());
  }
View Full Code Here

    WizardPanel p1 = new WizardPanel(wizard, "Introduction");
    p1.addLabel(introText.toString());
  }

  private void addMailPanelToWizard() {
    final WizardPanel p2 = new WizardPanel(wizard, "Mail document") {
      private static final long serialVersionUID = -1111708493729196988L;

      /**
       * @see de.chris_soft.utilities.swing.wizard.WizardPanel#isNextButtonEnabled()
       */
      @Override
      public boolean isNextButtonEnabled() {
        if (!Boolean.parseBoolean(wizard.getContent(PROP_KEY_SHALL_SEND_MAIL, "true"))) {
          return true;
        }
        if (!wizard.getContent(PROP_KEY_SENDER_MAIL_ADDRESS, "").contains("@")) {
          return false;
        }
        if (wizard.getContent(PROP_KEY_SENDER_MAIL_PW, "").length() == 0) {
          return false;
        }
        if (wizard.getContent(PROP_KEY_SENDER_MAIL_LOGIN, "").length() == 0) {
          return false;
        }
        if (wizard.getContent(PROP_KEY_SENDER_POP3_SERVER, "").length() == 0) {
          return false;
        }
        if (wizard.getContent(PROP_KEY_SENDER_SMTP_PORT, "").length() == 0) {
          return false;
        }
        if (wizard.getContent(PROP_KEY_SENDER_SMTP_SERVER, "").length() == 0) {
          return false;
        }
        if (!wizard.getContent(PROP_KEY_RECEIVER_MAIL_ADDRESS, "").contains("@")) {
          return false;
        }
        return true;
      }
    };

    // Set default values if missing.
    wizard.getContent(PROP_KEY_SHALL_SEND_MAIL, "true");
    wizard.getContent(PROP_KEY_SET_FULLTEXT_INTO_MAIL_BODY, "true");

    p2.addCheckBoxInput("Send mail per document", PROP_KEY_SHALL_SEND_MAIL, new WizardCheckBoxInputListener() {
      @Override
      public void checkInputChanged(String key, boolean checked) {
        p2.getComponentByName(PROP_KEY_SENDER_MAIL_ADDRESS).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_SENDER_MAIL_LOGIN).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_SENDER_MAIL_PW).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_SENDER_SMTP_PORT).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_SENDER_SMTP_SERVER).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_SENDER_POP3_SERVER).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_RECEIVER_MAIL_ADDRESS).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_SET_FULLTEXT_INTO_MAIL_BODY).setEnabled(checked);
        p2.getComponentByName(PROP_KEY_ADD_DOCUMENT_AS_ATTACHMENT).setEnabled(checked);
      }
    });
    p2.addTextInput("Sender mail address", PROP_KEY_SENDER_MAIL_ADDRESS, new WizardTextInputListener() {
      @Override
      public void textInputChanged(String key, String textContent) {
        final String lowerContent = textContent.toLowerCase();
        ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_MAIL_LOGIN)).setText(textContent);
        if (lowerContent.endsWith("@googlemail.com") || lowerContent.endsWith("@gmail.com")) {
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_SMTP_SERVER)).setText("smtp.googlemail.com");
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_SMTP_PORT)).setText("587");
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_POP3_SERVER)).setText("pop.googlemail.com");
        }
        else if (lowerContent.contains("@gmx.")) {
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_SMTP_SERVER)).setText("mail.gmx.net");
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_SMTP_PORT)).setText("587");
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_POP3_SERVER)).setText("pop.gmx.net");
        }
        else if (lowerContent.endsWith("@aol.com")) {
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_SMTP_SERVER)).setText("smtp.de.aol.com");
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_SMTP_PORT)).setText("587");
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_POP3_SERVER)).setText("pop.aol.com");
          String onlyLoginName = lowerContent.substring(0, lowerContent.length() - 8);
          ((JTextField) p2.getComponentByName(PROP_KEY_SENDER_MAIL_LOGIN)).setText(onlyLoginName);
        }
      }
    });
    p2.addTextInput("Sender mail login", PROP_KEY_SENDER_MAIL_LOGIN, null);
    p2.addTextInput("Sender mail password", PROP_KEY_SENDER_MAIL_PW, null);
    p2.addTextInput("Sender SMTP server", PROP_KEY_SENDER_SMTP_SERVER, null);
    p2.addTextInput("Sender SMTP port", PROP_KEY_SENDER_SMTP_PORT, null);
    p2.addTextInput("Sender POP3 server", PROP_KEY_SENDER_POP3_SERVER, null);
    p2.addTextInput("Receiver mail address", PROP_KEY_RECEIVER_MAIL_ADDRESS, null);
    p2.addCheckBoxInput("Set document full text into mail body", PROP_KEY_SET_FULLTEXT_INTO_MAIL_BODY, null);
    p2.addCheckBoxInput("Add PDF document as attachment", PROP_KEY_ADD_DOCUMENT_AS_ATTACHMENT, null);
  }
View Full Code Here

    p2.addCheckBoxInput("Set document full text into mail body", PROP_KEY_SET_FULLTEXT_INTO_MAIL_BODY, null);
    p2.addCheckBoxInput("Add PDF document as attachment", PROP_KEY_ADD_DOCUMENT_AS_ATTACHMENT, null);
  }

  private void addArchivePanelToWizard() {
    final WizardPanel p3 = new WizardPanel(wizard, "Archive") {
      private static final long serialVersionUID = 7026397794090207792L;

      @Override
      public boolean isNextButtonEnabled() {
        if (wizard.getContent(PROP_KEY_ARCHIVE_DIRECTORY_PATH, "").isEmpty()) {
          return false;
        }
        if (wizard.getContent(PROP_KEY_OBSERVE_DIRECTORIES, "").isEmpty()) {
          return false;
        }
        return true;
      }
    };

    p3.addDirectoryInput("Archive directory", PROP_KEY_ARCHIVE_DIRECTORY_PATH, null);
    p3.addDirectoryListInput("Directories to observe for documents", PROP_KEY_OBSERVE_DIRECTORIES, null);
  }
View Full Code Here

TOP

Related Classes of de.chris_soft.utilities.swing.wizard.WizardPanel

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.