コード例 #1
0
 private Clickable getClickable(String name) {
   List<Field> fields = ReflectionUtils.getFields(this, IClickable.class);
   Collection<Clickable> clickables =
       select(fields, f -> (Clickable) ReflectionUtils.getFieldValue(f, this));
   return LinqUtils.first(
       clickables, cl -> cl.getName().contains(getElementName(name.toLowerCase())));
 }
コード例 #2
0
 private Button getSubmitButton() {
   List<Field> fields = ReflectionUtils.getFields(this, IButton.class);
   switch (fields.size()) {
     case 0:
       throw JDISettings.exception("Can't find any buttons on form '%s.", toString());
     case 1:
       return (Button) ReflectionUtils.getFieldValue(fields.get(0), this);
     default:
       throw JDISettings.exception(
           "Form '%s' have more than 1 button. Use submit(entity, buttonName) for this case instead",
           toString());
   }
 }
コード例 #3
0
 public void fill(MapArray<String, String> objStrings) {
   LinqUtils.foreach(
       ReflectionUtils.getFields(this, ISetValue.class),
       element -> {
         String fieldValue =
             objStrings.first(
                 (name, value) ->
                     GetElement.namesEqual(name, AnnotationsUtil.getElementName(element)));
         if (fieldValue != null) {
           ISetValue setValueElement = (ISetValue) ReflectionUtils.getFieldValue(element, this);
           doActionRule.invoke(fieldValue, val -> setValueAction(val, setValueElement));
         }
       });
 }
コード例 #4
0
 public void verify(MapArray<String, String> objStrings, JActionTT<String, String> compare) {
   LinqUtils.foreach(
       ReflectionUtils.getFields(this, IHasValue.class),
       element -> {
         String fieldValue =
             objStrings.first(
                 (name, value) ->
                     GetElement.namesEqual(name, AnnotationsUtil.getElementName(element)));
         if (fieldValue != null) {
           IHasValue getValueElement = (IHasValue) ReflectionUtils.getFieldValue(element, this);
           doActionRule.invoke(
               fieldValue, val -> compare.invoke(getValueAction(getValueElement).trim(), val));
         }
       });
 }
コード例 #5
0
 private void setText(String text) {
   Field field = ReflectionUtils.getFields(this, ISetValue.class).get(0);
   ISetValue setValueElement = (ISetValue) ReflectionUtils.getFieldValue(field, this);
   doActionRule.invoke(text, val -> setValueAction(val, setValueElement));
 }
コード例 #6
0
 protected String getValueAction() {
   return PrintUtils.print(
       LinqUtils.select(
           ReflectionUtils.getFields(this, IHasValue.class),
           field -> ((IHasValue) ReflectionUtils.getFieldValue(field, this)).getValue()));
 }