Search in sources :

Example 11 with JsIgnore

use of jsinterop.annotations.JsIgnore in project console by hal.

the class ComplexAttributeOperations method add.

/**
 * Writes the payload to the complex attribute in the specified resource. After the resource has been updated, a success
 * message is fired and the specified callback is executed.
 *
 * @param complexAttribute the name of the complex attribute
 * @param type the human readable name of the complex attribute
 * @param address the fq address for the operation
 * @param payload the optional payload for the complex attribute (may be null or undefined)
 * @param callback the callback executed after the resource has been added
 */
@JsIgnore
public void add(String complexAttribute, String type, ResourceAddress address, @Nullable ModelNode payload, Callback callback) {
    Operation operation = new Operation.Builder(address, WRITE_ATTRIBUTE_OPERATION).param(NAME, complexAttribute).param(VALUE, payload == null ? new ModelNode().addEmptyObject() : payload).build();
    dispatcher.execute(operation, result -> {
        MessageEvent.fire(eventBus, Message.success(resources.messages().addSingleResourceSuccess(type)));
        callback.execute();
    });
}
Also used : Operation(org.jboss.hal.dmr.Operation) ModelNode(org.jboss.hal.dmr.ModelNode) JsIgnore(jsinterop.annotations.JsIgnore)

Example 12 with JsIgnore

use of jsinterop.annotations.JsIgnore in project console by hal.

the class ComplexAttributeOperations method reset.

/**
 * Undefines all non required attributes in the specified form. After the attributes in the complex attribute have been
 * undefined a standard success message is fired and the specified callback is executed.
 * <p>
 * If the form contains only required attributes, a warning message is fired and the specified callback is executed.
 *
 * @param complexAttribute the name of the complex attribute
 * @param type the human readable name of the complex attribute
 * @param address the fq address for the operation
 * @param form the form which should be reset
 * @param callback the callback executed after the resource has been saved
 */
@JsIgnore
public <T> void reset(String complexAttribute, String type, ResourceAddress address, Metadata metadata, Form<T> form, Callback callback) {
    Set<String> attributes = stream(form.getBoundFormItems().spliterator(), false).map(FormItem::getName).collect(toSet());
    Composite composite = operationFactory(complexAttribute).resetResource(address, attributes, metadata);
    reset(type, composite, callback);
}
Also used : Composite(org.jboss.hal.dmr.Composite) JsIgnore(jsinterop.annotations.JsIgnore)

Example 13 with JsIgnore

use of jsinterop.annotations.JsIgnore in project console by hal.

the class ComplexAttributeOperations method remove.

/**
 * Undefines the complex attribute. After the attribute has been undefined a standard success message is fired and the
 * specified callback is executed.
 *
 * @param complexAttribute the name of the complex attribute
 * @param type the human readable name of the complex attribute
 * @param address the fq address for the operation
 * @param callback the callback executed after the complex attribute has been undefined
 */
@JsIgnore
public void remove(String complexAttribute, String type, ResourceAddress address, Callback callback) {
    Operation operation = new Operation.Builder(address, UNDEFINE_ATTRIBUTE_OPERATION).param(NAME, complexAttribute).build();
    SafeHtml question = resources.messages().removeSingletonConfirmationQuestion();
    DialogFactory.showConfirmation(resources.messages().removeConfirmationTitle(type), question, () -> dispatcher.execute(operation, result -> {
        MessageEvent.fire(eventBus, Message.success(resources.messages().removeSingletonResourceSuccess(type)));
        callback.execute();
    }));
}
Also used : ModelNode(org.jboss.hal.dmr.ModelNode) Iterables(com.google.common.collect.Iterables) Provider(javax.inject.Provider) StatementContext(org.jboss.hal.meta.StatementContext) MessageEvent(org.jboss.hal.spi.MessageEvent) SuccessfulMetadataCallback(org.jboss.hal.meta.processing.SuccessfulMetadataCallback) AddResourceDialog(org.jboss.hal.core.mbui.dialog.AddResourceDialog) ResourceAddress(org.jboss.hal.dmr.ResourceAddress) Inject(javax.inject.Inject) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) Progress(org.jboss.hal.flow.Progress) AddressTemplate(org.jboss.hal.meta.AddressTemplate) Map(java.util.Map) Message(org.jboss.hal.spi.Message) Metadata(org.jboss.hal.meta.Metadata) Nullable(javax.annotation.Nullable) Collectors.toSet(java.util.stream.Collectors.toSet) CompositeResult(org.jboss.hal.dmr.CompositeResult) Operation(org.jboss.hal.dmr.Operation) Collections.emptyList(java.util.Collections.emptyList) Set(java.util.Set) EventBus(com.google.web.bindery.event.shared.EventBus) DialogFactory(org.jboss.hal.ballroom.dialog.DialogFactory) Composite(org.jboss.hal.dmr.Composite) JsIgnore(jsinterop.annotations.JsIgnore) Dispatcher(org.jboss.hal.dmr.dispatch.Dispatcher) FormItem(org.jboss.hal.ballroom.form.FormItem) MetadataProcessor(org.jboss.hal.meta.processing.MetadataProcessor) Callback(org.jboss.hal.spi.Callback) StreamSupport.stream(java.util.stream.StreamSupport.stream) Resources(org.jboss.hal.resources.Resources) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) Footer(org.jboss.hal.spi.Footer) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) Form(org.jboss.hal.ballroom.form.Form) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) Operation(org.jboss.hal.dmr.Operation) JsIgnore(jsinterop.annotations.JsIgnore)

