From 8667b3a1f7d59bda25532702193e2a68983cf8ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pereda?= Date: Tue, 15 Oct 2024 14:46:16 +0200 Subject: [PATCH] Move Gluon components out of Kit into new Gluon-plugin module (#748) * 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 --- README.md | 13 +- app/pom.xml | 5 + .../app/DocumentWindowController.java | 13 +- .../scenebuilder/app/SceneBuilderApp.java | 16 +- .../app/menubar/MenuBarController.java | 236 ++++---- .../preferences/PreferencesController.java | 7 +- .../PreferencesRecordDocument.java | 64 +-- .../preferences/PreferencesRecordGlobal.java | 32 +- .../PreferencesWindowController.java | 29 +- app/src/main/java/module-info.java | 1 + gluon-plugin/pom.xml | 58 ++ .../GluonDesignHierarchyMaskProvider.java | 112 ++++ .../plugins/GluonExternalThemeProvider.java | 99 ++++ .../plugins/GluonMetadataProvider.java | 256 +++++++++ .../plugins/GluonSectionProvider.java | 101 ++++ .../alert/ImportingGluonControlsAlert.java | 9 +- .../plugins}/alert/WarnThemeAlert.java | 35 +- .../plugins/editor/GluonEditorController.java | 113 ++++ .../plugins/editor/GluonEditorPlatform.java | 189 ++++++ .../hierarchy/HierarchyItemExpandedPanel.java | 27 +- .../HierarchyItemExpansionPanel.java | 20 +- .../scenebuilder/plugins/i18n/I18N.java | 66 +++ gluon-plugin/src/main/java/module-info.java | 52 ++ gluon-plugin/src/main/resources/LICENSE.txt | 30 + .../plugins}/css/GluonDocument.css | 2 +- .../editor/images/nodeicons/AppBar.png | Bin .../editor/images/nodeicons/AppBar@2x.png | Bin .../nodeicons/AutoCompleteTextField.png | Bin .../nodeicons/AutoCompleteTextField@2x.png | Bin .../editor/images/nodeicons/Avatar.png | Bin .../editor/images/nodeicons/Avatar@2x.png | Bin .../images/nodeicons/BottomNavigation.png | Bin .../images/nodeicons/BottomNavigation@2x.png | Bin .../nodeicons/BottomNavigationButton.png | Bin .../nodeicons/BottomNavigationButton@2x.png | Bin .../editor/images/nodeicons/CardPane.png | Bin .../editor/images/nodeicons/CardPane@2x.png | Bin .../editor/images/nodeicons/CharmListView.png | Bin .../images/nodeicons/CharmListView@2x.png | Bin .../plugins/editor/images/nodeicons/Chip.png | Bin .../editor/images/nodeicons/Chip@2x.png | Bin .../images/nodeicons/CollapsedPanel.png | Bin .../images/nodeicons/CollapsedPanel@2x.png | Bin .../editor/images/nodeicons/Dialog.png | Bin .../editor/images/nodeicons/Dialog@2x.png | Bin .../images/nodeicons/DropdownButton.png | Bin .../images/nodeicons/DropdownButton@2x.png | Bin .../editor/images/nodeicons/ExpandedPanel.png | Bin .../images/nodeicons/ExpandedPanel@2x.png | Bin .../ExpansionPanel-collapsed_content.png | Bin 0 -> 271 bytes .../ExpansionPanel-collapsed_content@2x.png | Bin 0 -> 476 bytes .../ExpansionPanel-expanded_content.png | Bin 0 -> 268 bytes .../ExpansionPanel-expanded_content@2x.png | Bin 0 -> 483 bytes .../images/nodeicons/ExpansionPanel.png | Bin .../images/nodeicons/ExpansionPanel@2x.png | Bin .../nodeicons/ExpansionPanelContainer.png | Bin .../nodeicons/ExpansionPanelContainer@2x.png | Bin .../images/nodeicons/FloatingActionButton.png | Bin .../nodeicons/FloatingActionButton@2x.png | Bin .../editor/images/nodeicons/Gluon_View@2x.png | Bin .../plugins/editor/images/nodeicons/Icon.png | Bin .../editor/images/nodeicons/Icon@2x.png | Bin .../plugins/editor/images/nodeicons/Layer.png | Bin .../editor/images/nodeicons/Layer@2x.png | Bin .../editor/images/nodeicons/ListTile.png | Bin .../editor/images/nodeicons/ListTile@2x.png | Bin .../editor/images/nodeicons/MenuPopupView.png | Bin .../images/nodeicons/MenuPopupView@2x.png | Bin .../images/nodeicons/MenuSidePopupView.png | Bin .../images/nodeicons/MenuSidePopupView@2x.png | Bin .../images/nodeicons/MobileLayoutPane.png | Bin .../images/nodeicons/MobileLayoutPane@2x.png | Bin .../images/nodeicons/NavigationDrawer.png | Bin .../images/nodeicons/NavigationDrawer@2x.png | Bin .../editor/images/nodeicons/PopupView.png | Bin .../editor/images/nodeicons/PopupView@2x.png | Bin .../editor/images/nodeicons/ProgressBar.png | Bin .../images/nodeicons/ProgressBar@2x.png | Bin .../images/nodeicons/ProgressIndicator.png | Bin .../images/nodeicons/ProgressIndicator@2x.png | Bin .../editor/images/nodeicons/SettingsPane.png | Bin .../images/nodeicons/SettingsPane@2x.png | Bin .../editor/images/nodeicons/SplashView.png | Bin .../editor/images/nodeicons/SplashView@2x.png | Bin .../editor/images/nodeicons/TextField.png | Bin .../editor/images/nodeicons/TextField@2x.png | Bin .../images/nodeicons/ToggleButtonGroup.png | Bin .../images/nodeicons/ToggleButtonGroup@2x.png | Bin .../plugins/editor/images/nodeicons/View.png | Bin .../i18n/SceneBuilderPlugin.properties | 72 +++ .../i18n/SceneBuilderPlugin_zh_CN.properties | 72 +++ .../plugins/library/builtin/AppBar.fxml | 2 +- .../builtin/AutoCompleteTextField.fxml | 2 +- .../plugins/library/builtin/Avatar.fxml | 2 +- .../library/builtin/BottomNavigation.fxml | 2 +- .../builtin/BottomNavigationButton.fxml | 2 +- .../plugins/library/builtin/CardPane.fxml | 2 +- .../library/builtin/CharmListView.fxml | 2 +- .../plugins/library/builtin/Chip.fxml | 2 +- .../library/builtin/CollapsedPanel.fxml | 2 +- .../plugins/library/builtin/Dialog.fxml | 2 +- .../library/builtin/DropdownButton.fxml | 2 +- .../library/builtin/ExpandedPanel.fxml | 2 +- .../library/builtin/ExpansionPanel.fxml | 2 +- .../builtin/ExpansionPanelContainer.fxml | 2 +- .../plugins/library/builtin/Icon.fxml | 2 +- .../plugins/library/builtin/Layer.fxml | 2 +- .../plugins/library/builtin/ListTile.fxml | 2 +- .../library/builtin/MenuPopupView.fxml | 2 +- .../library/builtin/MenuSidePopupView.fxml | 2 +- .../library/builtin/MobileLayoutPane.fxml | 2 +- .../library/builtin/NavigationDrawer.fxml | 2 +- .../plugins/library/builtin/PopupView.fxml | 2 +- .../plugins/library/builtin/ProgressBar.fxml | 2 +- .../library/builtin/ProgressIndicator.fxml | 2 +- .../plugins/library/builtin/SettingsPane.fxml | 2 +- .../library/builtin/SidePopupView.fxml | 2 +- .../plugins/library/builtin/SplashView.fxml | 2 +- .../plugins/library/builtin/TextField.fxml | 2 +- .../library/builtin/ToggleButtonGroup.fxml | 2 +- .../plugins/library/builtin/View.fxml | 2 +- kit/pom.xml | 13 - .../kit/editor/DocumentationUrls.java | 10 +- .../kit/editor/EditorController.java | 76 +-- .../kit/editor/EditorPlatform.java | 273 ++++----- .../kit/editor/ExternalThemeProvider.java | 88 +++ .../kit/editor/job/SetDocumentRootJob.java | 5 +- .../job/atomic/AddPropertyValueJob.java | 9 +- .../kit/editor/job/atomic/SetFxomRootJob.java | 11 +- .../panel/content/ContentPanelController.java | 35 +- .../panel/content/WorkspaceController.java | 64 +-- .../content/driver/BorderPaneDriver.java | 9 +- .../content/driver/tring/BorderPaneTring.java | 25 +- .../content/mode/EditModeController.java | 4 +- .../AbstractHierarchyPanelController.java | 98 +--- .../hierarchy/HierarchyDNDController.java | 47 +- .../editor/panel/hierarchy/HierarchyItem.java | 13 +- .../hierarchy/HierarchyItemBorderPane.java | 9 +- .../hierarchy/HierarchyItemDialogPane.java | 9 +- .../panel/hierarchy/HierarchyItemGraphic.java | 7 +- .../hierarchy/treeview/HierarchyTreeCell.java | 10 +- .../panel/inspector/editors/EditorUtils.java | 10 +- .../panel/library/ImportWindowController.java | 20 +- .../scenebuilder/kit/fxom/FXOMDocument.java | 12 +- .../scenebuilder/kit/fxom/FXOMObject.java | 7 +- .../kit/library/BuiltinLibrary.java | 116 ++-- .../kit/library/BuiltinSectionComparator.java | 5 +- .../kit/library/ExternalSectionProvider.java | 71 +++ .../kit/library/util/ExplorerBase.java | 2 +- .../kit/library/util/JarReport.java | 22 +- .../kit/library/util/JarReportEntry.java | 6 +- .../metadata/ExternalMetadataProvider.java | 55 ++ .../scenebuilder/kit/metadata/Metadata.java | 227 ++------ .../klass/ComponentClassMetadata.java | 59 +- .../metadata/util/DesignHierarchyMask.java | 536 ++++++++---------- .../ExternalDesignHierarchyMaskProvider.java | 80 +++ .../PreferencesControllerBase.java | 4 +- .../PreferencesRecordGlobalBase.java | 54 +- .../kit/preview/PreviewWindowController.java | 91 +-- .../scenebuilder/kit/util/CssInternal.java | 6 +- kit/src/main/java/module-info.java | 11 +- .../kit/i18n/SceneBuilderKit.properties | 40 +- .../kit/i18n/SceneBuilderKit_ja.properties | 40 +- .../kit/i18n/SceneBuilderKit_zh_CN.properties | 38 -- .../kit/editor/DocumentationUrlsTest.java | 8 +- pom.xml | 7 +- 166 files changed, 2516 insertions(+), 1615 deletions(-) create mode 100644 gluon-plugin/pom.xml create mode 100644 gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonDesignHierarchyMaskProvider.java create mode 100644 gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonExternalThemeProvider.java create mode 100644 gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonMetadataProvider.java create mode 100644 gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonSectionProvider.java rename {kit/src/main/java/com/oracle/javafx/scenebuilder/kit => gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins}/alert/ImportingGluonControlsAlert.java (89%) rename {kit/src/main/java/com/oracle/javafx/scenebuilder/kit => gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins}/alert/WarnThemeAlert.java (66%) create mode 100644 gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/editor/GluonEditorController.java create mode 100644 gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/editor/GluonEditorPlatform.java rename {kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel => gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins}/hierarchy/HierarchyItemExpandedPanel.java (82%) rename {kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel => gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins}/hierarchy/HierarchyItemExpansionPanel.java (83%) create mode 100644 gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/i18n/I18N.java create mode 100644 gluon-plugin/src/main/java/module-info.java create mode 100644 gluon-plugin/src/main/resources/LICENSE.txt rename {app/src/main/resources/com/oracle/javafx/scenebuilder/app => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins}/css/GluonDocument.css (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_AppBar.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/AppBar.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_AppBar@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/AppBar@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_AutoCompleteTextField.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/AutoCompleteTextField.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_AutoCompleteTextField@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/AutoCompleteTextField@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Avatar.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Avatar.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Avatar@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Avatar@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_BottomNavigation.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/BottomNavigation.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_BottomNavigation@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/BottomNavigation@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_BottomNavigationButton.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/BottomNavigationButton.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_BottomNavigationButton@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/BottomNavigationButton@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_CardPane.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CardPane.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_CardPane@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CardPane@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_CharmListView.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CharmListView.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_CharmListView@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CharmListView@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Chip.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Chip.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Chip@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Chip@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel-collapsed_content.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CollapsedPanel.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel-collapsed_content@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CollapsedPanel@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Dialog.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Dialog.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Dialog@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Dialog@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_DropdownButton.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/DropdownButton.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_DropdownButton@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/DropdownButton@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel-expanded_content.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpandedPanel.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel-expanded_content@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpandedPanel@2x.png (100%) create mode 100644 gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel-collapsed_content.png create mode 100644 gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel-collapsed_content@2x.png create mode 100644 gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel-expanded_content.png create mode 100644 gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel-expanded_content@2x.png rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanelContainer.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanelContainer.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanelContainer@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanelContainer@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_FloatingActionButton.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/FloatingActionButton.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_FloatingActionButton@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/FloatingActionButton@2x.png (100%) rename {kit/src/main/resources/com/oracle/javafx/scenebuilder/kit => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins}/editor/images/nodeicons/Gluon_View@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Icon.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Icon.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Icon@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Icon@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Layer.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Layer.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Layer@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Layer@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ListTile.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ListTile.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ListTile@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ListTile@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MenuPopupView.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MenuPopupView.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MenuPopupView@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MenuPopupView@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MenuSidePopupView.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MenuSidePopupView.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MenuSidePopupView@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MenuSidePopupView@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MobileLayoutPane.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MobileLayoutPane.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MobileLayoutPane@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MobileLayoutPane@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_NavigationDrawer.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/NavigationDrawer.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_NavigationDrawer@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/NavigationDrawer@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_PopupView.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/PopupView.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_PopupView@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/PopupView@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ProgressBar.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ProgressBar.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ProgressBar@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ProgressBar@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ProgressIndicator.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ProgressIndicator.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ProgressIndicator@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ProgressIndicator@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_SettingsPane.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/SettingsPane.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_SettingsPane@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/SettingsPane@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_SplashView.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/SplashView.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_SplashView@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/SplashView@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_TextField.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/TextField.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_TextField@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/TextField@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ToggleButtonGroup.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ToggleButtonGroup.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ToggleButtonGroup@2x.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ToggleButtonGroup@2x.png (100%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_View.png => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/View.png (100%) create mode 100644 gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/i18n/SceneBuilderPlugin.properties create mode 100644 gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/i18n/SceneBuilderPlugin_zh_CN.properties rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_AppBar.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/AppBar.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_AutoCompleteTextField.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/AutoCompleteTextField.fxml (95%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_Avatar.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/Avatar.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_BottomNavigation.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/BottomNavigation.fxml (95%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_BottomNavigationButton.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/BottomNavigationButton.fxml (95%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_CardPane.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/CardPane.fxml (95%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_CharmListView.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/CharmListView.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_Chip.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/Chip.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_CollapsedPanel.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/CollapsedPanel.fxml (95%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_Dialog.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/Dialog.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_DropdownButton.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/DropdownButton.fxml (95%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_ExpandedPanel.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/ExpandedPanel.fxml (95%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_ExpansionPanel.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/ExpansionPanel.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_ExpansionPanelContainer.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/ExpansionPanelContainer.fxml (95%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_Icon.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/Icon.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_Layer.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/Layer.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_ListTile.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/ListTile.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_MenuPopupView.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/MenuPopupView.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_MenuSidePopupView.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/MenuSidePopupView.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_MobileLayoutPane.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/MobileLayoutPane.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_NavigationDrawer.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/NavigationDrawer.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_PopupView.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/PopupView.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_ProgressBar.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/ProgressBar.fxml (95%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_ProgressIndicator.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/ProgressIndicator.fxml (95%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_SettingsPane.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/SettingsPane.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_SidePopupView.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/SidePopupView.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_SplashView.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/SplashView.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_TextField.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/TextField.fxml (94%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_ToggleButtonGroup.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/ToggleButtonGroup.fxml (95%) rename kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_View.fxml => gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/View.fxml (94%) create mode 100644 kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/ExternalThemeProvider.java create mode 100644 kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/ExternalSectionProvider.java create mode 100644 kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/ExternalMetadataProvider.java create mode 100644 kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/util/ExternalDesignHierarchyMaskProvider.java 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 observable, } } - private static class SwatchListener implements ChangeListener { + private static class SwatchListener implements ChangeListener { @Override - public void changed(ObservableValue observable, EditorPlatform.GluonSwatch oldValue, EditorPlatform.GluonSwatch newValue) { + public void changed(ObservableValue observable, EditorPlatform.Theme oldValue, EditorPlatform.Theme newValue) { final PreferencesController preferencesController = PreferencesController.getSingleton(); final PreferencesRecordGlobal recordGlobal @@ -477,9 +474,9 @@ public void changed(ObservableValue observ } } - private static class GluonThemeListener implements ChangeListener { + private static class GluonThemeListener implements ChangeListener { @Override - public void changed(ObservableValue observable, EditorPlatform.GluonTheme oldValue, EditorPlatform.GluonTheme newValue) { + public void changed(ObservableValue 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 isExternalAccepting(DesignHierarchyMask.Accessory accessory) { + if (accessory == DesignHierarchyMask.Accessory.CONTENT || accessory == DesignHierarchyMask.Accessory.GRAPHIC || + accessory == DesignHierarchyMask.Accessory.DP_CONTENT || accessory == DesignHierarchyMask.Accessory.DP_GRAPHIC) { + // For these accessories, we accept every object except an ExpandedPanel + return o -> !(o instanceof ExpansionPanel.ExpandedPanel); + } else if (accessory == EX_CONTENT) { + // For this accessory, we accept only an ExpandedPanel + return o -> o instanceof ExpansionPanel.ExpandedPanel; + } else if (accessory == DesignHierarchyMask.Accessory.EXPANDABLE_CONTENT || accessory == COLLAPSED_CONTENT) { + // For these accessories, we accept only an ExpansionPanel + return o -> o instanceof ExpansionPanel; + } + return o -> true; + } + + @Override + public Map> getExternalHierarchyItemGeneratorMap() { + return Map.of( + EXPANDED_CONTENT, (mask, fxom) -> new HierarchyItemExpansionPanel(mask, fxom, EXPANDED_CONTENT), + COLLAPSED_CONTENT, (mask, fxom) -> new HierarchyItemExpansionPanel(mask, fxom, COLLAPSED_CONTENT), + EX_CONTENT, (mask, fxom) -> new HierarchyItemExpandedPanel(mask, fxom, EX_CONTENT) + ); + } + + @Override + public Optional getExternalAccessoryForHierarchyItem(HierarchyItem hierarchyItem) { + if (hierarchyItem instanceof HierarchyItemExpandedPanel expandedPanel) { + return Optional.of(expandedPanel.getAccessory()); + } else if (hierarchyItem instanceof HierarchyItemExpansionPanel expansionPanel) { + return Optional.of(expansionPanel.getAccessory()); + } + return Optional.empty(); + } +} \ No newline at end of file diff --git a/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonExternalThemeProvider.java b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonExternalThemeProvider.java new file mode 100644 index 000000000..b2b14ac21 --- /dev/null +++ b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonExternalThemeProvider.java @@ -0,0 +1,99 @@ +/* + * 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.scenebuilder.plugins.alert.ImportingGluonControlsAlert; +import com.gluonhq.scenebuilder.plugins.alert.WarnThemeAlert; +import com.gluonhq.scenebuilder.plugins.editor.GluonEditorController; +import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform; +import com.oracle.javafx.scenebuilder.kit.editor.ExternalThemeProvider; +import javafx.stage.Stage; + +import java.util.List; +import java.util.function.Consumer; + +import static com.gluonhq.scenebuilder.plugins.editor.GluonEditorPlatform.GLUON_DOCUMENT_STYLESHEET; +import static com.gluonhq.scenebuilder.plugins.editor.GluonEditorPlatform.GLUON_IMPL_PACKAGE; +import static com.gluonhq.scenebuilder.plugins.editor.GluonEditorPlatform.GLUON_MOBILE; +import static com.gluonhq.scenebuilder.plugins.editor.GluonEditorPlatform.GLUON_MOBILE_DARK; +import static com.gluonhq.scenebuilder.plugins.editor.GluonEditorPlatform.GLUON_MOBILE_LIGHT; +import static com.gluonhq.scenebuilder.plugins.editor.GluonEditorPlatform.GLUON_PACKAGE; + +public class GluonExternalThemeProvider implements ExternalThemeProvider { + + @Override + public List getExternalThemes() { + return List.of(GLUON_MOBILE, GLUON_MOBILE_LIGHT, GLUON_MOBILE_DARK); + } + + @Override + public List getExternalStylesheets() { + // keep modena first, for user agent stylesheet + String modenaStylesheet = EditorPlatform.Theme.MODENA.getStylesheetURLs().getFirst(); + String gluonStylesheet = GLUON_MOBILE.getStylesheetURLs().getFirst(); + String gluonThemeStylesheet = GluonEditorController.getInstance().getGluonTheme().getStylesheetURLs().getFirst(); + String gluonSwatchStylesheet = GluonEditorController.getInstance().getGluonSwatch().getStylesheetURLs().getFirst(); + String gluonDocumentStylesheet = getGluonDocumentStylesheetURL(); + return List.of(modenaStylesheet, gluonStylesheet, gluonThemeStylesheet, gluonSwatchStylesheet, gluonDocumentStylesheet); + } + + @Override + public boolean hasClassFromExternalPlugin(String text) { + if (text == null || text.isEmpty()) { + return false; + } + if (text.startsWith(GLUON_PACKAGE) || text.contains(GLUON_PACKAGE)) { + return true; + } + return text.startsWith(GLUON_IMPL_PACKAGE) || text.contains(GLUON_IMPL_PACKAGE); + } + + @Override + public void showThemeAlert(Stage owner, EditorPlatform.Theme currentTheme, Consumer onSuccess) { + WarnThemeAlert.showAlertIfRequired(owner, currentTheme, onSuccess); + } + + @Override + public void showImportAlert(Stage owner) { + new ImportingGluonControlsAlert(owner).showAndWait(); + } + + @Override + public String getExternalJavadocURL() { + return "https://docs.gluonhq.com/charm/javadoc/latest/"; + } + + public static String getGluonDocumentStylesheetURL() { + return GLUON_DOCUMENT_STYLESHEET; + } + +} diff --git a/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonMetadataProvider.java b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonMetadataProvider.java new file mode 100644 index 000000000..c8f3346f7 --- /dev/null +++ b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonMetadataProvider.java @@ -0,0 +1,256 @@ +/* + * 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.oracle.javafx.scenebuilder.kit.metadata.ExternalMetadataProvider; +import com.oracle.javafx.scenebuilder.kit.metadata.klass.ComponentClassMetadata; +import com.oracle.javafx.scenebuilder.kit.metadata.property.ComponentPropertyMetadata; +import com.oracle.javafx.scenebuilder.kit.metadata.property.ValuePropertyMetadata; +import com.oracle.javafx.scenebuilder.kit.metadata.property.value.BooleanPropertyMetadata; +import com.oracle.javafx.scenebuilder.kit.metadata.property.value.EnumerationPropertyMetadata; +import com.oracle.javafx.scenebuilder.kit.metadata.property.value.EventHandlerPropertyMetadata; +import com.oracle.javafx.scenebuilder.kit.metadata.property.value.StringPropertyMetadata; +import com.oracle.javafx.scenebuilder.kit.metadata.util.InspectorPath; +import com.oracle.javafx.scenebuilder.kit.metadata.util.PropertyName; +import javafx.scene.control.SelectionMode; + +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +import static com.oracle.javafx.scenebuilder.kit.metadata.Metadata.ButtonBaseMetadata; +import static com.oracle.javafx.scenebuilder.kit.metadata.Metadata.ControlMetadata; +import static com.oracle.javafx.scenebuilder.kit.metadata.Metadata.MenuItemMetadata; +import static com.oracle.javafx.scenebuilder.kit.metadata.Metadata.NodeMetadata; +import static com.oracle.javafx.scenebuilder.kit.metadata.Metadata.RegionMetadata; +import static com.oracle.javafx.scenebuilder.kit.metadata.Metadata.ToggleButtonMetadata; + +public class GluonMetadataProvider implements ExternalMetadataProvider { + + // Abstract Component Classes + private final ComponentClassMetadata BottomNavigationMetadata = + new ComponentClassMetadata(com.gluonhq.charm.glisten.control.BottomNavigation.class, ControlMetadata); + private final ComponentClassMetadata CardPaneMetadata = + new ComponentClassMetadata(com.gluonhq.charm.glisten.control.CardPane.class, ControlMetadata); + private final ComponentClassMetadata CollapsedPanelMetadata = + new ComponentClassMetadata(com.gluonhq.charm.glisten.control.ExpansionPanel.CollapsedPanel.class, RegionMetadata); + private final ComponentClassMetadata DropdownButtonMetadata = + new ComponentClassMetadata(com.gluonhq.charm.glisten.control.DropdownButton.class, ControlMetadata); + private final ComponentClassMetadata ExpandedPanelMetadata = + new ComponentClassMetadata( com.gluonhq.charm.glisten.control.ExpansionPanel.ExpandedPanel.class, RegionMetadata); + private final ComponentClassMetadata ExpansionPanelContainerMetadata = + new ComponentClassMetadata(com.gluonhq.charm.glisten.control.ExpansionPanelContainer.class, ControlMetadata); + private final ComponentClassMetadata ExpansionPanelMetadata = + new ComponentClassMetadata( com.gluonhq.charm.glisten.control.ExpansionPanel.class, ControlMetadata); + private final ComponentClassMetadata SettingsPaneMetadata = + new ComponentClassMetadata(com.gluonhq.charm.glisten.control.SettingsPane.class, ControlMetadata); + private final ComponentClassMetadata OptionMetadata = + new ComponentClassMetadata(com.gluonhq.charm.glisten.control.settings.Option.class, null); + private final ComponentClassMetadata ToggleButtonGroupMetadata = + new ComponentClassMetadata(com.gluonhq.charm.glisten.control.ToggleButtonGroup.class, ControlMetadata); + + private static final PropertyName actionItemsName = new PropertyName("actionItems"); + private static final PropertyName togglesName = new PropertyName("toggles"); + private static final PropertyName titleNodesName = new PropertyName("titleNodes"); + private static final PropertyName optionsName = new PropertyName("options"); + private static final PropertyName itemsName = new PropertyName("items"); + + public GluonMetadataProvider() { + // Property Names + final PropertyName bottomNavigationTypeName = new PropertyName("type"); + final PropertyName buttonsName = new PropertyName("buttons"); + final PropertyName collapsedContentName = new PropertyName("collapsedContent"); + final PropertyName contentName = new PropertyName("content"); + final PropertyName expandedContentName = new PropertyName("expandedContent"); + final PropertyName expandedName = new PropertyName("expanded"); + final PropertyName onPullToRefreshName = new PropertyName("onPullToRefresh"); + final PropertyName searchBoxVisibleName = new PropertyName("searchBoxVisible"); + final PropertyName selectionTypeName = new PropertyName("selectionType"); + final PropertyName titleFilterName = new PropertyName("titleFilter"); + + // Property Metadata + final ComponentPropertyMetadata actionItems_Node_PropertyMetadata = + new ComponentPropertyMetadata( + actionItemsName, + NodeMetadata, + true); /* collection */ + final EnumerationPropertyMetadata bottomNavigationTypePropertyMetadata = + new EnumerationPropertyMetadata( + bottomNavigationTypeName, + BottomNavigation.Type.class, + true, /* readWrite */ + BottomNavigation.Type.FIXED, /* defaultValue */ + new InspectorPath("Properties", "Specific", 0)); + final ComponentPropertyMetadata buttons_EXPANDEDPANEL_PropertyMetadata = + new ComponentPropertyMetadata( + buttonsName, + ButtonBaseMetadata, + true); /* collection */ + final ComponentPropertyMetadata collapsedContentPropertyMetadata = + new ComponentPropertyMetadata( + collapsedContentName, + NodeMetadata, + false /* collection */ + ); + final ComponentPropertyMetadata content_EXPANDEDPANEL_PropertyMetadata = + new ComponentPropertyMetadata( + contentName, + NodeMetadata, + false); /* collection */ + final ComponentPropertyMetadata expandedContentPropertyMetadata = + new ComponentPropertyMetadata( + expandedContentName, + NodeMetadata, + false /* collection */ + ); + final BooleanPropertyMetadata expandedPropertyMetadata = + new BooleanPropertyMetadata( + expandedName, + true, /* readWrite */ + false, /* defaultValue */ + new InspectorPath("Properties", "Specific", 0) + ); + final ComponentPropertyMetadata items_ExpansionPanel_PropertyMetadata = + new ComponentPropertyMetadata( + itemsName, + ExpansionPanelMetadata, + true); /* collection */ + final ComponentPropertyMetadata items_MenuItem_PropertyMetadata = + new ComponentPropertyMetadata( + itemsName, + MenuItemMetadata, + true); /* collection */ + final ComponentPropertyMetadata items_Node_PropertyMetadata = + new ComponentPropertyMetadata( + itemsName, + NodeMetadata, + true); /* collection */ + final ValuePropertyMetadata onPullToRefreshPropertyMetadata = + new EventHandlerPropertyMetadata( + onPullToRefreshName, + true, /* readWrite */ + null, /* defaultValue */ + new InspectorPath("Code", "Specific", 0) + ); + final ComponentPropertyMetadata options_Option_PropertyMetadata = + new ComponentPropertyMetadata( + optionsName, + OptionMetadata, + true); /* collection */ + final ValuePropertyMetadata searchBoxVisiblePropertyMetadata = + new BooleanPropertyMetadata( + searchBoxVisibleName, + true, /* readWrite */ + true, /* defaultValue */ + new InspectorPath("Properties", "Specific", 0)); + final ValuePropertyMetadata selectionTypePropertyMetadata = + new EnumerationPropertyMetadata( + selectionTypeName, + javafx.scene.control.SelectionMode.class, + true, /* readWrite */ + SelectionMode.SINGLE, + new InspectorPath("Properties", "Specific", 0)); + final ValuePropertyMetadata titleFilterPropertyMetadata = + new StringPropertyMetadata( + titleFilterName, + true, /* readWrite */ + "", + new InspectorPath("Properties", "Specific", 1)); + final ComponentPropertyMetadata titleNodes_Node_PropertyMetadata = + new ComponentPropertyMetadata( + titleNodesName, + NodeMetadata, + true); /* collection */ + final ComponentPropertyMetadata toggles_ToggleButton_PropertyMetadata = + new ComponentPropertyMetadata( + togglesName, + ToggleButtonMetadata, + true /* collection */ + ); + + // ComponentMetadata -> PropertyMetadata + BottomNavigationMetadata.getProperties().add(bottomNavigationTypePropertyMetadata); + BottomNavigationMetadata.getProperties().add(actionItems_Node_PropertyMetadata); + + CardPaneMetadata.getProperties().add(items_Node_PropertyMetadata); + CardPaneMetadata.getProperties().add(onPullToRefreshPropertyMetadata); + + CollapsedPanelMetadata.getProperties().add(titleNodes_Node_PropertyMetadata); + + DropdownButtonMetadata.getProperties().add(items_MenuItem_PropertyMetadata); + + ExpandedPanelMetadata.getProperties().add(content_EXPANDEDPANEL_PropertyMetadata); + ExpandedPanelMetadata.getProperties().add(buttons_EXPANDEDPANEL_PropertyMetadata); + + ExpansionPanelContainerMetadata.getProperties().add(items_ExpansionPanel_PropertyMetadata); + + ExpansionPanelMetadata.getProperties().add(expandedContentPropertyMetadata); + ExpansionPanelMetadata.getProperties().add(collapsedContentPropertyMetadata); + ExpansionPanelMetadata.getProperties().add(expandedPropertyMetadata); + + SettingsPaneMetadata.getProperties().add(searchBoxVisiblePropertyMetadata); + SettingsPaneMetadata.getProperties().add(titleFilterPropertyMetadata); + SettingsPaneMetadata.getProperties().add(options_Option_PropertyMetadata); + + ToggleButtonGroupMetadata.getProperties().add(toggles_ToggleButton_PropertyMetadata); + ToggleButtonGroupMetadata.getProperties().add(selectionTypePropertyMetadata); + } + + @Override + public List getExternalItems() { + return Arrays.asList(BottomNavigationMetadata, CardPaneMetadata, + CollapsedPanelMetadata, DropdownButtonMetadata, + ExpandedPanelMetadata, ExpansionPanelContainerMetadata, + ExpansionPanelMetadata, OptionMetadata, + SettingsPaneMetadata, ToggleButtonGroupMetadata); + } + + @Override + public Optional getExternalSubComponentProperty(Class componentClass) { + PropertyName result = null; + if (componentClass == com.gluonhq.charm.glisten.control.BottomNavigation.class) { + result = actionItemsName; + } else if (componentClass == com.gluonhq.charm.glisten.control.CardPane.class || + componentClass == com.gluonhq.charm.glisten.control.DropdownButton.class || + componentClass == com.gluonhq.charm.glisten.control.ExpansionPanelContainer.class) { + result = itemsName; + } else if (componentClass == com.gluonhq.charm.glisten.control.ToggleButtonGroup.class) { + result = togglesName; + } else if (componentClass == com.gluonhq.charm.glisten.control.ExpansionPanel.CollapsedPanel.class) { + result = titleNodesName; + } else if (componentClass == com.gluonhq.charm.glisten.control.SettingsPane.class) { + result = optionsName; + } + return Optional.ofNullable(result); + } +} \ No newline at end of file diff --git a/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonSectionProvider.java b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonSectionProvider.java new file mode 100644 index 000000000..af779f159 --- /dev/null +++ b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/GluonSectionProvider.java @@ -0,0 +1,101 @@ +/* + * 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.oracle.javafx.scenebuilder.kit.library.ExternalSectionProvider; + +import java.util.ArrayList; +import java.util.List; + +public class GluonSectionProvider implements ExternalSectionProvider { + + private static final String TAG_GLUON = "Gluon"; + + @Override + public int getExternalSectionPosition() { + return 2; + } + + @Override + public String getExternalSectionName() { + return TAG_GLUON; + } + + @Override + public List> getExternalSectionItems() { + List> items = new ArrayList<>(); + items.add(com.gluonhq.charm.glisten.control.AppBar.class); + items.add(com.gluonhq.charm.glisten.control.AutoCompleteTextField.class); + items.add(com.gluonhq.charm.glisten.control.Avatar.class); + items.add(com.gluonhq.charm.glisten.control.BottomNavigation.class); + items.add(com.gluonhq.charm.glisten.control.BottomNavigationButton.class); + items.add(com.gluonhq.charm.glisten.control.CardPane.class); + items.add(com.gluonhq.charm.glisten.control.CharmListView.class); + items.add(com.gluonhq.charm.glisten.control.Chip.class); + items.add(com.gluonhq.charm.glisten.control.ExpansionPanel.CollapsedPanel.class); +// items.add(com.gluonhq.charm.glisten.control.Dialog.class); + items.add(com.gluonhq.charm.glisten.control.DropdownButton.class); + items.add(com.gluonhq.charm.glisten.control.ExpansionPanel.class); + items.add(com.gluonhq.charm.glisten.control.ExpansionPanel.ExpandedPanel.class); + items.add(com.gluonhq.charm.glisten.control.ExpansionPanelContainer.class); +// items.add(com.gluonhq.charm.glisten.layout.layer.FloatingActionButton.class); +// items.add(com.gluonhq.charm.glisten.layout.responsive.grid.GridLayout.class); +// items.add(com.gluonhq.charm.glisten.layout.responsive.grid.GridRow.class); +// items.add(com.gluonhq.charm.glisten.layout.responsive.grid.GridSpan.class); + items.add(com.gluonhq.charm.glisten.control.Icon.class); + items.add(com.gluonhq.charm.glisten.layout.Layer.class); +// items.add(com.gluonhq.charm.glisten.control.ListTile.class); +// items.add(com.gluonhq.charm.glisten.layout.layer.MenuPopupView.class); +// items.add(com.gluonhq.charm.glisten.layout.layer.MenuSidePopupView.class); + items.add(com.gluonhq.charm.glisten.control.NavigationDrawer.class); +// items.add(com.gluonhq.charm.glisten.layout.layer.PopupView.class); + items.add(com.gluonhq.charm.glisten.control.ProgressBar.class); + items.add(com.gluonhq.charm.glisten.control.ProgressIndicator.class); + items.add(com.gluonhq.charm.glisten.control.SettingsPane.class); +// items.add(com.gluonhq.charm.glisten.layout.layer.SidePopupView.class); + items.add(com.gluonhq.charm.glisten.mvc.SplashView.class); + items.add(com.gluonhq.charm.glisten.control.TextField.class); + items.add(com.gluonhq.charm.glisten.control.ToggleButtonGroup.class); + items.add(com.gluonhq.charm.glisten.mvc.View.class); + return items; + } + + @Override + public String getItemsFXMLPath() { + return "library/builtin"; + } + + @Override + public String getItemsIconPath() { + return "editor/images/nodeicons"; + } +} diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/alert/ImportingGluonControlsAlert.java b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/alert/ImportingGluonControlsAlert.java similarity index 89% rename from kit/src/main/java/com/oracle/javafx/scenebuilder/kit/alert/ImportingGluonControlsAlert.java rename to gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/alert/ImportingGluonControlsAlert.java index 38279c2ca..432e853fc 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/alert/ImportingGluonControlsAlert.java +++ b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/alert/ImportingGluonControlsAlert.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Gluon and/or its affiliates. + * Copyright (c) 2017, 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: @@ -29,15 +29,14 @@ * (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.alert; -package com.oracle.javafx.scenebuilder.kit.alert; - -import com.oracle.javafx.scenebuilder.kit.i18n.I18N; +import com.oracle.javafx.scenebuilder.kit.alert.SBAlert; +import com.gluonhq.scenebuilder.plugins.i18n.I18N; import javafx.scene.control.ButtonBar; import javafx.scene.control.ButtonType; import javafx.stage.Stage; - /** * Used when the user is importing Gluon controls */ diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/alert/WarnThemeAlert.java b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/alert/WarnThemeAlert.java similarity index 66% rename from kit/src/main/java/com/oracle/javafx/scenebuilder/kit/alert/WarnThemeAlert.java rename to gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/alert/WarnThemeAlert.java index 0a94890d8..f2082dc1f 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/alert/WarnThemeAlert.java +++ b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/alert/WarnThemeAlert.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Gluon and/or its affiliates. + * Copyright (c) 2017, 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: @@ -30,26 +30,28 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.oracle.javafx.scenebuilder.kit.alert; +package com.gluonhq.scenebuilder.plugins.alert; -import com.oracle.javafx.scenebuilder.kit.editor.EditorController; +import com.gluonhq.scenebuilder.plugins.editor.GluonEditorPlatform; +import com.oracle.javafx.scenebuilder.kit.alert.SBAlert; import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform; -import com.oracle.javafx.scenebuilder.kit.i18n.I18N; -import com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument; -import com.oracle.javafx.scenebuilder.kit.fxom.FXOMObject; +import com.gluonhq.scenebuilder.plugins.i18n.I18N; import javafx.scene.control.ButtonBar; import javafx.scene.control.ButtonType; import javafx.stage.Stage; +import java.util.function.Consumer; + /** * Used when the user adds a Gluon control to the document or loads a document with a Gluon control and * Gluon Mobile theme is not set. * When a Gluon control is used, Gluon Mobile theme must be set in order for the control to work correctly. */ public class WarnThemeAlert extends SBAlert { + private static boolean hasBeenShown = false; - private WarnThemeAlert(EditorController editorController, Stage owner) { + private WarnThemeAlert(Stage owner, Consumer onSuccess) { super(AlertType.WARNING, owner); setTitle(I18N.getString("alert.theme.gluon.mobile.title")); @@ -62,25 +64,18 @@ private WarnThemeAlert(EditorController editorController, Stage owner) { getButtonTypes().setAll(setGluonTheme, ignore); resultProperty().addListener((observable, oldValue, newValue) -> { - if (newValue == setGluonTheme) { - editorController.setTheme(EditorPlatform.Theme.GLUON_MOBILE_LIGHT); + if (newValue == setGluonTheme && onSuccess != null) { + onSuccess.accept(GluonEditorPlatform.GLUON_MOBILE_LIGHT); } }); setOnShown(event -> hasBeenShown = true); } - public static void showAlertIfRequired(EditorController editorController, FXOMObject fxomObject, Stage owner) { - if (!hasBeenShown && fxomObject != null && fxomObject.isGluon() && (editorController.getTheme() != EditorPlatform.Theme.GLUON_MOBILE_LIGHT - && editorController.getTheme() != EditorPlatform.Theme.GLUON_MOBILE_DARK)) { - new WarnThemeAlert(editorController, owner).showAndWait(); - } - } - - public static void showAlertIfRequired(EditorController editorController, FXOMDocument fxomDocument, Stage owner) { - if (!hasBeenShown && fxomDocument != null && fxomDocument.hasGluonControls() && (editorController.getTheme() != EditorPlatform.Theme.GLUON_MOBILE_LIGHT - && editorController.getTheme() != EditorPlatform.Theme.GLUON_MOBILE_DARK)) { - new WarnThemeAlert(editorController, owner).showAndWait(); + public static void showAlertIfRequired(Stage owner, EditorPlatform.Theme currentTheme, Consumer onSuccess) { + if (!hasBeenShown && + (!GluonEditorPlatform.isGluonMobileLight(currentTheme) && !GluonEditorPlatform.isGluonMobileDark(currentTheme))) { + new WarnThemeAlert(owner, onSuccess).showAndWait(); } } diff --git a/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/editor/GluonEditorController.java b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/editor/GluonEditorController.java new file mode 100644 index 000000000..538bc29e0 --- /dev/null +++ b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/editor/GluonEditorController.java @@ -0,0 +1,113 @@ +/* + * 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.editor; + +import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleObjectProperty; + +public class GluonEditorController { + + private static GluonEditorController instance; + + private GluonEditorController() {} + + public static GluonEditorController getInstance() { + if (instance == null) { + instance = new GluonEditorController(); + } + return instance; + } + + private final ObjectProperty gluonThemeProperty + = new SimpleObjectProperty<>(GluonEditorPlatform.DEFAULT_GLUON_THEME); + private final ObjectProperty gluonSwatchProperty + = new SimpleObjectProperty<>(GluonEditorPlatform.DEFAULT_GLUON_SWATCH); + + /** + * Returns the gluon theme used by this editor + * + * @return the gluon theme used by this editor + */ + public EditorPlatform.Theme getGluonTheme() { + return gluonThemeProperty.get(); + } + + /** + * Sets the gluon theme used by this editor. + * Content and Preview panels sharing this editor will update + * their content to use this new theme. + * + * @param theme the theme to be used in this editor + */ + public void setGluonTheme(EditorPlatform.Theme theme) { + gluonThemeProperty.set(theme); + } + + /** + * The property holding the gluon theme used by this editor + * + * @return the property holding the gluon theme used by this editor. + */ + public ObjectProperty gluonThemeProperty() { + return gluonThemeProperty; + } + + /** + * Sets the gluon swatch used by this editor. + * Content and Preview panels sharing this editor will update + * their content to use this new swatch. + * + * @param swatch the swatch to be used in this editor + */ + public void setGluonSwatch(EditorPlatform.Theme swatch) { + gluonSwatchProperty.set(swatch); + } + + /** + * Returns the gluon swatch used by this editor + * + * @return the gluon swatch used by this editor + */ + public EditorPlatform.Theme getGluonSwatch() { + return gluonSwatchProperty.get(); + } + + /** + * The property holding the gluon swatch used by this editor + * + * @return the property holding the gluon swatch used by this editor. + */ + public ObjectProperty gluonSwatchProperty() { + return gluonSwatchProperty; + } +} diff --git a/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/editor/GluonEditorPlatform.java b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/editor/GluonEditorPlatform.java new file mode 100644 index 000000000..64832f93b --- /dev/null +++ b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/editor/GluonEditorPlatform.java @@ -0,0 +1,189 @@ +/* + * 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.editor; + +import com.gluonhq.charm.glisten.visual.GlistenStyleClasses; +import com.gluonhq.scenebuilder.plugins.i18n.I18N; +import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform; +import javafx.scene.Node; +import javafx.scene.paint.Color; +import javafx.scene.shape.Rectangle; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class GluonEditorPlatform { + + private static final Logger LOGGER = Logger.getLogger(GluonEditorPlatform.class.getName()); + + /** + * Gluon Mobile + */ + public static final EditorPlatform.Theme GLUON_MOBILE = + new EditorPlatform.Theme("GLUON_MOBILE", "Gluon Mobile", GlistenStyleClasses.impl_loadResource("glisten.css")); + + /** + * Gluon Theme + */ + public static final EditorPlatform.Theme GLUON_MOBILE_LIGHT = + new EditorPlatform.Theme("GLUON_MOBILE_LIGHT", I18N.getString("title.gluon.theme.light"), GlistenStyleClasses.impl_loadResource("theme_light.css")); + public static final EditorPlatform.Theme GLUON_MOBILE_DARK = + new EditorPlatform.Theme("GLUON_MOBILE_DARK", I18N.getString("title.gluon.theme.dark"), GlistenStyleClasses.impl_loadResource("theme_dark.css")); + + /** + * Gluon Swatch + */ + public static final EditorPlatform.Theme GLUON_SWATCH_AMBER = + new EditorPlatform.Theme("AMBER", I18N.getString("title.gluon.swatch.amber"), GlistenStyleClasses.impl_loadResource("swatch_amber.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_BLUE = + new EditorPlatform.Theme("BLUE", I18N.getString("title.gluon.swatch.blue"), GlistenStyleClasses.impl_loadResource("swatch_blue.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_BLUE_GREY = + new EditorPlatform.Theme("BLUE_GREY", I18N.getString("title.gluon.swatch.blue_grey"), GlistenStyleClasses.impl_loadResource("swatch_blue_grey.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_BROWN = + new EditorPlatform.Theme("BROWN", I18N.getString("title.gluon.swatch.brown"), GlistenStyleClasses.impl_loadResource("swatch_brown.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_CYAN = + new EditorPlatform.Theme("CYAN", I18N.getString("title.gluon.swatch.cyan"), GlistenStyleClasses.impl_loadResource("swatch_cyan.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_DEEP_ORANGE = + new EditorPlatform.Theme("DEEP_ORANGE", I18N.getString("title.gluon.swatch.deep_orange"), GlistenStyleClasses.impl_loadResource("swatch_deep_orange.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_DEEP_PURPLE = + new EditorPlatform.Theme("DEEP_PURPLE", I18N.getString("title.gluon.swatch.deep_purple"), GlistenStyleClasses.impl_loadResource("swatch_deep_purple.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_GREEN = + new EditorPlatform.Theme("GREEN", I18N.getString("title.gluon.swatch.green"), GlistenStyleClasses.impl_loadResource("swatch_green.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_GREY = + new EditorPlatform.Theme("GREY", I18N.getString("title.gluon.swatch.grey"), GlistenStyleClasses.impl_loadResource("swatch_grey.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_INDIGO = + new EditorPlatform.Theme("INDIGO", I18N.getString("title.gluon.swatch.indigo"), GlistenStyleClasses.impl_loadResource("swatch_indigo.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_LIGHT_BLUE = + new EditorPlatform.Theme("LIGHT_BLUE", I18N.getString("title.gluon.swatch.light_blue"), GlistenStyleClasses.impl_loadResource("swatch_light_blue.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_LIGHT_GREEN = + new EditorPlatform.Theme("LIGHT_GREEN", I18N.getString("title.gluon.swatch.light_green"), GlistenStyleClasses.impl_loadResource("swatch_light_green.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_LIME = + new EditorPlatform.Theme("LIME", I18N.getString("title.gluon.swatch.lime"), GlistenStyleClasses.impl_loadResource("swatch_lime.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_ORANGE = + new EditorPlatform.Theme("ORANGE", I18N.getString("title.gluon.swatch.orange"), GlistenStyleClasses.impl_loadResource("swatch_orange.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_PINK = + new EditorPlatform.Theme("PINK", I18N.getString("title.gluon.swatch.pink"), GlistenStyleClasses.impl_loadResource("swatch_pink.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_PURPLE = + new EditorPlatform.Theme("PURPLE", I18N.getString("title.gluon.swatch.purple"), GlistenStyleClasses.impl_loadResource("swatch_purple.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_RED = + new EditorPlatform.Theme("RED", I18N.getString("title.gluon.swatch.red"), GlistenStyleClasses.impl_loadResource("swatch_red.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_TEAL = + new EditorPlatform.Theme("TEAL", I18N.getString("title.gluon.swatch.teal"), GlistenStyleClasses.impl_loadResource("swatch_teal.css")); + public static final EditorPlatform.Theme GLUON_SWATCH_YELLOW = + new EditorPlatform.Theme("YELLOW", I18N.getString("title.gluon.swatch.yellow"), GlistenStyleClasses.impl_loadResource("swatch_yellow.css")); + + public static List getGluonSwatchList() { + return List.of(GLUON_SWATCH_AMBER, GLUON_SWATCH_BLUE, GLUON_SWATCH_BLUE_GREY, GLUON_SWATCH_BROWN, GLUON_SWATCH_CYAN, + GLUON_SWATCH_DEEP_ORANGE, GLUON_SWATCH_DEEP_PURPLE, GLUON_SWATCH_GREEN, GLUON_SWATCH_GREY, GLUON_SWATCH_INDIGO, + GLUON_SWATCH_LIGHT_BLUE, GLUON_SWATCH_LIGHT_GREEN, GLUON_SWATCH_LIME, GLUON_SWATCH_ORANGE, GLUON_SWATCH_PINK, + GLUON_SWATCH_PURPLE, GLUON_SWATCH_RED, GLUON_SWATCH_TEAL, GLUON_SWATCH_YELLOW); + } + + public static EditorPlatform.Theme swatchValueOf(String themeName) { + return getGluonSwatchList().stream() + .filter(t -> t.name().equals(themeName)) + .findFirst() + .orElse(DEFAULT_GLUON_SWATCH); + } + /** + * Default Gluon Swatch + */ + public static final EditorPlatform.Theme DEFAULT_GLUON_SWATCH = GLUON_SWATCH_BLUE; + + /** + * Default Gluon Theme + */ + public static final EditorPlatform.Theme DEFAULT_GLUON_THEME = GLUON_MOBILE_LIGHT; + + /** + * Gluon Glisten package + */ + public static final String GLUON_PACKAGE = "com.gluonhq.charm.glisten"; + public static final String GLUON_IMPL_PACKAGE = "com.gluonhq.impl.charm.glisten"; + + /** + * scene builder specific tweaks to Gluon theme + */ + public static final String GLUON_DOCUMENT_STYLESHEET = "com/gluonhq/scenebuilder/plugins/css/GluonDocument.css"; + + + private static final String PRIMARY_SWATCH_500_STR = "-primary-swatch-500:"; + + + public static boolean isGluonMobileLight(EditorPlatform.Theme theme) { return theme == GLUON_MOBILE_LIGHT; } + + public static boolean isGluonMobileDark(EditorPlatform.Theme theme) { + return theme == GLUON_MOBILE_DARK; + } + + private static Color color; + + private static Color getSwatchColor(EditorPlatform.Theme theme) { + if (color == null) { + try { + URL url = new URL(theme.getStylesheetURLs().getFirst()); + try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) { + String s = reader.readLine(); + while (s != null) { + // Remove white spaces + String trimmedString = s.replaceAll("\\s+", ""); + int indexOf = trimmedString.indexOf(PRIMARY_SWATCH_500_STR); + if (indexOf != -1) { + String colorString = trimmedString.substring(indexOf + PRIMARY_SWATCH_500_STR.length(), trimmedString.indexOf(";")); + color = Color.web(colorString); + break; + } + s = reader.readLine(); + } + } catch (IOException e) { + LOGGER.log(Level.WARNING, "Failed reading color from stylesheet: ", e); + } + } catch (IOException e) { + LOGGER.log(Level.WARNING, "Failed to get color from stylesheet: ", e); + } + } + return color; + } + + public static Node createGraphicForSwatch(EditorPlatform.Theme theme) { + Rectangle rect = new Rectangle(8, 8); + rect.setFill(getSwatchColor(theme)); + rect.setStroke(Color.BLACK); + return rect; + } + +} diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemExpandedPanel.java b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/hierarchy/HierarchyItemExpandedPanel.java similarity index 82% rename from kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemExpandedPanel.java rename to gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/hierarchy/HierarchyItemExpandedPanel.java index 84078e471..4e0dcdeae 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemExpandedPanel.java +++ b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/hierarchy/HierarchyItemExpandedPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Gluon and/or its affiliates. + * Copyright (c) 2016, 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: @@ -30,8 +30,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.oracle.javafx.scenebuilder.kit.editor.panel.hierarchy; +package com.gluonhq.scenebuilder.plugins.hierarchy; +import com.oracle.javafx.scenebuilder.kit.editor.panel.hierarchy.HierarchyItem; import com.oracle.javafx.scenebuilder.kit.i18n.I18N; import com.oracle.javafx.scenebuilder.kit.editor.images.ImageUtils; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMObject; @@ -51,17 +52,17 @@ public class HierarchyItemExpandedPanel extends HierarchyItem { /** * Creates a hierarchy item. * - * @param owner The accessory owner + * @param owner The accessory owner * @param fxomObject The FX object represented by this item + * @param accessory The accessory */ - public HierarchyItemExpandedPanel( - final DesignHierarchyMask owner, - final FXOMObject fxomObject) { + public HierarchyItemExpandedPanel(final DesignHierarchyMask owner, + final FXOMObject fxomObject, DesignHierarchyMask.Accessory accessory) { assert owner != null; this.owner = owner; // fxomObject can be null for place holder items this.mask = fxomObject == null ? null : new DesignHierarchyMask(fxomObject); - this.accessory = DesignHierarchyMask.Accessory.EX_CONTENT; + this.accessory = accessory; } @Override @@ -74,11 +75,11 @@ public boolean equals(Object obj) { } final HierarchyItemExpandedPanel item = (HierarchyItemExpandedPanel) obj; if (!isEmpty()) { - // If the place holder is not empty, we compare the fxom object + // If the placeholder is not empty, we compare the fxom object assert getFxomObject() != null; return getFxomObject().equals(item.getFxomObject()); } else { - // If the place holder is empty, we compare the accessory + owner + // If the placeholder is empty, we compare the accessory + owner return getOwner().equals(item.getOwner()) && getAccessory().equals(item.getAccessory()); } @@ -94,7 +95,7 @@ public int hashCode() { } @Override - public boolean isPlaceHolder() { + public boolean isPlaceholder() { return true; } @@ -122,13 +123,13 @@ public DesignHierarchyMask.Accessory getAccessory() { } @Override - public Image getPlaceHolderImage() { + public Image getPlaceholderImage() { return ImageUtils.getNodeIcon("CustomNode.png"); } @Override - public String getPlaceHolderInfo() { - return (mask != null ? null : I18N.getString("hierarchy.placeholder.insert") + accessory.toString().toUpperCase(Locale.getDefault())); + public String getPlaceholderInfo() { + return (mask != null ? null : I18N.getString("hierarchy.placeholder.insert", accessory.toString().toUpperCase(Locale.ROOT))); } @Override diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemExpansionPanel.java b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/hierarchy/HierarchyItemExpansionPanel.java similarity index 83% rename from kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemExpansionPanel.java rename to gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/hierarchy/HierarchyItemExpansionPanel.java index af8db20ad..5d467a0ee 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemExpansionPanel.java +++ b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/hierarchy/HierarchyItemExpansionPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Gluon and/or its affiliates. + * Copyright (c) 2016, 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: @@ -30,8 +30,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.oracle.javafx.scenebuilder.kit.editor.panel.hierarchy; +package com.gluonhq.scenebuilder.plugins.hierarchy; +import com.gluonhq.scenebuilder.plugins.GluonDesignHierarchyMaskProvider; +import com.oracle.javafx.scenebuilder.kit.editor.panel.hierarchy.HierarchyItem; import com.oracle.javafx.scenebuilder.kit.i18n.I18N; import com.oracle.javafx.scenebuilder.kit.editor.images.ImageUtils; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMObject; @@ -76,11 +78,11 @@ public boolean equals(Object obj) { } final HierarchyItemExpansionPanel item = (HierarchyItemExpansionPanel) obj; if (!isEmpty()) { - // If the place holder is not empty, we compare the fxom object + // If the placeholder is not empty, we compare the fxom object assert getFxomObject() != null; return getFxomObject().equals(item.getFxomObject()); } else { - // If the place holder is empty, we compare the accessory + owner + // If the placeholder is empty, we compare the accessory + owner return getOwner().equals(item.getOwner()) && getAccessory().equals(item.getAccessory()); } @@ -96,7 +98,7 @@ public int hashCode() { } @Override - public boolean isPlaceHolder() { + public boolean isPlaceholder() { return true; } @@ -124,13 +126,13 @@ public DesignHierarchyMask.Accessory getAccessory() { } @Override - public Image getPlaceHolderImage() { - return ImageUtils.getNodeIcon("Gluon_ExpansionPanel-" + accessory.name().toLowerCase(Locale.ROOT) + ".png"); + public Image getPlaceholderImage() { + return ImageUtils.getImage(GluonDesignHierarchyMaskProvider.class.getResource("editor/images/nodeicons/ExpansionPanel-" + accessory.name().toLowerCase(Locale.ROOT) + ".png")); } @Override - public String getPlaceHolderInfo() { - return (mask != null ? null : I18N.getString("hierarchy.placeholder.insert") + accessory.name().toUpperCase(Locale.getDefault())); + public String getPlaceholderInfo() { + return (mask != null ? null : I18N.getString("hierarchy.placeholder.insert", accessory.name().toUpperCase(Locale.ROOT))); } @Override diff --git a/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/i18n/I18N.java b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/i18n/I18N.java new file mode 100644 index 000000000..770ab533b --- /dev/null +++ b/gluon-plugin/src/main/java/com/gluonhq/scenebuilder/plugins/i18n/I18N.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2024, Gluon and/or its affiliates. + * Copyright (c) 2012, 2014, Oracle 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 Oracle Corporation 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.i18n; + +import java.text.MessageFormat; +import java.util.ResourceBundle; + +/** + * + */ +public class I18N { + + private static ResourceBundle bundle; + + I18N() { + // no-op + } + + public static String getString(String key) { + return getBundle().getString(key); + } + + public static String getString(String key, Object... arguments) { + final String pattern = getString(key); + return MessageFormat.format(pattern, arguments); + } + + public static synchronized ResourceBundle getBundle() { + if (bundle == null) { + final String packageName = I18N.class.getPackage().getName(); + bundle = ResourceBundle.getBundle(packageName + ".SceneBuilderPlugin"); //NOI18N + } + + return bundle; + } +} diff --git a/gluon-plugin/src/main/java/module-info.java b/gluon-plugin/src/main/java/module-info.java new file mode 100644 index 000000000..df76bd53f --- /dev/null +++ b/gluon-plugin/src/main/java/module-info.java @@ -0,0 +1,52 @@ +/* + * 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 Oracle Corporation and 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. + */ +module com.gluonhq.scenebuilder.gluon.plugin { + requires transitive com.gluonhq.scenebuilder.kit; + requires java.logging; + + requires com.gluonhq.charm.glisten; + requires com.gluonhq.attach.display; + + opens com.gluonhq.scenebuilder.plugins.css; + opens com.gluonhq.scenebuilder.plugins.editor.images.nodeicons to com.gluonhq.scenebuilder.kit; + opens com.gluonhq.scenebuilder.plugins.hierarchy to com.gluonhq.scenebuilder.kit; + opens com.gluonhq.scenebuilder.plugins.library.builtin to com.gluonhq.scenebuilder.kit; + + provides com.oracle.javafx.scenebuilder.kit.editor.ExternalThemeProvider with com.gluonhq.scenebuilder.plugins.GluonExternalThemeProvider; + provides com.oracle.javafx.scenebuilder.kit.library.ExternalSectionProvider with com.gluonhq.scenebuilder.plugins.GluonSectionProvider; + provides com.oracle.javafx.scenebuilder.kit.metadata.ExternalMetadataProvider with com.gluonhq.scenebuilder.plugins.GluonMetadataProvider; + provides com.oracle.javafx.scenebuilder.kit.metadata.util.ExternalDesignHierarchyMaskProvider with com.gluonhq.scenebuilder.plugins.GluonDesignHierarchyMaskProvider; + + exports com.gluonhq.scenebuilder.plugins; + exports com.gluonhq.scenebuilder.plugins.editor; + exports com.gluonhq.scenebuilder.plugins.alert; +} \ No newline at end of file diff --git a/gluon-plugin/src/main/resources/LICENSE.txt b/gluon-plugin/src/main/resources/LICENSE.txt new file mode 100644 index 000000000..c8ad63035 --- /dev/null +++ b/gluon-plugin/src/main/resources/LICENSE.txt @@ -0,0 +1,30 @@ + +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. \ No newline at end of file diff --git a/app/src/main/resources/com/oracle/javafx/scenebuilder/app/css/GluonDocument.css b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/css/GluonDocument.css similarity index 94% rename from app/src/main/resources/com/oracle/javafx/scenebuilder/app/css/GluonDocument.css rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/css/GluonDocument.css index 9ae74ed43..f825f8702 100644 --- a/app/src/main/resources/com/oracle/javafx/scenebuilder/app/css/GluonDocument.css +++ b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/css/GluonDocument.css @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Gluon and/or its affiliates. + * Copyright (c) 2016, 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: diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_AppBar.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/AppBar.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_AppBar.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/AppBar.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_AppBar@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/AppBar@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_AppBar@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/AppBar@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_AutoCompleteTextField.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/AutoCompleteTextField.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_AutoCompleteTextField.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/AutoCompleteTextField.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_AutoCompleteTextField@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/AutoCompleteTextField@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_AutoCompleteTextField@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/AutoCompleteTextField@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Avatar.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Avatar.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Avatar.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Avatar.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Avatar@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Avatar@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Avatar@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Avatar@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_BottomNavigation.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/BottomNavigation.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_BottomNavigation.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/BottomNavigation.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_BottomNavigation@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/BottomNavigation@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_BottomNavigation@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/BottomNavigation@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_BottomNavigationButton.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/BottomNavigationButton.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_BottomNavigationButton.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/BottomNavigationButton.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_BottomNavigationButton@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/BottomNavigationButton@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_BottomNavigationButton@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/BottomNavigationButton@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_CardPane.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CardPane.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_CardPane.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CardPane.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_CardPane@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CardPane@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_CardPane@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CardPane@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_CharmListView.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CharmListView.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_CharmListView.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CharmListView.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_CharmListView@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CharmListView@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_CharmListView@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CharmListView@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Chip.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Chip.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Chip.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Chip.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Chip@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Chip@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Chip@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Chip@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel-collapsed_content.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CollapsedPanel.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel-collapsed_content.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CollapsedPanel.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel-collapsed_content@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CollapsedPanel@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel-collapsed_content@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/CollapsedPanel@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Dialog.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Dialog.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Dialog.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Dialog.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Dialog@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Dialog@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Dialog@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Dialog@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_DropdownButton.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/DropdownButton.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_DropdownButton.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/DropdownButton.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_DropdownButton@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/DropdownButton@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_DropdownButton@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/DropdownButton@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel-expanded_content.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpandedPanel.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel-expanded_content.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpandedPanel.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel-expanded_content@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpandedPanel@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel-expanded_content@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpandedPanel@2x.png diff --git a/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel-collapsed_content.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel-collapsed_content.png new file mode 100644 index 0000000000000000000000000000000000000000..334c35fc31a4dbcbf79cc8edda18e14293d2d24d GIT binary patch literal 271 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|PI|gHhFAzD zi}=j?8t>RMzftDHgRAarViTURS~5O)k?t{LQ)6SN&RmaK5fg6kOq*Ifai_)2M4gx!}03yWp}L+!nk$K78Qq^4(!!!Mh@|a?Zmud&7Cc<@P6kczNqg z!)b>egNB<|1T)VHT-e;|7#h^D(DF>vL5DaNwN|IcCJydl9f{sM^_!bC literal 0 HcmV?d00001 diff --git a/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel-collapsed_content@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel-collapsed_content@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..23ad2b5a6a098bf7db0b899ed51b20726ba30942 GIT binary patch literal 476 zcmV<20VDp2P)Px$mPtfGR9FdPoUWyKmQn%#Q7Me?z+SfXsXOGH{FRO--FB~ z*#RI;Jux;wM=&!?*meQLW$-psU|5*t!oWmI*n@SF=>U-4wg^jbbezBcnqg_KJ2)z! zW|Bma6#_6D>VwS~{{H*Vz|2HKs)K2U(j;X=G`(OhC6px6P}97T%Qr~?QlLPGU9 zDZ!0R?SMxC&Je)WhQsCyO2h^{1V$YIP6MEhBB-xMPXMwL1i%ge^-@82AOHYH0A{B( S)cyqk0000RMzftDHgRAarViTURS~5O)k?t{LQ)6SN&RmaK5fg6kOq*Ifai_)2M4gx!}03yWp}L+!ee(KK|A}+?)PBFvsQj1Cs}5_J;E`?v0kLu`)M~ zsrmdKI;Vst06=tV5&!@I literal 0 HcmV?d00001 diff --git a/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel-expanded_content@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel-expanded_content@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..bc60c1608292e58f0cda5a5d418eb058037de6d7 GIT binary patch literal 483 zcmV<90UZ8`P)Px$ok>JNR9FdPbWC#5F|DPd#+8&0j=N~ZSdFnIVd-;iB!nO+xzyADX=!qe{LL>oU+0{}?7E*b($KvI3GEkTGXJ!^&f~ z7*d?H8M4#ecnE;g0H~t~>Z{Qcfb0YTumeE7R1h8r Z0055=cr_~IPc8re002ovPDHLkV1hrrzuEu* literal 0 HcmV?d00001 diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanel@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanel@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanelContainer.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanelContainer.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanelContainer.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanelContainer.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanelContainer@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanelContainer@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ExpansionPanelContainer@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ExpansionPanelContainer@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_FloatingActionButton.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/FloatingActionButton.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_FloatingActionButton.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/FloatingActionButton.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_FloatingActionButton@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/FloatingActionButton@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_FloatingActionButton@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/FloatingActionButton@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_View@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Gluon_View@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_View@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Gluon_View@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Icon.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Icon.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Icon.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Icon.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Icon@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Icon@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Icon@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Icon@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Layer.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Layer.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Layer.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Layer.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Layer@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Layer@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_Layer@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/Layer@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ListTile.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ListTile.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ListTile.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ListTile.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ListTile@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ListTile@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ListTile@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ListTile@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MenuPopupView.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MenuPopupView.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MenuPopupView.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MenuPopupView.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MenuPopupView@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MenuPopupView@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MenuPopupView@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MenuPopupView@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MenuSidePopupView.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MenuSidePopupView.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MenuSidePopupView.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MenuSidePopupView.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MenuSidePopupView@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MenuSidePopupView@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MenuSidePopupView@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MenuSidePopupView@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MobileLayoutPane.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MobileLayoutPane.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MobileLayoutPane.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MobileLayoutPane.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MobileLayoutPane@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MobileLayoutPane@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_MobileLayoutPane@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/MobileLayoutPane@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_NavigationDrawer.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/NavigationDrawer.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_NavigationDrawer.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/NavigationDrawer.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_NavigationDrawer@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/NavigationDrawer@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_NavigationDrawer@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/NavigationDrawer@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_PopupView.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/PopupView.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_PopupView.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/PopupView.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_PopupView@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/PopupView@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_PopupView@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/PopupView@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ProgressBar.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ProgressBar.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ProgressBar.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ProgressBar.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ProgressBar@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ProgressBar@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ProgressBar@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ProgressBar@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ProgressIndicator.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ProgressIndicator.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ProgressIndicator.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ProgressIndicator.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ProgressIndicator@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ProgressIndicator@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ProgressIndicator@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ProgressIndicator@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_SettingsPane.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/SettingsPane.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_SettingsPane.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/SettingsPane.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_SettingsPane@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/SettingsPane@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_SettingsPane@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/SettingsPane@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_SplashView.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/SplashView.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_SplashView.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/SplashView.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_SplashView@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/SplashView@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_SplashView@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/SplashView@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_TextField.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/TextField.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_TextField.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/TextField.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_TextField@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/TextField@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_TextField@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/TextField@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ToggleButtonGroup.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ToggleButtonGroup.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ToggleButtonGroup.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ToggleButtonGroup.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ToggleButtonGroup@2x.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ToggleButtonGroup@2x.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_ToggleButtonGroup@2x.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/ToggleButtonGroup@2x.png diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_View.png b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/View.png similarity index 100% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/editor/images/nodeicons/Gluon_View.png rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/editor/images/nodeicons/View.png diff --git a/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/i18n/SceneBuilderPlugin.properties b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/i18n/SceneBuilderPlugin.properties new file mode 100644 index 000000000..232629c11 --- /dev/null +++ b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/i18n/SceneBuilderPlugin.properties @@ -0,0 +1,72 @@ +# 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. + +################ Alert when Gluon Mobile theme is not set +alert.theme.gluon.mobile.title = Scene Builder +alert.theme.gluon.mobile.headertext = Gluon Mobile theme is not set +alert.theme.gluon.mobile.contenttext = If Gluon Mobile theme is not set and you are using Gluon controls, they may not work correctly. +alert.theme.gluon.mobile.setgluontheme = Set Gluon theme +alert.theme.gluon.mobile.ignore = Ignore + +################ Alert when importing Gluon controls +alert.importing.gluon.title = Scene Builder +alert.importing.gluon.headertext = You're importing Gluon controls +alert.importing.gluon.contenttext = These controls won't be imported because this version of Scene Builder already provides Gluon controls. +alert.importing.gluon.ok.button = OK + +# ----------------------------------------------------------------------------- +# Themes (from app i18n) +# ----------------------------------------------------------------------------- +# Document themes +title.theme.gluon_mobile_dark = Gluon Mobile Dark +title.theme.gluon_mobile_light = Gluon Mobile Light +# Gluon Swatches +title.gluon.swatch.blue = Blue Swatch +title.gluon.swatch.cyan = Cyan Swatch +title.gluon.swatch.deep_orange = Deep Orange Swatch +title.gluon.swatch.deep_purple = Deep Purple Swatch +title.gluon.swatch.green = Green Swatch +title.gluon.swatch.indigo = Indigo Swatch +title.gluon.swatch.light_blue = Light Blue Swatch +title.gluon.swatch.pink = Pink Swatch +title.gluon.swatch.purple = Purple Swatch +title.gluon.swatch.red = Red Swatch +title.gluon.swatch.teal = Teal Swatch +title.gluon.swatch.light_green = Light Green Swatch +title.gluon.swatch.lime = Lime Swatch +title.gluon.swatch.yellow = Yellow Swatch +title.gluon.swatch.amber = Amber Swatch +title.gluon.swatch.orange = Orange Swatch +title.gluon.swatch.brown = Brown Swatch +title.gluon.swatch.grey = Grey Swatch +title.gluon.swatch.blue_grey = Blue Grey Swatch +# Gluon Themes +title.gluon.theme.light = Light Theme +title.gluon.theme.dark = Dark Theme diff --git a/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/i18n/SceneBuilderPlugin_zh_CN.properties b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/i18n/SceneBuilderPlugin_zh_CN.properties new file mode 100644 index 000000000..1d6822d71 --- /dev/null +++ b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/i18n/SceneBuilderPlugin_zh_CN.properties @@ -0,0 +1,72 @@ +# 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. + +################ Alert when Gluon Mobile theme is not set +alert.theme.gluon.mobile.title = Scene Builder +alert.theme.gluon.mobile.headertext = Gluon Mobile 主题未设置 +alert.theme.gluon.mobile.contenttext = 如果未设置 Gluon Mobile 主题并且您正在使用 Gluon 控件,它们可能无法正常工作。 +alert.theme.gluon.mobile.setgluontheme = 设置 Gluon 主题 +alert.theme.gluon.mobile.ignore = 忽略 + +################ Alert when importing Gluon controls +alert.importing.gluon.title = Scene Builder +alert.importing.gluon.headertext = 您正在导入 Gluon 控件 +alert.importing.gluon.contenttext = 不会导入这些控件,因为此版本的场景生成器已提供 Gluon 控件。 +alert.importing.gluon.ok.button = 确定 + +# ----------------------------------------------------------------------------- +# Themes (from app i18n) +# ----------------------------------------------------------------------------- +# Document themes +title.theme.gluon_mobile_dark = Gluon 手机暗色主题 +title.theme.gluon_mobile_light = Gluon 手机浅色主题 +# Gluon Swatches +title.gluon.swatch.blue = 蓝色 +title.gluon.swatch.cyan = 青色 +title.gluon.swatch.deep_orange = 深橙色 +title.gluon.swatch.deep_purple = 深紫色 +title.gluon.swatch.green = 绿色 +title.gluon.swatch.indigo = 靛蓝色 +title.gluon.swatch.light_blue = 浅蓝色 +title.gluon.swatch.pink = 粉色 +title.gluon.swatch.purple = 紫色 +title.gluon.swatch.red = 红色 +title.gluon.swatch.teal = 蓝绿色 +title.gluon.swatch.light_green = 浅绿色 +title.gluon.swatch.lime = 青柠色 +title.gluon.swatch.yellow = 黄色 +title.gluon.swatch.amber = 琥珀色 +title.gluon.swatch.orange = 橙色 +title.gluon.swatch.brown = 棕色 +title.gluon.swatch.grey = 灰色 +title.gluon.swatch.blue_grey = 蓝灰色 +# Gluon Themes +title.gluon.theme.light = 浅色主题 +title.gluon.theme.dark = 暗色主题 diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_AppBar.fxml b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/AppBar.fxml similarity index 94% rename from kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_AppBar.fxml rename to gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/AppBar.fxml index 8f403ceef..86aeb8288 100644 --- a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/library/builtin/Gluon_AppBar.fxml +++ b/gluon-plugin/src/main/resources/com/gluonhq/scenebuilder/plugins/library/builtin/AppBar.fxml @@ -1,6 +1,6 @@ - - com.gluonhq - charm-glisten - ${charm.glisten.version} - - - com.gluonhq.attach - display - ${gluon.attach.version} - desktop - - org.apache.httpcomponents diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/DocumentationUrls.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/DocumentationUrls.java index cb9dfd216..f06e59bd0 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/DocumentationUrls.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/DocumentationUrls.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Gluon and/or its affiliates. + * Copyright (c) 2022, 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: @@ -44,17 +44,13 @@ public enum DocumentationUrls { /** * Javadoc home (for Inspector and CSS Analyzer properties) */ - JAVADOC_HOME("https://openjfx.io/javadoc/11/"), + JAVADOC_HOME("https://openjfx.io/javadoc/23/"), /** * This URL is where you go when the user takes Scene Builder Help action (shortcut F1) */ ORACLE_DOCUMENTATION("https://docs.oracle.com/javafx/index.html"), - /** - * Gluon javadoc home (for Inspector and CSS Analyzer properties) - */ - GLUON_JAVADOC_HOME("https://docs.gluonhq.com/charm/javadoc/latest/"), GLUON_SCENEBUILDER_HOME("https://gluonhq.com/products/scene-builder/"), OPENJFX_GETTING_STARTED("https://openjfx.io/openjfx-docs/"), @@ -69,7 +65,7 @@ public enum DocumentationUrls { */ JFXCENTRAL_HOMEPAGE("https://www.jfx-central.com"); - private static final String SAFE_DEFAULT_VERSION = "17"; + private static final String SAFE_DEFAULT_VERSION = "21"; private static String javaFxMajorVersion = null; diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/EditorController.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/EditorController.java index 0bb065252..8b0ae0752 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/EditorController.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/EditorController.java @@ -33,7 +33,6 @@ package com.oracle.javafx.scenebuilder.kit.editor; import com.oracle.javafx.scenebuilder.kit.ResourceUtils; -import com.oracle.javafx.scenebuilder.kit.alert.WarnThemeAlert; import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform.Theme; import com.oracle.javafx.scenebuilder.kit.editor.drag.DragController; import com.oracle.javafx.scenebuilder.kit.i18n.I18N; @@ -269,10 +268,6 @@ public enum Size { = new SimpleObjectProperty<>(new BuiltinGlossary()); private final ObjectProperty resourcesProperty = new SimpleObjectProperty<>(null); - private final ObjectProperty gluonThemeProperty - = new SimpleObjectProperty<>(EditorPlatform.DEFAULT_GLUON_THEME); - private final ObjectProperty gluonSwatchProperty - = new SimpleObjectProperty<>(EditorPlatform.DEFAULT_SWATCH); private final ListProperty sceneStyleSheetProperty = new SimpleListProperty<>(); private final BooleanProperty pickModeEnabledProperty @@ -294,7 +289,7 @@ public enum Size { * Creates an empty editor controller (ie it has no associated fxom document). */ public EditorController() { - jobManager.revisionProperty().addListener((ChangeListener) (ov, t, t1) -> jobManagerRevisionDidChange()); + jobManager.revisionProperty().addListener((ov, t, t1) -> jobManagerRevisionDidChange()); } /** @@ -546,6 +541,7 @@ public ObservableValue resourcesProperty() { // -- Theme property private final ObjectProperty themeProperty = new SimpleObjectProperty<>(EditorPlatform.DEFAULT_THEME) { + @Override protected void invalidated() { FXOMDocument fxomDocument = getFxomDocument(); @@ -584,64 +580,6 @@ public ObservableValue themeProperty() { return themeProperty; } - /** - * Returns the gluon theme used by this editor - * - * @return the gluon theme used by this editor - */ - public EditorPlatform.GluonTheme getGluonTheme() { - return gluonThemeProperty.get(); - } - - /** - * Sets the gluon theme used by this editor. - * Content and Preview panels sharing this editor will update - * their content to use this new theme. - * - * @param theme the theme to be used in this editor - */ - public void setGluonTheme(EditorPlatform.GluonTheme theme) { - gluonThemeProperty.set(theme); - } - - /** - * The property holding the gluon theme used by this editor - * - * @return the property holding the gluon theme used by this editor. - */ - public ObjectProperty gluonThemeProperty() { - return gluonThemeProperty; - } - - /** - * Sets the gluon swatch used by this editor. - * Content and Preview panels sharing this editor will update - * their content to use this new swatch. - * - * @param swatch the swatch to be used in this editor - */ - public void setGluonSwatch(EditorPlatform.GluonSwatch swatch) { - gluonSwatchProperty.set(swatch); - } - - /** - * Returns the gluon swatch used by this editor - * - * @return the gluon swatch used by this editor - */ - public EditorPlatform.GluonSwatch getGluonSwatch() { - return gluonSwatchProperty.get(); - } - - /** - * The property holding the gluon swatch used by this editor - * - * @return the property holding the gluon swatch used by this editor. - */ - public ObjectProperty gluonSwatchProperty() { - return gluonSwatchProperty; - } - /** * * @return the list of scene style sheet used by this editor @@ -1790,7 +1728,9 @@ public void performInsert(LibraryItem libraryItem) { jobManager.push(job); - WarnThemeAlert.showAlertIfRequired(this, newObject, ownerWindow); + if (newObject.isClassFromExternalPlugin()) { + EditorPlatform.showThemeAlert(ownerWindow, getTheme(), this::setTheme); + } } /** @@ -2553,7 +2493,7 @@ private boolean isSelectionControl() { final ObjectSelectionGroup osg = (ObjectSelectionGroup) asg; for (FXOMObject fxomObject : osg.getItems()) { final boolean isControl = fxomObject.getSceneGraphObject() instanceof Control; - if (isControl == false) { + if (!isControl) { return false; } } @@ -2579,8 +2519,8 @@ private void updateFxomDocument(String fxmlText, URL fxmlLocation, ResourceBundl watchingController.fxomDocumentDidChange(); - if (checkTheme) { - WarnThemeAlert.showAlertIfRequired(this, newFxomDocument, ownerWindow); + if (checkTheme && newFxomDocument != null && newFxomDocument.hasControlsFromExternalPlugin()) { + EditorPlatform.showThemeAlert(getOwnerWindow(), getTheme(), this::setTheme); } } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/EditorPlatform.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/EditorPlatform.java index 15d6df31a..66cd72a5c 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/EditorPlatform.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/EditorPlatform.java @@ -32,26 +32,22 @@ */ package com.oracle.javafx.scenebuilder.kit.editor; -import com.gluonhq.charm.glisten.visual.GlistenStyleClasses; - -import java.io.BufferedReader; import java.io.File; import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URL; import java.nio.file.Paths; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Locale; +import java.util.Optional; +import java.util.ServiceLoader; +import java.util.function.Consumer; import java.util.logging.Level; import java.util.logging.Logger; -import java.util.stream.Collectors; import com.oracle.javafx.scenebuilder.kit.i18n.I18N; -import javafx.scene.Node; import javafx.scene.input.MouseEvent; -import javafx.scene.paint.Color; -import javafx.scene.shape.Rectangle; +import javafx.stage.Stage; /** * This class contains static methods that depends on the platform. @@ -91,165 +87,71 @@ public static OS get() { */ public static final boolean IS_WINDOWS = osName.contains("windows"); //NOI18N - /** - * Gluon Glisten package - */ - public static final String GLUON_PACKAGE = "com.gluonhq.charm.glisten"; - - /** - * scene builder specific tweaks to Gluon theme - */ - public static final String GLUON_DOCUMENT_STYLESHEET = "com/oracle/javafx/scenebuilder/app/css/GluonDocument.css"; - /** * Default theme */ public static final Theme DEFAULT_THEME = Theme.MODENA; - /** - * Default Gluon Swatch - */ - public static final EditorPlatform.GluonSwatch DEFAULT_SWATCH = GluonSwatch.BLUE; - - /** - * Default Gluon Theme - */ - public static final EditorPlatform.GluonTheme DEFAULT_GLUON_THEME = GluonTheme.LIGHT; - - interface StylesheetProvider { - List getStylesheetURLs(); - } - - private static final String MODENA_PATH = "com/sun/javafx/scene/control/skin/modena/"; - private static final String CASPIAN_PATH = "com/sun/javafx/scene/control/skin/caspian/"; /** * Themes supported by Scene Builder Kit. */ - public enum Theme implements StylesheetProvider { - GLUON_MOBILE_LIGHT(GlistenStyleClasses.impl_loadResource("glisten.css")), - GLUON_MOBILE_DARK(GlistenStyleClasses.impl_loadResource("glisten.css")), - MODENA(MODENA_PATH + "modena.css"), - MODENA_TOUCH(MODENA_PATH + "modena.css", MODENA_PATH + "touch.css"), - MODENA_HIGH_CONTRAST_BLACK_ON_WHITE(MODENA_PATH + "modena.css", MODENA_PATH + "blackOnWhite.css"), - MODENA_HIGH_CONTRAST_WHITE_ON_BLACK(MODENA_PATH + "modena.css", MODENA_PATH + "whiteOnBlack.css"), - MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK(MODENA_PATH + "modena.css", MODENA_PATH + "yellowOnBlack.css"), - MODENA_TOUCH_HIGH_CONTRAST_BLACK_ON_WHITE(MODENA_PATH + "modena.css", MODENA_PATH + "touch.css", MODENA_PATH + "blackOnWhite.css"), - MODENA_TOUCH_HIGH_CONTRAST_WHITE_ON_BLACK(MODENA_PATH + "modena.css", MODENA_PATH + "touch.css", MODENA_PATH + "whiteOnBlack.css"), - MODENA_TOUCH_HIGH_CONTRAST_YELLOW_ON_BLACK(MODENA_PATH + "modena.css", MODENA_PATH + "touch.css", MODENA_PATH + "yellowOnBlack.css"), - CASPIAN(CASPIAN_PATH + "caspian.css"), - CASPIAN_HIGH_CONTRAST(CASPIAN_PATH + "caspian.css", CASPIAN_PATH + "highcontrast.css"), - CASPIAN_EMBEDDED(CASPIAN_PATH + "caspian.css", CASPIAN_PATH + "embedded.css"), - CASPIAN_EMBEDDED_HIGH_CONTRAST(CASPIAN_PATH + "caspian.css", CASPIAN_PATH + "embedded.css", CASPIAN_PATH + "highcontrast.css"), - CASPIAN_EMBEDDED_QVGA(CASPIAN_PATH + "caspian.css", CASPIAN_PATH + "embedded.css", CASPIAN_PATH + "embedded-qvga.css"), - CASPIAN_EMBEDDED_QVGA_HIGH_CONTRAST(CASPIAN_PATH + "caspian.css", CASPIAN_PATH + "embedded.css", CASPIAN_PATH + "embedded-qvga.css", CASPIAN_PATH + "highcontrast.css"); - - private final List urls; - - Theme(String... urls) { - this.urls = List.of(urls); - } - - @Override - public List getStylesheetURLs() { - return urls; - } - - @Override - public String toString() { - String lowerCaseName = name().toLowerCase(Locale.ROOT); - return I18N.getString("title.theme." + lowerCaseName); - } - } - - /** - * Gluon Swatch - */ - public enum GluonSwatch implements StylesheetProvider { - BLUE, - CYAN, - DEEP_ORANGE, - DEEP_PURPLE, - GREEN, - INDIGO, - LIGHT_BLUE, - PINK, - PURPLE, - RED, - TEAL, - LIGHT_GREEN, - LIME, - YELLOW, - AMBER, - ORANGE, - BROWN, - GREY, - BLUE_GREY; - - private static final String PRIMARY_SWATCH_500_STR = "-primary-swatch-500:"; - - Color color; + public record Theme(String name, String value, String... stylesheetURLs) { + + private static final String MODENA_PATH = "com/sun/javafx/scene/control/skin/modena/"; + private static final String CASPIAN_PATH = "com/sun/javafx/scene/control/skin/caspian/"; + + public static final Theme MODENA = + new Theme("MODENA", I18N.getString("title.theme.modena"), MODENA_PATH + "modena.css"); + public static final Theme MODENA_TOUCH = + new Theme("MODENA_TOUCH", I18N.getString("title.theme.modena_touch"), MODENA_PATH + "modena.css", MODENA_PATH + "touch.css"); + public static final Theme MODENA_HIGH_CONTRAST_BLACK_ON_WHITE = + new Theme("MODENA_HIGH_CONTRAST_BLACK_ON_WHITE", I18N.getString("title.theme.modena_high_contrast_black_on_white"), MODENA_PATH + "modena.css", MODENA_PATH + "blackOnWhite.css"); + public static final Theme MODENA_HIGH_CONTRAST_WHITE_ON_BLACK = + new Theme("MODENA_HIGH_CONTRAST_WHITE_ON_BLACK", I18N.getString("title.theme.modena_high_contrast_white_on_black"), MODENA_PATH + "modena.css", MODENA_PATH + "whiteOnBlack.css"); + public static final Theme MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK = + new Theme("MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK", I18N.getString("title.theme.modena_high_contrast_yellow_on_black"), MODENA_PATH + "modena.css", MODENA_PATH + "yellowOnBlack.css"); + public static final Theme MODENA_TOUCH_HIGH_CONTRAST_BLACK_ON_WHITE = + new Theme("MODENA_TOUCH_HIGH_CONTRAST_BLACK_ON_WHITE", I18N.getString("title.theme.modena_touch_high_contrast_black_on_white"), MODENA_PATH + "modena.css", MODENA_PATH + "touch.css", MODENA_PATH + "blackOnWhite.css"); + public static final Theme MODENA_TOUCH_HIGH_CONTRAST_WHITE_ON_BLACK = + new Theme("MODENA_TOUCH_HIGH_CONTRAST_WHITE_ON_BLACK", I18N.getString("title.theme.modena_touch_high_contrast_white_on_black"), MODENA_PATH + "modena.css", MODENA_PATH + "touch.css", MODENA_PATH + "whiteOnBlack.css"); + public static final Theme MODENA_TOUCH_HIGH_CONTRAST_YELLOW_ON_BLACK = + new Theme("MODENA_TOUCH_HIGH_CONTRAST_YELLOW_ON_BLACK", I18N.getString("title.theme.modena_touch_high_contrast_yellow_on_black"), MODENA_PATH + "modena.css", MODENA_PATH + "touch.css", MODENA_PATH + "yellowOnBlack.css"); + public static final Theme CASPIAN = + new Theme("CASPIAN", I18N.getString("title.theme.caspian"), CASPIAN_PATH + "caspian.css"); + public static final Theme CASPIAN_HIGH_CONTRAST = + new Theme("CASPIAN_HIGH_CONTRAST", I18N.getString("title.theme.caspian_high_contrast"), CASPIAN_PATH + "caspian.css", CASPIAN_PATH + "highcontrast.css"); + public static final Theme CASPIAN_EMBEDDED = + new Theme("CASPIAN_EMBEDDED", I18N.getString("title.theme.caspian_embedded"), CASPIAN_PATH + "caspian.css", CASPIAN_PATH + "embedded.css"); + public static final Theme CASPIAN_EMBEDDED_HIGH_CONTRAST = + new Theme("CASPIAN_EMBEDDED_HIGH_CONTRAST", I18N.getString("title.theme.caspian_embedded_high_contrast"), CASPIAN_PATH + "caspian.css", CASPIAN_PATH + "embedded.css", CASPIAN_PATH + "highcontrast.css"); + public static final Theme CASPIAN_EMBEDDED_QVGA = + new Theme("CASPIAN_EMBEDDED_QVGA", I18N.getString("title.theme.caspian_embedded_qvga"), CASPIAN_PATH + "caspian.css", CASPIAN_PATH + "embedded.css", CASPIAN_PATH + "embedded-qvga.css"); + public static final Theme CASPIAN_EMBEDDED_QVGA_HIGH_CONTRAST = + new Theme("CASPIAN_EMBEDDED_QVGA_HIGH_CONTRAST", I18N.getString("title.theme.caspian_embedded_qvga_high_contrast"), CASPIAN_PATH + "caspian.css", CASPIAN_PATH + "embedded.css", CASPIAN_PATH + "embedded-qvga.css", CASPIAN_PATH + "highcontrast.css"); @Override public String toString() { - String lowerCaseSwatch = "title.gluon.swatch." + name().toLowerCase(Locale.ROOT); - return I18N.getString(lowerCaseSwatch); + return value; } - @Override public List getStylesheetURLs() { - return List.of(GlistenStyleClasses.impl_loadResource("swatch_" + name().toLowerCase(Locale.ROOT) + ".css")); + return List.of(stylesheetURLs); } - public Color getColor() { - if (color == null) { - URL url = null; - try { - url = new URL(getStylesheetURLs().getFirst()); - try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) { - String s = reader.readLine(); - while (s != null) { - // Remove white spaces - String trimmedString = s.replaceAll("\\s+", ""); - int indexOf = trimmedString.indexOf(PRIMARY_SWATCH_500_STR); - if (indexOf != -1) { - int indexOfSemiColon = trimmedString.indexOf(";"); - String colorString = trimmedString.substring(indexOf + PRIMARY_SWATCH_500_STR.length(), indexOfSemiColon); - color = Color.web(colorString); - } - s = reader.readLine(); - } - } - } catch (IOException e) { - LOGGER.log(Level.WARNING, "Failed to get color from stylesheet: ", e); - } - } - return color; + public static List getThemeList() { + List themeList = new ArrayList<>(List.of(Theme.MODENA, Theme.MODENA_TOUCH, Theme.MODENA_HIGH_CONTRAST_BLACK_ON_WHITE, + Theme.MODENA_HIGH_CONTRAST_WHITE_ON_BLACK, Theme.MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK, Theme.MODENA_TOUCH_HIGH_CONTRAST_BLACK_ON_WHITE, + Theme.MODENA_TOUCH_HIGH_CONTRAST_WHITE_ON_BLACK, Theme.MODENA_HIGH_CONTRAST_YELLOW_ON_BLACK, + Theme.CASPIAN, Theme.CASPIAN_EMBEDDED, Theme.CASPIAN_EMBEDDED_HIGH_CONTRAST, Theme.CASPIAN_EMBEDDED_QVGA, Theme.CASPIAN_EMBEDDED_QVGA_HIGH_CONTRAST)); + themeList.addAll(0, getExternalThemes()); + return themeList; } - public Node createGraphic() { - Rectangle rect = new Rectangle(8, 8); - rect.setFill(getColor()); - rect.setStroke(Color.BLACK); - return rect; - } - } - - /** - * Gluon Theme - */ - public enum GluonTheme implements StylesheetProvider { - LIGHT, - DARK; - - @Override - public String toString() { - String lowerCaseName = "title.gluon.theme." + name().toLowerCase(Locale.ROOT); - return I18N.getString(lowerCaseName); - } - - @Override - public List getStylesheetURLs() { - return List.of(GlistenStyleClasses.impl_loadResource("theme_" + name().toLowerCase(Locale.ROOT) + ".css")); + public static Theme valueOf(String themeName) { + return getThemeList().stream() + .filter(t -> t.name().equals(themeName)) + .findFirst() + .orElse(DEFAULT_THEME); } } @@ -262,10 +164,6 @@ public static String getPlatformThemeStylesheetURL() { return Theme.MODENA.getStylesheetURLs().getFirst(); } - public static String getGluonDocumentStylesheetURL() { - return GLUON_DOCUMENT_STYLESHEET; - } - public static boolean isModena(Theme theme) { return theme.toString().startsWith("MODENA"); } @@ -305,12 +203,6 @@ public static boolean isCaspian(Theme theme) { return theme.toString().startsWith("CASPIAN"); } - public static boolean isGluonMobileLight(Theme theme) { return theme == Theme.GLUON_MOBILE_LIGHT; } - - public static boolean isGluonMobileDark(Theme theme) { - return theme == Theme.GLUON_MOBILE_DARK; - } - /** * Requests the underlying platform to open a given file. On Linux, it runs * 'xdg-open'. On Mac, it runs 'open'. On Windows, it runs 'cmd /c start'. @@ -431,7 +323,7 @@ public static boolean isAssertionEnabled() { */ private static void executeDaemon(List cmd, File wDir, int exitCodeOk) throws IOException, FileBrowserRevealException { - var cmdLine = cmd.stream().collect(Collectors.joining(" ")); + var cmdLine = String.join(" ", cmd); long timeoutSec = 5; try { int exitValue = new Cmd().exec(cmd, wDir, timeoutSec); @@ -450,10 +342,67 @@ private static void executeDaemon(List cmd, File wDir, int exitCodeOk) LOGGER.log(Level.SEVERE, "Process timeout after {0}s: {1} in {2}", new Object[] { timeoutSec, cmdLine, wDir }); Thread.currentThread().interrupt(); - String msg = "The command to reval the file exited with an error after timeout.\nCommand: %s\nWorking Dir: %s\nTimeout (s):%s" + String msg = "The command to reveal the file exited with an error after timeout.\nCommand: %s\nWorking Dir: %s\nTimeout (s):%s" .formatted(cmdLine, wDir, timeoutSec); String detailMsg = msg + "\n" + e.getMessage(); throw new IOException(detailMsg); } } + + // External + private static final Collection externalThemeProviders = getExternalThemeProviders(); + + private static List getExternalThemes() { + List result = new ArrayList<>(); + for (ExternalThemeProvider provider : externalThemeProviders) { + result.addAll(provider.getExternalThemes()); + } + return result; + } + + public static List getStylesheetsForTheme(Theme theme) { + if (getExternalThemes().contains(theme)) { + for (ExternalThemeProvider provider : externalThemeProviders) { + return provider.getExternalStylesheets(); + } + } + return List.of(); + } + + public static void showThemeAlert(Stage owner, EditorPlatform.Theme currentTheme, Consumer onSuccess) { + for (ExternalThemeProvider provider : externalThemeProviders) { + provider.showThemeAlert(owner, currentTheme, onSuccess); + } + } + + public static void showImportAlert(Stage owner) { + for (ExternalThemeProvider provider : externalThemeProviders) { + provider.showImportAlert(owner); + } + } + + public static boolean hasClassFromExternalPlugin(String text) { + for (ExternalThemeProvider provider : externalThemeProviders) { + if (provider.hasClassFromExternalPlugin(text)) { + return true; + } + } + return false; + } + + public static Optional getExternalJavadocURL(String classname) { + for (ExternalThemeProvider provider : externalThemeProviders) { + if (provider.hasClassFromExternalPlugin(classname)) { + return Optional.of(provider.getExternalJavadocURL()); + } + } + return Optional.empty(); + } + + private static Collection getExternalThemeProviders() { + ServiceLoader loader = ServiceLoader.load(ExternalThemeProvider.class); + Collection providers = new ArrayList<>(); + loader.iterator().forEachRemaining(providers::add); + return providers; + } } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/ExternalThemeProvider.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/ExternalThemeProvider.java new file mode 100644 index 000000000..7e3def95d --- /dev/null +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/ExternalThemeProvider.java @@ -0,0 +1,88 @@ +/* + * 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.oracle.javafx.scenebuilder.kit.editor; + +import javafx.stage.Stage; + +import java.util.List; +import java.util.function.Consumer; + +public interface ExternalThemeProvider { + + /** + * Gets a list of possible themes from an external plugin + * + * @return list of themes + */ + List getExternalThemes(); + + /** + * Gets a list of possible stylesheets from an external plugin + * + * @return a list of stylesheets + */ + List getExternalStylesheets(); + + /** + * Verifies if a given text (either from a class name or an FXML file) contains + * package names of classes from a given plugin + * + * @param text the text to check + * @return true if the text contains package names from a plugin + */ + boolean hasClassFromExternalPlugin(String text); + + /** + * If controls from an external plugin are added, but the current theme doesn't support those, + * it shows an alert that the theme from the plugin needs to be activated + * + * @param owner the stage that will own the alert + * @param currentTheme the current theme + * @param onSuccess if alert button is accepted, the external plugin will be applied + */ + void showThemeAlert(Stage owner, EditorPlatform.Theme currentTheme, Consumer onSuccess); + + /** + * When a jar is imported as custom library, but there is a plugin with such + * jar, an alert is shown + * + * @param owner the stage that will own the alert + */ + void showImportAlert(Stage owner); + + /** + * Returns a link to the javadoc URL of the plugin + * + * @return a valid link to javadoc + */ + String getExternalJavadocURL(); +} diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/job/SetDocumentRootJob.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/job/SetDocumentRootJob.java index 37c366fa5..f3eaf1b9d 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/job/SetDocumentRootJob.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/job/SetDocumentRootJob.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2024, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -84,10 +85,10 @@ protected List makeSubJobs() { result.add(new PrunePropertiesJob(newRoot, null, getEditorController())); } - // Adds job that effectively modifes the root + // Adds job that effectively modifies the root result.add(new SetFxomRootJob(newRoot, getEditorController())); - // If need, we add a job for resizing the root object + // If needed, we add a job for resizing the root object if ((newRoot != null) && usePredefinedSize) { final DesignHierarchyMask mask = new DesignHierarchyMask(newRoot); if (mask.needResizeWhenTopElement()) { diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/job/atomic/AddPropertyValueJob.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/job/atomic/AddPropertyValueJob.java index 38278f9db..24b8d7fcb 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/job/atomic/AddPropertyValueJob.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/job/atomic/AddPropertyValueJob.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Gluon and/or its affiliates. + * Copyright (c) 2017, 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,12 +32,11 @@ */ package com.oracle.javafx.scenebuilder.kit.editor.job.atomic; -import com.oracle.javafx.scenebuilder.kit.alert.WarnThemeAlert; import com.oracle.javafx.scenebuilder.kit.editor.EditorController; +import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform; import com.oracle.javafx.scenebuilder.kit.editor.job.Job; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMObject; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMPropertyC; -import javafx.stage.Stage; /** * @@ -99,7 +98,9 @@ public void redo() { value.addToParentProperty(targetIndex, targetProperty); getEditorController().getFxomDocument().endUpdate(); - WarnThemeAlert.showAlertIfRequired(getEditorController(), value, (Stage)getEditorController().getOwnerWindow()); + if (value.isClassFromExternalPlugin()) { + EditorPlatform.showThemeAlert(getEditorController().getOwnerWindow(), getEditorController().getTheme(), t -> getEditorController().setTheme(t)); + } assert value.getParentProperty() == targetProperty; assert value.getParentCollection() == null; diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/job/atomic/SetFxomRootJob.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/job/atomic/SetFxomRootJob.java index 8a8948b8a..8af5bf99e 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/job/atomic/SetFxomRootJob.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/job/atomic/SetFxomRootJob.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Gluon and/or its affiliates. + * Copyright (c) 2017, 2024, Gluon and/or its affiliates. * Copyright (c) 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -32,8 +32,8 @@ */ package com.oracle.javafx.scenebuilder.kit.editor.job.atomic; -import com.oracle.javafx.scenebuilder.kit.alert.WarnThemeAlert; import com.oracle.javafx.scenebuilder.kit.editor.EditorController; +import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform; import com.oracle.javafx.scenebuilder.kit.editor.job.Job; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMObject; @@ -67,14 +67,17 @@ public void execute() { assert oldRoot == null; // Saves the current root - final FXOMDocument fxomDocument = getEditorController().getFxomDocument(); + EditorController editorController = getEditorController(); + final FXOMDocument fxomDocument = editorController.getFxomDocument(); oldRoot = fxomDocument.getFxomRoot(); fxomDocument.beginUpdate(); fxomDocument.setFxomRoot(newRoot); fxomDocument.endUpdate(); - WarnThemeAlert.showAlertIfRequired(getEditorController(), newRoot, getEditorController().getOwnerWindow()); + if (newRoot != null && newRoot.isClassFromExternalPlugin()) { + EditorPlatform.showThemeAlert(editorController.getOwnerWindow(), editorController.getTheme(), editorController::setTheme); + } } @Override diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/ContentPanelController.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/ContentPanelController.java index cc0d9b46b..18ee21e49 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/ContentPanelController.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/ContentPanelController.java @@ -42,7 +42,6 @@ import java.util.logging.Level; import java.util.logging.Logger; -import javafx.beans.value.ChangeListener; import javafx.collections.ListChangeListener; import javafx.event.Event; import javafx.event.EventHandler; @@ -90,9 +89,6 @@ import com.oracle.javafx.scenebuilder.kit.editor.EditorController; import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform; -import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform.Theme; -import com.oracle.javafx.scenebuilder.kit.editor.drag.source.AbstractDragSource; -import com.oracle.javafx.scenebuilder.kit.editor.drag.target.AbstractDropTarget; import com.oracle.javafx.scenebuilder.kit.editor.panel.content.driver.SceneDriver; import com.oracle.javafx.scenebuilder.kit.editor.panel.content.driver.WindowDriver; import com.oracle.javafx.scenebuilder.kit.i18n.I18N; @@ -192,23 +188,11 @@ public ContentPanelController(EditorController editorController) { this.pickModeController = new PickModeController(this); this.workspaceController = new WorkspaceController(editorController); - editorController.getDragController().dragSourceProperty().addListener((ChangeListener) (ov, t, t1) -> dragSourceDidChange() - ); - - editorController.getDragController().dropTargetProperty().addListener((ChangeListener) (ov, t, t1) -> dropTargetDidChange() - ); - - editorController.themeProperty().addListener((ChangeListener) (ov, t, t1) -> themeDidChange() - ); - - editorController.gluonSwatchProperty().addListener(((observable, oldValue, newValue) -> themeDidChange())); - - editorController.gluonThemeProperty().addListener(((observable, oldValue, newValue) -> themeDidChange())); - - editorController.sceneStyleSheetProperty().addListener((ListChangeListener) change -> sceneStyleSheetsDidChange() - ); - editorController.pickModeEnabledProperty().addListener((ChangeListener) (ov, t, t1) -> pickModeDidChange() - ); + editorController.getDragController().dragSourceProperty().addListener((ov, t, t1) -> dragSourceDidChange()); + editorController.getDragController().dropTargetProperty().addListener((ov, t, t1) -> dropTargetDidChange()); + editorController.themeProperty().addListener((ov, t, t1) -> themeDidChange()); + editorController.sceneStyleSheetProperty().addListener((ListChangeListener) change -> sceneStyleSheetsDidChange()); + editorController.pickModeEnabledProperty().addListener((ov, t, t1) -> pickModeDidChange()); } /** @@ -1089,13 +1073,12 @@ private void dropTargetDidChange() { private void themeDidChange() { if (contentGroup != null) { final EditorPlatform.Theme theme = getEditorController().getTheme(); - final EditorPlatform.GluonSwatch gluonSwatch = getEditorController().getGluonSwatch(); - final EditorPlatform.GluonTheme gluonTheme = getEditorController().getGluonTheme(); - workspaceController.setThemeStyleSheet(theme.getStylesheetURLs(), theme, gluonSwatch, gluonTheme); + List themeStylesheets = new ArrayList<>(EditorPlatform.getStylesheetsForTheme(theme)); + themeStylesheets.addAll(theme.getStylesheetURLs()); + workspaceController.setThemeStyleSheet(themeStylesheets, theme); } } - private void sceneStyleSheetsDidChange() { if (contentGroup != null) { final List sceneStyleSheets = getEditorController().getSceneStyleSheets(); @@ -1229,7 +1212,7 @@ private List collectNodes() { candidates.add(subComponent); } } - for (DesignHierarchyMask.Accessory a : DesignHierarchyMask.Accessory.values()) { + for (DesignHierarchyMask.Accessory a : m.getAccessoryList()) { if (m.isAcceptingAccessory(a)) { final FXOMObject accessoryObject = m.getAccessory(a); if ((accessoryObject != null) && accessoryObject.isNode()) { diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/WorkspaceController.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/WorkspaceController.java index a88f7a70f..a91b880aa 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/WorkspaceController.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/WorkspaceController.java @@ -84,8 +84,8 @@ class WorkspaceController { private boolean autoResize3DContent = true; private double scaling = 1.0; private RuntimeException layoutException; - private EditorController editorController; - private ArrayList themeStylesheets = new ArrayList(); + private final EditorController editorController; + private final ArrayList themeStylesheets = new ArrayList<>(); private FXOMDocument fxomDocument; @@ -163,46 +163,17 @@ public List getThemeStyleSheets() { return Collections.unmodifiableList(themeStylesheets); } - public void setThemeStyleSheet(List themeStyleSheets, EditorPlatform.Theme theme, EditorPlatform.GluonSwatch gluonSwatch, EditorPlatform.GluonTheme gluonTheme) { + public void setThemeStyleSheet(List themeStyleSheets, EditorPlatform.Theme theme) { assert themeStyleSheets != null; assert theme != null; - assert gluonSwatch != null; - assert gluonTheme != null; - String gluonDocumentStylesheet = EditorPlatform.getGluonDocumentStylesheetURL(); - String gluonSwatchStylesheet = gluonSwatch.getStylesheetURLs().getFirst(); - String gluonThemeStylesheet = gluonTheme.getStylesheetURLs().getFirst(); - String previousGluonSwatchStylesheet = editorController.getGluonSwatch().getStylesheetURLs().getFirst(); - String previousGluonThemeStylesheet = editorController.getGluonTheme().getStylesheetURLs().getFirst(); - if (theme == EditorPlatform.Theme.GLUON_MOBILE_LIGHT || theme == EditorPlatform.Theme.GLUON_MOBILE_DARK) { - contentSubScene.setUserAgentStylesheet(EditorPlatform.Theme.MODENA.getStylesheetURLs().getFirst()); - ObservableList currentStyleSheets = FXCollections.observableArrayList(contentGroup.getStylesheets()); - currentStyleSheets.remove(previousGluonSwatchStylesheet); - currentStyleSheets.remove(previousGluonThemeStylesheet); - themeStyleSheets.forEach(themeStyleSheet -> { - if (!currentStyleSheets.contains(themeStyleSheet)) { - currentStyleSheets.add(themeStyleSheet); - } - }); - if (!currentStyleSheets.contains(gluonDocumentStylesheet)) { - currentStyleSheets.add(gluonDocumentStylesheet); - } - if (!currentStyleSheets.contains(gluonSwatchStylesheet)) { - currentStyleSheets.add(gluonSwatchStylesheet); - } - if (!currentStyleSheets.contains(gluonThemeStylesheet)) { - currentStyleSheets.add(gluonThemeStylesheet); - } - themeStylesheets.clear(); - themeStylesheets.addAll(currentStyleSheets); - contentGroupApplyCss(); -// setPreviewStyleSheets(Arrays.asList(themeStyleSheet)); - } else { - contentSubScene.setUserAgentStylesheet(themeStyleSheets.getFirst()); - ObservableList currentStyleSheets = FXCollections.observableArrayList(themeStyleSheets); - themeStylesheets.clear(); - themeStylesheets.addAll(currentStyleSheets); - contentGroupApplyCss(); - } + List stylesheets = new ArrayList<>(EditorPlatform.getStylesheetsForTheme(theme)); + stylesheets.addAll(themeStyleSheets); + contentSubScene.setUserAgentStylesheet(stylesheets.getFirst()); + + ObservableList currentStyleSheets = FXCollections.observableArrayList(stylesheets); + themeStylesheets.clear(); + themeStylesheets.addAll(currentStyleSheets); + contentGroupApplyCss(); // Update scenegraph layout, etc FXOMDocument fxomDocument = editorController.getFxomDocument(); @@ -212,15 +183,12 @@ public void setThemeStyleSheet(List themeStyleSheets, EditorPlatform.The } public void setPreviewStyleSheets(List previewStyleSheets) { - EditorPlatform.Theme currentTheme = editorController.getTheme(); + EditorPlatform.Theme theme = editorController.getTheme(); + List stylesheets = new ArrayList<>(EditorPlatform.getStylesheetsForTheme(theme)); + stylesheets.addAll(previewStyleSheets); + themeStylesheets.clear(); - themeStylesheets.addAll(previewStyleSheets); - if (currentTheme == EditorPlatform.Theme.GLUON_MOBILE_LIGHT || currentTheme == EditorPlatform.Theme.GLUON_MOBILE_DARK) { - themeStylesheets.add(EditorPlatform.Theme.GLUON_MOBILE_LIGHT.getStylesheetURLs().getFirst()); // We can call this with GLUON_MOBILE_LIGHT or GLUON_MOBILE_DARK - themeStylesheets.add(editorController.getGluonSwatch().getStylesheetURLs().getFirst()); - themeStylesheets.add(editorController.getGluonTheme().getStylesheetURLs().getFirst()); - themeStylesheets.add(EditorPlatform.getGluonDocumentStylesheetURL()); - } + themeStylesheets.addAll(stylesheets); contentGroupApplyCss(); } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/BorderPaneDriver.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/BorderPaneDriver.java index 6f46b3404..53f76112f 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/BorderPaneDriver.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/BorderPaneDriver.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2024, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -96,10 +97,10 @@ public AbstractDropTarget makeDropTarget(FXOMObject fxomObject, double sceneX, d @Override public AbstractTring makeTring(AbstractDropTarget dropTarget) { assert dropTarget instanceof AccessoryDropTarget; - - final AccessoryDropTarget accessoryDropTarget - = (AccessoryDropTarget) dropTarget; - return new BorderPaneTring(contentPanelController, + if (!(dropTarget instanceof AccessoryDropTarget accessoryDropTarget)) { + return null; + } + return new BorderPaneTring(contentPanelController, (FXOMInstance) dropTarget.getTargetObject(), accessoryDropTarget.getAccessory()); } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/tring/BorderPaneTring.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/tring/BorderPaneTring.java index 4b261d508..18ceb0818 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/tring/BorderPaneTring.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/driver/tring/BorderPaneTring.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2024, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -160,32 +161,32 @@ public static Bounds computeAreaBounds(Bounds lb, Bounds cb, Accessory area) { */ final double xmin, ymin, xmax, ymax; - switch(area) { - case TOP: + switch (area.name()) { + case "TOP": xmin = lb.getMinX(); ymin = lb.getMinY(); xmax = lb.getMaxX(); ymax = cb.getMinY(); break; - case BOTTOM: + case "BOTTOM": xmin = lb.getMinX(); ymin = cb.getMaxY(); xmax = lb.getMaxX(); ymax = lb.getMaxY(); break; - case LEFT: + case "LEFT": xmin = lb.getMinX(); ymin = cb.getMinY(); xmax = cb.getMinX(); ymax = cb.getMaxY(); break; - case RIGHT: + case "RIGHT": xmin = cb.getMaxX(); ymin = cb.getMinY(); xmax = lb.getMaxX(); ymax = cb.getMaxY(); break; - case CENTER: + case "CENTER": xmin = cb.getMinX(); ymin = cb.getMinY(); xmax = cb.getMaxX(); @@ -235,20 +236,20 @@ protected void layoutDecoration() { rightLabel.setPrefSize(rightBounds.getWidth(), rightBounds.getHeight()); final Label targetLabel; - switch(targetAccessory) { - case TOP: + switch (targetAccessory.name()) { + case "TOP": targetLabel = topLabel; break; - case BOTTOM: + case "BOTTOM": targetLabel = bottomLabel; break; - case LEFT: + case "LEFT": targetLabel = leftLabel; break; - case RIGHT: + case "RIGHT": targetLabel = rightLabel; break; - case CENTER: + case "CENTER": targetLabel = centerLabel; break; default: diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/mode/EditModeController.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/mode/EditModeController.java index 7e209ee4c..cca13d0a1 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/mode/EditModeController.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/content/mode/EditModeController.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Gluon and/or its affiliates. + * Copyright (c) 2022, 2024, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -321,7 +321,7 @@ private void updateTring() { newTring = tring; updateTring((GridPaneTring) tring, (GridPaneDropTarget) dropTarget); } else { - newTring = makeTring(dragController.getDropTarget()); + newTring = makeTring(dropTarget); } } else { newTring = null; diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/AbstractHierarchyPanelController.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/AbstractHierarchyPanelController.java index 0443fdda6..ea38810ba 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/AbstractHierarchyPanelController.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/AbstractHierarchyPanelController.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. * @@ -649,33 +649,14 @@ private TreeItem makeTreeItem(final FXOMObject fxomObject) { return treeItem; } - private TreeItem makeTreeItemExpansionPanel( - final DesignHierarchyMask owner, - final FXOMObject fxomObject, - final Accessory accessory) { - final HierarchyItemExpansionPanel item = new HierarchyItemExpansionPanel(owner, fxomObject, accessory); - final TreeItem treeItem = new TreeItem<>(item); - // Set back the TreeItem expanded property if any - Boolean expanded = treeItemsExpandedMapProperty.get(fxomObject); - if (expanded != null) { - treeItem.setExpanded(expanded); - } - // Mask may be null for empty place holder - if (item.getMask() != null) { - updateTreeItem(treeItem); - } - return treeItem; - } - - private TreeItem makeTreeItemExpandedPanel(final DesignHierarchyMask owner, final FXOMObject fxomObject) { - final HierarchyItemExpandedPanel item = new HierarchyItemExpandedPanel(owner, fxomObject); + private TreeItem makeTreeItem(HierarchyItem item, final FXOMObject fxomObject) { final TreeItem treeItem = new TreeItem<>(item); // Set back the TreeItem expanded property if any Boolean expanded = treeItemsExpandedMapProperty.get(fxomObject); if (expanded != null) { treeItem.setExpanded(expanded); } - // Mask may be null for empty place holder + // Mask may be null for empty placeholder if (item.getMask() != null) { updateTreeItem(treeItem); } @@ -686,38 +667,16 @@ private TreeItem makeTreeItemBorderPane( final DesignHierarchyMask owner, final FXOMObject fxomObject, final Accessory accessory) { - final HierarchyItemBorderPane item - = new HierarchyItemBorderPane(owner, fxomObject, accessory); - final TreeItem treeItem = new TreeItem<>(item); - // Set back the TreeItem expanded property if any - Boolean expanded = treeItemsExpandedMapProperty.get(fxomObject); - if (expanded != null) { - treeItem.setExpanded(expanded); - } - // Mask may be null for empty place holder - if (item.getMask() != null) { - updateTreeItem(treeItem); - } - return treeItem; + final HierarchyItemBorderPane item = new HierarchyItemBorderPane(owner, fxomObject, accessory); + return makeTreeItem(item, fxomObject); } private TreeItem makeTreeItemDialogPane( final DesignHierarchyMask owner, final FXOMObject fxomObject, final Accessory accessory) { - final HierarchyItemDialogPane item - = new HierarchyItemDialogPane(owner, fxomObject, accessory); - final TreeItem treeItem = new TreeItem<>(item); - // Set back the TreeItem expanded property if any - Boolean expanded = treeItemsExpandedMapProperty.get(fxomObject); - if (expanded != null) { - treeItem.setExpanded(expanded); - } - // Mask may be null for empty place holder - if (item.getMask() != null) { - updateTreeItem(treeItem); - } - return treeItem; + final HierarchyItemDialogPane item = new HierarchyItemDialogPane(owner, fxomObject, accessory); + return makeTreeItem(item, fxomObject); } /** @@ -729,18 +688,8 @@ private TreeItem makeTreeItemDialogPane( protected TreeItem makeTreeItemGraphic( final DesignHierarchyMask owner, final FXOMObject fxomObject) { - final HierarchyItemGraphic item - = new HierarchyItemGraphic(owner, fxomObject); - final TreeItem treeItem = new TreeItem<>(item); - Boolean expanded = treeItemsExpandedMapProperty.get(fxomObject); - if (expanded != null) { - treeItem.setExpanded(expanded); - } - // Mask may be null for empty place holder - if (item.getMask() != null) { - updateTreeItem(treeItem); - } - return treeItem; + final HierarchyItemGraphic item = new HierarchyItemGraphic(owner, fxomObject); + return makeTreeItem(item, fxomObject); } protected void updateTreeItems() { @@ -753,13 +702,13 @@ protected void updateTreeItems() { final Label label = getPromptLabel(); if (fxomDocument == null || fxomDocument.getFxomRoot() == null) { rootTreeItem = null; - // Add place holder to the parent + // Add placeholder to the parent if (fxomDocument == null) { label.setText(I18N.getString("contant.label.status.fxomdocument.null")); } else { label.setText(I18N.getString("content.label.status.invitation")); } - if (pane.getChildren().contains(label) == false) { + if (!pane.getChildren().contains(label)) { // This may occur when closing en empty document // => we switch from null FXOM root to null FXOM document pane.getChildren().add(label); @@ -767,7 +716,7 @@ protected void updateTreeItems() { } else { rootTreeItem = makeTreeItem(fxomDocument.getFxomRoot()); rootTreeItem.setExpanded(true); - // Remove place holder from the parent + // Remove placeholder from the parent ((Pane) parent).getChildren().remove(label); } } @@ -870,22 +819,13 @@ private void updateTreeItem(final TreeItem treeItem) { } } - // Gluon ExpansionPanel - for (Accessory accessory: new Accessory[]{ - Accessory.EXPANDED_CONTENT, - Accessory.COLLAPSED_CONTENT - }) { + // External Accessories + mask.getExternalHierarchyItemGeneratorMap().forEach((accessory, biFunction) -> { if (mask.isAcceptingAccessory(accessory)) { - final FXOMObject value = mask.getAccessory(accessory); - treeItem.getChildren().add(makeTreeItemExpansionPanel(mask, value, accessory)); + final FXOMObject fxom = mask.getAccessory(accessory); + treeItem.getChildren().add(makeTreeItem(biFunction.apply(mask, fxom), fxom)); } - } - - // Gluon ExpandedPanel - if (mask.isAcceptingAccessory(Accessory.EX_CONTENT)) { - final FXOMObject value = mask.getAccessory(Accessory.EX_CONTENT); - treeItem.getChildren().add(makeTreeItemExpandedPanel(mask, value)); - } + }); // Content (ScrollPane, Tab...) //--------------------------------- @@ -910,7 +850,7 @@ private void updateTreeItem(final TreeItem treeItem) { } } - // Positionning + // Positioning //--------------------------------- for (Accessory accessory : new Accessory[]{ Accessory.TOP, @@ -1131,7 +1071,7 @@ private void handleOnDragDetected(final MouseEvent event) { } final Selection selection = getEditorController().getSelection(); - if (selection.isEmpty() == false) { // (1) + if (!selection.isEmpty()) { // (1) if (selection.getGroup() instanceof ObjectSelectionGroup) { // A set of regular component (ie fxom objects) are selected final ObjectSelectionGroup osg = (ObjectSelectionGroup) selection.getGroup(); diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyDNDController.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyDNDController.java index d13220d13..fe151e47c 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyDNDController.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyDNDController.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. * @@ -43,9 +43,15 @@ 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.DesignHierarchyMask.Accessory; +import com.oracle.javafx.scenebuilder.kit.metadata.util.ExternalDesignHierarchyMaskProvider; import javafx.scene.control.TreeItem; import javafx.scene.input.DragEvent; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Optional; +import java.util.ServiceLoader; + /** * Controller for all drag and drop gestures in hierarchy panel. This class does * not depend on the TreeView or TreeTableView control and handles only @@ -257,17 +263,17 @@ private AbstractDropTarget makeDropTarget( final HierarchyItem item = treeItem.getValue(); assert item != null; - // When the TreeItem is a place holder : - // - if the place holder is empty - // the drop target is the place holder parent - // the accessory is set to the place holder value + // When the TreeItem is a placeholder : + // - if the placeholder is empty + // the drop target is the placeholder parent + // the accessory is set to the placeholder value // whatever the location value is. // - otherwise - // the drop target is the place holder item + // the drop target is the placeholder item // the accessory is set to null // the target index is set depending on the location value //------------------------------------------------------------------ - if (item.isPlaceHolder()) { // (1) + if (item.isPlaceholder()) { // (1) assert treeItem != rootTreeItem; assert item instanceof HierarchyItemBorderPane @@ -284,12 +290,9 @@ private AbstractDropTarget makeDropTarget( accessory = ((HierarchyItemBorderPane) item).getPosition(); } else if (item instanceof HierarchyItemDialogPane) { accessory = ((HierarchyItemDialogPane) item).getAccessory(); - } else if (item instanceof HierarchyItemExpansionPanel) { - accessory = ((HierarchyItemExpansionPanel) item).getAccessory(); - } else if (item instanceof HierarchyItemExpandedPanel) { - accessory = ((HierarchyItemExpandedPanel) item).getAccessory(); } else { - accessory = Accessory.GRAPHIC; + accessory = getExternalAccessoryForHierarchyItem(item) + .orElse(Accessory.GRAPHIC); } } else { // Set the drop target @@ -466,4 +469,24 @@ private AbstractDropTarget makeDropTarget( } return result; } + + // External providers + private final Collection externalDesignHierarchyMaskProviders = getExternalDesignHierarchyMaskProviders(); + + private Optional getExternalAccessoryForHierarchyItem(HierarchyItem item) { + for (ExternalDesignHierarchyMaskProvider provider : externalDesignHierarchyMaskProviders) { + Optional externalAccessoryForHierarchyItem = provider.getExternalAccessoryForHierarchyItem(item); + if (externalAccessoryForHierarchyItem.isPresent()) { + return externalAccessoryForHierarchyItem; + } + } + return Optional.empty(); + } + + private Collection getExternalDesignHierarchyMaskProviders() { + ServiceLoader loader = ServiceLoader.load(ExternalDesignHierarchyMaskProvider.class); + Collection providers = new ArrayList<>(); + loader.iterator().forEachRemaining(providers::add); + return providers; + } } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItem.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItem.java index fa33fda7a..f4abc61b7 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItem.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItem.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2024, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -208,7 +209,7 @@ public boolean isResourceKey(final DisplayOption option) { return option == INFO && mask.isResourceKey(); } - public boolean isPlaceHolder() { + public boolean isPlaceholder() { return false; } @@ -227,7 +228,7 @@ public boolean isAcceptingAccessory(Accessory accessory, FXOMObject fxomObject) } public boolean hasDisplayInfo(final DisplayOption option) { - // Item has display info if we are not on place holder and : + // Item has display info if we are not on placeholder and : // - either we display the FX ID // - or we display the node ID // - or we display the description and the item defines one @@ -237,13 +238,13 @@ public boolean hasDisplayInfo(final DisplayOption option) { || (option == INFO && mask.hasDescription())); } - public Image getPlaceHolderImage() { - // No place holder + public Image getPlaceholderImage() { + // No placeholder return null; } - public String getPlaceHolderInfo() { - // No place holder + public String getPlaceholderInfo() { + // No placeholder return null; } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemBorderPane.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemBorderPane.java index a8d653da4..a669c1bf0 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemBorderPane.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemBorderPane.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2024, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -101,7 +102,7 @@ public int hashCode() { } @Override - public boolean isPlaceHolder() { + public boolean isPlaceholder() { return true; } @@ -129,13 +130,13 @@ public Accessory getPosition() { } @Override - public Image getPlaceHolderImage() { + public Image getPlaceholderImage() { return ImageUtils.getNodeIcon("BorderPane-" + position.name().toLowerCase(Locale.ROOT) + ".png"); //NOI18N } @Override - public String getPlaceHolderInfo() { - return (mask != null ? null : I18N.getString("hierarchy.placeholder.insert") + position.name().toUpperCase(Locale.getDefault())); + public String getPlaceholderInfo() { + return (mask != null ? null : I18N.getString("hierarchy.placeholder.insert", position.name().toUpperCase(Locale.ROOT))); } @Override diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemDialogPane.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemDialogPane.java index 13c89adbe..c4c3dd7ee 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemDialogPane.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemDialogPane.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2024, Gluon and/or its affiliates. * Copyright (c) 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -101,7 +102,7 @@ public int hashCode() { } @Override - public boolean isPlaceHolder() { + public boolean isPlaceholder() { return true; } @@ -129,13 +130,13 @@ public Accessory getAccessory() { } @Override - public Image getPlaceHolderImage() { + public Image getPlaceholderImage() { return ImageUtils.getNodeIcon("DialogPane-" + accessory.toString().toLowerCase(Locale.ROOT) + ".png"); //NOI18N } @Override - public String getPlaceHolderInfo() { - return (mask != null ? null : I18N.getString("hierarchy.placeholder.insert") + accessory.toString().toUpperCase(Locale.getDefault())); + public String getPlaceholderInfo() { + return (mask != null ? null : I18N.getString("hierarchy.placeholder.insert", accessory.toString().toUpperCase(Locale.ROOT))); } @Override diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemGraphic.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemGraphic.java index 4c9b4a4a6..2f921e429 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemGraphic.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/HierarchyItemGraphic.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2024, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -93,7 +94,7 @@ public int hashCode() { } @Override - public boolean isPlaceHolder() { + public boolean isPlaceholder() { return true; } @@ -112,12 +113,12 @@ public DesignHierarchyMask getOwner() { } @Override - public Image getPlaceHolderImage() { + public Image getPlaceholderImage() { return ImageUtils.getNodeIcon("Graphic.png"); //NOI18N } @Override - public String getPlaceHolderInfo() { + public String getPlaceholderInfo() { return (mask != null ? null : I18N.getString("hierarchy.placeholder.insert.graphic")); } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/treeview/HierarchyTreeCell.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/treeview/HierarchyTreeCell.java index c66e3ecb8..e3a87bd6b 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/treeview/HierarchyTreeCell.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/hierarchy/treeview/HierarchyTreeCell.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Gluon and/or its affiliates. + * Copyright (c) 2017, 2024 Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -304,7 +304,7 @@ public HierarchyTreeCell(final AbstractHierarchyPanelController c) { final HierarchyItem item = treeItem.getValue(); assert item != null; - if (item.isPlaceHolder()) { + if (item.isPlaceholder()) { cell = HierarchyTreeCell.this; } else if (accessoryDropTarget.getAccessory() == Accessory.GRAPHIC) { // Check if an empty graphic TreeItem has been added @@ -362,7 +362,7 @@ public HierarchyTreeCell(final AbstractHierarchyPanelController c) { final HierarchyItem item = treeItem.getValue(); assert item != null; - if (item.isPlaceHolder() || item.getFxomObject() == dropTargetObject) { + if (item.isPlaceholder() || item.getFxomObject() == dropTargetObject) { // The place holder item is filled with a container // accepting sub components panelController.setBorder(HierarchyTreeCell.this, BorderSide.TOP_RIGHT_BOTTOM_LEFT); @@ -711,7 +711,7 @@ private void updateLayout(HierarchyItem item) { } // Update ImageViews - final Image placeHolderImage = item.getPlaceHolderImage(); + final Image placeHolderImage = item.getPlaceholderImage(); placeHolderImageView.setImage(placeHolderImage); placeHolderImageView.setManaged(placeHolderImage != null); @@ -747,7 +747,7 @@ private void updateLayout(HierarchyItem item) { } // Update Labels - final String placeHolderInfo = item.getPlaceHolderInfo(); + final String placeHolderInfo = item.getPlaceholderInfo(); placeHolderLabel.setText(placeHolderInfo); placeHolderLabel.setManaged(item.isEmpty()); placeHolderLabel.setVisible(item.isEmpty()); diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/inspector/editors/EditorUtils.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/inspector/editors/EditorUtils.java index 72866b45b..1fb7c9f24 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/inspector/editors/EditorUtils.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/inspector/editors/EditorUtils.java @@ -430,7 +430,7 @@ protected static void openUrl(Set> selectedClasses, ValuePropertyMetada propNameStr = propNameStr.substring(0, 1).toUpperCase(Locale.ENGLISH) + propNameStr.substring(1); String methodName; String posfix; - if (clazz.getName().startsWith(EditorPlatform.GLUON_PACKAGE)) { + if (EditorPlatform.hasClassFromExternalPlugin(clazz.getName())) { posfix = "--"; } else { posfix = "()"; @@ -443,12 +443,8 @@ protected static void openUrl(Set> selectedClasses, ValuePropertyMetada methodName = "get" + propNameStr + posfix; //NOI18N } - String url; - if (clazz.getName().startsWith(EditorPlatform.GLUON_PACKAGE)) { - url = DocumentationUrls.GLUON_JAVADOC_HOME.toString(); - } else { - url = DocumentationUrls.JAVADOC_HOME.toString() + clazz.getModule().getName() + "/"; - } + String url = EditorPlatform.getExternalJavadocURL(clazz.getName()) + .orElse(DocumentationUrls.JAVADOC_HOME + clazz.getModule().getName() + "/"); url += clazz.getName().replaceAll("\\.", "/") + ".html"; //NOI18N url += "#" + methodName; //NOI18N EditorPlatform.open(url); diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/library/ImportWindowController.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/library/ImportWindowController.java index 711827bea..1998bd129 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/library/ImportWindowController.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/library/ImportWindowController.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Gluon and/or its affiliates. + * Copyright (c) 2017, 2024, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -44,7 +44,6 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Set; import java.util.TreeSet; @@ -52,7 +51,7 @@ import java.util.logging.Logger; import java.util.stream.Collectors; -import com.oracle.javafx.scenebuilder.kit.alert.ImportingGluonControlsAlert; +import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform; import com.oracle.javafx.scenebuilder.kit.editor.panel.util.dialog.AbstractModalDialog; import com.oracle.javafx.scenebuilder.kit.editor.panel.util.dialog.ErrorDialog; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument; @@ -467,7 +466,7 @@ protected List call() throws Exception { = row -> row.importRequired(); importList.setCellFactory(CheckBoxListCell.forListView(importRequired)); - boolean importingGluonControls = false; + boolean importingControlsFromExternalPlugin = false; for (JarReport jarReport : jarReportList) { Path file = jarReport.getJar(); String jarName = file.getName(file.getNameCount() - 1).toString(); @@ -501,24 +500,23 @@ protected List call() throws Exception { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.getException().printStackTrace(pw); - sb.append(">> " + sw.toString()); + sb.append(">> ").append(sw); } } } LOGGER.info(sb.toString()); - if (jarReport.hasGluonControls()) { - importingGluonControls = true; + if (jarReport.hasControlsFromExternalPlugin()) { + importingControlsFromExternalPlugin = true; } } - if (importingGluonControls) { - ImportingGluonControlsAlert alert = new ImportingGluonControlsAlert(owner); - alert.showAndWait(); + if (importingControlsFromExternalPlugin) { + EditorPlatform.showImportAlert(owner); } // Sort based on the simple class name. - Collections.sort(importList.getItems(), new ImportRowComparator()); + importList.getItems().sort(new ImportRowComparator()); final int numOfComponentToImport = getNumOfComponentToImport(importList); updateOKButtonTitle(numOfComponentToImport); diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/fxom/FXOMDocument.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/fxom/FXOMDocument.java index 7d2a7ef53..b94279838 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/fxom/FXOMDocument.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/fxom/FXOMDocument.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Gluon and/or its affiliates. + * Copyright (c) 2017, 2024, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -76,13 +76,13 @@ public class FXOMDocument { private FXOMObject fxomRoot; private Object sceneGraphRoot; private Node displayNode; - private ArrayList displayStylesheets = new ArrayList<>(); + private final ArrayList displayStylesheets = new ArrayList<>(); private final SimpleIntegerProperty sceneGraphRevision = new SimpleIntegerProperty(); private final SimpleIntegerProperty cssRevision = new SimpleIntegerProperty(); private SceneGraphHolder sceneGraphHolder; private int updateDepth; - private boolean hasGluonControls; + private boolean hasControlsFromExternalPlugin; private List> initialDeclaredClasses; @@ -128,7 +128,7 @@ public FXOMDocument(String fxmlText, URL location, ClassLoader classLoader, Reso // Keeps this.sceneGraphRoot == null } - hasGluonControls = fxmlText.contains(EditorPlatform.GLUON_PACKAGE); + hasControlsFromExternalPlugin = EditorPlatform.hasClassFromExternalPlugin(fxmlText); } public FXOMDocument() { @@ -470,8 +470,8 @@ public void endHoldingSceneGraph() { sceneGraphHolder = null; } - public boolean hasGluonControls() { - return hasGluonControls; + public boolean hasControlsFromExternalPlugin() { + return hasControlsFromExternalPlugin; } /** diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/fxom/FXOMObject.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/fxom/FXOMObject.java index 662c3ede5..0713b5e5b 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/fxom/FXOMObject.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/fxom/FXOMObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Gluon and/or its affiliates. + * Copyright (c) 2017, 2024, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -735,10 +735,9 @@ void setParentCollection(FXOMCollection newParentCollection) { parentCollection = newParentCollection; } - public boolean isGluon() { - return sceneGraphObject != null && sceneGraphObject.getClass().getName().startsWith(EditorPlatform.GLUON_PACKAGE); + public boolean isClassFromExternalPlugin() { + return sceneGraphObject != null && EditorPlatform.hasClassFromExternalPlugin(sceneGraphObject.getClass().getName()); } - /* * Private diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/BuiltinLibrary.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/BuiltinLibrary.java index ca61ffce7..1c23d6750 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/BuiltinLibrary.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/BuiltinLibrary.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,13 +32,17 @@ */ package com.oracle.javafx.scenebuilder.kit.library; -import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform; import com.oracle.javafx.scenebuilder.kit.i18n.I18N; import com.oracle.javafx.scenebuilder.kit.editor.images.ImageUtils; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument; import java.io.IOException; import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; import java.util.Comparator; +import java.util.List; +import java.util.ServiceLoader; + import javafx.scene.layout.Region; /** @@ -47,11 +51,9 @@ */ public class BuiltinLibrary extends Library { - public static final String GLUON_FILE_PREFIX = "Gluon_"; // In SB 1.1 the section names of the Library have been localized. We assume // for now we stick to this approach, but fact is the support of custom // sections could change the rules of the game. - public static final String TAG_GLUON = "Gluon"; public static final String TAG_CONTAINERS = "Containers"; //NOI18N public static final String TAG_CONTROLS = "Controls"; //NOI18N public static final String TAG_MENU = "Menu"; //NOI18N @@ -139,41 +141,6 @@ public static void main(String[] args) { */ private BuiltinLibrary() { - // Gluon - addCustomizedItem(com.gluonhq.charm.glisten.control.AppBar.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.AutoCompleteTextField.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.Avatar.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.BottomNavigation.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.BottomNavigationButton.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.CardPane.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.CharmListView.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.Chip.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.ExpansionPanel.CollapsedPanel.class, TAG_GLUON); -// addCustomizedItem(com.gluonhq.charm.glisten.control.Dialog.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.DropdownButton.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.ExpansionPanel.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.ExpansionPanel.ExpandedPanel.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.ExpansionPanelContainer.class, TAG_GLUON); -// addCustomizedItem(com.gluonhq.charm.glisten.layout.layer.FloatingActionButton.class, TAG_GLUON); -// addCustomizedItem(com.gluonhq.charm.glisten.layout.responsive.grid.GridLayout.class, TAG_GLUON); -// addCustomizedItem(com.gluonhq.charm.glisten.layout.responsive.grid.GridRow.class, TAG_GLUON); -// addCustomizedItem(com.gluonhq.charm.glisten.layout.responsive.grid.GridSpan.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.Icon.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.layout.Layer.class, TAG_GLUON); -// addCustomizedItem(com.gluonhq.charm.glisten.control.ListTile.class, TAG_GLUON); -// addCustomizedItem(com.gluonhq.charm.glisten.layout.layer.MenuPopupView.class, TAG_GLUON); -// addCustomizedItem(com.gluonhq.charm.glisten.layout.layer.MenuSidePopupView.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.NavigationDrawer.class, TAG_GLUON); -// addCustomizedItem(com.gluonhq.charm.glisten.layout.layer.PopupView.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.ProgressBar.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.ProgressIndicator.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.SettingsPane.class, TAG_GLUON); -// addCustomizedItem(com.gluonhq.charm.glisten.layout.layer.SidePopupView.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.mvc.SplashView.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.TextField.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.control.ToggleButtonGroup.class, TAG_GLUON); - addCustomizedItem(com.gluonhq.charm.glisten.mvc.View.class, TAG_GLUON); - // Containers addCustomizedItem(javafx.scene.control.Accordion.class, TAG_CONTAINERS); addCustomizedItem(javafx.scene.control.Accordion.class, TAG_CONTAINERS, @@ -311,6 +278,9 @@ private BuiltinLibrary() { addDefaultItem(javafx.scene.ParallelCamera.class, TAG_3D); addDefaultItem(javafx.scene.PerspectiveCamera.class, TAG_3D); addCustomizedItem(javafx.scene.PointLight.class, TAG_3D); + + // External items + addExternalItems(); } @@ -323,8 +293,7 @@ private void addDefaultItem(Class componentClass, String section, String... q final String fxmlText = makeFxmlText(componentClass); addItem(nameWithQualifier.toString(), fxmlText, section, name); } - - + private void addRegionItem200x200(Class componentClass, String section) { addRegionItem200x200(componentClass, section, null); } @@ -384,10 +353,6 @@ private void addCustomizedItem(Class componentClass, String section, if (qualifier != null) { nameWithQualifier += qualifier; } - if (componentClass.getName().startsWith(EditorPlatform.GLUON_PACKAGE)) { - fxmlBaseName = GLUON_FILE_PREFIX + fxmlBaseName; - iconName = GLUON_FILE_PREFIX + iconName; - } final String fxmlText = readCustomizedFxmlText(fxmlBaseName, componentClass); assert fxmlText != null; addItem(nameWithQualifier, fxmlText, section, iconName); @@ -399,8 +364,38 @@ private void addItem(String name, String fxmlText, String section, String iconNa final LibraryItem item = new LibraryItem(name, section, fxmlText, iconURL, this); getItems().add(item); } - - + + private void addExternalItems() { + Collection providers = getExternalItemProviders(); + List orderedSections = BuiltinSectionComparator.getOrderedSections(); + for (ExternalSectionProvider provider : providers) { + for (Class item : provider.getExternalSectionItems()) { + String nameWithQualifier = item.getSimpleName(); + URL resourceUrl = provider.getClass().getResource(provider.getItemsFXMLPath() + "/" + nameWithQualifier + ".fxml"); + assert resourceUrl != null; + final String fxmlText = readFxmlURL(resourceUrl); + assert fxmlText != null; + URL iconURL = provider.getClass().getResource(provider.getItemsIconPath() + "/" + nameWithQualifier + ".png"); + assert iconURL != null; + final LibraryItem libraryItem = new LibraryItem(nameWithQualifier, provider.getExternalSectionName(), fxmlText, iconURL, this); + getItems().add(libraryItem); + } + int position = provider.getExternalSectionPosition(); + if (position < 0 || position >= orderedSections.size()) { + orderedSections.add(provider.getExternalSectionName()); + } else { + orderedSections.add(provider.getExternalSectionPosition(), provider.getExternalSectionName()); + } + } + } + + private Collection getExternalItemProviders() { + ServiceLoader loader = ServiceLoader.load(ExternalSectionProvider.class); + Collection providers = new ArrayList<>(); + loader.iterator().forEachRemaining(providers::add); + return providers; + } + private static String makeRegionFxmlText(Class componentClass, double pw, double ph) { final StringBuilder sb = new StringBuilder(); @@ -434,28 +429,25 @@ private static String makeRegionFxmlText(Class componentClass, return sb.toString(); } - - + private String readCustomizedFxmlText(String fxmlBaseName, Class componentClass) { - - final StringBuilder fxmlPath = new StringBuilder(); - fxmlPath.append("builtin/"); //NOI18N - fxmlPath.append(fxmlBaseName); - fxmlPath.append(".fxml"); //NOI18N - - final URL fxmlURL = BuiltinLibrary.class.getResource(fxmlPath.toString()); + String fxmlPath = "builtin/" + fxmlBaseName + ".fxml"; //NOI18N + final URL fxmlURL = BuiltinLibrary.class.getResource(fxmlPath); assert fxmlURL != null : "fxmlBaseName=" + fxmlBaseName; //NOI18N + return readFxmlURL(fxmlURL); + } + + private String readFxmlURL(URL fxmlURL) { final String result; - + try { result = FXOMDocument.readContentFromURL(fxmlURL); - } catch(IOException x) { + } catch (IOException x) { throw new IllegalStateException("Bug in " + getClass().getSimpleName(), x); //NOI18N - } catch(NullPointerException ex) { - System.out.println("fxmlPath = " + fxmlPath); - throw ex; + } catch (NullPointerException ex) { + System.out.println("fxmlURL = " + fxmlURL); + throw ex; } - return result; } } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/BuiltinSectionComparator.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/BuiltinSectionComparator.java index b91b2a57d..3797ee067 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/BuiltinSectionComparator.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/BuiltinSectionComparator.java @@ -47,7 +47,6 @@ public class BuiltinSectionComparator implements Comparator { static { orderedSections.add(BuiltinLibrary.TAG_CONTAINERS); orderedSections.add(BuiltinLibrary.TAG_CONTROLS); - orderedSections.add(BuiltinLibrary.TAG_GLUON); orderedSections.add(BuiltinLibrary.TAG_MENU); orderedSections.add(BuiltinLibrary.TAG_MISCELLANEOUS); orderedSections.add(BuiltinLibrary.TAG_SHAPES); @@ -59,6 +58,10 @@ public BuiltinSectionComparator() { // no-op } + static List getOrderedSections() { + return orderedSections; + } + /* * Comparator */ diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/ExternalSectionProvider.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/ExternalSectionProvider.java new file mode 100644 index 000000000..6dcf99081 --- /dev/null +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/ExternalSectionProvider.java @@ -0,0 +1,71 @@ +/* + * 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.oracle.javafx.scenebuilder.kit.library; + +import java.util.List; + +public interface ExternalSectionProvider { + + /** + * Position of the external section within the built-in library sections + * 0 will be on top, -1 at the bottom + * @return an integer with the expected position + */ + int getExternalSectionPosition(); + + /** + * Name of the external section + * @return a String with the section's name + */ + String getExternalSectionName(); + + /** + * list of items added to the external section + * @return a List of classes for this section + */ + List> getExternalSectionItems(); + + /** + * path of the FXML resources, relative to the external section provider, where the + * FXML files for each item are located + * @return a String with the path + */ + String getItemsFXMLPath(); + + /** + * path of the Icon resources, relative to the external section provider, where the + * icons for each item are located + * @return a String with the path + */ + String getItemsIconPath(); + +} \ No newline at end of file diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/util/ExplorerBase.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/util/ExplorerBase.java index 1ddf56ebd..9004b26a5 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/util/ExplorerBase.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/util/ExplorerBase.java @@ -90,7 +90,7 @@ JarReportEntry exploreEntry(String entryName, ClassLoader classLoader, String cl || className.startsWith("com.oracle.javafx.scenebuilder.") //NOI18N || className.startsWith("com.javafx.") || className.startsWith("module-info") - || className.startsWith(EditorPlatform.GLUON_PACKAGE)) { //NOI18N + || EditorPlatform.hasClassFromExternalPlugin(className)) { // ignore classes from plugins, they are loaded in their own section status = JarReportEntry.Status.IGNORED; entryClass = null; entryException = null; diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/util/JarReport.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/util/JarReport.java index cb7e21ee7..da85c014c 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/util/JarReport.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/util/JarReport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Gluon and/or its affiliates. + * Copyright (c) 2017, 2024, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -37,7 +37,6 @@ import javafx.collections.ObservableList; import java.nio.file.Path; -import java.util.ArrayList; import java.util.List; /** @@ -48,19 +47,16 @@ public class JarReport { private final Path jar; private final ObservableList entries = FXCollections.observableArrayList(); - private boolean hasGluonControls = false; + private boolean hasControlsFromExternalPlugin = false; public JarReport(Path jar) { this.jar = jar; - this.entries.addListener(new ListChangeListener() { - @Override - public void onChanged(Change c) { - while (c.next()) { - if (c.wasAdded()) { - for (JarReportEntry entry : c.getAddedSubList()) { - if (entry.isGluon()) { - hasGluonControls = true; - } + this.entries.addListener((ListChangeListener) c -> { + while (c.next()) { + if (c.wasAdded()) { + for (JarReportEntry entry : c.getAddedSubList()) { + if (entry.isClassFromExternalPlugin()) { + hasControlsFromExternalPlugin = true; } } } @@ -76,6 +72,6 @@ public List getEntries() { return entries; } - public boolean hasGluonControls() { return hasGluonControls; } + public boolean hasControlsFromExternalPlugin() { return hasControlsFromExternalPlugin; } } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/util/JarReportEntry.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/util/JarReportEntry.java index ae9fd7073..f69bec971 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/util/JarReportEntry.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/library/util/JarReportEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Gluon and/or its affiliates. + * Copyright (c) 2017, 2024, Gluon and/or its affiliates. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. * All rights reserved. Use is subject to license terms. * @@ -83,10 +83,10 @@ public Throwable getException() { } public boolean isNode() { - return (klass == null) ? false : Node.class.isAssignableFrom(klass); + return klass != null && Node.class.isAssignableFrom(klass); } - public boolean isGluon() { return className != null && className.startsWith(EditorPlatform.GLUON_PACKAGE); } + public boolean isClassFromExternalPlugin() { return EditorPlatform.hasClassFromExternalPlugin(className); } /* * Object diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/ExternalMetadataProvider.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/ExternalMetadataProvider.java new file mode 100644 index 000000000..598bfc273 --- /dev/null +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/ExternalMetadataProvider.java @@ -0,0 +1,55 @@ +/* + * 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.oracle.javafx.scenebuilder.kit.metadata; + +import com.oracle.javafx.scenebuilder.kit.metadata.klass.ComponentClassMetadata; +import com.oracle.javafx.scenebuilder.kit.metadata.util.PropertyName; + +import java.util.List; +import java.util.Optional; + +public interface ExternalMetadataProvider { + + /** + * list of items added to the metadata + * @return a List of classes + */ + List getExternalItems(); + + /** + * Returns an optional with a propertyName for an external component class, if any, + * or empty + * @param componentClass the class + * @return an optional with a propertyName or empty + */ + Optional getExternalSubComponentProperty(Class componentClass); +} \ No newline at end of file diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/Metadata.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/Metadata.java index 45134fa8d..8e8885d60 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/Metadata.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/Metadata.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. * @@ -36,7 +36,6 @@ * THIS CODE IS AUTOMATICALLY GENERATED ! */ -import com.gluonhq.charm.glisten.control.BottomNavigation; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMInstance; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMIntrinsic; import com.oracle.javafx.scenebuilder.kit.metadata.klass.ComponentClassMetadata; @@ -57,7 +56,6 @@ import com.oracle.javafx.scenebuilder.kit.metadata.util.PropertyName; import javafx.scene.Scene; -import javafx.scene.control.SelectionMode; import javafx.stage.Stage; import javafx.stage.Window; @@ -70,6 +68,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.ServiceLoader; import java.util.Set; import java.util.WeakHashMap; @@ -255,21 +254,26 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { // Abstract Component Classes - private final ComponentClassMetadata NodeMetadata = + public static final ComponentClassMetadata NodeMetadata = new ComponentClassMetadata(javafx.scene.Node.class, null); - private final ComponentClassMetadata ParentMetadata = + public static final ComponentClassMetadata ParentMetadata = new ComponentClassMetadata(javafx.scene.Parent.class, NodeMetadata); - private final ComponentClassMetadata RegionMetadata = + public static final ComponentClassMetadata RegionMetadata = new ComponentClassMetadata(javafx.scene.layout.Region.class, ParentMetadata); - private final ComponentClassMetadata PaneMetadata = + public static final ComponentClassMetadata PaneMetadata = new ComponentClassMetadata(javafx.scene.layout.Pane.class, RegionMetadata); - private final ComponentClassMetadata ControlMetadata = + public static final ComponentClassMetadata ControlMetadata = new ComponentClassMetadata(javafx.scene.control.Control.class, RegionMetadata); - private final ComponentClassMetadata LabeledMetadata = + public static final ComponentClassMetadata MenuItemMetadata = + new ComponentClassMetadata(javafx.scene.control.MenuItem.class, null); + public static final ComponentClassMetadata LabeledMetadata = new ComponentClassMetadata(javafx.scene.control.Labeled.class, ControlMetadata); - private final ComponentClassMetadata ButtonBaseMetadata = + public static final ComponentClassMetadata ButtonBaseMetadata = new ComponentClassMetadata(javafx.scene.control.ButtonBase.class, LabeledMetadata); - private final ComponentClassMetadata ComboBoxBaseMetadata = + public static final ComponentClassMetadata ToggleButtonMetadata = + new ComponentClassMetadata(javafx.scene.control.ToggleButton.class, ButtonBaseMetadata); + + private final ComponentClassMetadata ComboBoxBaseMetadata = new ComponentClassMetadata(javafx.scene.control.ComboBoxBase.class, ControlMetadata); private final ComponentClassMetadata PopupWindowMetadata = new ComponentClassMetadata(javafx.stage.PopupWindow.class, null); @@ -279,15 +283,11 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new ComponentClassMetadata(javafx.scene.control.TextInputControl.class, ControlMetadata); private final ComponentClassMetadata TableColumnBaseMetadata = new ComponentClassMetadata(javafx.scene.control.TableColumnBase.class, null); - private final ComponentClassMetadata MenuItemMetadata = - new ComponentClassMetadata(javafx.scene.control.MenuItem.class, null); - private final ComponentClassMetadata TextFieldMetadata = + private final ComponentClassMetadata TextFieldMetadata = new ComponentClassMetadata(javafx.scene.control.TextField.class, TextInputControlMetadata); private final ComponentClassMetadata ProgressIndicatorMetadata = new ComponentClassMetadata(javafx.scene.control.ProgressIndicator.class, ControlMetadata); - private final ComponentClassMetadata ToggleButtonMetadata = - new ComponentClassMetadata(javafx.scene.control.ToggleButton.class, ButtonBaseMetadata); - private final ComponentClassMetadata AxisMetadata = + private final ComponentClassMetadata AxisMetadata = new ComponentClassMetadata(javafx.scene.chart.Axis.class, RegionMetadata); private final ComponentClassMetadata ChartMetadata = new ComponentClassMetadata(javafx.scene.chart.Chart.class, RegionMetadata); @@ -316,8 +316,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new ComponentClassMetadata(javafx.embed.swing.SwingNode.class, NodeMetadata); private final ComponentClassMetadata AmbientLightMetadata = new ComponentClassMetadata(javafx.scene.AmbientLight.class, LightBaseMetadata); - private final ComponentClassMetadata CardPaneMetadata = - new ComponentClassMetadata(com.gluonhq.charm.glisten.control.CardPane.class, ControlMetadata); private final ComponentClassMetadata GroupMetadata = new ComponentClassMetadata(javafx.scene.Group.class, ParentMetadata); private final ComponentClassMetadata ParallelCameraMetadata = @@ -334,14 +332,10 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new ComponentClassMetadata(javafx.scene.chart.AreaChart.class, XYChartMetadata); private final ComponentClassMetadata BarChartMetadata = new ComponentClassMetadata(javafx.scene.chart.BarChart.class, XYChartMetadata); - private final ComponentClassMetadata BottomNavigationMetadata = - new ComponentClassMetadata(com.gluonhq.charm.glisten.control.BottomNavigation.class, ControlMetadata); private final ComponentClassMetadata BubbleChartMetadata = new ComponentClassMetadata(javafx.scene.chart.BubbleChart.class, XYChartMetadata); private final ComponentClassMetadata CategoryAxisMetadata = new ComponentClassMetadata(javafx.scene.chart.CategoryAxis.class, AxisMetadata); - private final ComponentClassMetadata DropdownButtonMetadata = - new ComponentClassMetadata(com.gluonhq.charm.glisten.control.DropdownButton.class, ControlMetadata); private final ComponentClassMetadata LineChartMetadata = new ComponentClassMetadata(javafx.scene.chart.LineChart.class, XYChartMetadata); private final ComponentClassMetadata NumberAxisMetadata = @@ -350,14 +344,10 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new ComponentClassMetadata(javafx.scene.chart.PieChart.class, ChartMetadata); private final ComponentClassMetadata ScatterChartMetadata = new ComponentClassMetadata(javafx.scene.chart.ScatterChart.class, XYChartMetadata); - private final ComponentClassMetadata SettingsPaneMetadata = - new ComponentClassMetadata(com.gluonhq.charm.glisten.control.SettingsPane.class, ControlMetadata); - private final ComponentClassMetadata StackedAreaChartMetadata = + private final ComponentClassMetadata StackedAreaChartMetadata = new ComponentClassMetadata(javafx.scene.chart.StackedAreaChart.class, XYChartMetadata); private final ComponentClassMetadata StackedBarChartMetadata = new ComponentClassMetadata(javafx.scene.chart.StackedBarChart.class, XYChartMetadata); - private final ComponentClassMetadata ToggleButtonGroupMetadata = - new ComponentClassMetadata(com.gluonhq.charm.glisten.control.ToggleButtonGroup.class, ControlMetadata); private final ComponentClassMetadata AccordionMetadata = new ComponentClassMetadata(javafx.scene.control.Accordion.class, ControlMetadata); private final ComponentClassMetadata ButtonMetadata = @@ -370,8 +360,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new ComponentClassMetadata(javafx.scene.control.CheckMenuItem.class, MenuItemMetadata); private final ComponentClassMetadata ChoiceBoxMetadata = new ComponentClassMetadata(javafx.scene.control.ChoiceBox.class, ControlMetadata); - private final ComponentClassMetadata CollapsedPanelMetadata = - new ComponentClassMetadata(com.gluonhq.charm.glisten.control.ExpansionPanel.CollapsedPanel.class, RegionMetadata); private final ComponentClassMetadata ColorPickerMetadata = new ComponentClassMetadata(javafx.scene.control.ColorPicker.class, ComboBoxBaseMetadata); private final ComponentClassMetadata ComboBoxMetadata = @@ -380,11 +368,7 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new ComponentClassMetadata(javafx.scene.control.ContextMenu.class, PopupControlMetadata); private final ComponentClassMetadata CustomMenuItemMetadata = new ComponentClassMetadata(javafx.scene.control.CustomMenuItem.class, MenuItemMetadata); - private final ComponentClassMetadata DatePickerMetadata = - new ComponentClassMetadata(javafx.scene.control.DatePicker.class, ComboBoxBaseMetadata); - private final ComponentClassMetadata DialogPaneMetadata = - new ComponentClassMetadata(javafx.scene.control.DialogPane.class, PaneMetadata); - private final ComponentClassMetadata HyperlinkMetadata = + private final ComponentClassMetadata HyperlinkMetadata = new ComponentClassMetadata(javafx.scene.control.Hyperlink.class, ButtonBaseMetadata); private final ComponentClassMetadata LabelMetadata = new ComponentClassMetadata(javafx.scene.control.Label.class, LabeledMetadata); @@ -492,12 +476,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new ComponentClassMetadata(javafx.scene.shape.Cylinder.class, Shape3DMetadata); private final ComponentClassMetadata EllipseMetadata = new ComponentClassMetadata(javafx.scene.shape.Ellipse.class, ShapeMetadata); - private final ComponentClassMetadata ExpandedPanelMetadata = - new ComponentClassMetadata( com.gluonhq.charm.glisten.control.ExpansionPanel.ExpandedPanel.class, RegionMetadata); - private final ComponentClassMetadata ExpansionPanelMetadata = - new ComponentClassMetadata( com.gluonhq.charm.glisten.control.ExpansionPanel.class, ControlMetadata); - private final ComponentClassMetadata ExpansionPanelContainerMetadata = - new ComponentClassMetadata(com.gluonhq.charm.glisten.control.ExpansionPanelContainer.class, ControlMetadata); private final ComponentClassMetadata HLineToMetadata = new ComponentClassMetadata(javafx.scene.shape.HLineTo.class, PathElementMetadata); private final ComponentClassMetadata LineMetadata = @@ -508,9 +486,7 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new ComponentClassMetadata(javafx.scene.shape.MeshView.class, Shape3DMetadata); private final ComponentClassMetadata MoveToMetadata = new ComponentClassMetadata(javafx.scene.shape.MoveTo.class, PathElementMetadata); - private final ComponentClassMetadata OptionMetadata = - new ComponentClassMetadata(com.gluonhq.charm.glisten.control.settings.Option.class, null); - private final ComponentClassMetadata PathMetadata = + private final ComponentClassMetadata PathMetadata = new ComponentClassMetadata(javafx.scene.shape.Path.class, ShapeMetadata); private final ComponentClassMetadata PolygonMetadata = new ComponentClassMetadata(javafx.scene.shape.Polygon.class, ShapeMetadata); @@ -554,8 +530,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new PropertyName("accessibleRoleDescription"); private final PropertyName accessibleTextName = new PropertyName("accessibleText"); - private final PropertyName actionItemsName = - new PropertyName("actionItems"); private final PropertyName alignmentName = new PropertyName("alignment"); private final PropertyName allowIndeterminateName = @@ -598,8 +572,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new PropertyName("blockIncrement"); private final PropertyName bottomName = new PropertyName("bottom"); - private final PropertyName bottomNavigationTypeName = - new PropertyName("type"); private final PropertyName boundsInLocalName = new PropertyName("boundsInLocal"); private final PropertyName boundsInParentName = @@ -732,8 +704,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new PropertyName("expanded"); private final PropertyName expandedItemCountName = new PropertyName("expandedItemCount"); - private final PropertyName expandedPropertyName = - new PropertyName("expanded"); private final PropertyName farClipName = new PropertyName("farClip"); private final PropertyName fieldOfViewName = @@ -964,9 +934,7 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new PropertyName("onMousePressed"); private final PropertyName onMouseReleasedName = new PropertyName("onMouseReleased"); - private final PropertyName onPullToRefreshName = - new PropertyName("onPullToRefresh"); - private final PropertyName onRotateName = + private final PropertyName onRotateName = new PropertyName("onRotate"); private final PropertyName onRotationFinishedName = new PropertyName("onRotationFinished"); @@ -1016,9 +984,7 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new PropertyName("opacity"); private final PropertyName opaqueInsetsName = new PropertyName("opaqueInsets"); - private final PropertyName optionsName = - new PropertyName("options"); - private final PropertyName orientationName = + private final PropertyName orientationName = new PropertyName("orientation"); private final PropertyName paddingName = new PropertyName("padding"); @@ -1108,12 +1074,8 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new PropertyName("scrollLeft"); private final PropertyName scrollTopName = new PropertyName("scrollTop"); - private final PropertyName searchBoxVisibleName = - new PropertyName("searchBoxVisible"); - private final PropertyName selectedName = + private final PropertyName selectedName = new PropertyName("selected"); - private final PropertyName selectionTypeName = - new PropertyName("selectionType"); private final PropertyName shapeName = new PropertyName("shape"); private final PropertyName showRootName = @@ -1228,18 +1190,12 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { new PropertyName("tileHeight"); private final PropertyName tileWidthName = new PropertyName("tileWidth"); - private final PropertyName titleFilterName = - new PropertyName("titleFilter"); - private final PropertyName titleName = + private final PropertyName titleName = new PropertyName("title"); - private final PropertyName titleNodesName = - new PropertyName("titleNodes"); private final PropertyName titleSideName = new PropertyName("titleSide"); private final PropertyName toggleGroupName = new PropertyName("toggleGroup"); - private final PropertyName togglesName = - new PropertyName("toggles"); private final PropertyName tooltipName = new PropertyName("tooltip"); private final PropertyName topName = @@ -1614,11 +1570,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { true, /* readWrite */ "", /* defaultValue */ new InspectorPath("Properties", "Accessibility", 0)); - private final ComponentPropertyMetadata actionItems_Node_PropertyMetadata = - new ComponentPropertyMetadata( - actionItemsName, - NodeMetadata, - true); /* collection */ private final ValuePropertyMetadata alignment_TOP_LEFT_PropertyMetadata = new EnumerationPropertyMetadata( alignmentName, @@ -1770,13 +1721,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { true, /* readWrite */ 10.0, /* defaultValue */ new InspectorPath("Properties", "Specific", 73)); - private final EnumerationPropertyMetadata bottomNavigationTypePropertyMetadata = - new EnumerationPropertyMetadata( - bottomNavigationTypeName, - BottomNavigation.Type.class, - true, /* readWrite */ - BottomNavigation.Type.FIXED, /* defaultValue */ - new InspectorPath("Properties", "Specific", 0)); private final ComponentPropertyMetadata bottomPropertyMetadata = new ComponentPropertyMetadata( bottomName, @@ -1820,11 +1764,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { true, /* readWrite */ "L_HE+U+FBIX_NCYOA_R", /* defaultValue */ new InspectorPath("Properties", "Specific", 5)); - private final ComponentPropertyMetadata buttons_EXPANDEDPANEL_PropertyMetadata = - new ComponentPropertyMetadata( - buttonsName, - ButtonBaseMetadata, - true); /* collection */ private final ComponentPropertyMetadata buttonsPropertyMetadata = new ComponentPropertyMetadata( buttonsName, @@ -2592,11 +2531,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { false, /* readWrite */ null, /* No defaultValue for R/O property */ new InspectorPath("Properties", "Extras", 5)); - private final ComponentPropertyMetadata items_ExpansionPanel_PropertyMetadata = - new ComponentPropertyMetadata( - itemsName, - ExpansionPanelMetadata, - true); /* collection */ private final ComponentPropertyMetadata items_MenuItem_PropertyMetadata = new ComponentPropertyMetadata( itemsName, @@ -3144,13 +3078,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { true, /* readWrite */ null, /* defaultValue */ new InspectorPath("Code", "Mouse", 7)); - private final ValuePropertyMetadata onPullToRefreshPropertyMetadata = - new EventHandlerPropertyMetadata( - onPullToRefreshName, - true, /* readWrite */ - null, /* defaultValue */ - new InspectorPath("Code", "Specific", 0) - ); private final ValuePropertyMetadata onRotatePropertyMetadata = new EventHandlerPropertyMetadata( onRotateName, @@ -3302,11 +3229,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { true, /* readWrite */ null, /* defaultValue */ new InspectorPath("Properties", "Node", 12)); - private final ComponentPropertyMetadata options_Option_PropertyMetadata = - new ComponentPropertyMetadata( - optionsName, - OptionMetadata, - true); /* collection */ private final ValuePropertyMetadata orientation_HORIZONTAL_PropertyMetadata = new EnumerationPropertyMetadata( orientationName, @@ -3652,19 +3574,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { true, /* readWrite */ 0.0, /* defaultValue */ new InspectorPath("Properties", "Text", 17)); - private final ValuePropertyMetadata searchBoxVisiblePropertyMetadata = - new BooleanPropertyMetadata( - searchBoxVisibleName, - true, /* readWrite */ - true, /* defaultValue */ - new InspectorPath("Properties", "Specific", 0)); - private final ValuePropertyMetadata selectionTypePropertyMetadata = - new EnumerationPropertyMetadata( - selectionTypeName, - javafx.scene.control.SelectionMode.class, - true, /* readWrite */ - SelectionMode.SINGLE, - new InspectorPath("Properties", "Specific", 0)); private final ValuePropertyMetadata selected_Boolean_PropertyMetadata = new BooleanPropertyMetadata( selectedName, @@ -4374,17 +4283,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { false, /* readWrite */ null, /* No defaultValue for R/O property */ new InspectorPath("Layout", "Specific", 20)); - private final ValuePropertyMetadata titleFilterPropertyMetadata = - new StringPropertyMetadata( - titleFilterName, - true, /* readWrite */ - "", - new InspectorPath("Properties", "Specific", 1)); - private final ComponentPropertyMetadata titleNodes_Node_PropertyMetadata = - new ComponentPropertyMetadata( - titleNodesName, - NodeMetadata, - true); /* collection */ private final ValuePropertyMetadata titlePropertyMetadata = new StringPropertyMetadata( titleName, @@ -4398,12 +4296,6 @@ public boolean isPropertyTrimmingNeeded(PropertyName name) { true, /* readWrite */ javafx.geometry.Side.TOP, /* defaultValue */ new InspectorPath("Properties", "Specific", 60)); - private final ComponentPropertyMetadata toggles_ToggleButton_PropertyMetadata = - new ComponentPropertyMetadata( - togglesName, - ToggleButtonMetadata, - true /* collection */ - ); private final ValuePropertyMetadata toggleGroupPropertyMetadata = new ToggleGroupPropertyMetadata( toggleGroupName, @@ -4905,7 +4797,6 @@ private Metadata() { componentClassMap.put(AxisMetadata.getKlass(), AxisMetadata); componentClassMap.put(BarChartMetadata.getKlass(), BarChartMetadata); componentClassMap.put(BorderPaneMetadata.getKlass(), BorderPaneMetadata); - componentClassMap.put(BottomNavigationMetadata.getKlass(), BottomNavigationMetadata); componentClassMap.put(BoxMetadata.getKlass(), BoxMetadata); componentClassMap.put(BubbleChartMetadata.getKlass(), BubbleChartMetadata); componentClassMap.put(ButtonMetadata.getKlass(), ButtonMetadata); @@ -4913,7 +4804,6 @@ private Metadata() { componentClassMap.put(ButtonBaseMetadata.getKlass(), ButtonBaseMetadata); componentClassMap.put(CameraMetadata.getKlass(), CameraMetadata); componentClassMap.put(CanvasMetadata.getKlass(), CanvasMetadata); - componentClassMap.put(CardPaneMetadata.getKlass(), CardPaneMetadata); componentClassMap.put(CategoryAxisMetadata.getKlass(), CategoryAxisMetadata); componentClassMap.put(ChartMetadata.getKlass(), ChartMetadata); componentClassMap.put(CheckBoxMetadata.getKlass(), CheckBoxMetadata); @@ -4921,7 +4811,6 @@ private Metadata() { componentClassMap.put(ChoiceBoxMetadata.getKlass(), ChoiceBoxMetadata); componentClassMap.put(CircleMetadata.getKlass(), CircleMetadata); componentClassMap.put(ClosePathMetadata.getKlass(), ClosePathMetadata); - componentClassMap.put(CollapsedPanelMetadata.getKlass(), CollapsedPanelMetadata); componentClassMap.put(ColorPickerMetadata.getKlass(), ColorPickerMetadata); componentClassMap.put(ColumnConstraintsMetadata.getKlass(), ColumnConstraintsMetadata); componentClassMap.put(ComboBoxMetadata.getKlass(), ComboBoxMetadata); @@ -4932,13 +4821,7 @@ private Metadata() { componentClassMap.put(CubicCurveToMetadata.getKlass(), CubicCurveToMetadata); componentClassMap.put(CustomMenuItemMetadata.getKlass(), CustomMenuItemMetadata); componentClassMap.put(CylinderMetadata.getKlass(), CylinderMetadata); - componentClassMap.put(DatePickerMetadata.getKlass(), DatePickerMetadata); - componentClassMap.put(DialogPaneMetadata.getKlass(), DialogPaneMetadata); - componentClassMap.put(DropdownButtonMetadata.getKlass(), DropdownButtonMetadata); componentClassMap.put(EllipseMetadata.getKlass(), EllipseMetadata); - componentClassMap.put(ExpandedPanelMetadata.getKlass(), ExpandedPanelMetadata); - componentClassMap.put(ExpansionPanelMetadata.getKlass(), ExpansionPanelMetadata); - componentClassMap.put(ExpansionPanelContainerMetadata.getKlass(), ExpansionPanelContainerMetadata); componentClassMap.put(FlowPaneMetadata.getKlass(), FlowPaneMetadata); componentClassMap.put(GridPaneMetadata.getKlass(), GridPaneMetadata); componentClassMap.put(GroupMetadata.getKlass(), GroupMetadata); @@ -5019,7 +4902,6 @@ private Metadata() { componentClassMap.put(TextInputControlMetadata.getKlass(), TextInputControlMetadata); componentClassMap.put(TilePaneMetadata.getKlass(), TilePaneMetadata); componentClassMap.put(TitledPaneMetadata.getKlass(), TitledPaneMetadata); - componentClassMap.put(ToggleButtonGroupMetadata.getKlass(), ToggleButtonGroupMetadata); componentClassMap.put(ToggleButtonMetadata.getKlass(), ToggleButtonMetadata); componentClassMap.put(ToolBarMetadata.getKlass(), ToolBarMetadata); componentClassMap.put(TooltipMetadata.getKlass(), TooltipMetadata); @@ -5034,6 +4916,8 @@ private Metadata() { componentClassMap.put(XYChartMetadata.getKlass(), XYChartMetadata); componentClassMap.put(IncludeElementMetadata.getKlass(), IncludeElementMetadata); + addExternalMetadata(); + // ComponentMetadata -> PropertyMetadata AccordionMetadata.getProperties().add(panesPropertyMetadata); AccordionMetadata.getProperties().add(styleClass_c4_PropertyMetadata); @@ -5088,9 +4972,6 @@ private Metadata() { BorderPaneMetadata.getProperties().add(rightPropertyMetadata); BorderPaneMetadata.getProperties().add(topPropertyMetadata); - BottomNavigationMetadata.getProperties().add(bottomNavigationTypePropertyMetadata); - BottomNavigationMetadata.getProperties().add(actionItems_Node_PropertyMetadata); - BoxMetadata.getProperties().add(accessibleRole_NODE_PropertyMetadata); BoxMetadata.getProperties().add(depthPropertyMetadata); BoxMetadata.getProperties().add(height_Double_200_PropertyMetadata); @@ -5127,9 +5008,6 @@ private Metadata() { CanvasMetadata.getProperties().add(pickOnBounds_false_PropertyMetadata); CanvasMetadata.getProperties().add(width_Double_0_PropertyMetadata); - CardPaneMetadata.getProperties().add(items_Node_PropertyMetadata); - CardPaneMetadata.getProperties().add(onPullToRefreshPropertyMetadata); - CategoryAxisMetadata.getProperties().add(categoriesPropertyMetadata); CategoryAxisMetadata.getProperties().add(categorySpacingPropertyMetadata); CategoryAxisMetadata.getProperties().add(endMarginPropertyMetadata); @@ -5166,8 +5044,6 @@ private Metadata() { CircleMetadata.getProperties().add(pickOnBounds_false_PropertyMetadata); CircleMetadata.getProperties().add(radius_0_PropertyMetadata); - CollapsedPanelMetadata.getProperties().add(titleNodes_Node_PropertyMetadata); - ColorPickerMetadata.getProperties().add(focusTraversable_true_PropertyMetadata); ColorPickerMetadata.getProperties().add(styleClass_c5_PropertyMetadata); ColorPickerMetadata.getProperties().add(value_Color_PropertyMetadata); @@ -5249,25 +5125,6 @@ private Metadata() { CylinderMetadata.getProperties().add(pickOnBounds_false_PropertyMetadata); CylinderMetadata.getProperties().add(radius_100_PropertyMetadata); - DatePickerMetadata.getProperties().add(accessibleRole_DATE_PICKER_PropertyMetadata); - DatePickerMetadata.getProperties().add(editable_true_PropertyMetadata); - DatePickerMetadata.getProperties().add(focusTraversable_true_PropertyMetadata); - DatePickerMetadata.getProperties().add(showWeekNumbersPropertyMetadata); - DatePickerMetadata.getProperties().add(styleClass_c9_PropertyMetadata); - - DialogPaneMetadata.getProperties().add(buttonTypesPropertyMetadata); - DialogPaneMetadata.getProperties().add(children_c1_PropertyMetadata); - DialogPaneMetadata.getProperties().add(content_Node_NULL_PropertyMetadata); - DialogPaneMetadata.getProperties().add(contentTextPropertyMetadata); - DialogPaneMetadata.getProperties().add(expandableContentPropertyMetadata); - DialogPaneMetadata.getProperties().add(expanded_false_PropertyMetadata); - DialogPaneMetadata.getProperties().add(graphicPropertyMetadata); - DialogPaneMetadata.getProperties().add(headerPropertyMetadata); - DialogPaneMetadata.getProperties().add(headerTextPropertyMetadata); - DialogPaneMetadata.getProperties().add(styleClass_c30_PropertyMetadata); - - DropdownButtonMetadata.getProperties().add(items_MenuItem_PropertyMetadata); - EllipseMetadata.getProperties().add(accessibleRole_NODE_PropertyMetadata); EllipseMetadata.getProperties().add(centerXPropertyMetadata); EllipseMetadata.getProperties().add(centerYPropertyMetadata); @@ -5275,15 +5132,6 @@ private Metadata() { EllipseMetadata.getProperties().add(radiusXPropertyMetadata); EllipseMetadata.getProperties().add(radiusYPropertyMetadata); - ExpandedPanelMetadata.getProperties().add(content_EXPANDEDPANEL_PropertyMetadata); - ExpandedPanelMetadata.getProperties().add(buttons_EXPANDEDPANEL_PropertyMetadata); - - ExpansionPanelMetadata.getProperties().add(expandedContentPropertyMetadata); - ExpansionPanelMetadata.getProperties().add(collapsedContentPropertyMetadata); - ExpansionPanelMetadata.getProperties().add(expandedPropertyMetadata); - - ExpansionPanelContainerMetadata.getProperties().add(items_ExpansionPanel_PropertyMetadata); - FlowPaneMetadata.getProperties().add(alignment_TOP_LEFT_PropertyMetadata); FlowPaneMetadata.getProperties().add(columnHalignmentPropertyMetadata); FlowPaneMetadata.getProperties().add(contentBiasPropertyMetadata); @@ -5799,10 +5647,6 @@ private Metadata() { SeparatorMenuItemMetadata.getProperties().add(hideOnClick_false_PropertyMetadata); SeparatorMenuItemMetadata.getProperties().add(styleClass_c23_PropertyMetadata); - SettingsPaneMetadata.getProperties().add(searchBoxVisiblePropertyMetadata); - SettingsPaneMetadata.getProperties().add(titleFilterPropertyMetadata); - SettingsPaneMetadata.getProperties().add(options_Option_PropertyMetadata); - ShapeMetadata.getProperties().add(accessibleRole_NODE_PropertyMetadata); ShapeMetadata.getProperties().add(fill_BLACK_PropertyMetadata); ShapeMetadata.getProperties().add(pickOnBounds_false_PropertyMetadata); @@ -6024,9 +5868,6 @@ private Metadata() { TitledPaneMetadata.getProperties().add(mnemonicParsing_false_PropertyMetadata); TitledPaneMetadata.getProperties().add(styleClass_c26_PropertyMetadata); - ToggleButtonGroupMetadata.getProperties().add(toggles_ToggleButton_PropertyMetadata); - ToggleButtonGroupMetadata.getProperties().add(selectionTypePropertyMetadata); - ToggleButtonMetadata.getProperties().add(accessibleRole_TOGGLE_BUTTON_PropertyMetadata); ToggleButtonMetadata.getProperties().add(alignment_CENTER_PropertyMetadata); ToggleButtonMetadata.getProperties().add(focusTraversable_true_PropertyMetadata); @@ -6348,6 +6189,22 @@ private Metadata() { subSectionMap.put("Code", ss2); } + private final Collection externalMetadataProviders = getExternalMetadataProviders(); + + private void addExternalMetadata() { + for (ExternalMetadataProvider provider : externalMetadataProviders) { + for (ComponentClassMetadata item : provider.getExternalItems()) { + componentClassMap.put(item.getKlass(), item); + } + } + } + + private Collection getExternalMetadataProviders() { + ServiceLoader loader = ServiceLoader.load(ExternalMetadataProvider.class); + Collection providers = new ArrayList<>(); + loader.iterator().forEachRemaining(providers::add); + return providers; + } // The following properties have been rejected: // javafx.embed.swing.SwingNode -> content : Property type (JComponent) is not certified diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/klass/ComponentClassMetadata.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/klass/ComponentClassMetadata.java index 2ca1a494c..3bc07243d 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/klass/ComponentClassMetadata.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/klass/ComponentClassMetadata.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,10 +32,16 @@ */ package com.oracle.javafx.scenebuilder.kit.metadata.klass; +import com.oracle.javafx.scenebuilder.kit.metadata.ExternalMetadataProvider; import com.oracle.javafx.scenebuilder.kit.metadata.property.PropertyMetadata; import com.oracle.javafx.scenebuilder.kit.metadata.util.PropertyName; + +import java.util.ArrayList; +import java.util.Collection; import java.util.HashSet; import java.util.Iterator; +import java.util.Optional; +import java.util.ServiceLoader; import java.util.Set; /** @@ -152,16 +158,6 @@ private static PropertyName getSubComponentProperty(Class componentClass) { * Group children * Panes children * - * ------------ Gluon ------------------ - * - * BottomNavigation actionItems - * CardPane items - * DropdownButton items - * ExpansionPanelContainer items - * ToggleButtonGroup toggles - * CollapsedPanel titleNodes - * SettingsPane options - * * ------------------------------------ * * Other null @@ -201,24 +197,10 @@ private static PropertyName getSubComponentProperty(Class componentClass) { result = childrenName; } else if (componentClass == javafx.scene.layout.Pane.class) { result = childrenName; - } else if (componentClass == com.gluonhq.charm.glisten.control.BottomNavigation.class) { - result = actionItemsName; - } else if (componentClass == com.gluonhq.charm.glisten.control.CardPane.class) { - result = itemsName; - } else if (componentClass == com.gluonhq.charm.glisten.control.DropdownButton.class) { - result = itemsName; - } else if (componentClass == com.gluonhq.charm.glisten.control.ExpansionPanelContainer.class) { - result = itemsName; - } else if (componentClass == com.gluonhq.charm.glisten.control.ToggleButtonGroup.class) { - result = togglesName; - } else if (componentClass == com.gluonhq.charm.glisten.control.ExpansionPanel.CollapsedPanel.class) { - result = titleNodesName; - } else if (componentClass == com.gluonhq.charm.glisten.control.SettingsPane.class) { - result = optionsName; } else { - result = null; + result = getExternalSubComponentProperty(componentClass) + .orElse(null); } - return result; } @@ -230,10 +212,23 @@ private static PropertyName getSubComponentProperty(Class componentClass) { private static final PropertyName panesName = new PropertyName("panes"); private static final PropertyName tabsName = new PropertyName("tabs"); private static final PropertyName childrenName = new PropertyName("children"); - // Gluon - private static final PropertyName actionItemsName = new PropertyName("actionItems"); - private static final PropertyName togglesName = new PropertyName("toggles"); - private static final PropertyName titleNodesName = new PropertyName("titleNodes"); - private static final PropertyName optionsName = new PropertyName("options"); + private static final Collection externalMetadataProviders = getExternalMetadataProviders(); + + private static Optional getExternalSubComponentProperty(Class componentClass) { + for (ExternalMetadataProvider provider : externalMetadataProviders) { + Optional externalSubComponentProperty = provider.getExternalSubComponentProperty(componentClass); + if (externalSubComponentProperty.isPresent()) { + return externalSubComponentProperty; + } + } + return Optional.empty(); + } + + private static Collection getExternalMetadataProviders() { + ServiceLoader loader = ServiceLoader.load(ExternalMetadataProvider.class); + Collection providers = new ArrayList<>(); + loader.iterator().forEachRemaining(providers::add); + return providers; + } } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/util/DesignHierarchyMask.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/util/DesignHierarchyMask.java index 49db5c8f5..4f04ca5b9 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/util/DesignHierarchyMask.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/util/DesignHierarchyMask.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. * @@ -32,20 +32,15 @@ */ package com.oracle.javafx.scenebuilder.kit.metadata.util; -import com.gluonhq.charm.glisten.control.BottomNavigation; -import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform; -import com.gluonhq.charm.glisten.control.DropdownButton; -import com.gluonhq.charm.glisten.control.ExpansionPanel; -import com.gluonhq.charm.glisten.control.ToggleButtonGroup; -import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform; import com.oracle.javafx.scenebuilder.kit.editor.images.ImageUtils; +import com.oracle.javafx.scenebuilder.kit.editor.panel.hierarchy.HierarchyItem; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMCollection; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMInstance; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMIntrinsic; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMObject; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMProperty; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMPropertyC; -import com.oracle.javafx.scenebuilder.kit.library.BuiltinLibrary; +import com.oracle.javafx.scenebuilder.kit.library.ExternalSectionProvider; import com.oracle.javafx.scenebuilder.kit.metadata.Metadata; import com.oracle.javafx.scenebuilder.kit.metadata.klass.ComponentClassMetadata; import com.oracle.javafx.scenebuilder.kit.metadata.property.ComponentPropertyMetadata; @@ -58,6 +53,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.ServiceLoader; +import java.util.function.BiFunction; +import java.util.function.Predicate; + import javafx.geometry.Orientation; import javafx.scene.Group; import javafx.scene.Node; @@ -91,71 +90,74 @@ */ public class DesignHierarchyMask { - public enum Accessory { - // True accessories - - PLACEHOLDER, - TOOLTIP, - CONTEXT_MENU, - CLIP, - GRAPHIC, - // Single-valued sub-components treated as accessories - // TODO(elp) : verify that it is complete - CONTENT, - ROOT, - SCENE, - TOP, - BOTTOM, - LEFT, - RIGHT, - CENTER, - XAXIS, - YAXIS, - TREE_COLUMN, - EXPANDABLE_CONTENT, - HEADER, - DP_CONTENT { - @Override - public String toString() { - return "CONTENT"; // NOI18N - } - }, - DP_GRAPHIC { - @Override - public String toString() { - return "GRAPHIC"; // NOI18N - } - }, - // ExpansionPanel - EXPANDED_CONTENT, - COLLAPSED_CONTENT, - // ExpandedPanel - EX_CONTENT { - @Override - public String toString() { return "CONTENT"; } - } + /** + * An accessory is defined by its class name, a string name, a propertyName, a class, and a predicate + * @param name + * @param propertyName + * @param classForAccessory + * @param isAccepting + */ + public record Accessory(String name, PropertyName propertyName, Class classForAccessory, Predicate isAccepting) { + + @Override + public String toString() { + return name; + } + + // Accessories + public static final Accessory PLACEHOLDER = + new Accessory("PLACEHOLDER", new PropertyName("placeholder"), javafx.scene.Node.class, o -> true); + public static final Accessory TOOLTIP = + new Accessory("TOOLTIP", new PropertyName("tooltip"), javafx.scene.control.Tooltip.class, o -> true); + public static final Accessory CONTEXT_MENU = + new Accessory("CONTEXT_MENU", new PropertyName("contextMenu"), javafx.scene.control.ContextMenu.class, o -> true); + public static final Accessory CLIP = + new Accessory("CLIP", new PropertyName("clip"), javafx.scene.Node.class, o -> true); + public static final Accessory ROOT = + new Accessory("ROOT", new PropertyName("root"), javafx.scene.Node.class, o -> true); + public static final Accessory SCENE = + new Accessory("SCENE", new PropertyName("scene"), javafx.scene.Scene.class, o -> true); + public static final Accessory TOP = + new Accessory("TOP", new PropertyName("top"), javafx.scene.Node.class, o -> true); + public static final Accessory BOTTOM = + new Accessory("BOTTOM", new PropertyName("bottom"), javafx.scene.Node.class, o -> true); + public static final Accessory LEFT = + new Accessory("LEFT", new PropertyName("left"), javafx.scene.Node.class, o -> true); + public static final Accessory RIGHT = + new Accessory("RIGHT", new PropertyName("right"), javafx.scene.Node.class, o -> true); + public static final Accessory CENTER = + new Accessory("CENTER", new PropertyName("center"), javafx.scene.Node.class, o -> true); + public static final Accessory XAXIS = + new Accessory("XAXIS", new PropertyName("xAxis"), javafx.scene.chart.Axis.class, o -> true); + public static final Accessory YAXIS = + new Accessory("YAXIS", new PropertyName("xAxis"), javafx.scene.chart.Axis.class, o -> true); + public static final Accessory TREE_COLUMN = + new Accessory("TREE_COLUMN", new PropertyName("treeColumn"), javafx.scene.control.TreeTableColumn.class, o -> true); + public static final Accessory EXPANDABLE_CONTENT = + new Accessory("EXPANDABLE_CONTENT", new PropertyName("expandableContent"), javafx.scene.Node.class, o -> true); + public static final Accessory HEADER = + new Accessory("HEADER", new PropertyName("header"), javafx.scene.Node.class, o -> true); + + // content and graphic accept every object except a DialogPane + public static final Accessory CONTENT = + new Accessory("CONTENT", new PropertyName("content"), javafx.scene.Node.class, o -> !(o instanceof DialogPane)); + public static final Accessory GRAPHIC = + new Accessory("GRAPHIC", new PropertyName("graphic"), javafx.scene.Node.class, o -> !(o instanceof DialogPane)); + // dp_content and dp_graphic accept only a DialogPane + public static final Accessory DP_CONTENT = + new Accessory("CONTENT", new PropertyName("content"), javafx.scene.Node.class, o -> o instanceof DialogPane); + public static final Accessory DP_GRAPHIC = + new Accessory("GRAPHIC", new PropertyName("graphic"), javafx.scene.Node.class, o -> o instanceof DialogPane); + } + + public List getAccessoryList() { + List accessories = new ArrayList<>(List.of(Accessory.PLACEHOLDER, Accessory.TOOLTIP, Accessory.CONTEXT_MENU, Accessory.CLIP, + Accessory.ROOT, Accessory.SCENE, Accessory.TOP, Accessory.BOTTOM, Accessory.LEFT, Accessory.RIGHT, + Accessory.CENTER, Accessory.XAXIS, Accessory.YAXIS, Accessory.TREE_COLUMN, Accessory.EXPANDABLE_CONTENT, Accessory.HEADER, + Accessory.CONTENT, Accessory.GRAPHIC, Accessory.DP_CONTENT, Accessory.DP_GRAPHIC)); + accessories.addAll(getExternalAccessories()); + return accessories; } - private static final PropertyName graphicName = new PropertyName("graphic"); - private static final PropertyName contentName = new PropertyName("content"); - private static final PropertyName rootName = new PropertyName("root"); - private static final PropertyName sceneName = new PropertyName("scene"); - private static final PropertyName expandableContentName = new PropertyName("expandableContent"); - private static final PropertyName headerName = new PropertyName("header"); - private static final PropertyName topName = new PropertyName("top"); - private static final PropertyName bottomName = new PropertyName("bottom"); - private static final PropertyName leftName = new PropertyName("left"); - private static final PropertyName rightName = new PropertyName("right"); - private static final PropertyName centerName = new PropertyName("center"); - private static final PropertyName xAxisName = new PropertyName("xAxis"); - private static final PropertyName yAxisName = new PropertyName("yAxis"); - private static final PropertyName placeholderName = new PropertyName("placeholder"); - private static final PropertyName tooltipName = new PropertyName("tooltip"); - private static final PropertyName contextMenuName = new PropertyName("contextMenu"); - private static final PropertyName clipName = new PropertyName("clip"); - private static final PropertyName treeColumnName = new PropertyName("treeColumn"); - // ExpansionPanel - private static final PropertyName expandedContentName = new PropertyName("expandedContent"); - private static final PropertyName collapsedContentName = new PropertyName("collapsedContent"); private final FXOMObject fxomObject; private Map propertyMetadataMap; // Initialized lazily @@ -181,7 +183,7 @@ public FXOMObject getClosestFxNode() { FXOMObject result = fxomObject; DesignHierarchyMask mask = this; - while ((result != null) && (mask.isFxNode() == false)) { + while ((result != null) && (!mask.isFxNode())) { result = mask.getParentFXOMObject(); mask = (result == null) ? null : new DesignHierarchyMask(result); } @@ -204,46 +206,50 @@ public URL getClassNameIconURL() { return null; } final URL url; - if (sceneGraphObject instanceof Separator) { - // Separator orientation - final Separator obj = (Separator) sceneGraphObject; - if (Orientation.HORIZONTAL.equals(obj.getOrientation())) { - url = ImageUtils.getNodeIconURL("Separator-h.png"); //NOI18N - } else { - url = ImageUtils.getNodeIconURL("Separator-v.png"); //NOI18N + switch (sceneGraphObject) { + case Separator obj -> { + // Separator orientation + if (Orientation.HORIZONTAL.equals(obj.getOrientation())) { + url = ImageUtils.getNodeIconURL("Separator-h.png"); //NOI18N + } else { + url = ImageUtils.getNodeIconURL("Separator-v.png"); //NOI18N + } } - } else if (sceneGraphObject instanceof ScrollBar) { - // ScrollBar orientation - final ScrollBar obj = (ScrollBar) sceneGraphObject; - if (Orientation.HORIZONTAL.equals(obj.getOrientation())) { - url = ImageUtils.getNodeIconURL("ScrollBar-h.png"); //NOI18N - } else { - url = ImageUtils.getNodeIconURL("ScrollBar-v.png"); //NOI18N + case ScrollBar obj -> { + // ScrollBar orientation + if (Orientation.HORIZONTAL.equals(obj.getOrientation())) { + url = ImageUtils.getNodeIconURL("ScrollBar-h.png"); //NOI18N + } else { + url = ImageUtils.getNodeIconURL("ScrollBar-v.png"); //NOI18N + } } - } else if (sceneGraphObject instanceof Slider) { - // Slider orientation - final Slider obj = (Slider) sceneGraphObject; - if (Orientation.HORIZONTAL.equals(obj.getOrientation())) { - url = ImageUtils.getNodeIconURL("Slider-h.png"); //NOI18N - } else { - url = ImageUtils.getNodeIconURL("Slider-v.png"); //NOI18N + case Slider obj -> { + // Slider orientation + if (Orientation.HORIZONTAL.equals(obj.getOrientation())) { + url = ImageUtils.getNodeIconURL("Slider-h.png"); //NOI18N + } else { + url = ImageUtils.getNodeIconURL("Slider-v.png"); //NOI18N + } } - } else if (sceneGraphObject instanceof SplitPane) { - // SplitPane orientation - final SplitPane obj = (SplitPane) sceneGraphObject; - if (Orientation.HORIZONTAL.equals(obj.getOrientation())) { - url = ImageUtils.getNodeIconURL("SplitPane-h.png"); //NOI18N - } else { - url = ImageUtils.getNodeIconURL("SplitPane-v.png"); //NOI18N + case SplitPane obj -> { + // SplitPane orientation + if (Orientation.HORIZONTAL.equals(obj.getOrientation())) { + url = ImageUtils.getNodeIconURL("SplitPane-h.png"); //NOI18N + } else { + url = ImageUtils.getNodeIconURL("SplitPane-v.png"); //NOI18N + } } - } else { - // Default - Class componentClass = sceneGraphObject.getClass(); - String fileName = componentClass.getSimpleName(); - if (componentClass.getName().startsWith(EditorPlatform.GLUON_PACKAGE)) { - fileName = BuiltinLibrary.GLUON_FILE_PREFIX + fileName; + default -> { + // Default + Class componentClass = sceneGraphObject.getClass(); + URL externalURL = findExternalItemImage(componentClass); + if (externalURL == null) { + String fileName = componentClass.getSimpleName(); + url = ImageUtils.getNodeIconURL(fileName + ".png"); //NOI18N + } else { + url = externalURL; + } } - url = ImageUtils.getNodeIconURL(fileName + ".png"); //NOI18N } return url; } @@ -259,8 +265,7 @@ public String getClassNameInfo() { String prefix = "", suffix = ""; //NOI18N // For FXOMIntrinsic, we use the source sceneGraphObject - if (fxomObject instanceof FXOMIntrinsic) { - final FXOMIntrinsic fxomIntrinsic = (FXOMIntrinsic) fxomObject; + if (fxomObject instanceof FXOMIntrinsic fxomIntrinsic) { sceneGraphObject = fxomIntrinsic.getSourceSceneGraphObject(); if (fxomIntrinsic.getType() == FXOMIntrinsic.Type.FX_INCLUDE) { // Add FXML prefix for included FXML file @@ -273,18 +278,16 @@ public String getClassNameInfo() { if (sceneGraphObject == null) { classNameInfo = prefix + fxomObject.getGlueElement().getTagName() + suffix; } else { - if (sceneGraphObject instanceof Node) { - final Node node = (Node) sceneGraphObject; + if (sceneGraphObject instanceof Node node) { // GridPane : add num rows x num columns if (node instanceof GridPane) { int columnsSize = getColumnsSize(); int rowsSize = getRowsSize(); - suffix += " (" + columnsSize + //NOI18N - " x " + rowsSize + ")"; //NOI18N + suffix += " (" + columnsSize + " x " + rowsSize + ")"; //NOI18N } - // GridPane children : add child positionning within the GridPane + // GridPane children : add child positioning within the GridPane final FXOMObject parentFxomObject = fxomObject.getParentObject(); if (parentFxomObject != null) { final Object parentSceneGraphObject = parentFxomObject.getSceneGraphObject(); @@ -341,8 +344,7 @@ public String getSingleLineDescription() { */ public Object getNodeIdValue() { Object result = null; - if (fxomObject instanceof FXOMInstance) { - final FXOMInstance fxomInstance = (FXOMInstance) fxomObject; + if (fxomObject instanceof FXOMInstance fxomInstance) { final PropertyName propertyName = new PropertyName("id"); //NOI18N final ValuePropertyMetadata vpm = Metadata.getMetadata().queryValueProperty(fxomInstance, propertyName); @@ -367,8 +369,7 @@ public String getNodeId() { public String getFxId() { String result = null; - if (fxomObject instanceof FXOMInstance) { // Can be null for place holder items - final FXOMInstance fxomInstance = (FXOMInstance) fxomObject; + if (fxomObject instanceof FXOMInstance fxomInstance) { // Can be null for place holder items final String fxId = fxomInstance.getFxId(); result = fxId == null ? "" : fxId; //NOI18N } @@ -413,8 +414,7 @@ public boolean isResourceKey() { public boolean isFreeChildPositioning() { boolean result = false; - if (fxomObject instanceof FXOMInstance) { - final FXOMInstance fxomInstance = (FXOMInstance) fxomObject; + if (fxomObject instanceof FXOMInstance fxomInstance) { final Class componentClass = fxomInstance.getDeclaredClass(); result = componentClass == AnchorPane.class || componentClass == Group.class @@ -424,38 +424,11 @@ public boolean isFreeChildPositioning() { } public boolean isAcceptingAccessory(Accessory accessory) { - final PropertyName propertyName = getPropertyNameForAccessory(accessory); - final Class valueClass = getClassForAccessory(accessory); - final Object sceneGraphObject = fxomObject.getSceneGraphObject(); - switch (accessory) { - case CONTENT: - case GRAPHIC: - if (sceneGraphObject instanceof DialogPane == true || sceneGraphObject instanceof ExpansionPanel.ExpandedPanel == true) { - return false; - } - break; - case DP_CONTENT: - case DP_GRAPHIC: - if (sceneGraphObject instanceof DialogPane == false || sceneGraphObject instanceof ExpansionPanel.ExpandedPanel == true) { - return false; - } - break; - case EXPANDABLE_CONTENT: - case COLLAPSED_CONTENT: - if (sceneGraphObject instanceof ExpansionPanel == false) { - return false; - } - break; - case EX_CONTENT: - if (sceneGraphObject instanceof ExpansionPanel.ExpandedPanel == false) { - return false; - } - break; - default: - break; + if (!accessory.isAccepting().test(sceneGraphObject) || !isExternalAccepting(accessory, sceneGraphObject)) { + return false; } - return isAcceptingProperty(propertyName, valueClass); + return isAcceptingProperty(accessory.propertyName(), accessory.classForAccessory()); } /** @@ -467,64 +440,12 @@ public boolean isAcceptingAccessory(Accessory accessory) { */ public boolean isAcceptingAccessory(final Accessory accessory, final FXOMObject fxomObject) { final Object sceneGraphObject; - if (fxomObject instanceof FXOMIntrinsic) { - sceneGraphObject = ((FXOMIntrinsic) fxomObject).getSourceSceneGraphObject(); + if (fxomObject instanceof FXOMIntrinsic fxomIntrinsic) { + sceneGraphObject = fxomIntrinsic.getSourceSceneGraphObject(); } else { sceneGraphObject = fxomObject.getSceneGraphObject(); } - final Class accessoryClass = getClassForAccessory(accessory); - return isAcceptingAccessory(accessory) - && accessoryClass.isInstance(sceneGraphObject); - } - - public static Class getClassForAccessory(Accessory accessory) { - final Class result; - - switch (accessory) { - case GRAPHIC: - case TOP: - case BOTTOM: - case LEFT: - case RIGHT: - case CENTER: - case PLACEHOLDER: - case CLIP: - case CONTENT: - case ROOT: - result = javafx.scene.Node.class; - break; - case SCENE: - result = javafx.scene.Scene.class; - break; - case XAXIS: - case YAXIS: - result = javafx.scene.chart.Axis.class; - break; - case TOOLTIP: - result = javafx.scene.control.Tooltip.class; - break; - case CONTEXT_MENU: - result = javafx.scene.control.ContextMenu.class; - break; - case TREE_COLUMN: - result = javafx.scene.control.TreeTableColumn.class; - break; - case DP_CONTENT: - case EX_CONTENT: - case EXPANDABLE_CONTENT: - case DP_GRAPHIC: - case HEADER: - result = javafx.scene.Node.class; - break; - case EXPANDED_CONTENT: - case COLLAPSED_CONTENT: - result = javafx.scene.Node.class; - break; - default: // Bug - throw new IllegalStateException("Unexpected accessory " + accessory); - } - - return result; + return isAcceptingAccessory(accessory) && accessory.classForAccessory().isInstance(sceneGraphObject); } public FXOMObject getAccessory(Accessory accessory) { @@ -536,9 +457,8 @@ public FXOMObject getAccessory(Accessory accessory) { final FXOMProperty fxomProperty = fxomInstance.getProperties().get(propertyName); final FXOMObject result; - if (fxomProperty instanceof FXOMPropertyC) { - final FXOMPropertyC fxomPropertyC = (FXOMPropertyC) fxomProperty; - assert fxomPropertyC.getValues().size() >= 1 : "accessory=" + accessory; + if (fxomProperty instanceof FXOMPropertyC fxomPropertyC) { + assert !fxomPropertyC.getValues().isEmpty() : "accessory=" + accessory; result = fxomPropertyC.getValues().get(0); } else { result = null; @@ -602,8 +522,7 @@ public boolean isAcceptingSubComponent(final Collection fxomObjects) = subComponentMetadata.getClassMetadata().getKlass(); for (FXOMObject obj : fxomObjects) { final Object sceneGraphObject; - if (obj instanceof FXOMIntrinsic) { - final FXOMIntrinsic intrinsicObj = (FXOMIntrinsic) obj; + if (obj instanceof FXOMIntrinsic intrinsicObj) { sceneGraphObject = intrinsicObj.getSourceSceneGraphObject(); } else { sceneGraphObject = obj.getSceneGraphObject(); @@ -628,10 +547,10 @@ public PropertyName getSubComponentPropertyName() { result = null; } else { final Class componentClass = sceneGraphObject.getClass(); - final ComponentClassMetadata componentClassMedadata + final ComponentClassMetadata componentClassMetadata = Metadata.getMetadata().queryComponentMetadata(componentClass); - assert componentClassMedadata != null; - result = componentClassMedadata.getSubComponentProperty(); + assert componentClassMetadata != null; + result = componentClassMetadata.getSubComponentProperty(); } return result; @@ -696,77 +615,7 @@ public PropertyName getPropertyNameForDescription() { } public PropertyName getPropertyNameForAccessory(Accessory accessory) { - final PropertyName result; - - switch (accessory) { - case GRAPHIC: - case DP_GRAPHIC: - result = graphicName; - break; - case CONTENT: - case DP_CONTENT: - case EX_CONTENT: - result = contentName; - break; - case ROOT: - result = rootName; - break; - case SCENE: - result = sceneName; - break; - case EXPANDABLE_CONTENT: - result = expandableContentName; - break; - case HEADER: - result = headerName; - break; - case TOP: - result = topName; - break; - case BOTTOM: - result = bottomName; - break; - case LEFT: - result = leftName; - break; - case RIGHT: - result = rightName; - break; - case CENTER: - result = centerName; - break; - case XAXIS: - result = xAxisName; - break; - case YAXIS: - result = yAxisName; - break; - case PLACEHOLDER: - result = placeholderName; - break; - case TOOLTIP: - result = tooltipName; - break; - case CONTEXT_MENU: - result = contextMenuName; - break; - case CLIP: - result = clipName; - break; - case TREE_COLUMN: - result = treeColumnName; - break; - case EXPANDED_CONTENT: - result = expandedContentName; - break; - case COLLAPSED_CONTENT: - result = collapsedContentName; - break; - default: // Bug - throw new IllegalStateException("Unexpected accessory " + accessory); - } - - return result; + return accessory.propertyName(); } /* @@ -805,8 +654,7 @@ public FXOMPropertyC getAccessoryProperty(Accessory accessory) { private void queryPropertyMetadata() { if (propertyMetadataMap == null) { propertyMetadataMap = new HashMap<>(); - if (fxomObject instanceof FXOMInstance) { - final FXOMInstance fxomInstance = (FXOMInstance) fxomObject; + if (fxomObject instanceof FXOMInstance fxomInstance) { if (fxomInstance.getSceneGraphObject() != null) { final Class componentClass = fxomInstance.getSceneGraphObject().getClass(); for (ComponentPropertyMetadata cpm : Metadata.getMetadata().queryComponentProperties(componentClass)) { @@ -1002,12 +850,10 @@ public FXOMObject getRowConstraintsAtIndex(int index) { */ public int getColumnIndex() { int result = 0; - if (fxomObject instanceof FXOMInstance) { + if (fxomObject instanceof FXOMInstance fxomInstance) { assert fxomObject.getSceneGraphObject() != null; - final FXOMInstance fxomInstance = (FXOMInstance) fxomObject; result = getIndexFromGrid(fxomInstance, "columnIndex"); - } else if(fxomObject instanceof FXOMIntrinsic) { - FXOMIntrinsic fxomIntrinsic = (FXOMIntrinsic) fxomObject; + } else if(fxomObject instanceof FXOMIntrinsic fxomIntrinsic) { FXOMInstance fxomInstance = fxomIntrinsic.createFxomInstanceFromIntrinsic(); result = getIndexFromGrid(fxomInstance, "columnIndex"); } @@ -1021,12 +867,10 @@ public int getColumnIndex() { */ public int getRowIndex() { int result = 0; - if (fxomObject instanceof FXOMInstance) { + if (fxomObject instanceof FXOMInstance fxomInstance) { assert fxomObject.getSceneGraphObject() != null; - final FXOMInstance fxomInstance = (FXOMInstance) fxomObject; result = getIndexFromGrid(fxomInstance, "rowIndex"); - } else if(fxomObject instanceof FXOMIntrinsic) { - FXOMIntrinsic fxomIntrinsic = (FXOMIntrinsic) fxomObject; + } else if(fxomObject instanceof FXOMIntrinsic fxomIntrinsic) { FXOMInstance fxomInstance = fxomIntrinsic.createFxomInstanceFromIntrinsic(); result = getIndexFromGrid(fxomInstance, "rowIndex"); } @@ -1071,22 +915,90 @@ public static boolean containsLineFeed(String str) { * the layout. */ public boolean needResizeWhenTopElement() { - return (this.isAcceptingSubComponent() - || this.isAcceptingAccessory(Accessory.CONTENT) - || this.isAcceptingAccessory(Accessory.ROOT) - || this.isAcceptingAccessory(Accessory.SCENE) - || this.isAcceptingAccessory(Accessory.CENTER) - || this.isAcceptingAccessory(Accessory.TOP) - || this.isAcceptingAccessory(Accessory.RIGHT) - || this.isAcceptingAccessory(Accessory.BOTTOM) - || this.isAcceptingAccessory(Accessory.LEFT)) - && ! (fxomObject.getSceneGraphObject() instanceof MenuButton - || fxomObject.getSceneGraphObject() instanceof MenuBar - || fxomObject.getSceneGraphObject() instanceof ToolBar - || fxomObject.getSceneGraphObject() instanceof ExpansionPanel.ExpandedPanel - || fxomObject.getSceneGraphObject() instanceof DropdownButton - || fxomObject.getSceneGraphObject() instanceof BottomNavigation - || fxomObject.getSceneGraphObject() instanceof ExpansionPanel.CollapsedPanel - || fxomObject.getSceneGraphObject() instanceof ToggleButtonGroup); // Jerome + Object sceneGraphObject = fxomObject.getSceneGraphObject(); + return (isAcceptingSubComponent() + || isAcceptingAccessory(Accessory.CONTENT) + || isAcceptingAccessory(Accessory.ROOT) + || isAcceptingAccessory(Accessory.SCENE) + || isAcceptingAccessory(Accessory.CENTER) + || isAcceptingAccessory(Accessory.TOP) + || isAcceptingAccessory(Accessory.RIGHT) + || isAcceptingAccessory(Accessory.BOTTOM) + || isAcceptingAccessory(Accessory.LEFT)) + && !(sceneGraphObject instanceof MenuButton + || sceneGraphObject instanceof MenuBar + || sceneGraphObject instanceof ToolBar + || isExternalNonResizable(sceneGraphObject)); + } + + // External providers + private final Collection externalDesignHierarchyMaskProviders = getExternalDesignHierarchyMaskProviders(); + private final Collection externalItemProviders = getExternalItemProviders(); + + private boolean isExternalNonResizable(Object object) { + for (ExternalDesignHierarchyMaskProvider provider : externalDesignHierarchyMaskProviders) { + for (Class item : provider.getExternalNonResizableItems()) { + if (item.isInstance(object)) { + // if we have any match with one external class, object is non-resizable + return true; + } + } + } + // no matches, object is resizable + return false; + } + + private List getExternalAccessories() { + List result = new ArrayList<>(); + for (ExternalDesignHierarchyMaskProvider provider : externalDesignHierarchyMaskProviders) { + result.addAll(provider.getExternalAccessories()); + } + return result; + } + + private boolean isExternalAccepting(Accessory accessory, Object object) { + for (ExternalDesignHierarchyMaskProvider provider : externalDesignHierarchyMaskProviders) { + if (!provider.isExternalAccepting(accessory).test(object)) { + // if we have any match with one external predicate not accepting the object, then the accessory is not accepting + return false; + } + } + // no matches, accessory accepts object + return true; + } + + public Map> getExternalHierarchyItemGeneratorMap() { + Map> map = new HashMap<>(); + for (ExternalDesignHierarchyMaskProvider provider : externalDesignHierarchyMaskProviders) { + map.putAll(provider.getExternalHierarchyItemGeneratorMap()); + } + return map; + } + + private URL findExternalItemImage(Class clazz) { + for (ExternalSectionProvider provider : externalItemProviders) { + for (Class item : provider.getExternalSectionItems()) { + if (item == clazz) { + URL iconURL = provider.getClass().getResource(provider.getItemsIconPath() + "/" + item.getSimpleName() + ".png"); + assert iconURL != null; + return iconURL; + } + } + } + return null; + } + + private Collection getExternalDesignHierarchyMaskProviders() { + ServiceLoader loader = ServiceLoader.load(ExternalDesignHierarchyMaskProvider.class); + Collection providers = new ArrayList<>(); + loader.iterator().forEachRemaining(providers::add); + return providers; + } + + private Collection getExternalItemProviders() { + ServiceLoader loader = ServiceLoader.load(ExternalSectionProvider.class); + Collection providers = new ArrayList<>(); + loader.iterator().forEachRemaining(providers::add); + return providers; } } diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/util/ExternalDesignHierarchyMaskProvider.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/util/ExternalDesignHierarchyMaskProvider.java new file mode 100644 index 000000000..8203bf04d --- /dev/null +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/metadata/util/ExternalDesignHierarchyMaskProvider.java @@ -0,0 +1,80 @@ +/* + * 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.oracle.javafx.scenebuilder.kit.metadata.util; + +import com.oracle.javafx.scenebuilder.kit.editor.panel.hierarchy.HierarchyItem; +import com.oracle.javafx.scenebuilder.kit.fxom.FXOMObject; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.BiFunction; +import java.util.function.Predicate; + +public interface ExternalDesignHierarchyMaskProvider { + + /** + * List of external classes that their design mask should not + * resize while used as top element of the layout + * @return a List of classes + */ + List> getExternalNonResizableItems(); + + /** + * List of external accessories + * @return a list with external accessories + */ + List getExternalAccessories(); + + /** + * Returns a predicate for a given accessory, that takes an object + * and returns true or false based on a given condition + * @param accessory the accessory + * @return a predicate to test an object + */ + Predicate isExternalAccepting(DesignHierarchyMask.Accessory accessory); + + /** + * Returns a map with external accessories as keys, and biFunctions that generate a valid HierarchyItem (or subclass) + * given a mask and an FXOM object, that can be inserted in the Hierarchy Tree, as values for those keys. + * @return a map of accessories and biFunctions to generate HierarchyItems + */ + Map> getExternalHierarchyItemGeneratorMap(); + + /** + * If the hierarchyItem object matches a given condition, gets an optional of the external accessory + * for such object, else returns empty + * @param hierarchyItem the HierarchyItem object + * @return an optional with an accessory or empty + */ + Optional getExternalAccessoryForHierarchyItem(HierarchyItem hierarchyItem); +} \ No newline at end of file diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/preferences/PreferencesControllerBase.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/preferences/PreferencesControllerBase.java index 4a1f28c30..f1cc28b3f 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/preferences/PreferencesControllerBase.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/preferences/PreferencesControllerBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Gluon and/or its affiliates. + * Copyright (c) 2017, 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: @@ -73,8 +73,6 @@ public abstract class PreferencesControllerBase { public static final String SCENE_STYLE_SHEETS = "sceneStyleSheets"; //NOI18N public static final String I18N_RESOURCE = "I18NResource"; //NOI18N public static final String THEME = "theme"; - public static final String GLUON_SWATCH = "gluonSwatch"; - public static final String GLUON_THEME = "gluonTheme"; /*************************************************************************** * * diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/preferences/PreferencesRecordGlobalBase.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/preferences/PreferencesRecordGlobalBase.java index 95c55e2aa..6727156b5 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/preferences/PreferencesRecordGlobalBase.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/preferences/PreferencesRecordGlobalBase.java @@ -1,3 +1,34 @@ +/* + * Copyright (c) 2017, 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 Oracle Corporation 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.oracle.javafx.scenebuilder.kit.preferences; import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform; @@ -53,8 +84,6 @@ public String toString() { public static final Color DEFAULT_ALIGNMENT_GUIDES_COLOR = Color.RED; public static final Color DEFAULT_PARENT_RING_COLOR = Color.rgb(238, 168, 47); public static final EditorPlatform.Theme DEFAULT_THEME = EditorPlatform.DEFAULT_THEME; - public static final EditorPlatform.GluonSwatch DEFAULT_SWATCH = EditorPlatform.DEFAULT_SWATCH; - public static final EditorPlatform.GluonTheme DEFAULT_GLUON_THEME = EditorPlatform.DEFAULT_GLUON_THEME; /*************************************************************************** * * @@ -71,8 +100,6 @@ public String toString() { protected Color parentRingColor = DEFAULT_PARENT_RING_COLOR; protected EditorPlatform.Theme theme = DEFAULT_THEME; - protected EditorPlatform.GluonSwatch gluonSwatch = DEFAULT_SWATCH; - protected EditorPlatform.GluonTheme gluonTheme = DEFAULT_GLUON_THEME; /*************************************************************************** * * @@ -139,14 +166,6 @@ public void setParentRingColor(Color value) { public void setTheme(EditorPlatform.Theme theme) { this.theme = theme; } - public EditorPlatform.GluonSwatch getSwatch() { return gluonSwatch; } - - public void setSwatch(EditorPlatform.GluonSwatch swatch) { this.gluonSwatch = swatch; } - - public EditorPlatform.GluonTheme getGluonTheme() { return gluonTheme; } - - public void setGluonTheme(EditorPlatform.GluonTheme theme) { this.gluonTheme = theme; } - /** * Read data from the java preferences DB and initialize properties. */ @@ -180,11 +199,6 @@ public void readFromJavaPreferences() { // Document theme String themeName = applicationRootPreferences.get(PreferencesControllerBase.THEME, DEFAULT_THEME.name()); theme = EditorPlatform.Theme.valueOf(themeName); - String swatchName = applicationRootPreferences.get(PreferencesControllerBase.GLUON_SWATCH, DEFAULT_SWATCH.name()); - gluonSwatch = EditorPlatform.GluonSwatch.valueOf(swatchName); - String gluonThemeName = applicationRootPreferences.get(PreferencesControllerBase.GLUON_THEME, DEFAULT_GLUON_THEME.name()); - gluonTheme = EditorPlatform.GluonTheme.valueOf(gluonThemeName); - } public void writeToJavaPreferences(String key) { @@ -209,12 +223,6 @@ public void writeToJavaPreferences(String key) { case PreferencesControllerBase.THEME: applicationRootPreferences.put(PreferencesControllerBase.THEME, getTheme().name()); break; - case PreferencesControllerBase.GLUON_SWATCH: - applicationRootPreferences.put(PreferencesControllerBase.GLUON_SWATCH, getSwatch().name()); - break; - case PreferencesControllerBase.GLUON_THEME: - applicationRootPreferences.put(PreferencesControllerBase.GLUON_THEME, getGluonTheme().name()); - break; default: assert false; break; diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/preview/PreviewWindowController.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/preview/PreviewWindowController.java index b1933846e..26cc14f9c 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/preview/PreviewWindowController.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/preview/PreviewWindowController.java @@ -35,7 +35,6 @@ import com.oracle.javafx.scenebuilder.kit.editor.EditorController; import com.oracle.javafx.scenebuilder.kit.editor.EditorController.Size; import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform; -import com.oracle.javafx.scenebuilder.kit.editor.EditorPlatform.Theme; import com.oracle.javafx.scenebuilder.kit.editor.panel.util.AbstractWindowController; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument; import com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.FXOMDocumentSwitch; @@ -47,7 +46,6 @@ import java.net.MalformedURLException; import java.util.ArrayList; import java.util.List; -import java.util.ResourceBundle; import java.util.Timer; import java.util.TimerTask; @@ -86,8 +84,6 @@ public final class PreviewWindowController extends AbstractWindowController { private boolean autoResize3DContent = true; private static final String NID_PREVIEW_ROOT = "previewRoot"; //NOI18N private EditorPlatform.Theme editorControllerTheme; - private EditorPlatform.GluonTheme editorControllerGluonTheme; - private EditorPlatform.GluonSwatch editorControllerGluonSwatch; private ObservableList sceneStyleSheet; private Size currentSize = Size.SIZE_PREFERRED; private boolean sizeChangedFromMenu = false; @@ -114,18 +110,18 @@ public PreviewWindowController(EditorController editorController, Stage owner) { super(owner); this.editorController = editorController; this.editorController.fxomDocumentProperty().addListener( - (ChangeListener) (ov, od, nd) -> { - assert editorController.getFxomDocument() == nd; - if (od != null) { - od.sceneGraphRevisionProperty().removeListener(fxomDocumentRevisionListener); - od.cssRevisionProperty().removeListener(cssRevisionListener); - } - if (nd != null) { - nd.sceneGraphRevisionProperty().addListener(fxomDocumentRevisionListener); - nd.cssRevisionProperty().addListener(cssRevisionListener); - requestUpdate(DELAYED); - } - }); + (ov, od, nd) -> { + assert editorController.getFxomDocument() == nd; + if (od != null) { + od.sceneGraphRevisionProperty().removeListener(fxomDocumentRevisionListener); + od.cssRevisionProperty().removeListener(cssRevisionListener); + } + if (nd != null) { + nd.sceneGraphRevisionProperty().addListener(fxomDocumentRevisionListener); + nd.cssRevisionProperty().addListener(cssRevisionListener); + requestUpdate(DELAYED); + } + }); if (editorController.getFxomDocument() != null) { editorController.getFxomDocument().sceneGraphRevisionProperty().addListener(fxomDocumentRevisionListener); @@ -133,39 +129,23 @@ public PreviewWindowController(EditorController editorController, Stage owner) { } this.editorControllerTheme = editorController.getTheme(); - this.editorController.themeProperty().addListener((ChangeListener) (ov, t, t1) -> { + this.editorController.themeProperty().addListener((ov, t, t1) -> { if (t1 != null) { editorControllerTheme = t1; requestUpdate(DELAYED); } }); - this.editorControllerGluonSwatch = editorController.getGluonSwatch(); - this.editorController.gluonSwatchProperty().addListener(((observable, oldValue, newValue) -> { - if (newValue != null) { - editorControllerGluonSwatch = newValue; - requestUpdate(DELAYED); - } - })); - - this.editorControllerGluonTheme = editorController.getGluonTheme(); - this.editorController.gluonThemeProperty().addListener(((observable, oldValue, newValue) -> { - if (newValue != null) { - editorControllerGluonTheme = newValue; - requestUpdate(DELAYED); - } - })); - this.sceneStyleSheet = editorController.getSceneStyleSheets(); - this.editorController.sceneStyleSheetProperty().addListener((ChangeListener>) (ov, t, t1) -> { + this.editorController.sceneStyleSheetProperty().addListener((ov, t, t1) -> { if (t1 != null) { sceneStyleSheet = t1; requestUpdate(DELAYED); } }); - this.editorController.resourcesProperty().addListener((ChangeListener) (ov, t, t1) -> requestUpdate(DELAYED)); - this.editorController.sampleDataEnabledProperty().addListener((ChangeListener) (ov, t, t1) -> requestUpdate(DELAYED)); + this.editorController.resourcesProperty().addListener((ov, t, t1) -> requestUpdate(DELAYED)); + this.editorController.sampleDataEnabledProperty().addListener((ov, t, t1) -> requestUpdate(DELAYED)); } /* @@ -273,7 +253,7 @@ public void run() { // => we must wrap the code into a Runnable object and call the Platform.runLater Platform.runLater(() -> { final FXOMDocument fxomDocument = editorController.getFxomDocument(); - List themeStyleSheetsString = null; + List themeStyleSheetsList = null; if (fxomDocument != null) { // We clone the FXOMDocument FXOMDocument clone; @@ -290,7 +270,8 @@ public void run() { } Object sceneGraphRoot = clone.getDisplayNodeOrSceneGraphRoot(); - themeStyleSheetsString = editorControllerTheme.getStylesheetURLs(); + themeStyleSheetsList = new ArrayList<>(EditorPlatform.getStylesheetsForTheme(editorController.getTheme())); + themeStyleSheetsList.addAll(editorControllerTheme.getStylesheetURLs()); if (sceneGraphRoot instanceof Parent) { ((Parent) sceneGraphRoot).setId(NID_PREVIEW_ROOT); @@ -341,35 +322,11 @@ public void run() { } getScene().setRoot(getRoot()); - if (themeStyleSheetsString != null) { - String gluonDocumentStylesheet = EditorPlatform.getGluonDocumentStylesheetURL(); - String gluonSwatchStylesheet = editorControllerGluonSwatch.getStylesheetURLs().getFirst(); - String gluonThemeStylesheet = editorControllerGluonTheme.getStylesheetURLs().getFirst(); - if (editorControllerTheme == Theme.GLUON_MOBILE_LIGHT || editorControllerTheme == Theme.GLUON_MOBILE_DARK) { - ObservableList newStylesheets = FXCollections.observableArrayList(getScene().getStylesheets()); - themeStyleSheetsString.forEach(themeStyleSheetString -> { - if (!newStylesheets.contains(themeStyleSheetString)) { - newStylesheets.add(themeStyleSheetString); - } - }); - if (!newStylesheets.contains(gluonDocumentStylesheet)) { - newStylesheets.add(gluonDocumentStylesheet); - } - if (!newStylesheets.contains(gluonSwatchStylesheet)) { - newStylesheets.add(gluonSwatchStylesheet); - } - if (!newStylesheets.contains(gluonThemeStylesheet)) { - newStylesheets.add(gluonThemeStylesheet); - } - getScene().setUserAgentStylesheet(Theme.MODENA.getStylesheetURLs().getFirst()); - getScene().getStylesheets().clear(); - getScene().getStylesheets().addAll(newStylesheets); - } else { - getScene().setUserAgentStylesheet(themeStyleSheetsString.getFirst()); - ObservableList newStylesheets = FXCollections.observableArrayList(themeStyleSheetsString); - getScene().getStylesheets().clear(); - getScene().getStylesheets().addAll(newStylesheets); - } + if (themeStyleSheetsList != null) { + getScene().setUserAgentStylesheet(themeStyleSheetsList.getFirst()); + ObservableList newStylesheets = FXCollections.observableArrayList(themeStyleSheetsList); + getScene().getStylesheets().clear(); + getScene().getStylesheets().addAll(newStylesheets); } updateWindowSize(); updateWindowTitle(); diff --git a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/util/CssInternal.java b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/util/CssInternal.java index 8f245a76c..870345a8a 100644 --- a/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/util/CssInternal.java +++ b/kit/src/main/java/com/oracle/javafx/scenebuilder/kit/util/CssInternal.java @@ -152,10 +152,8 @@ public static boolean isThemeClass(Theme theme, String styleClass) { public static List getThemeStyleClasses(Theme theme) { Set themeClasses = new HashSet<>(); theme.getStylesheetURLs().forEach(themeStyleSheet -> { - if (!themeStyleSheet.contains("glisten.css")) { - URL resource = Button.class.getResource("/" + themeStyleSheet); - themeClasses.addAll(getStyleClasses(resource)); - } + URL resource = Button.class.getResource("/" + themeStyleSheet); + themeClasses.addAll(getStyleClasses(resource)); }); return new ArrayList<>(themeClasses); } diff --git a/kit/src/main/java/module-info.java b/kit/src/main/java/module-info.java index 3031a0f18..a6bca64e4 100644 --- a/kit/src/main/java/module-info.java +++ b/kit/src/main/java/module-info.java @@ -37,9 +37,8 @@ requires javafx.swing; requires javafx.media; requires transitive javafx.web; + requires java.logging; - requires com.gluonhq.charm.glisten; - requires com.gluonhq.attach.display; requires static javax.json.api; requires transitive static java.prefs; @@ -58,7 +57,7 @@ requires static plexus.utils; opens com.oracle.javafx.scenebuilder.kit to javafx.fxml; - opens com.oracle.javafx.scenebuilder.kit.alert to javafx.fxml; + opens com.oracle.javafx.scenebuilder.kit.alert; opens com.oracle.javafx.scenebuilder.kit.css; opens com.oracle.javafx.scenebuilder.kit.editor; opens com.oracle.javafx.scenebuilder.kit.editor.drag to javafx.fxml; @@ -120,7 +119,7 @@ opens com.oracle.javafx.scenebuilder.kit.library to javafx.fxml; opens com.oracle.javafx.scenebuilder.kit.library.user to javafx.fxml; opens com.oracle.javafx.scenebuilder.kit.library.util to javafx.fxml; - opens com.oracle.javafx.scenebuilder.kit.metadata to javafx.fxml; + opens com.oracle.javafx.scenebuilder.kit.metadata; opens com.oracle.javafx.scenebuilder.kit.metadata.klass to javafx.fxml; opens com.oracle.javafx.scenebuilder.kit.metadata.property to javafx.fxml; opens com.oracle.javafx.scenebuilder.kit.metadata.property.value to javafx.fxml; @@ -141,6 +140,10 @@ opens com.oracle.javafx.scenebuilder.kit.util.eventnames to javafx.fxml; provides com.oracle.javafx.scenebuilder.kit.i18n.spi.I18NResourcesProvider with com.oracle.javafx.scenebuilder.kit.i18n.spi.I18NResourcesProviderImpl; + uses com.oracle.javafx.scenebuilder.kit.editor.ExternalThemeProvider; + uses com.oracle.javafx.scenebuilder.kit.library.ExternalSectionProvider; + uses com.oracle.javafx.scenebuilder.kit.metadata.ExternalMetadataProvider; + uses com.oracle.javafx.scenebuilder.kit.metadata.util.ExternalDesignHierarchyMaskProvider; exports com.oracle.javafx.scenebuilder.kit; exports com.oracle.javafx.scenebuilder.kit.alert; diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/i18n/SceneBuilderKit.properties b/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/i18n/SceneBuilderKit.properties index 10f3c73ff..f80e38b36 100644 --- a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/i18n/SceneBuilderKit.properties +++ b/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/i18n/SceneBuilderKit.properties @@ -93,7 +93,7 @@ library.panel.menu.view.sections = View as Sections # ----------------------------------------------------------------------------- # Hierarchy Panel # ----------------------------------------------------------------------------- -hierarchy.placeholder.insert = insert +hierarchy.placeholder.insert = insert {0} hierarchy.placeholder.insert.graphic = insert graphic hierarchy.column.header.classname = Class Name hierarchy.column.header.info = Info @@ -495,19 +495,6 @@ job.toggle.fx.root = Toggle fx:root job.set.fxid = Set fx:id to ''{0}'' job.remove.fxid = Remove fx:id ''{0}'' -################ Alert when Gluon Mobile theme is not set -alert.theme.gluon.mobile.title = Scene Builder -alert.theme.gluon.mobile.headertext = Gluon Mobile theme is not set -alert.theme.gluon.mobile.contenttext = If Gluon Mobile theme is not set and you are using Gluon controls, they may not work correctly. -alert.theme.gluon.mobile.setgluontheme = Set Gluon theme -alert.theme.gluon.mobile.ignore = Ignore - -################ Alert when importing Gluon controls -alert.importing.gluon.title = Scene Builder -alert.importing.gluon.headertext = You're importing Gluon controls -alert.importing.gluon.contenttext = These controls won't be imported because this version of Scene Builder already provides Gluon controls. -alert.importing.gluon.ok.button = OK - ################ Scene Builder theme prefs.tool.theme.default = Default Theme prefs.tool.theme.dark = Dark Theme @@ -550,8 +537,6 @@ alert.open.failure.charset.not.found.details = It may be due to the encoding in # Themes (from app i18n) # ----------------------------------------------------------------------------- # Document themes -title.theme.gluon_mobile_dark = Gluon Mobile Dark -title.theme.gluon_mobile_light = Gluon Mobile Light title.theme.modena = Modena (FX8) title.theme.modena_touch = Modena Touch (FX8) title.theme.modena_high_contrast_black_on_white = Modena High Contrast - Black on White (FX8) @@ -566,26 +551,3 @@ title.theme.caspian_embedded_qvga = Caspian Embedded QVGA (FX2) title.theme.caspian_high_contrast = Caspian High Contrast (FX2) title.theme.caspian_embedded_high_contrast = Caspian Embedded High Contrast (FX2) title.theme.caspian_embedded_qvga_high_contrast = Caspian Embedded QVGA High Contrast (FX2) -# Gluon Swatches -title.gluon.swatch.blue = Blue Swatch -title.gluon.swatch.cyan = Cyan Swatch -title.gluon.swatch.deep_orange = Deep Orange Swatch -title.gluon.swatch.deep_purple = Deep Purple Swatch -title.gluon.swatch.green = Green Swatch -title.gluon.swatch.indigo = Indigo Swatch -title.gluon.swatch.light_blue = Light Blue Swatch -title.gluon.swatch.pink = Pink Swatch -title.gluon.swatch.purple = Purple Swatch -title.gluon.swatch.red = Red Swatch -title.gluon.swatch.teal = Teal Swatch -title.gluon.swatch.light_green = Light Green Swatch -title.gluon.swatch.lime = Lime Swatch -title.gluon.swatch.yellow = Yellow Swatch -title.gluon.swatch.amber = Amber Swatch -title.gluon.swatch.orange = Orange Swatch -title.gluon.swatch.brown = Brown Swatch -title.gluon.swatch.grey = Grey Swatch -title.gluon.swatch.blue_grey = Blue Grey Swatch -# Gluon Themes -title.gluon.theme.light = Light Theme -title.gluon.theme.dark = Dark Theme diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/i18n/SceneBuilderKit_ja.properties b/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/i18n/SceneBuilderKit_ja.properties index 7d69687cc..e8721bde7 100644 --- a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/i18n/SceneBuilderKit_ja.properties +++ b/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/i18n/SceneBuilderKit_ja.properties @@ -93,7 +93,7 @@ library.panel.menu.view.sections = セクションの表示 # ----------------------------------------------------------------------------- # Hierarchy Panel # ----------------------------------------------------------------------------- -hierarchy.placeholder.insert = 挿入 +hierarchy.placeholder.insert = 挿入 {0} hierarchy.placeholder.insert.graphic = グラフィックの挿入 hierarchy.column.header.classname = クラス名 hierarchy.column.header.info = 情報 @@ -495,19 +495,6 @@ job.toggle.fx.root = fx:rootをトグル job.set.fxid = fx:idを''{0}''に設定 job.remove.fxid = fx:id ''{0}''の削除 -################ Alert when Gluon Mobile theme is not set -alert.theme.gluon.mobile.title = Scene Builder -alert.theme.gluon.mobile.headertext = Gluon Mobileテーマは設定されていません -alert.theme.gluon.mobile.contenttext = Gluon Mobileテーマを設定せずにGluonコントロールを使うと、正しく動作しないことがあります -alert.theme.gluon.mobile.setgluontheme = Gluonテーマの設定 -alert.theme.gluon.mobile.ignore = 無視 - -################ Alert when importing Gluon controls -alert.importing.gluon.title = Scene Builder -alert.importing.gluon.headertext = Gluonコントロールをインポートしています -alert.importing.gluon.contenttext = このバージョンのScene BuilderではGluonコントロールが既に提供されているため、これらのコントロールはインポートされません -alert.importing.gluon.ok.button = OK - ################ Scene Builder theme prefs.tool.theme.default = デフォルトのテーマ prefs.tool.theme.dark = Dark Theme @@ -550,8 +537,6 @@ alert.open.failure.charset.not.found.details = ドキュメントのエンコー # Themes (from app i18n) # ----------------------------------------------------------------------------- # Document themes -title.theme.gluon_mobile_dark = Gluon Mobile Dark -title.theme.gluon_mobile_light = Gluon Mobile Light title.theme.modena = Modena (FX8) title.theme.modena_touch = Modena Touch (FX8) title.theme.modena_high_contrast_black_on_white = Modena高コントラスト - 白地に黒 (FX8) @@ -566,26 +551,3 @@ title.theme.caspian_embedded_qvga = Caspian Embedded QVGA (FX2) title.theme.caspian_high_contrast = Caspian高コントラスト (FX2) title.theme.caspian_embedded_high_contrast = Caspian Embedded高コントラスト (FX2) title.theme.caspian_embedded_qvga_high_contrast = Caspian Embedded QVGA高コントラスト (FX2) -# Gluon Swatches -title.gluon.swatch.blue = Blue Swatch -title.gluon.swatch.cyan = Cyan Swatch -title.gluon.swatch.deep_orange = Deep Orange Swatch -title.gluon.swatch.deep_purple = Deep Purple Swatch -title.gluon.swatch.green = Green Swatch -title.gluon.swatch.indigo = Indigo Swatch -title.gluon.swatch.light_blue = Light Blue Swatch -title.gluon.swatch.pink = Pink Swatch -title.gluon.swatch.purple = Purple Swatch -title.gluon.swatch.red = Red Swatch -title.gluon.swatch.teal = Teal Swatch -title.gluon.swatch.light_green = Light Green Swatch -title.gluon.swatch.lime = Lime Swatch -title.gluon.swatch.yellow = Yellow Swatch -title.gluon.swatch.amber = Amber Swatch -title.gluon.swatch.orange = Orange Swatch -title.gluon.swatch.brown = Brown Swatch -title.gluon.swatch.grey = Grey Swatch -title.gluon.swatch.blue_grey = Blue Grey Swatch -# Gluon Themes -title.gluon.theme.light = Light Theme -title.gluon.theme.dark = Dark Theme diff --git a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/i18n/SceneBuilderKit_zh_CN.properties b/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/i18n/SceneBuilderKit_zh_CN.properties index b09a2251d..804b01de7 100644 --- a/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/i18n/SceneBuilderKit_zh_CN.properties +++ b/kit/src/main/resources/com/oracle/javafx/scenebuilder/kit/i18n/SceneBuilderKit_zh_CN.properties @@ -495,19 +495,6 @@ job.toggle.fx.root = 切换 fx:root job.set.fxid = 设置 fx:id 为 ''{0}'' job.remove.fxid = 移除 fx:id ''{0}'' -################ Alert when Gluon Mobile theme is not set -alert.theme.gluon.mobile.title = Scene Builder -alert.theme.gluon.mobile.headertext = Gluon Mobile 主题未设置 -alert.theme.gluon.mobile.contenttext = 如果未设置 Gluon Mobile 主题并且您正在使用 Gluon 控件,它们可能无法正常工作。 -alert.theme.gluon.mobile.setgluontheme = 设置 Gluon 主题 -alert.theme.gluon.mobile.ignore = 忽略 - -################ Alert when importing Gluon controls -alert.importing.gluon.title = Scene Builder -alert.importing.gluon.headertext = 您正在导入 Gluon 控件 -alert.importing.gluon.contenttext = 不会导入这些控件,因为此版本的场景生成器已提供 Gluon 控件。 -alert.importing.gluon.ok.button = 确定 - ################ Scene Builder theme prefs.tool.theme.default = 默认主题 prefs.tool.theme.dark = 暗色主题 @@ -550,8 +537,6 @@ alert.open.failure.charset.not.found.details = 这可能是由于您文档中的 # Themes (from app i18n) # ----------------------------------------------------------------------------- # Document themes -title.theme.gluon_mobile_dark = Gluon 手机暗色主题 -title.theme.gluon_mobile_light = Gluon 手机浅色主题 title.theme.modena = Modena 主题 (FX8) title.theme.modena_touch = Modena 触摸板主题 (FX8) title.theme.modena_high_contrast_black_on_white = Modena 高对比度 - 黑底白字 主题 (FX8) @@ -566,26 +551,3 @@ title.theme.caspian_embedded_qvga = Caspian 嵌入式 QVGA 主题(FX2) title.theme.caspian_high_contrast = Caspian 高对比度主题 (FX2) title.theme.caspian_embedded_high_contrast = Caspian 嵌入式高对比度主题 (FX2) title.theme.caspian_embedded_qvga_high_contrast = Caspian 嵌入式 QVGA 高对比度主题 (FX2) -# Gluon Swatches -title.gluon.swatch.blue = 蓝色 -title.gluon.swatch.cyan = 青色 -title.gluon.swatch.deep_orange = 深橙色 -title.gluon.swatch.deep_purple = 深紫色 -title.gluon.swatch.green = 绿色 -title.gluon.swatch.indigo = 靛蓝色 -title.gluon.swatch.light_blue = 浅蓝色 -title.gluon.swatch.pink = 粉色 -title.gluon.swatch.purple = 紫色 -title.gluon.swatch.red = 红色 -title.gluon.swatch.teal = 蓝绿色 -title.gluon.swatch.light_green = 浅绿色 -title.gluon.swatch.lime = 青柠色 -title.gluon.swatch.yellow = 黄色 -title.gluon.swatch.amber = 琥珀色 -title.gluon.swatch.orange = 橙色 -title.gluon.swatch.brown = 棕色 -title.gluon.swatch.grey = 灰色 -title.gluon.swatch.blue_grey = 蓝灰色 -# Gluon Themes -title.gluon.theme.light = 浅色主题 -title.gluon.theme.dark = 暗色主题 diff --git a/kit/src/test/java/com/oracle/javafx/scenebuilder/kit/editor/DocumentationUrlsTest.java b/kit/src/test/java/com/oracle/javafx/scenebuilder/kit/editor/DocumentationUrlsTest.java index 4ab4eceb7..01e4f241c 100644 --- a/kit/src/test/java/com/oracle/javafx/scenebuilder/kit/editor/DocumentationUrlsTest.java +++ b/kit/src/test/java/com/oracle/javafx/scenebuilder/kit/editor/DocumentationUrlsTest.java @@ -60,15 +60,9 @@ public void that_platform_documentation_url_matches_configuration() { DocumentationUrls.ORACLE_DOCUMENTATION.toString()); } - @Test - public void that_platform_gluon_javadoc_url_matches_configuration() { - assertEquals("https://docs.gluonhq.com/charm/javadoc/latest/", - DocumentationUrls.GLUON_JAVADOC_HOME.toString()); - } - @Test public void that_platform_javadoc_url_matches_configuration() { - assertEquals("https://openjfx.io/javadoc/11/", + assertEquals("https://openjfx.io/javadoc/23/", DocumentationUrls.JAVADOC_HOME.toString()); } diff --git a/pom.xml b/pom.xml index 86e1e6087..03fdbfcd9 100644 --- a/pom.xml +++ b/pom.xml @@ -13,6 +13,7 @@ kit app + gluon-plugin @@ -121,7 +122,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.1.2 + 3.5.0 checkstyle.xml UTF-8 @@ -133,7 +134,7 @@ com.puppycrawl.tools checkstyle - 8.45.1 + 10.18.2 @@ -421,7 +422,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.1.2 + 3.5.0