use of elemental2.core.Function in project kie-wb-common by kiegroup.
the class DataTypeSelectView method makeOption.
HTMLOptionElement makeOption(final DataType dataType, final Function<DataType, String> dataTypeConsumer) {
final String optionValue = dataTypeConsumer.apply(dataType);
final HTMLOptionElement option = makeHTMLOptionElement();
option.text = optionValue;
option.value = optionValue;
return option;
}
use of elemental2.core.Function in project kie-wb-common by kiegroup.
the class DataTypeSelectView method makeOptionGroup.
HTMLOptGroupElement makeOptionGroup(final String groupTitle, final List<DataType> dataTypes, final Function<DataType, String> dataTypeConsumer) {
final HTMLOptGroupElement optionGroup = makeHTMLOptGroupElement();
optionGroup.label = groupTitle;
dataTypes.stream().forEach(dataType -> {
final HTMLOptionElement option = makeOption(dataType, dataTypeConsumer);
optionGroup.appendChild(option);
});
return optionGroup;
}
use of elemental2.core.Function in project vue-gwt by Axellience.
the class VueComponentOptions method initTemplateExpressions.
/**
* Add template expressions to this {@link VueComponentOptions}.
*/
@JsOverlay
private void initTemplateExpressions() {
int i = 0;
Function templateMethod;
while ((templateMethod = getJavaComponentMethod("exp$" + i)) != null) {
addMethod("exp$" + i, templateMethod);
i++;
}
}
use of elemental2.core.Function in project vue-gwt by Axellience.
the class VueDirectiveOptions method copyHook.
/**
* Copy the given hook function from the Java instance to the options we pass to Vue
* @param hookFunctionName The name of the hook function to copy
*/
private void copyHook(String hookFunctionName) {
Function hookFunction = (Function) ((JsPropertyMap) vuegwt$javaDirectiveInstance).get(hookFunctionName);
if (hookFunction == null)
return;
// Filter empty function inherited from VueDirective
String body = getFunctionBody(hookFunction);
if ("".equals(body))
return;
set(hookFunctionName, hookFunction);
}
use of elemental2.core.Function in project vue-gwt by Axellience.
the class VueDirectiveOptions method getFunctionBody.
private String getFunctionBody(Function jsFunction) {
JsString jsString = cast(jsFunction.toString());
// Get content between first { and last }
JsString m = cast(jsString.match(new JsRegExp("\\{([\\s\\S]*)\\}", "m"))[1]);
// Strip comments
return m.replace(new JsRegExp("^\\s*\\/\\/.*$", "mg"), "").trim();
}
Aggregations