IUiContentManager - changing current UI content
IUiContentManager
- an interface to change the current UI-displayed spreadsheet.
Possibilities
load(File file)
- loads the xlsx-file to the SCell UI controlload(File file, IPasswordInput setting)
- loads the xlsx-file to the SCell UI control with the possibility to process password inputload(InputStream inputStream, String title)
- loads the xlsx-stream to the SCell UI controlload(InputStream inputStream, String title, IPasswordInput setting)
- loads the xlsx-stream to the SCell UI control with the possibility to process password inputsetPasswordInput(IPasswordInput passwordInput)
- sets the custom password supplier to use on loading the xlsx-contentgetActiveWorksheet()
- returns the currently selected worksheetclear()
- clears the current SCell UI control from any content (similar to the creation of a new xlsx-file)getCoreApi()
- gets the current core entry point (currentIWorkbook
) for a more convenient management- Working with clipboard -
cut()
,copy()
,paste()
(business license) - Working with undo/redo commands -
undoLastAction()
,redoLastAction()
(business license)
Usage 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.Button;
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());
// Clear all content example (it is similar to creation a new spreadsheet)
Button createNewButton = new Button("Clear all contents");
createNewButton.setOnAction(event -> {
createNewButton.setDisable(true);
uiApi.getContentManager().clear(); // Clears all the existing content of the SCell UI control
createNewButton.setDisable(false);
});
root.setTop(createNewButton);
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();
}
}