Skip to content

Commit

Permalink
pre-review cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Dec 12, 2023
1 parent 5fabcc7 commit 64fbabb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
/**
* A format to describe a variable available to be read from the server. Application fields are optional, and only
* populated when a variable is provided by application mode.
*
* APIs which take a VariableDefinition` must at least be provided an object with a <b>type</b> and <b>id</b> field.
* <p>
* APIs which take a VariableDefinition must at least be provided an object with a <b>type</b> and <b>id</b> field.
*/
@TsInterface
@TsName(namespace = "dh.ide", name = "VariableDefinition")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -978,10 +978,8 @@ public void close() {
JsLog.debug("Closing tree table", this);

connection.unregisterSimpleReconnectable(this);
connection.releaseTicket(widget.getTicket());

// Presently it is never necessary to release widget tickets, since they can't be export tickets.
// connection.releaseTicket(widget.getTicket());
connection.releaseTicket(widget.getTicket());

if (filteredTable != null) {
filteredTable.release();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ public String getDataAsString() {
return new String(Js.uncheckedCast(response.getData().getPayload_asU8()), StandardCharsets.UTF_8);
}

/**
* @return the exported objects sent in the initial message from the server. The client is responsible for closing
* them when finished using them.
*/
@Override
@JsProperty
public JsWidgetExportedObject[] getExportedObjects() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.vertispan.tsdefs.annotations.TsInterface;
import com.vertispan.tsdefs.annotations.TsName;
import elemental2.core.JsArray;
import elemental2.promise.Promise;
import io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.session_pb.ExportRequest;
import io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.ExportedTableCreationResponse;
Expand All @@ -19,10 +20,13 @@
import io.deephaven.web.client.api.console.JsVariableType;
import io.deephaven.web.client.state.ClientTableState;
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsNullable;
import jsinterop.annotations.JsProperty;

/**
* Represents a server-side object that may not yet have been fetched by the client.
* Represents a server-side object that may not yet have been fetched by the client. When this object will no longer be
* used, if {@link #fetch()} is not called on this object, then {@link #close()} must be to ensure server-side resources
* are correctly freed.
*/
@TsInterface
@TsName(namespace = "dh", name = "WidgetExportedObject")
Expand Down Expand Up @@ -58,8 +62,19 @@ public JsWidgetExportedObject(WorkerConnection connection, TypedTicket ticket) {
});
}

/**
* Returns the type of this export, typically one of {@link JsVariableType}, but may also include plugin types. If
* null, this object cannot be fetched, but can be passed to the server, such as via
* {@link JsWidget#sendMessage(JsWidget.MessageUnion, JsArray)}.
*
* @return the string type of this server-side object, or null.
*/
@JsNullable
@JsProperty
public String getType() {
if (ticket.getType().isEmpty()) {
return null;
}
return ticket.getType();
}

Expand Down Expand Up @@ -93,17 +108,6 @@ public Promise<JsWidgetExportedObject> reexport() {
});
}


// Could also return Promise<JsWidgetExportedObject> - perhaps if we make it have a `boolean refetch` arg?
// /**
// * Returns a copy of this widget, so that any later {@link #fetch()} will always return a fresh instance.
// * @return
// */
// @JsMethod
// public JsWidgetExportedObject copy() {
// return new JsWidgetExportedObject(connection, ticket);
// }

/**
* Returns a promise that will fetch the object represented by this reference. Multiple calls to this will return
* the same instance.
Expand Down

0 comments on commit 64fbabb

Please sign in to comment.