Example 14 with JsIgnore

use of jsinterop.annotations.JsIgnore in project vue-gwt by Axellience.

the class VueGWT method initWithoutVueLib.

/**
 * Inject scripts necessary for Vue GWT to work Requires Vue to be defined in Window.
 */
@JsIgnore
public static void initWithoutVueLib() {
    if (!isVueLibInjected()) {
        throw new RuntimeException("Couldn't find Vue.js on init. Either include it Vue.js in your index.html or call VueGWT.init() instead of initWithoutVueLib.");
    }
    // Register custom observers for Collection and Maps
    VueGWTObserverManager.get().registerVueGWTObserver(new CollectionObserver());
    VueGWTObserverManager.get().registerVueGWTObserver(new MapObserver());
    isReady = true;
    // Call on ready callbacks
    for (Runnable onReadyCbk : onReadyCallbacks) {
        onReadyCbk.run();
    }
    onReadyCallbacks.clear();
}
Also used : CollectionObserver(com.axellience.vuegwt.core.client.observer.vuegwtobservers.CollectionObserver) MapObserver(com.axellience.vuegwt.core.client.observer.vuegwtobservers.MapObserver) JsIgnore(jsinterop.annotations.JsIgnore)

Example 15 with JsIgnore

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

the class TableMap method refetch.

/**
 * Fetches (or re-fetches) the TableMap so it can be used internally
 */
@JsIgnore
public Promise<TableMap> refetch() {
    return Callbacks.promise(this, fetch).then(decl -> {
        workerConnection.registerTableMap(decl.getHandle(), this);
        tableMapHandle = decl.getHandle();
        for (Object key : (Object[]) decl.getKeys().getData()) {
            LocalKey k = LocalKey.of(key);
            put(key, k);
        }
        unsuppressEvents();
        fireEvent(EVENT_RECONNECT);
        return Promise.resolve(this);
    }).catch_(err -> {
        final CustomEventInit init = CustomEventInit.create();
        init.setDetail(err);
        unsuppressEvents();
        fireEvent(EVENT_RECONNECTFAILED, init);
        suppressEvents();
        // noinspection unchecked
        return (Promise<TableMap>) (Promise) Promise.reject(err);
    });
}
Also used : TableMapHandle(io.deephaven.web.shared.data.TableMapHandle) Arrays(java.util.Arrays) TableMapDeclaration(io.deephaven.web.shared.data.TableMapDeclaration) HashMap(java.util.HashMap) ClientTableState(io.deephaven.web.client.state.ClientTableState) CustomEventInit(elemental2.dom.CustomEventInit) Promise(elemental2.promise.Promise) JsSet(elemental2.core.JsSet) JsProperty(jsinterop.annotations.JsProperty) Consumer(java.util.function.Consumer) JsIgnore(jsinterop.annotations.JsIgnore) Map(java.util.Map) JsType(jsinterop.annotations.JsType) JsObject(elemental2.core.JsObject) Promise(elemental2.promise.Promise) CustomEventInit(elemental2.dom.CustomEventInit) JsObject(elemental2.core.JsObject) 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