Search in sources :

Example 16 with JsIgnore

use of jsinterop.annotations.JsIgnore in project deephaven-core by deephaven.

the class JsFigure method refetch.

@JsIgnore
public Promise<JsFigure> refetch() {
    plotHandlesToTables = new HashMap<>();
    return Callbacks.grpcUnaryPromise(fetch::fetch).then(response -> {
        this.descriptor = FigureDescriptor.deserializeBinary(response.getData_asU8());
        charts = descriptor.getChartsList().asList().stream().map(chartDescriptor -> new JsChart(chartDescriptor, this)).toArray(JsChart[]::new);
        JsObject.freeze(charts);
        return this.tableFetch.fetch(this, response);
    }).then(tableFetchData -> {
        // all tables are wired up, need to map them to the series instances
        tables = tableFetchData.tables;
        tableMaps = tableFetchData.tableMaps;
        plotHandlesToTableMaps = tableFetchData.plotHandlesToTableMaps;
        onClose = tableFetchData.onClose;
        for (int i = 0; i < tables.length; i++) {
            JsTable table = tables[i];
            registerTableWithId(table, Js.cast(JsArray.of((double) i)));
        }
        Arrays.stream(charts).flatMap(c -> Arrays.stream(c.getSeries())).forEach(s -> s.initSources(plotHandlesToTables, plotHandlesToTableMaps));
        Arrays.stream(charts).flatMap(c -> Arrays.stream(c.getMultiSeries())).forEach(s -> s.initSources(plotHandlesToTableMaps));
        return null;
    }).then(ignore -> {
        unsuppressEvents();
        fireEvent(EVENT_RECONNECT);
        return Promise.resolve(this);
    }, err -> {
        final FigureFetchError fetchError = new FigureFetchError(LazyPromise.ofObject(err), this.descriptor != null ? this.descriptor.getErrorsList() : new JsArray<>());
        final CustomEventInit init = CustomEventInit.create();
        init.setDetail(fetchError);
        unsuppressEvents();
        fireEvent(EVENT_RECONNECTFAILED, init);
        suppressEvents();
        // noinspection unchecked,rawtypes
        return (Promise<JsFigure>) (Promise) Promise.reject(fetchError);
    });
}
Also used : Arrays(java.util.Arrays) JsOptional(jsinterop.annotations.JsOptional) JsBiConsumer(io.deephaven.web.shared.fu.JsBiConsumer) HashMap(java.util.HashMap) HasEventHandling(io.deephaven.web.client.api.HasEventHandling) Promise(elemental2.promise.Promise) JsPropertyMap(jsinterop.base.JsPropertyMap) Callbacks(io.deephaven.web.client.api.Callbacks) JsProperty(jsinterop.annotations.JsProperty) HashSet(java.util.HashSet) Js(jsinterop.base.Js) FetchObjectResponse(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.object_pb.FetchObjectResponse) WorkerConnection(io.deephaven.web.client.api.WorkerConnection) JsTable(io.deephaven.web.client.api.JsTable) Map(java.util.Map) JsType(jsinterop.annotations.JsType) NoSuchElementException(java.util.NoSuchElementException) LazyPromise(io.deephaven.web.client.fu.LazyPromise) JsObject(elemental2.core.JsObject) TableMap(io.deephaven.web.client.api.TableMap) AxisDescriptor(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.console_pb.figuredescriptor.AxisDescriptor) JsLog(io.deephaven.web.client.fu.JsLog) FigureDescriptor(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.console_pb.FigureDescriptor) Set(java.util.Set) ClientTableState(io.deephaven.web.client.state.ClientTableState) CustomEventInit(elemental2.dom.CustomEventInit) ExportedTableCreationResponse(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.ExportedTableCreationResponse) Collectors(java.util.stream.Collectors) JsArray(elemental2.core.JsArray) JsIgnore(jsinterop.annotations.JsIgnore) Stream(java.util.stream.Stream) Promise(elemental2.promise.Promise) LazyPromise(io.deephaven.web.client.fu.LazyPromise) JsTable(io.deephaven.web.client.api.JsTable) JsArray(elemental2.core.JsArray) CustomEventInit(elemental2.dom.CustomEventInit) JsIgnore(jsinterop.annotations.JsIgnore)

Example 17 with JsIgnore

use of jsinterop.annotations.JsIgnore in project deephaven-core by deephaven.

the class JsFigure method downsampleNeeded.

