IScellUiApi<TControl> - Spreadsheet UI entry point
IScellUiApi<TControl>
- main UI API entry point.
To create the UI control, do the following, for example:
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 com.intechcore.scomponents.scell.api.init.ScellApiEntryPoint;
import com.intechcore.scomponents.scell.api.spreadsheet.IScellCoreApiFactory;
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;
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
.readOnly(false)
.create(apiFactory.createNew());
return uiApi.getControl();
}, 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();
}
}
There are several services to manage the UI control at runtime:
IUiContentManager getContentManager()
- changes the current spreadsheet - loads a new one or clears the existing oneIUiSelectionManager getSelectionManager()
- works with the current selection - gets or moves the active cellIUiControlSettings getSettingsService()
- changes or reads such settings as hide the grid or context menu at the runtimesetContextMenuItems(ContextMenuOwner target, List<PredefinedContextMenuCommand> commands)
- customises grid or edits cell context menus
Next (IUiContentManager - Changing current UI content)