public String getDriverPath() { return correctPath(driversPath); }
/** * @param objStrings Specify entity as mapArray * Fills all elements on the form which implements SetValue interface and can be matched with fields in input entity */ public List<String> verify(MapArray<String, String> objStrings) { List<String> compareFalse = new ArrayList<>(); foreach(allFields(), field -> { String fieldValue = objStrings.first((name, value) -> namesEqual(name, getElementName(field))); if (fieldValue == null) return; IHasValue valueField = (IHasValue) getValueField(field, this); doActionRule.accept(fieldValue, expected -> { String actual = getValueAction(valueField).trim(); if (actual.equals(expected)) return; compareFalse.add(format("Field '%s' (Actual: '%s' <> Expected: '%s')", field.getName(), actual, expected)); }); }); filter = ALL; return compareFalse; }
/** * @param objStrings Specify entity as mapArray * Fills all elements on the form which implements SetValue interface and can be matched with fields in input entity */ public List<String> verify(MapArray<String, String> objStrings) { List<String> compareFalse = new ArrayList<>(); foreach(getFields(this, IHasValue.class), field -> { String fieldValue = objStrings.first((name, value) -> namesEqual(name, getElementName(field))); if (fieldValue == null) return; IHasValue valueField = (IHasValue) getValueField(field, this); doActionRule.accept(fieldValue, expected -> { String actual = getValueAction(valueField).trim(); if (actual.equals(expected)) return; compareFalse.add(format("Field '%s' (Actual: '%s' <> Expected: '%s')", field.getName(), actual, expected)); }); }); return compareFalse; }
/** * @param objStrings Specify entity as mapArray * Fills all elements on the form which implements SetValue interface and can be matched with fields in input entity */ public List<String> verify(MapArray<String, String> objStrings) { List<String> compareFalse = new ArrayList<>(); foreach(allFields(), field -> { String fieldValue = objStrings.first((name, value) -> namesEqual(name, getElementName(field))); if (fieldValue == null) return; IHasValue valueField = (IHasValue) getValueField(field, this); doActionRule.accept(fieldValue, expected -> { String actual = getValueAction(valueField).trim(); if (actual.equals(expected)) return; compareFalse.add(format("Field '%s' (Actual: '%s' <> Expected: '%s')", field.getName(), actual, expected)); }); }); filter = ALL; return compareFalse; }
public String getDriverPath() { return correctPath(driversPath); }
public Button getButton(Functions funcName) { List<Field> fields = getFields(element, IButton.class); if (fields.size() == 1) return (Button) getValueField(fields.get(0), element); Collection<Button> buttons = LinqUtils.select(fields, f -> (Button) getValueField(f, element)); Button button = LinqUtils.first(buttons, b -> b.function.equals(funcName)); if (button == null) { String name = funcName.name; String buttonName = name.toLowerCase().contains("button") ? name : name + "button"; button = LinqUtils.first(buttons, b -> namesEqual(b.getName(), buttonName)); if (button == null) throw exception("Can't find button '%s' for Element '%s'", name, toString()); } return button; }
public static String getValidUrl(String logPath) { if (logPath == null || logPath.equals("")) return ""; String result = logPath.replace("/", "\\"); if (result.charAt(1) != ':') if (result.substring(0, 3).equals("..\\")) result = result.substring(2); if (result.charAt(0) != '\\') result = "\\" + result; if (result.charAt(result.length() - 1) != '\\') result = result + "\\"; return StringUtils.correctPath(result); }
public Button getButton(Functions funcName) { List<Field> fields = getFields(element, IButton.class); if (fields.size() == 1) return (Button) getValueField(fields.get(0), element); Collection<Button> buttons = select(fields, f -> (Button) getValueField(f, element)); Button button = first(buttons, b -> b.function.equals(funcName)); if (button == null) { String name = funcName.name; String buttonName = name.toLowerCase().contains("button") ? name : name + "button"; button = first(buttons, b -> namesEqual(b.getName(), buttonName)); if (button == null) throw exception("Can't find button '%s' for Element '%s'", name, toString()); } return button; }
public static String getValidUrl(String logPath) { if (logPath == null || logPath.equals("")) return ""; String result = logPath.replace("/", "\\"); if (result.charAt(1) != ':') if (result.substring(0, 3).equals("..\\")) result = result.substring(2); if (result.charAt(0) != '\\') result = "\\" + result; if (result.charAt(result.length() - 1) != '\\') result = result + "\\"; return StringUtils.correctPath(result); }
public Button getButton(Functions funcName) { List<Field> fields = getFields(element, IButton.class); if (fields.size() == 1) return (Button) getValueField(fields.get(0), element); Collection<Button> buttons = select(fields, f -> (Button) getValueField(f, element)); Button button = first(buttons, b -> b.function.equals(funcName)); if (button == null) { String name = funcName.name; String buttonName = name.toLowerCase().contains("button") ? name : name + "button"; button = first(buttons, b -> namesEqual(b.getName(), buttonName)); if (button == null) throw exception("Can't find button '%s' for Element '%s'", name, toString()); } return button; }
public static String getValidUrl(String logPath) { if (logPath == null || logPath.equals("")) return ""; String result = logPath.replace("/", "\\"); if (result.charAt(1) != ':') if (result.substring(0, 3).equals("..\\")) result = result.substring(2); if (result.charAt(0) != '\\') result = "\\" + result; if (result.charAt(result.length() - 1) != '\\') result = result + "\\"; return StringUtils.correctPath(result); }
public Button getButton(String buttonName) { List<Field> fields = getFields(element, IButton.class); if (fields.size() == 1) return (Button) getValueField(fields.get(0), element); Collection<Button> buttons = LinqUtils.select(fields, f -> (Button) getValueField(f, element)); Button button = LinqUtils.first(buttons, b -> namesEqual(toButton(b.getName()), toButton(buttonName))); if (button == null) throw exception("Can't find button '%s' for Element '%s'", buttonName, toString()); return button; }
public <T> T asEntity(Class<T> entityClass) { try { T data = newEntity(entityClass); foreach(getFields(this, IHasValue.class), item -> { Field field = LinqUtils.first(getFields(data, String.class), f -> namesEqual(f.getName(), item.getName())); if (field == null) return; try { field.set(data, ((IHasValue) getValueField(item, this)).getValue()); } catch (Exception ignore) { } }); return data; } catch (Exception ex) { throw exception("Can't get entity from Form" + getName() + " for class: " + entityClass.getClass()); } }
public <T> T asEntity(Class<T> entityClass) { try { T data = newEntity(entityClass); foreach(getFields(this, IHasValue.class), item -> { Field field = LinqUtils.first(getFields(data, String.class), f -> namesEqual(f.getName(), item.getName())); if (field == null) return; try { field.set(data, ((IHasValue) getValueField(item, this)).getValue()); } catch (Exception ignore) { } }); return data; } catch (Exception ex) { throw exception("Can't get entity from Form" + getName() + " for class: " + entityClass.getClass()); } }
public Button getButton(String buttonName) { List<Field> fields = getFields(element, IButton.class); switch (fields.size()) { case 0: throw exception("Can't find any buttons on form '%s.", toString()); case 1: return (Button) getValueField(fields.get(0), element); default: Collection<Button> buttons = select(fields, f -> (Button) getValueField(f, element)); Button button = first(buttons, b -> namesEqual(toButton(b.getName()), toButton(buttonName))); if (button == null) throw exception("Can't find button '%s' for Element '%s'", buttonName, toString()); return button; } }
public static <T> T extractEntity(Class<T> entityClass, BaseElement el) { try { T data = newEntity(entityClass); foreach(getFields(el, IHasValue.class), item -> { Field field = LinqUtils.first(getFields(data, String.class), f -> namesEqual(f.getName(), item.getName())); if (field == null) return; try { field.set(data, ((IHasValue) getValueField(item, el)).getValue()); } catch (Exception ignore) { } }); return data; } catch (Exception ex) { throw exception("Can't get entity from Form" + el.getName() + " for class: " + entityClass.getClass()); } } /**
public Button getButton(String buttonName) { List<Field> fields = getFields(element, IButton.class); switch (fields.size()) { case 0: throw exception("Can't find any buttons on form '%s.", toString()); case 1: return (Button) getValueField(fields.get(0), element); default: Collection<Button> buttons = select(fields, f -> (Button) getValueField(f, element)); Button button = first(buttons, b -> namesEqual(toButton(b.getName()), toButton(buttonName))); if (button == null) throw exception("Can't find button '%s' for Element '%s'", buttonName, toString()); return button; } }
/** * @param map Specify entity as map * Fills all elements on the form which implements SetValue interface and can be matched with fields in input entity */ public final void fill(MapArray<String, String> map) { foreach(getFields(this, ISetValue.class), element -> { String fieldValue = map.first((name, value) -> namesEqual(name, getElementName(element))); if (fieldValue == null) return; ISetValue setValueElement = (ISetValue) getValueField(element, this); doActionRule.accept(fieldValue, val -> setValueAction(val, setValueElement)); }); }
/** * @param map Specify entity as map * Fills all elements on the form which implements SetValue interface and can be matched with fields in input entity */ public final void fill(MapArray<String, String> map) { foreach(allFields(), element -> { String fieldValue = map.first((name, value) -> namesEqual(name, getElementName(element))); if (fieldValue == null) return; ISetValue setValueElement = (ISetValue) getValueField(element, this); doActionRule.accept(fieldValue, val -> setValueAction(val, setValueElement)); }); filter = ALL; }
/** * @param map Specify entity as map * Fills all elements on the form which implements SetValue interface and can be matched with fields in input entity */ public final void fill(MapArray<String, String> map) { foreach(allFields(), element -> { String fieldValue = map.first((name, value) -> namesEqual(name, getElementName(element))); if (fieldValue == null) return; ISetValue setValueElement = (ISetValue) getValueField(element, this); doActionRule.accept(fieldValue, val -> setValueAction(val, setValueElement)); }); filter = ALL; }