Examples of UIRequest_Boolean


Examples of net.sf.jeters.componentInterface.dataStructs.UIRequest_Boolean

        UIRequest[] overviewRequestArray = new UIRequest[] {
            new UIRequest_Selection("url", str("mediaWikiWrite"), str("helpMediaWikiWrite"), selectedURLIndex, wikiURLs),
            new UIRequest_String("label", str("articleName"), str("helpArticleName"), text.getLabel()),
            new UIRequest_String("text", str("articleText"), str("helpArticleText"), text.getText(),multipleLines,lineWrap),
            new UIRequest_String("summary", str("summary"), str("helpSummary"), text.getEditSummary()),
            new UIRequest_Boolean("minor", str("minor"), str("helpMinor"), text.isMinorEdit())
        };
         
        NamedDataSet overviewReply = uiForRequests.request(overviewRequestArray);
         
        if ( overviewReply == null ) {
          text = null;
          completed = true;
        } else {         
         
          try {
            createBot(conf_wikiURLs[overviewReply.<Integer>get("url")]);
           
            text.setLabel(overviewReply.<String>get("label"));
            text.setText(overviewReply.<String>get("text"));
            text.setEditSummary(overviewReply.<String>get("summary"));
            text.setMinorEdit(overviewReply.<Boolean>get("minor"));
             
            completed = true;
           
          } catch (MalformedURLException e) {
            uiForRequests.request(
                new UIRequest_Output(
                    str("errorMalformedURL", e.getMessage())));
          } catch (NamedDataNotAvailableException e) {       
            uiForRequests.request(new UIRequest_Output(str("errorUserInput")));
          }
         
        }
       
      }
     
    } else {

      if (text.getWikiURL() != null) {
        try {
          createBot(text.getWikiURL().toString());         
        } catch (MalformedURLException e) {
          //do nothing, user will be asked
        }
      }
     
      if (bot == null || alwaysAskForOutputWiki) {
       
        int selectedURLIndex = indexOfUrlInURLStringArray(wikiURLs, text.getWikiURL());
       
        UIRequest[] requestArray = new UIRequest[] {
            new UIRequest_Selection("url", str("mediaWikiWrite"), str("helpMediaWikiWrite"), selectedURLIndex, conf_wikiURLs)
        };
       
        NamedDataSet reply = uiForRequests.request(requestArray);
       
        try {
          createBot(conf_wikiURLs[reply.<Integer>get("url")]);
        } catch (MalformedURLException e) {
          uiForRequests.request(
              new UIRequest_Output(
                  str("errorMalformedURL", e.getMessage())));
        } catch (NamedDataNotAvailableException e) {       
          uiForRequests.request(new UIRequest_Output(str("errorUserInput")));
        }
       
      }
     
    }
     
    /* write the article to the wiki (after logging in) */
     
    if( text != null ){   
     
      /*
       * if the bot is not logged in,
       * but all information is available to log in, do so
       */
       
      if( !bot.isLoggedIn()
          && username != null && !username.equals("")
          && password != null ){         
         
        try {
          bot.login(username, password);
        } catch (ActionException e) {
          /* the "Login failed" message will be printed */         
        }
         
        if ( !bot.isLoggedIn() && !password.equals("") ) {
          uiForRequests.request(
              new UIRequest_Output(str("errorLoginFailed")) );       
       
           
      }
       
      /*
       * if bot (still) not logged in, ask for username and password
       * until the bot is logged in or the user gives up
       */
       
      boolean tryAgain = true;
   
      while( !bot.isLoggedIn() && tryAgain ){
                       
        UIRequest requestArray[] = {
          new UIRequest_String("username", str("username"),
              str("helpUsername"), username),
          new UIRequest_String("password", str("password"),
              str("helpPassword"),
              UIRequest_String.LayoutFlag.hideInput)
        };
       
        NamedDataSet reply = uiForRequests.request(requestArray);
       
        if ( reply == null ) { //cancelled
          tryAgain = false;
        }
         
        else {
           
          try {               
            username = reply.get("username");
            password = reply.get("password");
             
            try {
              bot.login(username,password);
            } catch (ActionException e) {
              /* error message will be printed */
            }
               
            /* if login failed: ask about giving up */             
            ifbot.isLoggedIn() == false ){
             
              UIRequest tryAgainRequestArray[] = { new UIRequest_Boolean("tryAgain", str("loginFailedTryAgain"), str("helpLoginFailedTryAgain")) };
                   
              try {
                tryAgain = uiForRequests.request(tryAgainRequestArray).<Boolean>get("tryAgain");
              } catch ( NamedDataNotAvailableException ndnae ){ tryAgain = false; /* no further attempts to log in */ }
                       
            }
               
          } catch (NamedDataNotAvailableException ndnae) {
            uiForRequests.request( new UIRequest_Output(str("errorGetAccountInfo")) );
            username = null;
            password = null;
          }
           
        }
                       
      }
       
      /* after successful login: write the article to the MediaWiki */
       
      if ( bot.isLoggedIn() ) {
   
      boolean ready = false;
         
        while ( !ready ) {
         
          try {
            writeArticle(text);
            ready = true;
          } catch ( ActionException ae ) {
            /* writing failed, ready remains false */
          } catch ( ProcessException pe ) {
            /* writing failed, ready remains false */
          }
           
          if ( !ready ) {
           
            UIRequest tryAgainRequestArray[] = { new UIRequest_Boolean("tryAgain", str("writingFailedTryAgain"), str("helpWritingFailedTryAgain")) };
                   
            try {
              ready = (false == uiForRequests.request(tryAgainRequestArray).<Boolean>get("tryAgain"));
            } catch ( NamedDataNotAvailableException ndnae ) {
              System.err.println(str("exceptionUserInput", ndnae.toString()));
View Full Code Here

Examples of net.sf.jeters.componentInterface.dataStructs.UIRequest_Boolean

       
        requestArray = new UIRequest[] {
          new UIRequest_String("regex", str("searchFor"), str("helpSearchFor")),
          new UIRequest_String("rwith", str("replaceWith"), str("helpReplaceWith")),
          new UIRequest_String("summary", str("summary"), str("helpSummary"), defaultSummary),
          new UIRequest_Boolean("ask", str("ask"), str("helpAsk"), confirmChangesByDefault),
          new UIRequest_Output(str("help"))
        };
       
      } else {
       
        RegExReplacement rep = (RegExReplacement)replacements.get(0);
        requestArray = new UIRequest[] {
          new UIRequest_String("regex", str("searchFor"), str("helpSearchFor"), rep.regex),
          new UIRequest_String("rwith", str("replaceWith"), str("helpReplaceWith"), rep.rwith),
          new UIRequest_String("summary", str("summary"), str("helpSummary"), summary),
          new UIRequest_Boolean("ask", str("ask"), str("helpAsk"), rep.rating > 0),
          new UIRequest_Output(str("help"))
        };
       
      }     
     
View Full Code Here

Examples of net.sf.jeters.componentInterface.dataStructs.UIRequest_Boolean

                       multipleLines, lineWrap),
      new UIRequest_String(null,
                       str("summary"),
                       str("helpSummary"),
                       text.getEditSummary()),
      new UIRequest_Boolean(null,
                        str("minor"),
                        str("helpMinor"),
                        text.isMinorEdit())
    };
   
View Full Code Here

Examples of net.sf.jeters.componentInterface.dataStructs.UIRequest_Boolean

               
          } break;
           
          case Request_Boolean:
         
            UIRequest_Boolean booleanRequest = (UIRequest_Boolean)request;
         
            //create the check box
           
            JCheckBox checkBoxBooleanRequest = new JCheckBox(booleanRequest.label);
View Full Code Here

Examples of net.sf.jeters.componentInterface.dataStructs.UIRequest_Boolean

           */
                 
          if (outputFile.exists()) {
           
            UIRequest outputRequestArray[] = {
                new UIRequest_Boolean("overwrite",
                    str("requestOverwrite"),
                    str("helpOverwrite")) };
               
            boolean overwrite =
              uiForRequests.request(outputRequestArray)
                .<Boolean>get("overwrite");
           
            if (!overwrite){
              outputFile = null;
              tryAgain = true;
            }
                   
          }
         
          if (outputFile != null) {
           
            //check whether the file is writable
           
            if (!outputFile.canWrite()) {
              uiForRequests.request(
                  new UIRequest_Output(
                      str("errorFileNotWritable")) );
            } else {
         
              outputFile.createNewFile();
               
              FileWriter writer = new FileWriter(outputFile);
             
              writer.write(text.getText());
             
              writer.close();
             
              savingComplete = true;
             
            }
             
          }
         
        } catch (IOException e) {
          uiForRequests.request(
              new UIRequest_Output(
                  str("errorFileOutput", outputFile, e)) );
        } catch (NamedDataNotAvailableException e) {
          uiForRequests.request(
              new UIRequest_Output(
                  str("invaildUserInput", e)) );
        }
       
        if (!tryAgain && !savingComplete) {
         
          UIRequest tryAgainRequestArray[] = {
              new UIRequest_Boolean(
                  "tryAgain", str("requestTryAgain"),
                  str("helpTryAgain")) };
                 
          try{
            tryAgain =
View Full Code Here

Examples of net.sf.jeters.componentInterface.dataStructs.UIRequest_Boolean

      System.out.println("\nnach der Korrektur:\n");
      System.out.println(cleanedStrings[1]);
      System.out.println("\nvorgenommene Änderungen:\n");
      System.out.println(descriptionOfChanges);
         
      UIRequest requestArray[] = { new UIRequest_Boolean("confirmation","\nÄnderungen übernehmen?","Bei „ja“ werden alle(!) Änderungen in diesem Textabschnitt übernommen.") };
      NamedDataSet reply = this.request(requestArray);
     
      Boolean newVersionAccepted = false;
      try{
        newVersionAccepted = reply.get("confirmation");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.