Skip to content

Commit

Permalink
Move Gluon components out of Kit into new Gluon-plugin module (#748)
Browse files Browse the repository at this point in the history
* Add plugins module, introduce ExternalSectionProvider, and add GluonSectionProvider implementation

* Add ExternalMetadataProvider and GluonMetadataProvider implementation

* Add ExternalDesignHierarchyMaskProvider and GluonDesignHierarchyMaskProvider implementation

* Refactor Accessory enum in DesignHierarchyMask and add more API to related interfaces

* Move Gluon theme and stylesheets from kit to plugins

* add javadoc

* rename module

* Update readme and plugin
  • Loading branch information
jperedadnr authored Oct 15, 2024
1 parent 47659c9 commit 8667b3a
Show file tree
Hide file tree
Showing 166 changed files with 2,516 additions and 1,615 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Alternatively, utilizing the Maven Wrapper, one can run:

`./mvnw clean package`

It will create a partial shadow cross-platform jar under `app/target/lib/scenebuilder-$version.jar`, that doesn't include the JavaFX dependencies.
It will create a partial shadow cross-platform jar under `app/target/lib/scenebuilder-$version-all.jar`, that doesn't include the JavaFX dependencies.

### How to run Scene Builder ###

Expand All @@ -67,14 +67,14 @@ Then Scene Builder can be started with Maven:

`mvn javafx:run -f app`

Alternatively, you can run the partial shadow jar, providing you have downloaded the JavaFX SDK from [here](https://gluonhq.com/products/javafx/):
Alternatively, you can run the partial shadow jar in the classpath, providing you have downloaded the JavaFX SDK from [here](https://gluonhq.com/products/javafx/):

```
java
java \
--module-path /path/to/javafx-sdk-$javafxVersion/lib \
--add-modules javafx.web,javafx.fxml,javafx.swing,javafx.media \
--add-opens=javafx.fxml/javafx.fxml=ALL-UNNAMED \
-cp app/target/lib/scenebuilder-$version.jar \
-cp app/target/lib/scenebuilder-$version-all.jar \
com.oracle.javafx.scenebuilder.app.SceneBuilderApp
```

Expand Down Expand Up @@ -111,7 +111,8 @@ mvn checkstyle:checkstyle

There will be a report for each sub-project, one for `app` and one for `kit`.

* Kit: `kit/target/site/checkstyle.html`
* App: `app/target/site/checkstyle.html`
* Kit: `kit/target/reports/checkstyle.html`
* App: `app/target/reports/checkstyle.html`
* Gluon-plugin: `gluon-plugin/target/reports/checkstyle.html`

This project makes use of [EditorConfig](https://editorconfig.org/) which is [directly supported](https://editorconfig.org/#pre-installed) by IntelliJ IDEA. There are plugins for NetBeans, Eclipse and Visual Studio and [more](https://editorconfig.org/#download). EditorConfig ensures via configuration in `.editorconfig` file, that the proper indentation is used.
5 changes: 5 additions & 0 deletions app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
<artifactId>kit</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.gluonhq.scenebuilder</groupId>
<artifactId>gluon-plugin</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
*/
package com.oracle.javafx.scenebuilder.app;

import com.gluonhq.scenebuilder.plugins.alert.WarnThemeAlert;
import com.gluonhq.scenebuilder.plugins.editor.GluonEditorController;
import com.oracle.javafx.scenebuilder.app.i18n.I18N;
import com.oracle.javafx.scenebuilder.app.menubar.MenuBarController;
import com.oracle.javafx.scenebuilder.app.message.MessageBarController;
Expand All @@ -41,7 +43,6 @@
import com.oracle.javafx.scenebuilder.app.report.JarAnalysisReportController;
import com.oracle.javafx.scenebuilder.app.util.AppSettings;
import com.oracle.javafx.scenebuilder.kit.ResourceUtils;
import com.oracle.javafx.scenebuilder.kit.alert.WarnThemeAlert;
import com.oracle.javafx.scenebuilder.kit.editor.DocumentationUrls;
import com.oracle.javafx.scenebuilder.kit.editor.EditorController;
import com.oracle.javafx.scenebuilder.kit.editor.EditorController.ControlAction;
Expand Down Expand Up @@ -407,7 +408,9 @@ public void loadFromFile(File fxmlFile) throws IOException {
updateFromDocumentPreferences(true);
watchingController.update();

WarnThemeAlert.showAlertIfRequired(editorController, editorController.getFxomDocument(), getStage());
if (editorController.getFxomDocument().hasControlsFromExternalPlugin()) {
WarnThemeAlert.showAlertIfRequired(getStage(), editorController.getTheme(), editorController::setTheme);
}
}

public void loadFromURL(URL fxmlURL, boolean refreshThemeFromDocumentPreferences) {
Expand Down Expand Up @@ -557,13 +560,11 @@ public void refreshTheme(PreferencesRecordGlobal preferencesRecordGlobal) {
}

public void refreshSwatch(PreferencesRecordGlobal preferencesRecordGlobal) {
final EditorController ec = getEditorController();
ec.setGluonSwatch(preferencesRecordGlobal.getSwatch());
GluonEditorController.getInstance().setGluonSwatch(preferencesRecordGlobal.getSwatch());
}

public void refreshGluonTheme(PreferencesRecordGlobal preferencesRecordGlobal) {
final EditorController ec = getEditorController();
ec.setGluonTheme(preferencesRecordGlobal.getGluonTheme());
GluonEditorController.getInstance().setGluonTheme(preferencesRecordGlobal.getGluonTheme());
}

public void refreshAccordionAnimation(PreferencesRecordGlobal preferencesRecordGlobal) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
*/
package com.oracle.javafx.scenebuilder.app;

import com.gluonhq.scenebuilder.plugins.editor.GluonEditorPlatform;
import com.oracle.javafx.scenebuilder.app.DocumentWindowController.ActionStatus;
import com.oracle.javafx.scenebuilder.app.about.AboutWindowController;
import com.oracle.javafx.scenebuilder.app.i18n.I18N;
Expand All @@ -45,7 +46,6 @@
import com.oracle.javafx.scenebuilder.app.welcomedialog.WelcomeDialogWindowController;
import com.oracle.javafx.scenebuilder.kit.ResourceUtils;
import com.oracle.javafx.scenebuilder.kit.ToolTheme;
import com.oracle.javafx.scenebuilder.kit.alert.ImportingGluonControlsAlert;
import com.oracle.javafx.scenebuilder.kit.alert.SBAlert;
import com.oracle.javafx.scenebuilder.kit.editor.EditorController;
import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform;
Expand Down Expand Up @@ -439,23 +439,19 @@ private void setUpUserLibrary(boolean showWelcomeDialog) {
userLibrary.setOnUpdatedJarReports(jarReports -> {
boolean shouldShowImportGluonJarAlert = false;
for (JarReport jarReport : jarReports) {
if (jarReport.hasGluonControls()) {
if (jarReport.hasControlsFromExternalPlugin()) {
// We check if the jar has already been imported to avoid showing the import gluon jar
// alert every time Scene Builder starts for jars that have already been imported
if (!hasGluonJarBeenImported(jarReport.getJar().getFileName().toString())) {
shouldShowImportGluonJarAlert = true;
break;
}
}
}
if (shouldShowImportGluonJarAlert) {
Platform.runLater(() -> {
var dwc = findFirstUnusedDocumentWindowController().orElse(makeNewWindow());
ImportingGluonControlsAlert alert = new ImportingGluonControlsAlert(dwc.getStage());
AppSettings.setWindowIcon(alert);
if (showWelcomeDialog) {
alert.initOwner(WelcomeDialogWindowController.getInstance().getStage());
}
alert.showAndWait();
EditorPlatform.showImportAlert(showWelcomeDialog ? WelcomeDialogWindowController.getInstance().getStage() : dwc.getStage());
});
}
updateImportedGluonJars(jarReports);
Expand Down Expand Up @@ -694,7 +690,7 @@ private void loadTemplateInWindow(Template template, DocumentWindowController do

if (template.getType() == Type.PHONE) {
documentWindowController.getEditorController().performEditAction(EditorController.EditAction.SET_SIZE_335x600);
documentWindowController.getEditorController().setTheme(EditorPlatform.Theme.GLUON_MOBILE_LIGHT);
documentWindowController.getEditorController().setTheme(GluonEditorPlatform.GLUON_MOBILE_LIGHT);
}

documentWindowController.openWindow();
Expand Down Expand Up @@ -1080,7 +1076,7 @@ private static void updateImportedGluonJars(List<JarReport> jars) {
PreferencesRecordGlobal recordGlobal = pc.getRecordGlobal();
List<String> jarReportCollection = new ArrayList<>();
for (JarReport jarReport : jars) {
if (jarReport.hasGluonControls()) {
if (jarReport.hasControlsFromExternalPlugin()) {
jarReportCollection.add(jarReport.getJar().getFileName().toString());
}
}
Expand Down
Loading

0 comments on commit 8667b3a

Please sign in to comment.