Package com.compomics.mslims.util.http.forms.inputs

Examples of com.compomics.mslims.util.http.forms.inputs.InputInterface


    iForm = HTTPForm.parseHTMLForm(ins);
    // Get all inputs.
    Vector<InputInterface> lvInputs = iForm.getInputs();
    for (int i = 0; i < lvInputs.size(); i++) {
      InputInterface lInput = (InputInterface) lvInputs.elementAt(i);

      // SELECTBOX
      if (lInput.getType() == InputInterface.SELECTINPUT) {

        if (lInput.getName().equals("FORMAT")) {
          // the data format of the input file
          lInput.setValue("Mascot generic");
        } else if (lInput.getName().equals("REPORT")) {
          // set REPORT to AUTO (the first entry)
          lInput.setValue(((SelectInput) lInput).getElements()[0]);
        } else {
          SelectInput input = (SelectInput) lInput;
          String[] elements = ((SelectInput) lInput).getElements();

          if (input.getMultiple()) {
            UserParameter p = new MultiChoiceParameter<String>(
                lInput.getComment(), lInput.getName(), elements);
            para.add(p);

          } else {
            UserParameter p = new ComboParameter<String>(
                lInput.getComment(), lInput.getName(), elements);
            para.add(p);
          }
        }
      }

      // Checkbox
      if (lInput.getType() == InputInterface.CHECKBOX) {
        if (lInput.getName().equals("OVERVIEW")) {
          lInput.setValue("0");
        } else
          para.add(new BooleanParameter(lInput.getComment(), lInput
              .getName()));
      }

      // Radio
      if (lInput.getType() == InputInterface.RADIOINPUT) {
        RadioInput input = (RadioInput) lInput;
        String[] elements = input.getChoices();
        para.add(new ComboParameter<String>(lInput.getComment(), lInput
            .getName(), elements));

      }

      // TextField
      if (lInput.getType() == InputInterface.TEXTFIELDINPUT
          && lInput instanceof TextFieldInput) {
        TextFieldInput textFiled = (TextFieldInput) lInput;
        if (textFiled.isHidden()) {

        } else if (textFiled.getName().equals("FILE")) {
          textFiled.setValue("");
        } else if (textFiled.getName().equals("PRECURSOR")) {
          // the precursor mass (m/z)
          textFiled.setValue("");
        } else if (textFiled.getName().equals("USERNAME")) {
          textFiled.setValue("");
        } else if (textFiled.getName().equals("USEREMAIL")) {
          textFiled.setValue("");
        } else if (textFiled.getName().equals("COM")) {
          // Search Title
          textFiled.setValue("Mzmine "
              + MZmineCore.getMZmineVersion());
        } else if (textFiled.getName().equals("SEG")) {
          // Proteinmass
          textFiled.setValue("");
        } else {
          para.add(new StringParameter(lInput.getComment(), lInput
              .getName()));
        }
      }
    }
View Full Code Here

TOP

Related Classes of com.compomics.mslims.util.http.forms.inputs.InputInterface

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.