Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enable Scene Builder to load FXML with unresolved imports (#120, #281, #733) #576

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
85723a2
fix: Allows Scene Builder conditionally to load FXML files with
Oliver-Loeffler Oct 2, 2022
6d11253
Renamed the preference 'keep unresolved imports' into 'allow loading …
Oliver-Loeffler Oct 3, 2022
c5880b4
Merged with Scene Builder baseline.
Oliver-Loeffler Oct 3, 2022
acf8460
Merge branch 'gluonhq:master' into issue-120
Oliver-Loeffler Nov 1, 2022
ca92d54
Merge branch 'gluonhq:master' into issue-120
Oliver-Loeffler Apr 6, 2023
1d60439
Merge branch 'gluonhq:master' into issue-120
Oliver-Loeffler Mar 18, 2024
d3f473f
Merge branch 'gluonhq:master' into issue-120
Oliver-Loeffler Mar 27, 2024
d04fef7
Merge branch 'gluonhq:master' into issue-120
Oliver-Loeffler Apr 2, 2024
cbdfd05
Added test to proof that FXOMDocument can load files despite having u…
Oliver-Loeffler Apr 3, 2024
0e05916
Added failing test for FXOMSaver.
Oliver-Loeffler Apr 3, 2024
09ed1d0
Opening, Saving and Save as are working. Also basic editing such as d…
Oliver-Loeffler Apr 4, 2024
fe33457
Editing incl. component browsing works as intended.
Oliver-Loeffler Apr 4, 2024
efe34c4
Added content to the FXOMSaverTest.
Oliver-Loeffler Apr 4, 2024
c05ceb6
Updated license header.
Oliver-Loeffler Apr 4, 2024
1a56caa
Increased log level from FINE to INFO so that file open actions can b…
Oliver-Loeffler Apr 4, 2024
076ea9d
Reworked FXOMRefresher to avoid the detection of unknown imports via …
Oliver-Loeffler Apr 4, 2024
515a84e
Added failing test.
Oliver-Loeffler Apr 4, 2024
908b838
Removed log statements.
Oliver-Loeffler Apr 9, 2024
c74849f
Added missing break statement in switch expression. Formatting.
Oliver-Loeffler Apr 9, 2024
1de1e31
Updated year in header
Oliver-Loeffler Apr 9, 2024
a814fc9
Formatting and license header.
Oliver-Loeffler Apr 9, 2024
2f52ccb
Updated license header.
Oliver-Loeffler Apr 9, 2024
edd76d9
Updated license header.
Oliver-Loeffler Apr 9, 2024
095dc11
Added test for FXOMImportsRemover and replacement/removal mechanism.
Oliver-Loeffler Apr 10, 2024
346a493
Formatting.
Oliver-Loeffler Apr 10, 2024
528b765
Simplified FXOMSaver handling of unresolvable imports.
Oliver-Loeffler Apr 10, 2024
953de94
Removed modification of GlueInstruction (toString()).
Oliver-Loeffler Apr 10, 2024
e599bb4
Updated expectations/asserts of wildcard import test for FXOMSaver.
Oliver-Loeffler Apr 10, 2024
93089b9
Formatting.
Oliver-Loeffler Apr 10, 2024
5847ac1
Organized imports.
Oliver-Loeffler Apr 10, 2024
19028d6
Complex condition moved into separate method.
Oliver-Loeffler Apr 10, 2024
7621fb6
Extracted error handling logic into separate methods.
Oliver-Loeffler Apr 10, 2024
d9dd99a
Added user notifiction in app to indicate missing types / unresolvabl…
Oliver-Loeffler Apr 11, 2024
4a7f937
Reworked dialog title to show file name.
Oliver-Loeffler Apr 11, 2024
0c5b3ef
Formatting
Oliver-Loeffler Apr 11, 2024
ac79601
Corrected typo.
Oliver-Loeffler Apr 11, 2024
8e18795
The missing types notification is now shown per editor window, not as…
Oliver-Loeffler Apr 11, 2024
690765d
Merge branch 'gluonhq:master' into issue-120
Oliver-Loeffler Aug 26, 2024
55f95ab
Merge branch 'gluonhq:master' into issue-120
Oliver-Loeffler Sep 29, 2024
cb6e16e
Updated Surefire version to eliminate JPMS related errors during test.
Oliver-Loeffler Sep 29, 2024
eed9eb8
Merge branch 'master' into issue-120
Oliver-Loeffler Oct 1, 2024
73dddef
Removed duplicate logger instance.
Oliver-Loeffler Oct 1, 2024
a4723e9
Added missing dialog title.
Oliver-Loeffler Oct 1, 2024
2cdcd66
Merge branch 'gluonhq:master' into issue-120
Oliver-Loeffler Oct 2, 2024
00566d5
Merge branch 'gluonhq:master' into issue-120
Oliver-Loeffler Oct 2, 2024
ae88732
Merge branch 'gluonhq:master' into issue-120
Oliver-Loeffler Oct 3, 2024
8094085
Merge branch 'master' into issue-120
jperedadnr Oct 30, 2024
2cbaffc
Merge branch 'gluonhq:master' into issue-120
Oliver-Loeffler Nov 10, 2024
d2114ce
Merge branch 'gluonhq:master' into issue-120
Oliver-Loeffler Dec 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import com.oracle.javafx.scenebuilder.kit.editor.selection.AbstractSelectionGroup;
import com.oracle.javafx.scenebuilder.kit.editor.selection.ObjectSelectionGroup;
import com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument;
import com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.FXOMDocumentSwitch;
import com.oracle.javafx.scenebuilder.kit.fxom.FXOMNodes;
import com.oracle.javafx.scenebuilder.kit.fxom.FXOMObject;
import com.oracle.javafx.scenebuilder.kit.library.Library;
Expand Down Expand Up @@ -98,6 +99,7 @@
import java.util.Optional;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;

import javafx.beans.InvalidationListener;
import javafx.beans.binding.Bindings;
Expand Down Expand Up @@ -125,6 +127,7 @@
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import javafx.stage.FileChooser.ExtensionFilter;
import javafx.stage.Window;
import javafx.stage.WindowEvent;
Expand Down Expand Up @@ -402,7 +405,11 @@ public SplitController getDocumentSplitController() {
public void loadFromFile(File fxmlFile) throws IOException {
final URL fxmlURL = fxmlFile.toURI().toURL();
final String fxmlText = FXOMDocument.readContentFromURL(fxmlURL);
editorController.setFxmlTextAndLocation(fxmlText, fxmlURL, false);

FXOMDocumentSwitch[] options = FXOMDocumentSwitch.PRESERVE_UNRESOLVED_IMPORTS
.fromToggle(getPreferencesRecordGlobal().isPreserveUnresolvedImports());

editorController.setFxmlTextAndLocation(fxmlText, fxmlURL, false, options);
updateLoadFileTime();
updateStageTitle(); // No-op if fxml has not been loaded yet
updateFromDocumentPreferences(true);
Expand Down Expand Up @@ -2355,6 +2362,37 @@ private PreferencesRecordGlobal getPreferencesRecordGlobal() {
}
return recordGlobal;
}

public void showMissingTypesNotificationIfNeeded(File fxmlFile) {
FXOMDocument doc = getEditorController().getFxomDocument();
if (doc.hasUnresolvableTypes()) {
notifyUserAboutUnresolvableImports(fxmlFile, doc.getUnresolvableTypes(), getStage());
}
}

private void notifyUserAboutUnresolvableImports(File fxmlFile, List<String> missingTypes, Stage owner) {
LOGGER.log(Level.WARNING, "Detected unresolved types in FXML: {0}: {1}",
new Object[] {fxmlFile, missingTypes.stream().collect(Collectors.joining(","))});

final ErrorDialog errorDialog = new ErrorDialog(owner);
String first10 = missingTypes.stream()
.limit(10)
.collect(Collectors.joining(";"+System.lineSeparator()));

errorDialog.setMessage(I18N.getString("alert.open.failure.unresolved.imports",
Integer.toString(missingTypes.size())));
errorDialog.setDetails(I18N.getString("alert.open.failure.unresolved.imports.details", first10));
errorDialog.setDetailsTitle(I18N.getString("alert.open.failure.unresolved.imports",
Integer.toString(missingTypes.size())));

String allMissing = missingTypes.stream()
.collect(Collectors.joining(";"+System.lineSeparator()));

errorDialog.setDebugInfo(I18N.getString("alert.open.failure.unresolved.imports.advice",
allMissing, missingTypes.size()));
errorDialog.setTitle(I18N.getString("alert.title.open") + ": " + fxmlFile.getName());
errorDialog.showAndWait();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: add a button to the dialog with an Open FXML/JAR Manager option, so the user can add the missing dependency.

}
}

///**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,8 @@ public void handleOpenFilesAction(List<String> files, Runnable onSuccess) {
EditorController.updateNextInitialDirectory(fileObjs.get(0));

Consumer<Map<File, Exception>> onError = errors -> showFileOpenErrors(errors,
() -> WelcomeDialogWindowController.getInstance().getStage());
() -> WelcomeDialogWindowController.getInstance()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid formatting changes if these are not needed for this PR?

.getStage());

