IScellUiApi<TControl> - Spreadsheet UI entry point
IScellUiApi<TControl>
- main UI API entry point.
To create the UI control, should make the following, for example:
import com.intechcore.scomponents.scell.api.ScellApiEntryPoint;
import com.intechcore.scomponents.scell.api.spreadsheet.IScellCoreApiFactory;
import com.intechcore.scomponents.scell.api.fx.IScellUiApi;
import com.intechcore.scomponents.scell.api.fx.IScellUiApiBuilder;
import com.intechcore.scomponents.scell.api.fx.IScellUiFxApiBuilder;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import java.util.concurrent.CompletableFuture;
public class TestAppUi extends Application {
@Override
public void start(Stage primaryStage) {
BorderPane root = new BorderPane(new Label("Initializing ..."));
ScellApiEntryPoint.getApiResolverAsync().thenApplyAsync(resolver -> {
IScellCoreApiFactory apiFactory = resolver.resolve(IScellCoreApiFactory.class);
IScellUiApiBuilder<Node> uiBuilder = resolver.resolve(IScellUiFxApiBuilder.class);
IScellUiApi<Node> uiApi = uiBuilder
.create(CompletableFuture.supplyAsync(apiFactory::createNew));
return uiApi.createControl();
}, Platform::runLater).whenCompleteAsync((node, throwable) -> {
if (throwable != null) {
node = new Label("Failed to init: " + throwable.getCause().getMessage());
}
root.setCenter(node);
}, Platform::runLater);
primaryStage.setScene(new Scene(root, 800, 600));
primaryStage.show();
}
}
To manage the UI control at runtime, there are several services:
IUiContentManager getContentManager()
- change current spreadsheet - load new or clear the existingIUiSelectionManager getSelectionManager()
- working with current selection - get or move the active cellIUiControlSettings getSettingsService()
- change or read some settings like hide the grid or context menu in runtimesetContextMenuItems(ContextMenuOwner target, List<TControl> menuItems, List<PredefinedContextMenuCommand> startCommands, List<PredefinedContextMenuCommand> endCommands)
- customise grid or editing cell context menus
Next (IUiContentManager - Changing current UI content)