Esempio n. 1
0
  /**
   * This will return a list of Pair objects, with each pair consiting of the <code>displayName
   * </code> of the field and its associated <code>value</code>.
   *
   * @param fieldGroup - An InputFieldGroup
   * @param command - The BeanWrapper instance wrapping {@link ReportDefinitionCommand}
   * @param exclusions - A list of <code>displayName</code> to be eliminated from the display.
   * @return List&lt;Pair&gt; objects.
   */
  public List<Pair> fetchFieldValues(
      InputFieldGroup fieldGroup, BeanWrapper command, String... exclusions) {
    List<Pair> fieldList = new ArrayList<Pair>();
    if (fieldGroup == null) return fieldList;

    for (InputField field : fieldGroup.getFields()) {
      if (exclusions != null && ArrayUtils.contains(exclusions, field.getDisplayName())) continue;
      fieldList.add(fetchFieldValue(field, command));
    }
    return fieldList;
  }
Esempio n. 2
0
  public void nextLevel() {
    level++;
    if (level >= 10) {
      level = 10;
      ifi.setEnabled(false);
    }

    Runnable changePic =
        new Runnable() {
          public void run() {
            String pic = "hangman" + level + ".gif";
            BufferedImage myPicture = null;
            try {
              if (!iidenki.IS_JAR) {
                myPicture = ImageIO.read(new File(pic));
              }
              if (iidenki.IS_JAR) {
                myPicture = ImageIO.read(this.getClass().getResource("/" + pic));
              }
            } catch (IOException e) {
              e.printStackTrace();
            }
            icon.setImage(myPicture);
            picLabel = new JLabel(icon);
            frame.add(picLabel);
            frame.setVisible(true);
            if (level == 10) {
              JOptionPane.showMessageDialog(frame, gh.loseText());
              level = 0;
              nextLevel();
              ifi.generateNew();
            }
          }
        };

    SwingUtilities.invokeLater(changePic);
  }
Esempio n. 3
0
 public Pair fetchFieldValue(InputField field, BeanWrapper command) {
   Object value = command.getPropertyValue(field.getPropertyName());
   String strValue = (value == null) ? null : String.valueOf(value);
   return new Pair(field.getDisplayName(), strValue);
 }
 private void addProperty(PropertiesConfiguration config, InputField inputField) {
   String fields = ConfigurationHelper.listToString(inputField.getFieldNames());
   String values = ConfigurationHelper.listToStringEmptyStringAllowed(inputField.getFieldValues());
   config.addProperty(inputField.getId() + ".fields", fields);
   config.addProperty(inputField.getId() + ".values", values);
 }
 /**
  * Specifies input fields to assign one value to. Crawljax first tries to match the found HTML
  * input element's id and then the name attribute.
  *
  * @param fieldNames the ids or names of the input fields
  * @return an InputField
  */
 public InputField fields(String... fieldNames) {
   InputField inputField = new InputField();
   inputField.setFieldNames(fieldNames);
   this.inputFields.add(inputField);
   return inputField;
 }
 /**
  * Specifies an input field to assign a value to. Crawljax first tries to match the found HTML
  * input element's id and then the name attribute.
  *
  * @param fieldName the id or name attribute of the input field
  * @return an InputField
  */
 public InputField field(String fieldName) {
   InputField inputField = new InputField();
   inputField.setFieldName(fieldName);
   this.inputFields.add(inputField);
   return inputField;
 }