Search in sources :

Example 1 with BusErrorCallback

use of org.jboss.errai.bus.client.api.BusErrorCallback in project kie-wb-common by kiegroup.

the class AssignmentsEditorWidget method getDataTypes.

protected void getDataTypes() {
    final String simpleDataTypes = "Boolean:Boolean,Float:Float,Integer:Integer,Object:Object,String:String";
    MessageBuilder.createCall(new RemoteCallback<List<String>>() {

        public void callback(List<String> dataTypes) {
            String formattedDataTypes = formatDataTypes(dataTypes);
            String allDataTypes = simpleDataTypes + "," + formattedDataTypes;
            showDataIOEditor(allDataTypes.toString());
        }
    }, new BusErrorCallback() {

        public boolean error(Message message, Throwable t) {
            notification.fire(new NotificationEvent(StunnerFormsClientFieldsConstants.INSTANCE.Error_retrieving_datatypes(), NotificationEvent.NotificationType.ERROR));
            showDataIOEditor(simpleDataTypes);
            return false;
        }
    }, DataTypesService.class).getDataTypeNames();
}
Also used : Message(org.jboss.errai.bus.client.api.messaging.Message) DataTypesService(org.kie.workbench.common.stunner.bpmn.service.DataTypesService) ArrayList(java.util.ArrayList) List(java.util.List) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) BusErrorCallback(org.jboss.errai.bus.client.api.BusErrorCallback)

Example 2 with BusErrorCallback

use of org.jboss.errai.bus.client.api.BusErrorCallback in project kie-wb-common by kiegroup.

the class VariablesEditorWidgetViewImpl method getDataTypes.

protected void getDataTypes(final String value, final boolean fireEvents) {
    final List<String> simpleDataTypes = new ArrayList<String>(Arrays.asList("Boolean", "Float", "Integer", "Object", "String"));
    final List<String> simpleDataTypeDisplayNames = new ArrayList<String>(Arrays.asList("Boolean", "Float", "Integer", "Object", "String"));
    MessageBuilder.createCall(new RemoteCallback<List<String>>() {

        public void callback(final List<String> serverDataTypes) {
            List<List<String>> mergedDataTypes = mergeDataTypes(simpleDataTypes, simpleDataTypeDisplayNames, serverDataTypes);
            setDataTypes(mergedDataTypes.get(0), mergedDataTypes.get(1));
            doSetValue(value, fireEvents, true);
        }
    }, new BusErrorCallback() {

        public boolean error(final Message message, final Throwable t) {
            notification.fire(new NotificationEvent(StunnerFormsClientFieldsConstants.INSTANCE.Error_retrieving_datatypes(), NotificationEvent.NotificationType.ERROR));
            setDataTypes(simpleDataTypes, simpleDataTypeDisplayNames);
            doSetValue(value, fireEvents, true);
            return false;
        }
    }, DataTypesService.class).getDataTypeNames();
}
Also used : Message(org.jboss.errai.bus.client.api.messaging.Message) ArrayList(java.util.ArrayList) DataTypesService(org.kie.workbench.common.stunner.bpmn.service.DataTypesService) ArrayList(java.util.ArrayList) List(java.util.List) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) BusErrorCallback(org.jboss.errai.bus.client.api.BusErrorCallback)

Aggregations

ArrayList (java.util.ArrayList)2 List (java.util.List)2 BusErrorCallback (org.jboss.errai.bus.client.api.BusErrorCallback)2 Message (org.jboss.errai.bus.client.api.messaging.Message)2 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)2 DataTypesService (org.kie.workbench.common.stunner.bpmn.service.DataTypesService)2 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)2