@JsIgnore
public void downsampleNeeded(String message, Set<JsSeries> series, double tableSize) {
    CustomEventInit failInit = CustomEventInit.create();
    failInit.setDetail(JsPropertyMap.of("series", series, "message", message, "size", tableSize));
    fireEvent(EVENT_DOWNSAMPLENEEDED, failInit);
}
Also used : CustomEventInit(elemental2.dom.CustomEventInit) JsIgnore(jsinterop.annotations.JsIgnore)

Example 18 with JsIgnore

use of jsinterop.annotations.JsIgnore in project deephaven-core by deephaven.

the class JsFigure method enqueueSubscriptionCheck.

@JsIgnore
public void enqueueSubscriptionCheck() {
    if (!subCheckEnqueued) {
        for (JsTable table : tables) {
            if (table.isClosed()) {
                throw new IllegalStateException("Cannot subscribe, at least one table is disconnected");
            }
        }
        subCheckEnqueued = true;
        LazyPromise.runLater(this::updateSubscriptions);
    }
}
Also used : JsTable(io.deephaven.web.client.api.JsTable) JsIgnore(jsinterop.annotations.JsIgnore)

Example 19 with JsIgnore

use of jsinterop.annotations.JsIgnore in project deephaven-core by deephaven.

the class JsMultiSeries method initSources.

@JsIgnore
public void initSources(Map<Integer, TableMap> plotHandlesToTableMaps) {
    descriptor.getDataSourcesList().asList().stream().mapToInt(MultiSeriesSourceDescriptor::getTableMapId).distinct().forEach(plotHandle -> {
        TableMap tableMap = plotHandlesToTableMaps.get(plotHandle);
        tableMap.getKeys().forEach((p0, p1, p2) -> {
            requestTable(tableMap, p0);
            return null;
        });
        tableMap.addEventListener(TableMap.EVENT_KEYADDED, event -> {
            requestTable(tableMap, ((CustomEvent) event).detail);
        });
    });
}
Also used : TableMap(io.deephaven.web.client.api.TableMap) JsIgnore(jsinterop.annotations.JsIgnore)

Example 20 with JsIgnore

use of jsinterop.annotations.JsIgnore in project deephaven-core by deephaven.

the class JsRollupConfig method buildRequest.

@JsIgnore
public RollupTableRequest buildRequest() {
    RollupTableRequest rollupRequest = new RollupTableRequest();
    ArrayList<String> aggregations = new ArrayList<>();
    this.aggregations.forEach(key -> aggregations.add("" + key + "=" + String.join(",", JsArrays.toStringArray(this.aggregations.get(key)))));
    rollupRequest.setAggregations(aggregations.toArray(new String[0]));
    JsArrays.setArray(groupingColumns, rollupRequest::setGroupingColumns);
    rollupRequest.setIncludeConstituents(includeConstituents);
    rollupRequest.setIncludeOriginalColumns(includeOriginalColumns);
    rollupRequest.setIncludeDescriptions(includeDescriptions);
    return rollupRequest;
}
Also used : RollupTableRequest(io.deephaven.web.shared.requests.RollupTableRequest) ArrayList(java.util.ArrayList) JsString(elemental2.core.JsString) JsIgnore(jsinterop.annotations.JsIgnore)

Aggregations

JsIgnore (jsinterop.annotations.JsIgnore)41 ModelNode (org.jboss.hal.dmr.ModelNode)11 Composite (org.jboss.hal.dmr.Composite)10 Operation (org.jboss.hal.dmr.Operation)10 ResourceAddress (org.jboss.hal.dmr.ResourceAddress)9 Map (java.util.Map)7 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)6 CustomEventInit (elemental2.dom.CustomEventInit)6 Set (java.util.Set)6 JsProperty (jsinterop.annotations.JsProperty)6 JsType (jsinterop.annotations.JsType)5 AddResourceDialog (org.jboss.hal.core.mbui.dialog.AddResourceDialog)5 ModelNodeForm (org.jboss.hal.core.mbui.form.ModelNodeForm)5 CompositeResult (org.jboss.hal.dmr.CompositeResult)5 Property (org.jboss.hal.dmr.Property)5 Iterables (com.google.common.collect.Iterables)4 EventBus (com.google.web.bindery.event.shared.EventBus)4 Collectors.toSet (java.util.stream.Collectors.toSet)4 StreamSupport.stream (java.util.stream.StreamSupport.stream)4 Nullable (javax.annotation.Nullable)4