// Fix for #45
if (userLibrary.isFirstExplorationCompleted()) {
Expand Down Expand Up @@ -715,10 +716,14 @@ public DocumentWindowController getFrontDocumentWindow() {
}

private void performOpenFiles(List<File> fxmlFiles) {
performOpenFiles(fxmlFiles, r -> showFileOpenErrors(r, getOwnerWindow()), () -> { /* no action here */ } );
performOpenFiles(fxmlFiles,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid formatting changes if these are not needed for this PR?

r -> showFileOpenErrors(r, getOwnerWindow()),
() -> { /* no action here */ } );
}

private void performOpenFiles(List<File> fxmlFiles, Consumer<Map<File, Exception>> onError, Runnable onSuccess) {
private void performOpenFiles(List<File> fxmlFiles,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid formatting changes if these are not needed for this PR?

Consumer<Map<File, Exception>> onError,
Runnable onSuccess) {
assert fxmlFiles != null;
assert fxmlFiles.isEmpty() == false;

Expand All @@ -740,6 +745,7 @@ private void performOpenFiles(List<File> fxmlFiles, Consumer<Map<File, Exception
hostWindow.openWindow();
openedFiles.add(fxmlFile);
LOGGER.log(Level.INFO, "Successfully opened file {0}", fxmlFile);
hostWindow.showMissingTypesNotificationIfNeeded(fxmlFile);
}
} catch (Exception xx) {
LOGGER.log(Level.WARNING, "Failed to open file: %s".formatted(fxmlFile), xx);
Expand All @@ -752,7 +758,7 @@ private void performOpenFiles(List<File> fxmlFiles, Consumer<Map<File, Exception
final PreferencesController pc = PreferencesController.getSingleton();
pc.getRecordGlobal().addRecentItems(openedFiles);
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove added blank characters (tabs or spaces)

if (exceptionsPerFile.isEmpty()) {
LOGGER.log(Level.FINE, "Successfully opened all files.");
onSuccess.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ 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 boolean DEFAULT_PRESERVE_UNRESOLVED_IMPORTS = true;

static final EditorPlatform.Theme DEFAULT_GLUON_SWATCH = GluonEditorPlatform.DEFAULT_GLUON_SWATCH;
static final EditorPlatform.Theme DEFAULT_GLUON_THEME = GluonEditorPlatform.DEFAULT_GLUON_THEME;
Expand All @@ -121,6 +122,7 @@ public String toString() {
private int recentItemsSize = DEFAULT_RECENT_ITEMS_SIZE;
private boolean accordionAnimation = DEFAULT_ACCORDION_ANIMATION;
private boolean wildcardImports = DEFAULT_WILDCARD_IMPORTS;
private boolean preserveUnresolvedImports = DEFAULT_PRESERVE_UNRESOLVED_IMPORTS;
private final List<String> recentItems = new ArrayList<>();

private LocalDate showUpdateDialogDate = null;
Expand Down Expand Up @@ -400,6 +402,14 @@ public void setWildcardImports(boolean wildcardImports) {
this.wildcardImports = wildcardImports;
}

public boolean isPreserveUnresolvedImports() {
return this.preserveUnresolvedImports;
}

public void setPreserveUnresolvedImports(boolean preserveUnresolvedImports) {
this.preserveUnresolvedImports = preserveUnresolvedImports;
}

public boolean isAlternateTextInputControlPaste() {
return alternatePasteBehavior;
}
Expand Down Expand Up @@ -501,6 +511,9 @@ public void readFromJavaPreferences() {
// Wildcard imports
setWildcardImports(applicationRootPreferences.getBoolean(WILDCARD_IMPORT, DEFAULT_WILDCARD_IMPORTS));

// Unresolvable Imports
setPreserveUnresolvedImports(applicationRootPreferences.getBoolean(PRESERVE_UNRESOLVED_IMPORTS, DEFAULT_PRESERVE_UNRESOLVED_IMPORTS));

// Alternate paste behavior for Text Input Controls
setAlternateTextInputControlPaste(applicationRootPreferences.getBoolean(ALTERNATE_TEXT_INPUT_PASTE, DEFAULT_ALTERNATE_TEXT_INPUT_PASTE));
}
Expand Down Expand Up @@ -578,6 +591,9 @@ public void writeToJavaPreferences(String key) {
case ALTERNATE_TEXT_INPUT_PASTE:
applicationRootPreferences.putBoolean(ALTERNATE_TEXT_INPUT_PASTE,isAlternateTextInputControlPaste());
break;
case PRESERVE_UNRESOLVED_IMPORTS:
applicationRootPreferences.putBoolean(PRESERVE_UNRESOLVED_IMPORTS, isPreserveUnresolvedImports());
break;
default:
super.writeToJavaPreferences(key);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.TOOL_THEME;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.WILDCARD_IMPORT;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.ALTERNATE_TEXT_INPUT_PASTE;
import static com.oracle.javafx.scenebuilder.app.preferences.PreferencesController.PRESERVE_UNRESOLVED_IMPORTS;

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;
Expand Down Expand Up @@ -143,6 +144,8 @@ public class PreferencesWindowController extends AbstractFxmlWindowController {
@FXML
private CheckBox wildcardImports;
@FXML
private CheckBox preserveUnresolvedImports;
@FXML
private CheckBox alternatePasteBehavior;
@FXML
private Label alternatePasteBehaviorLabel;
Expand Down Expand Up @@ -265,6 +268,10 @@ protected void controllerDidLoadFxml() {
// Wildcard Imports
wildcardImports.setSelected(recordGlobal.isWildcardImports());
wildcardImports.selectedProperty().addListener(new WildcardImportListener());

// Unresolvable Imports
preserveUnresolvedImports.setSelected(recordGlobal.isPreserveUnresolvedImports());
preserveUnresolvedImports.selectedProperty().addListener(new PreserveUnresolvedImportListener());

if (EditorPlatform.IS_MAC) {
// Alternate paste behavior for Text Input Controls
Expand Down Expand Up @@ -594,6 +601,17 @@ public void changed(ObservableValue<? extends Boolean> observable, Boolean oldVa
}
}

private static class PreserveUnresolvedImportListener implements ChangeListener<Boolean> {

@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
final PreferencesController preferencesController = PreferencesController.getSingleton();
final PreferencesRecordGlobal recordGlobal = preferencesController.getRecordGlobal();
recordGlobal.setPreserveUnresolvedImports(newValue);
recordGlobal.writeToJavaPreferences(PRESERVE_UNRESOLVED_IMPORTS);
}
}

private static class AlternatePasteListener implements ChangeListener<Boolean> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ prefs.cssanalyzer.columns.defaults.last = "Defaults" Column Last
prefs.recent.items = Recent items :
prefs.animate.accordion = Animate Accordion :
prefs.wildcard.import = Use Wildcard Imports :
prefs.preserve.unresolved.import = Load FXML with unresolved imports :
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imports:

prefs.tic.paste.alternate.behavior = Alternative paste behavior for text input :
prefs.tic.paste.alternate.behavior.tooltip = MacOS only: Enables workaround for pasting into text input controls.\nDisable when pasting text is not working as expected.
prefs.reset.default = Reset to Builtin Default Values
Expand Down Expand Up @@ -431,12 +432,15 @@ alert.save.noextension.savewith = Save with '.fxml'
alert.save.noextension.savewithout = Save without '.fxml'
alert.open.failure.charset.not.found = The given charset could not be set.
alert.open.failure.charset.not.found.details = It may be due to the encoding in your document.
alert.open.failure.unresolved.imports = Failed to resolve {0} FXML import(s):
alert.open.failure.unresolved.imports.details = Use Show Details to obtain a full list of unresolveable imports:\n\n{0}\n\nScene Builder will open the FXML for editing but the custom content will not be rendered correctly.\n\nUnresolved UI elements will be removed from FXML when the file is saved.\n\nPlease add the missing components to your user library within the JAR/FXML Manager. If individual class files are used, make sure, those are organized in a directory structure matching the package structure.\n\n
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..., make sure those... (remove comma)

alert.open.failure.unresolved.imports.advice = Please add the missing components to your user library within the JAR/FXML Manager.\nIf individual class files are used, make sure, those are organized in a directory structure matching the package structure.\n\n{0}\n\nA total of {1} unresolvable import(s) was found.\n
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..., make sure those... (remove comma)

alert.welcome.file.not.found.question = One or more project files were not found.
alert.welcome.file.not.found.message = If those are located on a removable or network drive, please make sure the drive is connected.\n\n
alert.welcome.file.not.found.title = Project file(s) not found
alert.welcome.file.not.found.okay = Remove From List
alert.welcome.file.not.found.no = OK

# -----------------------------------------------------------------------------
# Log Messages
# -----------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Copyright (c) 2016, 2019, 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.

Expand Down Expand Up @@ -50,7 +50,7 @@
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.shape.Rectangle?>

<GridPane hgap="6.0" maxWidth="1.7976931348623157E308" styleClass="theme-presets" vgap="10.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1">
<GridPane hgap="6.0" maxWidth="1.7976931348623157E308" prefHeight="-Infinity" prefWidth="550.0" styleClass="theme-presets" vgap="10.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label text="%prefs.doc.width" GridPane.columnIndex="0" GridPane.rowIndex="0" />
<DoubleField fx:id="rootContainerWidth" prefWidth="200.0" text="" GridPane.columnIndex="1" GridPane.rowIndex="0" />
Expand Down Expand Up @@ -127,11 +127,11 @@
<Label text="%prefs.wildcard.import" GridPane.columnIndex="0" GridPane.rowIndex="18" />
<CheckBox fx:id="wildcardImports" selected="true" GridPane.columnIndex="1" GridPane.rowIndex="18" />

<Button onAction="#resetToDefaultAction" prefWidth="-1.0" text="%prefs.reset.default" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.rowIndex="21">
<Button onAction="#resetToDefaultAction" prefWidth="-1.0" text="%prefs.reset.default" GridPane.columnSpan="2" GridPane.halignment="CENTER" GridPane.rowIndex="22">
<GridPane.margin>
<Insets top="-10.0" />
</GridPane.margin></Button>
<GridPane fx:id="alternatePasteBehaviorPane" hgap="5.0" vgap="10.0" GridPane.columnSpan="2" GridPane.rowIndex="20">
<GridPane fx:id="alternatePasteBehaviorPane" hgap="5.0" vgap="10.0" GridPane.columnSpan="2" GridPane.rowIndex="21">
<columnConstraints>
<ColumnConstraints halignment="RIGHT" hgrow="ALWAYS" percentWidth="50.0" />
<ColumnConstraints halignment="LEFT" hgrow="ALWAYS" percentWidth="50.0" />
Expand All @@ -157,7 +157,9 @@
</GridPane.margin></Separator>
</children>
</GridPane>
<Separator layoutX="30.0" layoutY="500.0" prefWidth="-1.0" GridPane.columnSpan="2" GridPane.rowIndex="19" />
<Separator layoutX="30.0" layoutY="500.0" prefWidth="-1.0" GridPane.columnSpan="2" GridPane.rowIndex="20" />
<Label text="%prefs.preserve.unresolved.import" GridPane.rowIndex="19" />
<CheckBox fx:id="preserveUnresolvedImports" mnemonicParsing="false" GridPane.columnIndex="1" GridPane.rowIndex="19" />
</children>
<columnConstraints>
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" maxWidth="-Infinity" minWidth="-Infinity" percentWidth="50.0" />
Expand Down Expand Up @@ -189,5 +191,6 @@
<RowConstraints maxHeight="-Infinity" minHeight="-Infinity" vgrow="NEVER" />
<RowConstraints maxHeight="-Infinity" minHeight="-Infinity" vgrow="NEVER" />
<RowConstraints maxHeight="-Infinity" minHeight="-Infinity" vgrow="NEVER" />
<RowConstraints maxHeight="-Infinity" minHeight="-Infinity" vgrow="NEVER" />
</rowConstraints>
</GridPane>
Original file line number Diff line number Diff line change
Expand Up @@ -707,10 +707,11 @@ public void setFxmlTextAndLocation(String fxmlText, URL fxmlLocation) throws IOE
* @param fxmlLocation null or the location of the fxml text being edited
* @param checkTheme if set to true a check will be made if the fxml contains
* Gluon controls and if so, the correct theme is set
* @param switches Optional switches to configure FXOM and FXML processes
* @throws IOException if fxml text cannot be parsed and loaded correctly.
*/
public void setFxmlTextAndLocation(String fxmlText, URL fxmlLocation, boolean checkTheme) throws IOException {
updateFxomDocument(fxmlText, fxmlLocation, getResources(), checkTheme);
public void setFxmlTextAndLocation(String fxmlText, URL fxmlLocation, boolean checkTheme, FXOMDocumentSwitch ... switches) throws IOException {
updateFxomDocument(fxmlText, fxmlLocation, getResources(), checkTheme, switches);
this.fxmlLocationProperty.setValue(fxmlLocation);
}

Expand Down Expand Up @@ -2513,11 +2514,12 @@ private boolean isSelectionControl() {
return true;
}

private void updateFxomDocument(String fxmlText, URL fxmlLocation, ResourceBundle resources, boolean checkTheme) throws IOException {
private void updateFxomDocument(String fxmlText, URL fxmlLocation, ResourceBundle resources, boolean checkTheme, FXOMDocumentSwitch ... switches) throws IOException {
final FXOMDocument newFxomDocument;

if (fxmlText != null) {
newFxomDocument = new FXOMDocument(fxmlText, fxmlLocation, getLibrary().getClassLoader(), resources, FXOMDocumentSwitch.NORMALIZED);
FXOMDocumentSwitch[] options = FXOMDocumentSwitch.combined(switches, FXOMDocumentSwitch.NORMALIZED);
newFxomDocument = new FXOMDocument(fxmlText, fxmlLocation, getLibrary().getClassLoader(), resources, options);
} else {
newFxomDocument = null;
}
Expand Down
Loading