private String getTypeOf(IEmaginController controller, OperationData data) { return (String) ReflectionUIUtils.invokeGetterOn(data, "businessType.displayName"); }
public String getModelAttribute(OperationData data, String name) { if (data != null) { Object o = ReflectionUIUtils.invokeGetterOn(data, name); return o != null ? o.toString() : ""; } return ""; }
/** * Set the given property on the target from the value readen from source * * @param source * @param target * @param propertyName */ public static void setPropertyValue(Object source, Object target, String propertyName) { Object val = invokeGetterOn(source, propertyName); invokeSetterOn(target, propertyName, val); }
/** * Set the given property on the target from the value readen from source. Source and target have * the same data type for the property but different names. * * @param source * @param target * @param spropertyName * @param tpropertyName */ public static void setPropertyValue(Object source, Object target, String spropertyName, String tpropertyName) { try { Object val = invokeGetterOn(source, spropertyName); invokeSetterOn(target, tpropertyName, val); } catch (IllegalArgumentException e) { // TODO: handle exception } }
/** * * @param data * @param filter * @return */ public default boolean isDisplayable(OperationData data, String filter) { if (data == null) { return true; } if (filter == null) { return true; } final String attr = getMasterAttributePath(); final String d = (String) ReflectionUIUtils.invokeGetterOn(data, attr); if (d == null) { return true; } return d.toLowerCase().contains(filter.toLowerCase()); }
/** * Get the value of attribute "type" corresponding to "full identifier" from entry. * * @return */ public String getEntryFullId() { Object val = null; if (entry.get() != null) { val = ReflectionUIUtils.invokeGetterOn(entry.get(), "type"); } return val == null ? null : val.toString(); }
public String getModelAttribute(IEmaginController controller, String name) { IOperationResult model = (IOperationResult) controller.getModel(); if (model != null) { OperationData data = (OperationData) model.rootData(); if (data != null) { Object d = ReflectionUIUtils.invokeGetterOn(data, name); return d != null ? d.toString() : ""; } } return null; }
private void addToResult(List<IEnumeratedValueModel> result, IOperationResult e) { if (e != null) { OperationData data = (OperationData) e.rootData(); if (data != null) { EnumeratedValueModel model = new EnumeratedValueModel(); model.setValue((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.displayName")); model.setSavedValue((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.fullId")); model.setDescription((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.description")); model.setSourceModel(data); result.add(model); } } }
public static List<EnumeratedValueModel> toEnumeratedValues(MultipleResult result) { List<EnumeratedValueModel> vals = new ArrayList<>(); if (result != null) { List<OperationData> datas = result.getData(); if (datas != null) { for(OperationData data: datas) { EnumeratedValueModel model = new EnumeratedValueModel(); model.setValue((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.value")); model.setSavedValue((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.savedValue")); model.setDescription((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.description")); model.setSourceModel(data); vals.add(model); }; } } return vals; }
public static List<EnumeratedValueModel> toEnumeratedValuesByName(MultipleResult result) { List<EnumeratedValueModel> vals = new ArrayList<>(); if (result != null) { List<OperationData> datas = result.getData(); if (datas != null) { for(OperationData data: datas) { EnumeratedValueModel model = new EnumeratedValueModel(); model.setValue((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.name")); model.setSavedValue((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.fullId")); model.setDescription((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.description")); model.setSourceModel(data); vals.add(model); }; } } return vals; }
public static List<EnumeratedValueModel> toEnumeratedValues(MultipleResult result) { List<EnumeratedValueModel> vals = new ArrayList<>(); if (result != null) { List<OperationData> datas = result.getData(); if (datas != null) { for(OperationData data: datas) { EnumeratedValueModel model = new EnumeratedValueModel(); model.setValue((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.displayName")); model.setSavedValue((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.fullId")); model.setDescription((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.description")); model.setSourceModel(data); vals.add(model); } } } return vals; }
public static List<EnumeratedValueModel> toEnumeratedValuesByDisplayName(MultipleResult result) { List<EnumeratedValueModel> vals = new ArrayList<>(); if (result != null) { List<OperationData> datas = result.getData(); if (datas != null) { for(OperationData data: datas) { EnumeratedValueModel model = new EnumeratedValueModel(); model.setValue((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.displayName")); model.setSavedValue((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.fullId")); model.setDescription((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.description")); model.setSourceModel(data); vals.add(model); } } } return vals; }
public static List<EnumeratedValueModel> toEnumeratedTypeValues(MultipleResult result) { List<EnumeratedValueModel> vals = new ArrayList<>(); if (result != null) { List<OperationData> datas = result.getData(); if (datas != null) { for(OperationData data: datas) { EnumeratedValueModel model = new EnumeratedValueModel(); model.setValue((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.linkDisplayName")); model.setSavedValue((String) ReflectionUIUtils.invokeGetterOn(data, "type")); model.setDescription((String) ReflectionUIUtils.invokeGetterOn(data, "attributes.linkDescription")); model.setSourceModel(data); vals.add(model); }; } } return vals; }
/** * Object source holds date in string value. Cibling object holds LocalDateTime. * * @param source * @param target * @param spropertyName * @param tpropertyName * @param sDatformat */ public static void setDateFromStringPropertyValue(Object source, Object target, String spropertyName, String tpropertyName, String sDatformat) { Object val = invokeGetterOn(source, spropertyName); LocalDateTime ldt = DateUtils.fromString_3((String) val, sDatformat); invokeSetterOn(target, tpropertyName, ldt); }
private void translate(AbstractViewController controller, VLViewComponentXML configuration) { final Object datavalue = ReflectionUIUtils.invokeGetterOn(null, null); initEnumeratedTypeTranslater(configuration); if (datavalue != null) { if (enumeratedTypeTranslater != null) { // TO DO Asunch if long running final String realVal = enumeratedTypeTranslater.translate(controller, configuration, datavalue.toString()); label.setText(realVal); } else { label.setText(datavalue.toString()); } } }
/** * @{inheritedDoc} */ @Override public void editCommit(IEmaginController sourceController, VLViewComponentXML inlineActionConfiguration, List<IInputComponentWrapper> rows) { IPersistenceServiceDelegate.super.editCommit(sourceController, inlineActionConfiguration, rows); String action = inlineActionConfiguration.getPropertyValue(ACTION_NAME); Map<String, Object> vals = extracValue(rows); vals.put(HIDDEN_PREFIX + ACTION_NAME, action); // commit all mofications in same controller IInputComponentWrapper row0 = rows.get(0); Object model = row0.getController().getModel(); String rootModelOid = (String) ReflectionUIUtils.invokeGetterOn(model, DATA_TYPE); int version = (Integer) ReflectionUIUtils.invokeGetterOn(model, DATA_ATTRIBUTES_VERSION); vals.put(HIDDEN_PREFIX + PERSISTENCE_FULL_ID, rootModelOid); vals.put(HIDDEN_PREFIX + PERSISTENCE_VERSION, version); //persistableUpdateOperation.doOperation(JsonObject.fromObject(vals), this::successHandler, getErrorHandler()); persistableUpdateOperation.doOperation(JsonUtils.toJsonObject(vals), this::successHandler, getErrorHandler()); }
/** * @{inheritedDoc} */ @Override public void build(IInputComponentWrapper inputComponentWrapper) { super.build(inputComponentWrapper); String value = (String) ReflectionUIUtils.invokeGetterOn(controller.getModel(), inputComponentWrapper.getAttributePath()); userAccountOperation.doOperation(value, this::handleResult); label.setWrapText(true); label.getStyleClass().add("form-value-label"); }
public void onCommitSuccess(IOperationResult result) { // commit all modifications for(IInputComponentWrapper r: row.getEntries()) { r.commitModification(); } row.endInlineEdit(); NotificationsUtils.sendObjectUpdateSuccessNotif(controller); // update version Integer newVersion = (Integer) ReflectionUIUtils.invokeGetterOn(result, "data.attributes.version"); ReflectionUIUtils.invokeSetterOn(row.getController().getModel(), "data.attributes.version", newVersion); // inform other object that this object have been updated ModelUpdatedEvent event = new ModelUpdatedEvent.Builder().model(result).build(); controller.dispatchEvent(event); } }
@Override public void onCommitSuccess(IOperationResult result) { // commit all modifications for(IInputComponentWrapper entry: row.getEntries()) { entry.commitModification(); } row.endInlineEdit(); NotificationsUtils.sendObjectUpdateSuccessNotif(controller); // update version Integer newVersion = (Integer) ReflectionUIUtils.invokeGetterOn(result, "data.attributes.version"); ReflectionUIUtils.invokeSetterOn(row.getController().getModel(), "data.attributes.version", newVersion); // inform other object that this object have been updated ModelUpdatedEvent event = new ModelUpdatedEvent.Builder().model(result).build(); controller.dispatchEvent(event); } }
private void onCommitSuccess(IOperationResult result) { Platform.runLater(() -> { layout.getChildren().clear(); row.endEdition(); }); // go back // tell the header nav bar to go back HeaderNavbarFireBackButton ev = new HeaderNavbarFireBackButton.Builder().build(); // attach commit result may be some warning to display ev.setModel(ActionResult.success()); dispatchEvent(ev); NotificationsUtils.sendObjectUpdateSuccessNotif(this); // update version Integer newVersion = (Integer) ReflectionUIUtils.invokeGetterOn(result, "data.attributes.version"); ReflectionUIUtils.invokeSetterOn(row.getController().getModel(), "data.attributes.version", newVersion); // inform other object that this object have been updated ModelUpdatedEvent event = new ModelUpdatedEvent.Builder().model(result).build(); dispatchEvent(event); }