diff --git a/README.md b/README.md
index d59c37696..1b4bc433e 100644
--- a/README.md
+++ b/README.md
@@ -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 ###
@@ -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
```
@@ -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.
diff --git a/app/pom.xml b/app/pom.xml
index 6659f97ec..25dc1fbaf 100644
--- a/app/pom.xml
+++ b/app/pom.xml
@@ -26,6 +26,11 @@
kit
${project.version}
+
+ com.gluonhq.scenebuilder
+ gluon-plugin
+ ${project.version}
+
diff --git a/app/src/main/java/com/oracle/javafx/scenebuilder/app/DocumentWindowController.java b/app/src/main/java/com/oracle/javafx/scenebuilder/app/DocumentWindowController.java
index 8fcb64064..f9487bbf1 100644
--- a/app/src/main/java/com/oracle/javafx/scenebuilder/app/DocumentWindowController.java
+++ b/app/src/main/java/com/oracle/javafx/scenebuilder/app/DocumentWindowController.java
@@ -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;
@@ -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;
@@ -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) {
@@ -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) {
diff --git a/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java b/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java
index 351a99732..99033c5f7 100644
--- a/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java
+++ b/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java
@@ -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;
@@ -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;
@@ -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);
@@ -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();
@@ -1080,7 +1076,7 @@ private static void updateImportedGluonJars(List jars) {
PreferencesRecordGlobal recordGlobal = pc.getRecordGlobal();
List jarReportCollection = new ArrayList<>();
for (JarReport jarReport : jars) {
- if (jarReport.hasGluonControls()) {
+ if (jarReport.hasControlsFromExternalPlugin()) {
jarReportCollection.add(jarReport.getJar().getFileName().toString());
}
}
diff --git a/app/src/main/java/com/oracle/javafx/scenebuilder/app/menubar/MenuBarController.java b/app/src/main/java/com/oracle/javafx/scenebuilder/app/menubar/MenuBarController.java
index bf2893d41..bb5817d45 100644
--- a/app/src/main/java/com/oracle/javafx/scenebuilder/app/menubar/MenuBarController.java
+++ b/app/src/main/java/com/oracle/javafx/scenebuilder/app/menubar/MenuBarController.java
@@ -32,6 +32,8 @@
*/
package com.oracle.javafx.scenebuilder.app.menubar;
+import com.gluonhq.scenebuilder.plugins.editor.GluonEditorController;
+import com.gluonhq.scenebuilder.plugins.editor.GluonEditorPlatform;
import com.oracle.javafx.scenebuilder.app.DocumentWindowController;
import com.oracle.javafx.scenebuilder.app.DocumentWindowController.DocumentControlAction;
import com.oracle.javafx.scenebuilder.app.DocumentWindowController.DocumentEditAction;
@@ -68,7 +70,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import javafx.beans.value.ChangeListener;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.Event;
@@ -1044,57 +1045,57 @@ public void perform() {
caspianEmbeddedThemeMenuItem.setUserData(new SetThemeActionController(EditorPlatform.Theme.CASPIAN_EMBEDDED));
caspianEmbeddedQVGAThemeMenuItem.setUserData(new SetThemeActionController(EditorPlatform.Theme.CASPIAN_EMBEDDED_QVGA));
- gluonMobileLightThemeMenuItem.setUserData(new SetThemeActionController(EditorPlatform.Theme.GLUON_MOBILE_LIGHT));
- gluonMobileDarkThemeMenuItem.setUserData(new SetThemeActionController(EditorPlatform.Theme.GLUON_MOBILE_DARK));
+ gluonMobileLightThemeMenuItem.setUserData(new SetThemeActionController(GluonEditorPlatform.GLUON_MOBILE_LIGHT));
+ gluonMobileDarkThemeMenuItem.setUserData(new SetThemeActionController(GluonEditorPlatform.GLUON_MOBILE_DARK));
modenaThemeMenuItem.setUserData(new SetThemeActionController(EditorPlatform.Theme.MODENA));
modenaTouchThemeMenuItem.setUserData(new SetThemeActionController(EditorPlatform.Theme.MODENA_TOUCH));
modenaHighContrastBlackonwhiteThemeMenuItem.setUserData(new SetThemeActionController(EditorPlatform.Theme.MODENA_HIGH_CONTRAST_BLACK_ON_WHITE));
modenaHighContrastWhiteonblackThemeMenuItem.setUserData(new SetThemeActionController(EditorPlatform.Theme.MODENA_HIGH_CONTRAST_WHITE_ON_BLACK));
modenaHighContrastYellowonblackThemeMenuItem.setUserData(new SetThemeActionController(EditorPlatform.Theme.MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK));
- blueSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.BLUE));
+ blueSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_BLUE));
addSwatchGraphic(blueSwatch);
- cyanSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.CYAN));
+ cyanSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_CYAN));
addSwatchGraphic(cyanSwatch);
- deepOrangeSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.DEEP_ORANGE));
+ deepOrangeSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_DEEP_ORANGE));
addSwatchGraphic(deepOrangeSwatch);
- deepPurpleSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.DEEP_PURPLE));
+ deepPurpleSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_DEEP_PURPLE));
addSwatchGraphic(deepPurpleSwatch);
- greenSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.GREEN));
+ greenSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_GREEN));
addSwatchGraphic(greenSwatch);
- indigoSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.INDIGO));
+ indigoSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_INDIGO));
addSwatchGraphic(indigoSwatch);
- lightBlueSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.LIGHT_BLUE));
+ lightBlueSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_LIGHT_BLUE));
addSwatchGraphic(lightBlueSwatch);
- pinkSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.PINK));
+ pinkSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_PINK));
addSwatchGraphic(pinkSwatch);
- purpleSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.PURPLE));
+ purpleSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_PURPLE));
addSwatchGraphic(purpleSwatch);
- redSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.RED));
+ redSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_RED));
addSwatchGraphic(redSwatch);
- tealSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.TEAL));
+ tealSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_TEAL));
addSwatchGraphic(tealSwatch);
- lightGreenSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.LIGHT_GREEN));
+ lightGreenSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_LIGHT_GREEN));
addSwatchGraphic(lightGreenSwatch);
- limeSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.LIME));
+ limeSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_LIME));
addSwatchGraphic(limeSwatch);
- yellowSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.YELLOW));
+ yellowSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_YELLOW));
addSwatchGraphic(yellowSwatch);
- amberSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.AMBER));
+ amberSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_AMBER));
addSwatchGraphic(amberSwatch);
- orangeSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.ORANGE));
+ orangeSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_ORANGE));
addSwatchGraphic(orangeSwatch);
- brownSwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.BROWN));
+ brownSwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_BROWN));
addSwatchGraphic(brownSwatch);
- greySwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.GREY));
+ greySwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_GREY));
addSwatchGraphic(greySwatch);
- blueGreySwatch.setUserData(new GluonActionController(EditorPlatform.GluonSwatch.BLUE_GREY));
+ blueGreySwatch.setUserData(new GluonActionController(GluonEditorPlatform.GLUON_SWATCH_BLUE_GREY));
addSwatchGraphic(blueGreySwatch);
addSceneStyleSheetMenuItem.setUserData(new DocumentControlActionController(DocumentControlAction.ADD_SCENE_STYLE_SHEET));
updateOpenAndRemoveSceneStyleSheetMenus();
if (documentWindowController != null) {
- this.documentWindowController.getEditorController().sceneStyleSheetProperty().addListener((ChangeListener>) (ov, t, t1) -> {
+ this.documentWindowController.getEditorController().sceneStyleSheetProperty().addListener((ov, t, t1) -> {
if (t1 != null) {
updateOpenAndRemoveSceneStyleSheetMenus();
setupMenuItemHandlers(removeSceneStyleSheetMenu);
@@ -1185,7 +1186,8 @@ public String getTitle() {
}
private void addSwatchGraphic(RadioMenuItem swatchMenuItem) {
- swatchMenuItem.setGraphic(((GluonActionController)swatchMenuItem.getUserData()).getSwatch().createGraphic());
+ EditorPlatform.Theme swatch = ((GluonActionController) swatchMenuItem.getUserData()).getSwatch();
+ swatchMenuItem.setGraphic(GluonEditorPlatform.createGraphicForSwatch(swatch));
}
/*
@@ -2080,50 +2082,50 @@ public void perform() {
= documentWindowController.getEditorController().getTheme();
EditorPlatform.Theme overridingTheme = theme;
- switch (theme) {
- case CASPIAN:
+ switch (theme.name()) {
+ case "CASPIAN":
if (caspianHighContrastThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.CASPIAN_HIGH_CONTRAST;
}
break;
- case CASPIAN_EMBEDDED:
+ case "CASPIAN_EMBEDDED":
if (caspianHighContrastThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.CASPIAN_EMBEDDED_HIGH_CONTRAST;
}
break;
- case CASPIAN_EMBEDDED_QVGA:
+ case "CASPIAN_EMBEDDED_QVGA":
if (caspianHighContrastThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.CASPIAN_EMBEDDED_QVGA_HIGH_CONTRAST;
}
break;
- case CASPIAN_HIGH_CONTRAST:
- switch (currentTheme) {
- case CASPIAN:
+ case "CASPIAN_HIGH_CONTRAST":
+ switch (currentTheme.name()) {
+ case "CASPIAN":
if (caspianHighContrastThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.CASPIAN_HIGH_CONTRAST;
}
break;
- case CASPIAN_EMBEDDED:
+ case "CASPIAN_EMBEDDED":
if (caspianHighContrastThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.CASPIAN_EMBEDDED_HIGH_CONTRAST;
}
break;
- case CASPIAN_EMBEDDED_QVGA:
+ case "CASPIAN_EMBEDDED_QVGA":
if (caspianHighContrastThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.CASPIAN_EMBEDDED_QVGA_HIGH_CONTRAST;
}
break;
- case CASPIAN_HIGH_CONTRAST:
+ case "CASPIAN_HIGH_CONTRAST":
if (!caspianHighContrastThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.CASPIAN;
}
break;
- case CASPIAN_EMBEDDED_HIGH_CONTRAST:
+ case "CASPIAN_EMBEDDED_HIGH_CONTRAST":
if (!caspianHighContrastThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.CASPIAN_EMBEDDED;
}
break;
- case CASPIAN_EMBEDDED_QVGA_HIGH_CONTRAST:
+ case "CASPIAN_EMBEDDED_QVGA_HIGH_CONTRAST":
if (!caspianHighContrastThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.CASPIAN_EMBEDDED_QVGA;
}
@@ -2134,7 +2136,7 @@ public void perform() {
break;
}
break;
- case MODENA:
+ case "MODENA":
if (modenaHighContrastBlackonwhiteThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_HIGH_CONTRAST_BLACK_ON_WHITE;
} else if (modenaHighContrastWhiteonblackThemeMenuItem.isSelected()) {
@@ -2143,7 +2145,7 @@ public void perform() {
overridingTheme = EditorPlatform.Theme.MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK;
}
break;
- case MODENA_TOUCH:
+ case "MODENA_TOUCH":
if (modenaHighContrastBlackonwhiteThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_TOUCH_HIGH_CONTRAST_BLACK_ON_WHITE;
} else if (modenaHighContrastWhiteonblackThemeMenuItem.isSelected()) {
@@ -2152,38 +2154,33 @@ public void perform() {
overridingTheme = EditorPlatform.Theme.MODENA_TOUCH_HIGH_CONTRAST_YELLOW_ON_BLACK;
}
break;
- case MODENA_HIGH_CONTRAST_BLACK_ON_WHITE:
- switch (currentTheme) {
- case MODENA:
+ case "MODENA_HIGH_CONTRAST_BLACK_ON_WHITE":
+ switch (currentTheme.name()) {
+ case "MODENA":
if (modenaHighContrastBlackonwhiteThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_HIGH_CONTRAST_BLACK_ON_WHITE;
}
break;
- case MODENA_TOUCH:
+ case "MODENA_TOUCH":
if (modenaHighContrastBlackonwhiteThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_TOUCH_HIGH_CONTRAST_BLACK_ON_WHITE;
}
break;
- case MODENA_HIGH_CONTRAST_BLACK_ON_WHITE:
+ case "MODENA_HIGH_CONTRAST_BLACK_ON_WHITE":
if (modenaHighContrastBlackonwhiteThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA;
}
break;
- case MODENA_HIGH_CONTRAST_WHITE_ON_BLACK:
+ case "MODENA_HIGH_CONTRAST_WHITE_ON_BLACK":
+ case "MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK":
break;
- case MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK:
- break;
- case MODENA_TOUCH_HIGH_CONTRAST_BLACK_ON_WHITE:
+ case "MODENA_TOUCH_HIGH_CONTRAST_BLACK_ON_WHITE":
if (modenaHighContrastBlackonwhiteThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_TOUCH;
}
break;
- case MODENA_TOUCH_HIGH_CONTRAST_WHITE_ON_BLACK:
- if (modenaHighContrastBlackonwhiteThemeMenuItem.isSelected()) {
- overridingTheme = EditorPlatform.Theme.MODENA_TOUCH_HIGH_CONTRAST_BLACK_ON_WHITE;
- }
- break;
- case MODENA_TOUCH_HIGH_CONTRAST_YELLOW_ON_BLACK:
+ case "MODENA_TOUCH_HIGH_CONTRAST_WHITE_ON_BLACK":
+ case "MODENA_TOUCH_HIGH_CONTRAST_YELLOW_ON_BLACK":
if (modenaHighContrastBlackonwhiteThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_TOUCH_HIGH_CONTRAST_BLACK_ON_WHITE;
}
@@ -2192,38 +2189,38 @@ public void perform() {
break;
}
break;
- case MODENA_HIGH_CONTRAST_WHITE_ON_BLACK:
- switch (currentTheme) {
- case MODENA:
+ case "MODENA_HIGH_CONTRAST_WHITE_ON_BLACK":
+ switch (currentTheme.name()) {
+ case "MODENA":
if (modenaHighContrastWhiteonblackThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_HIGH_CONTRAST_WHITE_ON_BLACK;
}
break;
- case MODENA_TOUCH:
+ case "MODENA_TOUCH":
if (modenaHighContrastWhiteonblackThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_TOUCH_HIGH_CONTRAST_WHITE_ON_BLACK;
}
break;
- case MODENA_HIGH_CONTRAST_BLACK_ON_WHITE:
+ case "MODENA_HIGH_CONTRAST_BLACK_ON_WHITE":
break;
- case MODENA_HIGH_CONTRAST_WHITE_ON_BLACK:
+ case "MODENA_HIGH_CONTRAST_WHITE_ON_BLACK":
if (modenaHighContrastWhiteonblackThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA;
}
break;
- case MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK:
+ case "MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK":
break;
- case MODENA_TOUCH_HIGH_CONTRAST_BLACK_ON_WHITE:
+ case "MODENA_TOUCH_HIGH_CONTRAST_BLACK_ON_WHITE":
if (modenaHighContrastWhiteonblackThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_TOUCH_HIGH_CONTRAST_WHITE_ON_BLACK;
}
break;
- case MODENA_TOUCH_HIGH_CONTRAST_WHITE_ON_BLACK:
+ case "MODENA_TOUCH_HIGH_CONTRAST_WHITE_ON_BLACK":
if (modenaHighContrastWhiteonblackThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_TOUCH;
}
break;
- case MODENA_TOUCH_HIGH_CONTRAST_YELLOW_ON_BLACK:
+ case "MODENA_TOUCH_HIGH_CONTRAST_YELLOW_ON_BLACK":
if (modenaHighContrastWhiteonblackThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_TOUCH_HIGH_CONTRAST_WHITE_ON_BLACK;
}
@@ -2232,38 +2229,33 @@ public void perform() {
break;
}
break;
- case MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK:
- switch (currentTheme) {
- case MODENA:
+ case "MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK":
+ switch (currentTheme.name()) {
+ case "MODENA":
if (modenaHighContrastYellowonblackThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK;
}
break;
- case MODENA_TOUCH:
+ case "MODENA_TOUCH":
if (modenaHighContrastYellowonblackThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_TOUCH_HIGH_CONTRAST_YELLOW_ON_BLACK;
}
break;
- case MODENA_HIGH_CONTRAST_BLACK_ON_WHITE:
- break;
- case MODENA_HIGH_CONTRAST_WHITE_ON_BLACK:
+ case "MODENA_HIGH_CONTRAST_BLACK_ON_WHITE":
+ case "MODENA_HIGH_CONTRAST_WHITE_ON_BLACK":
break;
- case MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK:
+ case "MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK":
if (modenaHighContrastYellowonblackThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA;
}
break;
- case MODENA_TOUCH_HIGH_CONTRAST_BLACK_ON_WHITE:
+ case "MODENA_TOUCH_HIGH_CONTRAST_BLACK_ON_WHITE":
+ case "MODENA_TOUCH_HIGH_CONTRAST_WHITE_ON_BLACK":
if (modenaHighContrastYellowonblackThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_TOUCH_HIGH_CONTRAST_YELLOW_ON_BLACK;
}
break;
- case MODENA_TOUCH_HIGH_CONTRAST_WHITE_ON_BLACK:
- if (modenaHighContrastYellowonblackThemeMenuItem.isSelected()) {
- overridingTheme = EditorPlatform.Theme.MODENA_TOUCH_HIGH_CONTRAST_YELLOW_ON_BLACK;
- }
- break;
- case MODENA_TOUCH_HIGH_CONTRAST_YELLOW_ON_BLACK:
+ case "MODENA_TOUCH_HIGH_CONTRAST_YELLOW_ON_BLACK":
if (modenaHighContrastYellowonblackThemeMenuItem.isSelected()) {
overridingTheme = EditorPlatform.Theme.MODENA_TOUCH;
}
@@ -2278,10 +2270,10 @@ public void perform() {
}
documentWindowController.getEditorController().setTheme(overridingTheme);
- if (overridingTheme == EditorPlatform.Theme.GLUON_MOBILE_LIGHT) {
- documentWindowController.getEditorController().setGluonTheme(EditorPlatform.GluonTheme.LIGHT);
- } else if (overridingTheme == EditorPlatform.Theme.GLUON_MOBILE_DARK) {
- documentWindowController.getEditorController().setGluonTheme(EditorPlatform.GluonTheme.DARK);
+ if (GluonEditorPlatform.isGluonMobileLight(overridingTheme)) {
+ GluonEditorController.getInstance().setGluonTheme(GluonEditorPlatform.GLUON_MOBILE_LIGHT);
+ } else if (GluonEditorPlatform.isGluonMobileDark(overridingTheme)) {
+ GluonEditorController.getInstance().setGluonTheme(GluonEditorPlatform.GLUON_MOBILE_DARK);
}
}
@@ -2295,52 +2287,34 @@ public boolean isSelected() {
final EditorPlatform.Theme currentTheme
= documentWindowController.getEditorController().getTheme();
- switch (theme) {
- case GLUON_MOBILE_LIGHT:
- res = EditorPlatform.isGluonMobileLight(currentTheme);
- break;
- case GLUON_MOBILE_DARK:
- res = EditorPlatform.isGluonMobileDark(currentTheme);
- break;
+ res = switch (theme.name()) {
+ case "GLUON_MOBILE_LIGHT" -> GluonEditorPlatform.GLUON_MOBILE_LIGHT == currentTheme;
+ case "GLUON_MOBILE_DARK" -> GluonEditorPlatform.GLUON_MOBILE_DARK == currentTheme;
// CASPIAN_HIGH_CONTRAST can be selected only if another CASPIAN
// theme is active.
- case CASPIAN_HIGH_CONTRAST:
- res = EditorPlatform.isCaspian(currentTheme);
- break;
- case CASPIAN:
- res = (currentTheme == theme || currentTheme == EditorPlatform.Theme.CASPIAN_HIGH_CONTRAST);
- break;
- case CASPIAN_EMBEDDED:
- res = (currentTheme == theme || currentTheme == EditorPlatform.Theme.CASPIAN_EMBEDDED_HIGH_CONTRAST);
- break;
- case CASPIAN_EMBEDDED_QVGA:
- res = (currentTheme == theme || currentTheme == EditorPlatform.Theme.CASPIAN_EMBEDDED_QVGA_HIGH_CONTRAST);
- break;
- case MODENA_HIGH_CONTRAST_BLACK_ON_WHITE:
- res = EditorPlatform.isModenaBlackOnWhite(currentTheme)
- && EditorPlatform.isModenaHighContrast(currentTheme);
- break;
- case MODENA_HIGH_CONTRAST_WHITE_ON_BLACK:
- res = EditorPlatform.isModenaWhiteOnBlack(currentTheme)
- && EditorPlatform.isModenaHighContrast(currentTheme);
- break;
- case MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK:
- res = EditorPlatform.isModenaYellowOnBlack(currentTheme)
- && EditorPlatform.isModenaHighContrast(currentTheme);
- break;
- case MODENA:
- res = (currentTheme == theme
- || (EditorPlatform.isModenaHighContrast(currentTheme)
- && !EditorPlatform.isModenaTouch(currentTheme)));
- break;
- case MODENA_TOUCH:
- res = (currentTheme == theme || EditorPlatform.isModenaTouchHighContrast(currentTheme));
- break;
- default:
+ case "CASPIAN_HIGH_CONTRAST" -> EditorPlatform.isCaspian(currentTheme);
+ case "CASPIAN" ->
+ (currentTheme == theme || currentTheme == EditorPlatform.Theme.CASPIAN_HIGH_CONTRAST);
+ case "CASPIAN_EMBEDDED" ->
+ (currentTheme == theme || currentTheme == EditorPlatform.Theme.CASPIAN_EMBEDDED_HIGH_CONTRAST);
+ case "CASPIAN_EMBEDDED_QVGA" ->
+ (currentTheme == theme || currentTheme == EditorPlatform.Theme.CASPIAN_EMBEDDED_QVGA_HIGH_CONTRAST);
+ case "MODENA_HIGH_CONTRAST_BLACK_ON_WHITE" -> EditorPlatform.isModenaBlackOnWhite(currentTheme)
+ && EditorPlatform.isModenaHighContrast(currentTheme);
+ case "MODENA_HIGH_CONTRAST_WHITE_ON_BLACK" -> EditorPlatform.isModenaWhiteOnBlack(currentTheme)
+ && EditorPlatform.isModenaHighContrast(currentTheme);
+ case "MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK" -> EditorPlatform.isModenaYellowOnBlack(currentTheme)
+ && EditorPlatform.isModenaHighContrast(currentTheme);
+ case "MODENA" -> (currentTheme == theme
+ || (EditorPlatform.isModenaHighContrast(currentTheme)
+ && !EditorPlatform.isModenaTouch(currentTheme)));
+ case "MODENA_TOUCH" ->
+ (currentTheme == theme || EditorPlatform.isModenaTouchHighContrast(currentTheme));
+ default -> {
assert false;
- res = false;
- break;
- }
+ yield false;
+ }
+ };
}
return res;
@@ -2349,13 +2323,13 @@ public boolean isSelected() {
class GluonActionController extends MenuItemController {
- private EditorPlatform.GluonSwatch gluonSwatch;
+ private final EditorPlatform.Theme gluonSwatch;
- public GluonActionController(EditorPlatform.GluonSwatch gluonSwatch) {
+ public GluonActionController(EditorPlatform.Theme gluonSwatch) {
this.gluonSwatch = gluonSwatch;
}
- public EditorPlatform.GluonSwatch getSwatch() {
+ public EditorPlatform.Theme getSwatch() {
return gluonSwatch;
}
@@ -2363,12 +2337,12 @@ public EditorPlatform.GluonSwatch getSwatch() {
public boolean canPerform() {
EditorPlatform.Theme currentTheme
= documentWindowController.getEditorController().getTheme();
- return currentTheme.equals(EditorPlatform.Theme.GLUON_MOBILE_LIGHT) || currentTheme.equals(EditorPlatform.Theme.GLUON_MOBILE_DARK);
+ return GluonEditorPlatform.isGluonMobileLight(currentTheme) || GluonEditorPlatform.isGluonMobileDark(currentTheme);
}
@Override
public void perform() {
- documentWindowController.getEditorController().setGluonSwatch(gluonSwatch);
+ GluonEditorController.getInstance().setGluonSwatch(gluonSwatch);
}
@Override
@@ -2377,7 +2351,7 @@ public boolean isSelected() {
if (documentWindowController == null) {
res = false;
} else if (gluonSwatch != null) {
- res = gluonSwatch == documentWindowController.getEditorController().getGluonSwatch();
+ res = gluonSwatch == GluonEditorController.getInstance().getGluonSwatch();
}
return res;
}
diff --git a/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesController.java b/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesController.java
index cf33a7ebf..9925fa096 100644
--- a/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesController.java
+++ b/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesController.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 Gluon and/or its affiliates.
+ * Copyright (c) 2016, 2024 Gluon and/or its affiliates.
* Copyright (c) 2012, 2014, Oracle and/or its affiliates.
* All rights reserved. Use is subject to license terms.
*
@@ -45,7 +45,7 @@
/**
* Defines preferences for Scene Builder App.
*/
-public class PreferencesController extends PreferencesControllerBase{
+public class PreferencesController extends PreferencesControllerBase {
/***************************************************************************
* *
@@ -86,6 +86,9 @@ public class PreferencesController extends PreferencesControllerBase{
static final String BOTTOM_DIVIDER_VPOS = "bottomDividerVPos"; //NOI18N
static final String LEFT_DIVIDER_VPOS = "leftDividerVPos"; //NOI18N
+ static final String GLUON_SWATCH = "gluonSwatch";
+ static final String GLUON_THEME = "gluonTheme";
+
private static PreferencesController singleton;
/***************************************************************************
diff --git a/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesRecordDocument.java b/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesRecordDocument.java
index 722c7d831..c4285cf0b 100644
--- a/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesRecordDocument.java
+++ b/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesRecordDocument.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Gluon and/or its affiliates.
+ * Copyright (c) 2016, 2024, Gluon and/or its affiliates.
* Copyright (c) 2012, 2014, Oracle and/or its affiliates.
* All rights reserved. Use is subject to license terms.
*
@@ -32,14 +32,16 @@
*/
package com.oracle.javafx.scenebuilder.app.preferences;
+import com.gluonhq.scenebuilder.plugins.editor.GluonEditorController;
+import com.gluonhq.scenebuilder.plugins.editor.GluonEditorPlatform;
import com.oracle.javafx.scenebuilder.app.DocumentWindowController;
import com.oracle.javafx.scenebuilder.app.SplitController;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.BOTTOM_DIVIDER_VPOS;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.BOTTOM_VISIBLE;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.DOCUMENT_VISIBLE;
-import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesControllerBase.GLUON_SWATCH;
-import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesControllerBase.GLUON_THEME;
+import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.GLUON_SWATCH;
+import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.GLUON_THEME;
import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesControllerBase.I18N_RESOURCE;
import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesControllerBase.STAGE_HEIGHT;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.INSPECTOR_SECTION_ID;
@@ -76,7 +78,6 @@
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.Accordion;
-import javafx.scene.control.TitledPane;
import javafx.stage.Stage;
/**
@@ -120,8 +121,8 @@ public class PreferencesRecordDocument {
private final List sceneStyleSheets = new ArrayList<>();
private String I18NResource = null;
private EditorPlatform.Theme theme;
- private EditorPlatform.GluonSwatch gluonSwatch;
- private EditorPlatform.GluonTheme gluonTheme;
+ private EditorPlatform.Theme gluonSwatch;
+ private EditorPlatform.Theme gluonTheme;
private Preferences documentPreferences;
private final Preferences documentsRootPreferences; // preference root node for all documents records
@@ -140,20 +141,19 @@ public PreferencesRecordDocument(Preferences documentsRootPreferences, DocumentW
// Add stage X and Y listeners
final Stage stage = documentWindowController.getStage();
assert stage != null;
- stage.xProperty().addListener((ChangeListener) (ov, t, t1) -> setXPos(t1.doubleValue()));
- stage.yProperty().addListener((ChangeListener) (ov, t, t1) -> setYPos(t1.doubleValue()));
-
+ stage.xProperty().addListener((ov, t, t1) -> setXPos(t1.doubleValue()));
+ stage.yProperty().addListener((ov, t, t1) -> setYPos(t1.doubleValue()));
// Add stage height and width listeners
- stage.heightProperty().addListener((ChangeListener) (ov, t, t1) -> setStageHeight(t1.doubleValue()));
- stage.widthProperty().addListener((ChangeListener) (ov, t, t1) -> setStageWidth(t1.doubleValue()));
+ stage.heightProperty().addListener((ov, t, t1) -> setStageHeight(t1.doubleValue()));
+ stage.widthProperty().addListener((ov, t, t1) -> setStageWidth(t1.doubleValue()));
// Add inspector accordion expanded pane listener
final InspectorPanelController ipc = documentWindowController.getInspectorPanelController();
assert ipc != null;
final Accordion accordion = ipc.getAccordion();
assert accordion != null;
- accordion.expandedPaneProperty().addListener((ChangeListener) (ov, t, t1) -> setInspectorSectionId(ipc.getExpandedSectionId()));
+ accordion.expandedPaneProperty().addListener((ov, t, t1) -> setInspectorSectionId(ipc.getExpandedSectionId()));
// Add dividers position listeners
final SplitController lhsc = documentWindowController.getLeftSplitController();
@@ -171,8 +171,8 @@ public PreferencesRecordDocument(Preferences documentsRootPreferences, DocumentW
// Add theme and Gluon theme listener
ec.themeProperty().addListener(((observable, oldValue, newValue) -> setTheme(newValue)));
- ec.gluonSwatchProperty().addListener(((observable, oldValue, newValue) -> setGluonSwatch(newValue)));
- ec.gluonThemeProperty().addListener(((observable, oldValue, newValue) -> setGluonTheme(newValue)));
+ GluonEditorController.getInstance().gluonSwatchProperty().addListener(((observable, oldValue, newValue) -> setGluonSwatch(newValue)));
+ GluonEditorController.getInstance().gluonThemeProperty().addListener(((observable, oldValue, newValue) -> setGluonTheme(newValue)));
}
public void resetDocumentPreferences() {
@@ -338,24 +338,24 @@ private EditorPlatform.Theme getTheme() {
return theme;
}
- public void setGluonSwatch(EditorPlatform.GluonSwatch gluonSwatch) {
+ public void setGluonSwatch(EditorPlatform.Theme gluonSwatch) {
this.gluonSwatch = gluonSwatch;
}
- public EditorPlatform.GluonSwatch getGluonSwatch() {
+ public EditorPlatform.Theme getGluonSwatch() {
if (gluonSwatch == null) {
- return documentWindowController.getEditorController().getGluonSwatch();
+ return GluonEditorController.getInstance().getGluonSwatch();
}
return gluonSwatch;
}
- public void setGluonTheme(EditorPlatform.GluonTheme gluonTheme) {
+ public void setGluonTheme(EditorPlatform.Theme gluonTheme) {
this.gluonTheme = gluonTheme;
}
- public EditorPlatform.GluonTheme getGluonTheme() {
+ public EditorPlatform.Theme getGluonTheme() {
if (gluonTheme == null) {
- return documentWindowController.getEditorController().getGluonTheme();
+ return GluonEditorController.getInstance().getGluonTheme();
}
return gluonTheme;
}
@@ -489,18 +489,14 @@ public void refreshGluonSwatch() {
if (gluonSwatch == null) {
return;
}
-
- EditorController editorController = documentWindowController.getEditorController();
- editorController.setGluonSwatch(gluonSwatch);
+ GluonEditorController.getInstance().setGluonSwatch(gluonSwatch);
}
public void refreshGluonTheme() {
if (gluonTheme == null) {
return;
}
-
- EditorController editorController = documentWindowController.getEditorController();
- editorController.setGluonTheme(gluonTheme);
+ GluonEditorController.getInstance().setGluonTheme(gluonTheme);
}
public void refresh() {
@@ -546,7 +542,7 @@ public void readFromJavaPreferences() {
for (String child : childrenNames) {
final Preferences pref = documentsRootPreferences.node(child);
final String nodePath = pref.get(PATH, null);
- assert nodePath != null && nodePath.isEmpty() == false; // Each document node defines a path
+ assert nodePath != null && !nodePath.isEmpty(); // Each document node defines a path
if (filePath.equals(nodePath)) {
documentPreferences = pref;
break;
@@ -634,7 +630,7 @@ public void readFromJavaPreferences() {
// Scene style sheets
final String items = documentPreferences.get(SCENE_STYLE_SHEETS, null);
if (items != null) {
- final String[] itemsArray = items.split("\\" + File.pathSeparator); //NOI18N
+ final String[] itemsArray = items.split(File.pathSeparator); //NOI18N
sceneStyleSheets.addAll(Arrays.asList(itemsArray));
}
@@ -652,16 +648,16 @@ public void readFromJavaPreferences() {
final String gluonSwatch = documentPreferences.get(GLUON_SWATCH, null);
if (gluonSwatch != null) {
- setGluonSwatch(EditorPlatform.GluonSwatch.valueOf(gluonSwatch));
+ setGluonSwatch(EditorPlatform.Theme.valueOf(gluonSwatch));
} else {
- setGluonSwatch(documentWindowController.getEditorController().getGluonSwatch());
+ setGluonSwatch(GluonEditorController.getInstance().getGluonSwatch());
}
final String gluonTheme = documentPreferences.get(GLUON_THEME, null);
if (gluonTheme != null) {
- setGluonTheme(EditorPlatform.GluonTheme.valueOf(gluonTheme));
+ setGluonTheme(EditorPlatform.Theme.valueOf(gluonTheme));
} else {
- setGluonTheme(documentWindowController.getEditorController().getGluonTheme());
+ setGluonTheme(GluonEditorController.getInstance().getGluonTheme());
}
}
@@ -684,7 +680,7 @@ public void writeToJavaPreferences() {
final File fxmlFile = new File(fxmlLocation.toURI());
final String filePath = fxmlFile.getPath();
final String key = generateKey(fxmlFile.getName());
- assert documentsRootPreferences.nodeExists(key) == false;
+ assert !documentsRootPreferences.nodeExists(key);
// Create a new document preference node under the document root node
documentPreferences = documentsRootPreferences.node(key);
// Document path
@@ -744,7 +740,7 @@ public void writeToJavaPreferences() {
// Theme and Gluon Theme
final EditorPlatform.Theme docTheme = getTheme();
documentPreferences.put(THEME, docTheme.name());
- if (docTheme == EditorPlatform.Theme.GLUON_MOBILE_LIGHT || docTheme == EditorPlatform.Theme.GLUON_MOBILE_DARK) {
+ if (GluonEditorPlatform.isGluonMobileLight(docTheme) || GluonEditorPlatform.isGluonMobileDark(docTheme)) {
documentPreferences.put(GLUON_SWATCH, getGluonSwatch().name());
documentPreferences.put(GLUON_THEME, getGluonTheme().name());
} else {
diff --git a/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesRecordGlobal.java b/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesRecordGlobal.java
index 70986c61f..afc7a758c 100644
--- a/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesRecordGlobal.java
+++ b/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesRecordGlobal.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2022, Gluon and/or its affiliates.
+ * Copyright (c) 2016, 2024, Gluon and/or its affiliates.
* Copyright (c) 2012, 2014, Oracle and/or its affiliates.
* All rights reserved. Use is subject to license terms.
*
@@ -32,6 +32,7 @@
*/
package com.oracle.javafx.scenebuilder.app.preferences;
+import com.gluonhq.scenebuilder.plugins.editor.GluonEditorPlatform;
import com.oracle.javafx.scenebuilder.kit.ToolTheme;
import com.oracle.javafx.scenebuilder.app.i18n.I18N;
import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform;
@@ -100,7 +101,12 @@ public String toString() {
static final boolean DEFAULT_ACCORDION_ANIMATION = true;
static final boolean DEFAULT_WILDCARD_IMPORTS = false;
static final boolean DEFAULT_ALTERNATE_TEXT_INPUT_PASTE = EditorPlatform.IS_MAC;
-
+
+ static final EditorPlatform.Theme DEFAULT_GLUON_SWATCH = GluonEditorPlatform.DEFAULT_GLUON_SWATCH;
+ static final EditorPlatform.Theme DEFAULT_GLUON_THEME = GluonEditorPlatform.DEFAULT_GLUON_THEME;
+
+ private EditorPlatform.Theme gluonSwatch = DEFAULT_GLUON_SWATCH;
+ private EditorPlatform.Theme gluonTheme = DEFAULT_GLUON_THEME;
/***************************************************************************
* *
* Instance fields *
@@ -154,6 +160,14 @@ public ToolTheme getToolTheme() {
public void setToolTheme(ToolTheme value) {
toolTheme = value;
}
+
+ public EditorPlatform.Theme getSwatch() { return gluonSwatch; }
+
+ public void setSwatch(EditorPlatform.Theme swatch) { this.gluonSwatch = swatch; }
+
+ public EditorPlatform.Theme getGluonTheme() { return gluonTheme; }
+
+ public void setGluonTheme(EditorPlatform.Theme theme) { this.gluonTheme = theme; }
public DISPLAY_MODE getLibraryDisplayOption() {
return libraryDisplayOption;
@@ -409,6 +423,12 @@ public void readFromJavaPreferences() {
setRootContainerWidth(DEFAULT_ROOT_CONTAINER_WIDTH);
}
+ // Gluon themes
+ String swatchName = applicationRootPreferences.get(PreferencesController.GLUON_SWATCH, DEFAULT_GLUON_SWATCH.name());
+ gluonSwatch = GluonEditorPlatform.swatchValueOf(swatchName);
+ String gluonThemeName = applicationRootPreferences.get(PreferencesController.GLUON_THEME, DEFAULT_GLUON_THEME.name());
+ gluonTheme = EditorPlatform.Theme.valueOf(gluonThemeName);
+
// Tool Theme
final String tool_theme = applicationRootPreferences.get(TOOL_THEME,
DEFAULT_TOOL_THEME.name());
@@ -438,7 +458,7 @@ public void readFromJavaPreferences() {
final String items = applicationRootPreferences.get(RECENT_ITEMS, null);
assert recentItems.isEmpty();
if (items != null && !items.isEmpty()) {
- final String[] itemsArray = items.split("\\" + File.pathSeparator); //NOI18N
+ final String[] itemsArray = items.split(File.pathSeparator); //NOI18N
assert itemsArray.length <= recentItemsSize;
recentItems.addAll(Arrays.asList(itemsArray));
}
@@ -493,6 +513,12 @@ public void writeToJavaPreferences(String key) {
case TOOL_THEME:
applicationRootPreferences.put(TOOL_THEME, getToolTheme().name());
break;
+ case PreferencesController.GLUON_SWATCH:
+ applicationRootPreferences.put(PreferencesController.GLUON_SWATCH, getSwatch().name());
+ break;
+ case PreferencesController.GLUON_THEME:
+ applicationRootPreferences.put(PreferencesController.GLUON_THEME, getGluonTheme().name());
+ break;
case PreferencesControllerBase.LIBRARY_DISPLAY_OPTION:
applicationRootPreferences.put(PreferencesControllerBase.LIBRARY_DISPLAY_OPTION, getLibraryDisplayOption().name());
break;
diff --git a/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesWindowController.java b/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesWindowController.java
index 57a3774ed..055f17f7c 100644
--- a/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesWindowController.java
+++ b/app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesWindowController.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2022, Gluon and/or its affiliates.
+ * Copyright (c) 2016, 2024, Gluon and/or its affiliates.
* Copyright (c) 2012, 2014, Oracle and/or its affiliates.
* All rights reserved. Use is subject to license terms.
*
@@ -32,14 +32,13 @@
*/
package com.oracle.javafx.scenebuilder.app.preferences;
+import com.gluonhq.scenebuilder.plugins.editor.GluonEditorPlatform;
import com.oracle.javafx.scenebuilder.app.SceneBuilderApp;
import com.oracle.javafx.scenebuilder.kit.ToolTheme;
import com.oracle.javafx.scenebuilder.app.i18n.I18N;
import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesControllerBase.ALIGNMENT_GUIDES_COLOR;
import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesControllerBase.BACKGROUND_IMAGE;
-import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesControllerBase.GLUON_SWATCH;
-import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesControllerBase.GLUON_THEME;
import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesControllerBase.ROOT_CONTAINER_HEIGHT;
import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesControllerBase.ROOT_CONTAINER_WIDTH;
import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesControllerBase.HIERARCHY_DISPLAY_OPTION;
@@ -49,6 +48,8 @@
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.ACCORDION_ANIMATION;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.CSS_TABLE_COLUMNS_ORDERING_REVERSED;
+import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.GLUON_SWATCH;
+import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.GLUON_THEME;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.RECENT_ITEMS;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.RECENT_ITEMS_SIZE;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.TOOL_THEME;
@@ -58,10 +59,10 @@
import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesRecordGlobalBase.DEFAULT_ALIGNMENT_GUIDES_COLOR;
import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesRecordGlobalBase.DEFAULT_BACKGROUND_IMAGE;
import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesRecordGlobalBase.DEFAULT_PARENT_RING_COLOR;
-import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesRecordGlobalBase.DEFAULT_SWATCH;
import static com.oracle.javafx.scenebuilder.kit.preferences.PreferencesRecordGlobalBase.DEFAULT_THEME;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesRecordGlobal.DEFAULT_TOOL_THEME;
+import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesRecordGlobal.DEFAULT_GLUON_SWATCH;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesRecordGlobal.recentItemsSizes;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesRecordGlobal.DEFAULT_HIERARCHY_DISPLAY_OPTION;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesRecordGlobal.DEFAULT_LIBRARY_DISPLAY_OPTION;
@@ -82,7 +83,6 @@
import com.oracle.javafx.scenebuilder.kit.util.control.paintpicker.PaintPicker.Mode;
import java.util.Arrays;
-import java.util.List;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
@@ -137,7 +137,7 @@ public class PreferencesWindowController extends AbstractFxmlWindowController {
@FXML
private ChoiceBox themes;
@FXML
- private ChoiceBox gluonSwatch;
+ private ChoiceBox gluonSwatch;
@FXML
private CheckBox animateAccordion;
@FXML
@@ -245,14 +245,11 @@ protected void controllerDidLoadFxml() {
cssAnalyzerColumnsOrder.getSelectionModel().selectedItemProperty().addListener(new ColumnOrderListener());
// Theme and Gluon Theme
- themes.getItems().setAll(Arrays.asList(EditorPlatform.Theme.class.getEnumConstants()));
+ themes.getItems().setAll(EditorPlatform.Theme.getThemeList());
themes.setValue(recordGlobal.getTheme());
themes.getSelectionModel().selectedItemProperty().addListener(new ThemesListener());
- List gluonSwatches = Arrays.asList(EditorPlatform.GluonSwatch.class.getEnumConstants());
- // Sort alphabetically
- gluonSwatches.sort((s1, s2) -> s1.toString().compareTo(s2.toString()));
- gluonSwatch.getItems().setAll(gluonSwatches);
+ gluonSwatch.getItems().setAll(GluonEditorPlatform.getGluonSwatchList());
gluonSwatch.setValue(recordGlobal.getSwatch());
gluonSwatch.getSelectionModel().selectedItemProperty().addListener(new SwatchListener());
@@ -342,7 +339,7 @@ void resetToDefaultAction(ActionEvent event) {
themes.setValue(DEFAULT_THEME);
// Default Gluon swatch
- gluonSwatch.setValue(DEFAULT_SWATCH);
+ gluonSwatch.setValue(DEFAULT_GLUON_SWATCH);
// Default Accordion Animation
animateAccordion.setSelected(DEFAULT_ACCORDION_ANIMATION);
@@ -461,9 +458,9 @@ public void changed(ObservableValue extends EditorPlatform.Theme> observable,
}
}
- private static class SwatchListener implements ChangeListener {
+ private static class SwatchListener implements ChangeListener {
@Override
- public void changed(ObservableValue extends EditorPlatform.GluonSwatch> observable, EditorPlatform.GluonSwatch oldValue, EditorPlatform.GluonSwatch newValue) {
+ public void changed(ObservableValue extends EditorPlatform.Theme> observable, EditorPlatform.Theme oldValue, EditorPlatform.Theme newValue) {
final PreferencesController preferencesController
= PreferencesController.getSingleton();
final PreferencesRecordGlobal recordGlobal
@@ -477,9 +474,9 @@ public void changed(ObservableValue extends EditorPlatform.GluonSwatch> observ
}
}
- private static class GluonThemeListener implements ChangeListener {
+ private static class GluonThemeListener implements ChangeListener {
@Override
- public void changed(ObservableValue extends EditorPlatform.GluonTheme> observable, EditorPlatform.GluonTheme oldValue, EditorPlatform.GluonTheme newValue) {
+ public void changed(ObservableValue extends EditorPlatform.Theme> observable, EditorPlatform.Theme oldValue, EditorPlatform.Theme newValue) {
final PreferencesController preferencesController
= PreferencesController.getSingleton();
final PreferencesRecordGlobal recordGlobal
diff --git a/app/src/main/java/module-info.java b/app/src/main/java/module-info.java
index 31f010d22..e66a94de1 100644
--- a/app/src/main/java/module-info.java
+++ b/app/src/main/java/module-info.java
@@ -36,6 +36,7 @@
requires javafx.media;
requires javafx.swing;
requires transitive com.gluonhq.scenebuilder.kit;
+ requires transitive com.gluonhq.scenebuilder.gluon.plugin;
requires java.logging;
requires java.prefs;
requires javax.json.api;
diff --git a/gluon-plugin/pom.xml b/gluon-plugin/pom.xml
new file mode 100644
index 000000000..ff72a6f87
--- /dev/null
+++ b/gluon-plugin/pom.xml
@@ -0,0 +1,58 @@
+
+ 4.0.0
+ gluon-plugin
+ Gluon Plugin for Scene Builder
+
+
+ com.gluonhq.scenebuilder
+ parent
+ 24.0.0-SNAPSHOT
+
+
+
+ 6.2.3
+ 4.0.21
+
+
+
+
+ com.gluonhq.scenebuilder
+ kit
+ ${project.version}
+
+
+
+
+ com.gluonhq
+ charm-glisten
+ ${charm.glisten.version}
+
+
+ com.gluonhq.attach
+ display
+ ${gluon.attach.version}
+ desktop
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.2.0
+
+ scenebuilder-gluon-plugin-${project.version}
+ target/lib
+
+
+ com.gluonhq.scenebuilder.gluon.plugin
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonDesignHierarchyMaskProvider.java b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonDesignHierarchyMaskProvider.java
new file mode 100644
index 000000000..27f497231
--- /dev/null
+++ b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonDesignHierarchyMaskProvider.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2024, Gluon and/or its affiliates.
+ * All rights reserved. Use is subject to license terms.
+ *
+ * This file is available and licensed under the following license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the distribution.
+ * - Neither the name of Gluon nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.gluonhq.scenebuilder.plugins;
+
+import com.gluonhq.charm.glisten.control.BottomNavigation;
+import com.gluonhq.charm.glisten.control.DropdownButton;
+import com.gluonhq.charm.glisten.control.ExpansionPanel;
+import com.gluonhq.charm.glisten.control.ToggleButtonGroup;
+import com.gluonhq.scenebuilder.plugins.hierarchy.HierarchyItemExpandedPanel;
+import com.gluonhq.scenebuilder.plugins.hierarchy.HierarchyItemExpansionPanel;
+import com.oracle.javafx.scenebuilder.kit.editor.panel.hierarchy.HierarchyItem;
+import com.oracle.javafx.scenebuilder.kit.fxom.FXOMObject;
+import com.oracle.javafx.scenebuilder.kit.metadata.util.DesignHierarchyMask;
+import com.oracle.javafx.scenebuilder.kit.metadata.util.ExternalDesignHierarchyMaskProvider;
+import com.oracle.javafx.scenebuilder.kit.metadata.util.PropertyName;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.BiFunction;
+import java.util.function.Predicate;
+
+public class GluonDesignHierarchyMaskProvider implements ExternalDesignHierarchyMaskProvider {
+
+ // ExpansionPanel
+ private static final DesignHierarchyMask.Accessory EXPANDED_CONTENT =
+ new DesignHierarchyMask.Accessory("EXPANDED_CONTENT", new PropertyName("expandedContent"), javafx.scene.Node.class, o -> true);
+ private static final DesignHierarchyMask.Accessory COLLAPSED_CONTENT =
+ new DesignHierarchyMask.Accessory("COLLAPSED_CONTENT", new PropertyName("collapsedContent"), javafx.scene.Node.class, o -> true);
+ // ExpansionPanel.ExpandedPanel
+ private static final DesignHierarchyMask.Accessory EX_CONTENT =
+ new DesignHierarchyMask.Accessory("CONTENT", new PropertyName("content"), javafx.scene.Node.class, o -> true);
+
+ @Override
+ public List> getExternalNonResizableItems() {
+ return List.of(
+ BottomNavigation.class,
+ DropdownButton.class,
+ ExpansionPanel.CollapsedPanel.class,
+ ExpansionPanel.ExpandedPanel.class,
+ ToggleButtonGroup.class);
+ }
+
+ @Override
+ public List getExternalAccessories() {
+ return List.of(EXPANDED_CONTENT, COLLAPSED_CONTENT, EX_CONTENT);
+ }
+
+ @Override
+ public Predicate