Search

How to Add SUniText Component into Project

Updated: Jun 18

This article describes step by step instruction how to add SUniText as a library in the context of an external project:

1. First of all, it needs to collect the project delivery packages and unzip archives somewhere in your file system. It contains two modules - sunitext and sunitext-ui and they are named as the version number of the snapshot and the revision number and date:

  • sunitext-ui-2.6.0-SNAPSHOT@build-15.06.2020-10-56-delivery.zip

  • sunitext-2.6.6-SNAPSHOT@build-15.06.2020-57-core-swt-fx-delivery.zip

2. Then you need to create a new project or use an existing one (in my case this is a new JavaFX project) and navigate to the Project Structure (F4), if you use IntelliJ IDEA. Then Modules → Dependencies and click the plus button to import JAR files from previously collected archives. In the drop-down list select JARs or directories and select the directory above with the archives described above. NOTE: for sunitext the location of the jar's files should be root_folder/sunitext-toolkit and for sunitext-ui - root_folder/sunitext-ui_modules/lib.



3. After that you will see two libraries in External libraries section.



4. This topic describe adding three buttons - Run SUniText application, Save and Open file)

5. To create an instance of ISUniTextEditor, you need to make a simple invocation of the SUniTextEditorImpl constructor, and then call init() method. Or you can use a custom implementation if you want.

public void init() {
 editorController = new SUniTextEditorImpl();
 editorController.init();
}

6. Then, by clicking the start button (built-in), an instance of the DemoWindow object is created, which takes editorController as a constructor parameter and calls the startEditor() method. If you set true, it means that control window should be running as well.

@FXML
void builtIn() {
 DemoWindow window = new DemoWindow(editorController);
 window.start(true);
}
* if you need to change the classloader you can use setClassLoaderType(ClassLoaderType classLoaderType) method. (There is support for JAVA_DEFAULT and OSGI)

7. Similarly, we control the opening and saving, using methods of editorController 

editorController.openFile(File file);

and

editorController.saveFileAs(File file);


You can call other functions of the class in the same way SUniTextEditorImpl which will be reflected in the behavior of the application window.

Recent Posts

See All

Scell Technical Description

Scell spreadsheet is a set of Java 8 code libraries. The libraries are distributed as an embedded jar archives and allowed under proprietary license: /*************************************************

Intechcore GmbH

Raiffeisenallee 16, 82041 Oberhaching by Munich-Area, Germany

Mo-Fr: 8:00-18:00
Sa, Su: Closed