//
//package COM.blackdirt.convert;

public class bdcTextBox extends Control {

    /////////////////////////////////
    // Component Definition Methods
    //////////////////////////////////

    public void initialize(Control c) {
      super.initialize(c);
      this.setType("TextBox");
      if (getMultiline()){
          this.setJavaType("TextArea");
      }
      else{
          this.setJavaType("TextField");
      }

    }




    public String declareString() {
//      System.out.println (getText());
      if (getMultiline()){
          return ("    TextArea  " + this.getName() + " = new TextArea(" +  "\"" + "multiline need to interpret .frx file" + "\"" + "," + (int)( this.getHeight() /8) + ", " +  (int)(this.getWidth()/6) + ");"  );
      }
      else{
          return ("    TextField  " + this.getName() + " = new TextField(" +  "\"" + this.getText() + "\"" + "," +  (int)(this.getWidth()/6) + ");"  );  
      }
    }


    public String controlArrayInitString() {
      if (getMultiline()){
          this.setJavaType("TextArea");
          return ("    TextArea  " + this.getName() + "[" + getIndex() + "] = new TextArea(" +  "\"" + "multiline need to interpret .frx file" + "\"" + "," + (int)( this.getHeight() /8) + ", " +  (int)(this.getWidth()/6) + ");"  );
      }
      else{
          return ("    TextField  " + this.getName() + "[" + getIndex() + "] = new TextField(" +  "\"" + this.getText() + "\"" + "," +  (int)(this.getWidth()/6) + ");"  );  
      }


    }

    public String addString(Control cParent) {

      String returnString;
      String thisName;

      if (isControlArray()){
         thisName = this.getName() + "[" + getIndex() +"]";
      }
      else{
         thisName = getName();
      }

      returnString = defaultAddString(cParent);
      if (!getPasswordChar().equals ("")){
         returnString = returnString + "      " + thisName + ".setEchoCharacter(" + "'" + getPasswordChar() + "'" +");" +"\n";
      }
      return(returnString);
     }


    public String addString11(Control cParent) {

      String returnString;
      String thisName;

      if (isControlArray()){
         thisName = this.getName() + "[" + getIndex() +"]";
      }
      else{
         thisName = getName();
      }

      returnString = defaultAddString11(cParent);
      if (!getPasswordChar().equals ("")){
         returnString = returnString + "      " + thisName + ".setEchoChar(" + "'" + getPasswordChar() + "'" +");" +"\n";
      }
      return(returnString);
     }


}




