下面列出了怎么用javafx.scene.control.TitledPane的API类实例代码及写法,或者点击链接到github查看源代码。
public void updateEditorPanel(final AttributeState state) {
if (state != null) {
Platform.runLater(() -> {
clearHeaderTitledPanes();
for (GraphElementType type : state.getGraphElements()) {
double longestTitleWidth = calcLongestTitle(state.getAttributeNames().get(type));
populateContentContainer(state, type, longestTitleWidth);
}
for (int i = 0; i < titledPaneHeadingsContainer.getChildren().size(); i++) {
TitledPane tp = (TitledPane) titledPaneHeadingsContainer.getChildren().get(i);
int count = ((VBox) tp.getContent()).getChildren().size();
final int totalAttrs = state.getAttributeCounts().get(ELEMENT_TYPES[i]);
final String attrCountDisplay = totalAttrs == count ? String.format(HEADING_TITLES[i], totalAttrs, "") : String.format(HEADING_TITLES[i], totalAttrs, String.format(HIDDEN_ATTRIBUTES_INFORMATION, totalAttrs - count));
headingTitleProperties[i].setValue(attrCountDisplay);
if (!state.getActiveGraphElements().isEmpty()) {
tp.setExpanded(state.getActiveGraphElements().contains(ELEMENT_TYPES[i]));
}
}
});
}
}
@Override
public Node getNode(
PageActionManager actionmanager,
CPageData inputdata,
Window parentwindow,
TabPane[] parenttabpanes,
CollapsibleNode nodetocollapsewhenactiontriggered) {
Node payloadnode = payload.getNode(actionmanager, inputdata, parentwindow, parenttabpanes,
(closewheninlineactioninside ? this : null));
collapsiblepane = new TitledPane(this.title, payloadnode);
collapsiblepane.setCollapsible(true);
collapsiblepane.setExpanded(this.openbydefault);
collapsiblepane.setBorder(Border.EMPTY);
collapsiblepane.setAnimated(false);
return collapsiblepane;
}
@Test
public void getText() {
TitledPane titledPane = (TitledPane) getPrimaryStage().getScene().getRoot().lookup(".titled-pane");
LoggingRecorder lr = new LoggingRecorder();
List<String> text = new ArrayList<>();
Platform.runLater(() -> {
RFXTitledPane rfxTitledPane = new RFXTitledPane(titledPane, null, null, lr);
titledPane.setExpanded(true);
rfxTitledPane.mouseButton1Pressed(null);
text.add(rfxTitledPane.getAttribute("text"));
});
new Wait("Waiting for titled pane text.") {
@Override
public boolean until() {
return text.size() > 0;
}
};
AssertJUnit.assertEquals("Node 1", text.get(0));
}
public void bind(final Accordion accordion, final String propertyName) {
Object selectedPane = props.getProperty(propertyName);
for (TitledPane tp : accordion.getPanes()) {
if (tp.getText() != null && tp.getText().equals(selectedPane)) {
accordion.setExpandedPane(tp);
break;
}
}
accordion.expandedPaneProperty().addListener(new ChangeListener<TitledPane>() {
@Override
public void changed(ObservableValue<? extends TitledPane> ov, TitledPane t, TitledPane expandedPane) {
if (expandedPane != null) {
props.setProperty(propertyName, expandedPane.getText());
}
}
});
}
public void createGreenhouses(TitledPane tp, Settlement settlement) {
VBox v = new VBox();
v.setSpacing(10);
v.setPadding(new Insets(0, 20, 10, 20));
List<Building> buildings = settlement.getBuildingManager().getACopyOfBuildings();
Iterator<Building> iter1 = buildings.iterator();
while (iter1.hasNext()) {
Building building = iter1.next();
if (building.hasFunction(FunctionType.FARMING)) {
// try {
Farming farm = (Farming) building.getFunction(FunctionType.FARMING);
Button b = createGreenhouseDialog(farm);
v.getChildren().add(b);
// }
// catch (BuildingException e) {}
}
}
tp.setContent(v);//"1 2 3 4 5..."));
tp.setExpanded(true);
}
private Pane buildCoursePanes() {
final File coursesDirectory = new File(System.getProperty("shootoff.courses"));
final ItemSelectionPane<File> uncategorizedPane = buildCategoryPane(coursesDirectory);
coursePanes.getChildren().add(new TitledPane("Uncategorized Courses", uncategorizedPane));
categoryMap.put(coursesDirectory.getPath(), uncategorizedPane);
final File[] courseFolders = coursesDirectory.listFiles(FOLDER_FILTER);
if (courseFolders != null) {
for (final File courseFolder : courseFolders) {
coursePanes.getChildren().add(new TitledPane(courseFolder.getName().replaceAll("_", "") + " Courses",
buildCategoryPane(courseFolder)));
}
} else {
logger.error("{} does not appear to be a valid course directory", coursesDirectory.getPath());
}
return coursePanes;
}
@Override
public void initialize(URL location, ResourceBundle resources) {
ConnectView connectView = new ConnectView();
InfoView infoView = new InfoView();
AboutView aboutView = new AboutView();
detailPane.setMinWidth(0.0);
detailPane.getPanes().addAll((TitledPane) connectView.getView(), (TitledPane) infoView.getView(), (TitledPane) aboutView.getView());
detailPane.setExpandedPane((TitledPane) connectView.getView());
detailPane.expandedPaneProperty().addListener((observable, oldValue, newValue) -> Platform.runLater(() -> {
if (detailPane.getExpandedPane() == null) {
// keep first view open
detailPane.setExpandedPane(detailPane.getPanes().get(0));
}
}));
}
private VBox settingPanel() {
VBox pane = new VBox();
pane.setAlignment(Pos.TOP_CENTER);
TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"),
prefix);
prefix.addMenuItemFor(Prefix.CURRENTPAGE);
prefix.addMenuItemFor(Prefix.FILENUMBER);
prefix.addMenuItemFor("[TOTAL_FILESNUMBER]");
pane.getChildren().addAll(selectionPane,
Views.titledPane(DefaultI18nContext.getInstance().i18n("Split settings"), splitOptions),
Views.titledPane(DefaultI18nContext.getInstance().i18n("Output settings"), destinationPane),
prefixTitled);
return pane;
}
private VBox settingPanel() {
VBox pane = new VBox();
pane.setAlignment(Pos.TOP_CENTER);
TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"),
prefix);
prefix.addMenuItemFor(Prefix.CURRENTPAGE);
prefix.addMenuItemFor(Prefix.FILENUMBER);
prefix.addMenuItemFor(Prefix.BOOKMARK);
prefix.addMenuItemFor(Prefix.BOOKMARK_STRICT);
prefix.addMenuItemFor("[TOTAL_FILESNUMBER]");
pane.getChildren().addAll(selectionPane,
Views.titledPane(DefaultI18nContext.getInstance().i18n("Split settings"), splitOptions),
Views.titledPane(DefaultI18nContext.getInstance().i18n("Output settings"), destinationPane),
prefixTitled);
return pane;
}
private VBox settingPanel() {
VBox pane = new VBox();
pane.setAlignment(Pos.TOP_CENTER);
TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"),
prefix);
prefix.addMenuItemFor(Prefix.CURRENTPAGE);
prefix.addMenuItemFor(Prefix.FILENUMBER);
prefix.addMenuItemFor("[TOTAL_FILESNUMBER]");
pane.getChildren().addAll(selectionPane,
Views.titledPane(DefaultI18nContext.getInstance().i18n("Split settings"), splitOptions),
Views.titledPane(DefaultI18nContext.getInstance().i18n("Output settings"), destinationPane),
prefixTitled);
return pane;
}
private VBox settingPanel() {
VBox pane = new VBox();
pane.setAlignment(Pos.TOP_CENTER);
VBox.setVgrow(selectionPane, Priority.ALWAYS);
TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"),
prefix);
prefix.addMenuItemFor(Prefix.FILENUMBER);
prefix.addMenuItemFor("[TOTAL_FILESNUMBER]");
TitledPane options = Views.titledPane(DefaultI18nContext.getInstance().i18n("Rotate settings"), rotateOptions);
pane.getChildren().addAll(selectionPane, options,
Views.titledPane(DefaultI18nContext.getInstance().i18n("Output settings"), destinationPane),
prefixTitled);
return pane;
}
private Optional<TitledPane> createPaneFor(URL url) {
return createViewFor(url)
.map(view -> {
view.getStylesheets().add(BundleUtils.getFXMLUrl("css_webview").toExternalForm());
view.setContextMenuEnabled(false);
return view;
})
.map(view -> {
final AnchorPane pane = new AnchorPane();
AnchorPane.setBottomAnchor(view, 0.0);
AnchorPane.setTopAnchor(view, 0.0);
pane.getChildren().add(view);
return pane;
})
.map(contentPane -> {
String fname = Files.getNameWithoutExtension(url.getFile());
final TitledPane titledPane = new TitledPane(fname, contentPane);
titledPane.setAnimated(false);
return titledPane;
});
}
/**
* Display a dialog containing all Rule objects registered with the Quality
* Control View and which matched for a given identifier.
*
* @param owner The owner Node
* @param identifier The identifier of the graph node being displayed.
* @param rules The list of rules measured against this graph node.
*/
private static void showRuleDialog(final Node owner, final String identifier, final List<Pair<Integer, String>> rules) {
final ScrollPane sp = new ScrollPane();
sp.setPrefHeight(512);
sp.setPrefWidth(512);
sp.setFitToWidth(true);
sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
sp.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
final VBox vbox = new VBox();
vbox.prefWidthProperty().bind(sp.widthProperty());
vbox.setPadding(Insets.EMPTY);
for (final Pair<Integer, String> rule : rules) {
final String[] t = rule.getValue().split("§");
final String quality = rule.getKey() == 0 ? Bundle.MSG_NotApplicable() : "" + rule.getKey();
final String title = String.format("%s - %s", quality, t[0]);
final Text content = new Text(t[1]);
content.wrappingWidthProperty().bind(sp.widthProperty().subtract(16)); // Subtract a random number to avoid the vertical scrollbar.
final TitledPane tp = new TitledPane(title, content);
tp.prefWidthProperty().bind(vbox.widthProperty());
tp.setExpanded(false);
tp.setWrapText(true);
vbox.getChildren().add(tp);
}
sp.setContent(vbox);
final Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setHeaderText(String.format(Bundle.MSG_QualtyControlRules(), identifier));
alert.getDialogPane().setContent(sp);
alert.setResizable(true);
alert.show();
}
/**
* multi value pane showing multiple values for an attribute
*
* @param attribute
* @param attributePane
* @param values
*/
private void createMultiValuePane(final AttributeData attribute, final TitledPane attributePane, final Object[] values) {
final VBox dataAndMoreButtonBox = new VBox(5); // 5 = spacing
final ScrollPane multiValuePane = new ScrollPane();
multiValuePane.setFitToWidth(true);
final ObservableList<Object> listData = FXCollections.observableArrayList();
if (values.length > VISIBLE_ROWS) {
for (int i = 0; i < VISIBLE_ROWS; i++) {
listData.add(values[i]);
}
} else {
listData.addAll(values);
}
final ListView<Object> listView = createListView(attribute, listData);
final boolean moreToLoad = values.length > VISIBLE_ROWS;
int visibleRow = moreToLoad ? VISIBLE_ROWS : listData.size();
listView.setPrefHeight((CELL_HEIGHT * visibleRow) + 2); // +2 because if it is == then there is still a scrollbar.
multiValuePane.setPrefHeight((CELL_HEIGHT * visibleRow) + 1);
multiValuePane.setContent(listView);
multiValuePane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
dataAndMoreButtonBox.setAlignment(Pos.CENTER);
dataAndMoreButtonBox.setPadding(new Insets(0, 0, 5, 0));
dataAndMoreButtonBox.getChildren().add(multiValuePane);
if (moreToLoad) {
Button loadMoreButton = createLoadMoreButton(dataAndMoreButtonBox, attribute);
dataAndMoreButtonBox.getChildren().add(loadMoreButton);
}
dataAndMoreButtonBox.addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent event) -> {
if (event.isShortcutDown() && (event.getCode() == KeyCode.A)) {
listView.getSelectionModel().selectAll();
event.consume();
}
});
attributePane.setContent(dataAndMoreButtonBox);
}
public void resetPanel() {
Platform.runLater(() -> {
clearHeaderTitledPanes();
for (Node n : titledPaneHeadingsContainer.getChildren()) {
TitledPane tp = (TitledPane) n;
tp.setExpanded(false);
}
});
}
@Override
public void initialize(URL location, ResourceBundle resources) {
initialiseLanguageChoiceBox();
Platform.runLater(() -> { // Fixes blurry text in the description text area
descriptionArea.setCache(false);
ScrollPane sp = (ScrollPane) descriptionArea.getChildrenUnmodifiable().get(0);
sp.setCache(false);
for (Node n : sp.getChildrenUnmodifiable()) {
n.setCache(false);
}
});
// Expands required info pane
Platform.runLater(() -> infoAccordion.setExpandedPane((TitledPane) infoAccordion.getChildrenUnmodifiable().get(0)));
Platform.runLater(this::registerValidators);
exportResultArea.setSyntaxHighlighter(new XmlSyntaxHighlighter());
exportResultArea.setEditable(false);
ControlUtil.copyToClipboardButton(copyResultButton, exportResultArea::getText);
resetMetadataButton.setOnAction(e -> {
Alert alert = new Alert(AlertType.CONFIRMATION, "Wipe out the rule's metadata?",
ButtonType.YES, ButtonType.CANCEL);
alert.showAndWait();
exportResultArea.setSyntaxHighlighter(new XmlSyntaxHighlighter());
if (alert.getResult() == ButtonType.YES) {
nameProperty().setValue("");
descriptionProperty().setValue("");
messageProperty().setValue("");
priorityProperty().setValue(RulePriority.MEDIUM);
}
});
languageVersionRangeSlider.currentLanguageProperty().bind(this.languageProperty());
Platform.runLater(() -> exportResultArea.moveTo(0));
}
public SVRealNodeAdapter(final Node node, final boolean collapseControls, final boolean collapseContentControls) {
super(ConnectorUtils.nodeClass(node), node.getClass().getName());
this.node = node;
this.collapseControls = collapseControls;
this.collapseContentControls = collapseContentControls;
boolean mustBeExpanded = !(node instanceof Control) || !collapseControls;
if (!mustBeExpanded && !collapseContentControls) {
mustBeExpanded = node instanceof TabPane || node instanceof SplitPane || node instanceof ScrollPane || node instanceof Accordion || node instanceof TitledPane;
}
setExpanded(mustBeExpanded);
}
public SVRemoteNodeAdapter(final Node node, final boolean collapseControls, final boolean collapseContentControls, final boolean fillChildren, final SVRemoteNodeAdapter parent) {
super(ConnectorUtils.nodeClass(node), node.getClass().getName());
boolean mustBeExpanded = !(node instanceof Control) || !collapseControls;
if (!mustBeExpanded && !collapseContentControls) {
mustBeExpanded = node instanceof TabPane || node instanceof SplitPane || node instanceof ScrollPane || node instanceof Accordion || node instanceof TitledPane;
}
setExpanded(mustBeExpanded);
this.id = node.getId();
this.nodeId = ConnectorUtils.getNodeUniqueID(node);
this.focused = node.isFocused();
if (node.getParent() != null && parent == null) {
this.parent = new SVRemoteNodeAdapter(node.getParent(), collapseControls, collapseContentControls, false, null);
} else if (parent != null) {
this.parent = parent;
}
/**
* Check visibility and mouse transparency after calculating the parent
*/
this.mouseTransparent = node.isMouseTransparent() || (this.parent != null && this.parent.isMouseTransparent());
this.visible = node.isVisible() && (this.parent == null || this.parent.isVisible());
/**
* TODO This should be improved
*/
if (fillChildren) {
nodes = ChildrenGetter.getChildren(node)
.stream()
.map(childNode -> new SVRemoteNodeAdapter(childNode, collapseControls, collapseContentControls, true, this))
.collect(Collectors.toList());
}
}
/**
* Creates a control which shows the details of an exception or error to be used as the content of
* a {@link WorkbenchDialog}.
*
* @param message the {@link Node} containing the standard dialog message
* @param details about the error or exception
*/
public DialogErrorContent(Node message, String details) {
this.message = message;
this.details = details;
getStyleClass().add("container");
// add message to the dialog content
getChildren().add(message);
// if details were specified, add them wrapped in a TitledPane
if (!Strings.isNullOrEmpty(details)) {
TextArea textArea = new TextArea();
textArea.setText(details);
textArea.setWrapText(true);
textArea.getStyleClass().add("error-details-text-area");
TitledPane titledPane = new TitledPane();
titledPane.getStyleClass().add("error-details-titled-pane");
titledPane.setText("Details");
titledPane.setContent(textArea);
titledPane.setPrefHeight(300);
getChildren().add(titledPane);
}
}
static VBox defaultPreferencePaneNode(ObjectProperty<Composite<ARGBType, ARGBType>> composite) {
final TitledPane titledPane = SourceStateCompositePane.createTitledPane(composite);
final VBox vbox = new VBox(titledPane);
vbox.setSpacing(0.0);
vbox.setPadding(Insets.EMPTY);
return vbox;
}
@Override
public void initControls() {
try {
super.initControls();
accordionPane.expandedPaneProperty().addListener(new ChangeListener<TitledPane>() {
@Override
public void changed(ObservableValue<? extends TitledPane> v, TitledPane o, TitledPane n) {
if (parent == null || n == null || (myPane != null && myPane.equals(n))) {
return;
}
expandPane(n);
}
});
isPickingColor.addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> ov, Boolean oldVal, Boolean newVal) {
if (imageController == null || imageController.isPickingColor.isBound()) {
return;
}
imageController.isPickingColor.set(newVal);
}
});
} catch (Exception e) {
logger.error(e.toString());
}
}
public AccordionSample() {
super(150,150);
TitledPane t1 = new TitledPane("Node 1", new Button("Button"));
TitledPane t2 = new TitledPane("Node 2", new Text("String"));
TitledPane t3 = new TitledPane("Node 3", new Rectangle(120,50, Color.RED));
Accordion accordion = new Accordion();
accordion.getPanes().add(t1);
accordion.getPanes().add(t2);
accordion.getPanes().add(t3);
getChildren().add(accordion);
}
@Override
public Parent getContentPane() {
BorderPane root = new BorderPane();
root.getStyleClass().add("MarathonFileChooser");
root.setId("marathon-file-chooser");
if (doesAllowChildren) {
if (!fileChooserInfo.isFileCreation()) {
propertiesView = new AddPropertiesView(new TestPropertiesInfo(fileChooserInfo.getFileToSave()));
TitledPane titledPane = new TitledPane("Properties", propertiesView);
centerPane.getChildren().addAll(splitPane, titledPane);
root.setPrefWidth(540);
root.setPrefHeight(580);
} else {
root.setPrefWidth(540);
root.setPrefHeight(380);
centerPane.getChildren().addAll(splitPane);
}
} else {
root.setPrefWidth(540);
root.setPrefHeight(380);
centerPane.getChildren().add(childrenListView);
}
root.setCenter(centerPane);
root.setBottom(buttonBar);
return root;
}
public Node getRoot() {
basicPane = new FormPane("browser-config-basic", 3);
advancedPane = new FormPane("browser-config-advanced", 3);
addBrowserName();
addWebDriverExeBrowse();
addBrowserExeBrowse();
addArguments();
addWdArguments();
addUseCleanSession();
addUseTechnologyPreview();
addVerbose();
addIELogLevel();
addSilent();
addLogFileBrowse();
addEnvironment();
addExtensions();
addPageLoadStrategy();
addUnexpectedAlertBehavior();
addAssumeUntrustedCertificateIssuer();
addAcceptUntrustedCertificates();
addAlwaysLoadNoFocusLib();
addBrowserPreferences();
ScrollPane sp1 = new ScrollPane(basicPane);
sp1.setFitToWidth(true);
TitledPane basicTitledPane = new TitledPane("Basic Settings", sp1);
ScrollPane sp2 = new ScrollPane(advancedPane);
sp2.setFitToWidth(true);
TitledPane advancedTitledPane = new TitledPane("Advanced Settings", sp2);
Accordion accordion = new Accordion(basicTitledPane, advancedTitledPane);
accordion.setExpandedPane(basicTitledPane);
return accordion;
}
public AccordionSample() {
super(150,150);
TitledPane t1 = new TitledPane("Node 1", new Button("Button"));
TitledPane t2 = new TitledPane("Node 2", new Text("String"));
TitledPane t3 = new TitledPane("Node 3", new Rectangle(120,50, Color.RED));
Accordion accordion = new Accordion();
accordion.getPanes().add(t1);
accordion.getPanes().add(t2);
accordion.getPanes().add(t3);
getChildren().add(accordion);
}
@Test
public void click() {
TitledPane titledPane = (TitledPane) getPrimaryStage().getScene().getRoot().lookup(".titled-pane");
LoggingRecorder lr = new LoggingRecorder();
Platform.runLater(() -> {
RFXTitledPane rfxTitledPane = new RFXTitledPane(titledPane, null, null, lr);
titledPane.setExpanded(true);
rfxTitledPane.mouseButton1Pressed(null);
});
List<Recording> recordings = lr.waitAndGetRecordings(1);
Recording recording = recordings.get(0);
AssertJUnit.assertEquals("click", recording.getCall());
}
/** Create a TilePane for each WidgetCategory
* @param parent Parent Pane
* @return Map of panes for each category
*/
private Map<WidgetCategory, Pane> createWidgetCategoryPanes(final Pane parent)
{
final Map<WidgetCategory, Pane> palette_groups = new HashMap<>();
final Set<String> deprecated = Preferences.hidden_widget_types;
for (final WidgetCategory category : WidgetCategory.values())
{
if (!WidgetFactory.getInstance()
.getWidgetDescriptions()
.stream()
.filter(desc -> !deprecated.contains(desc.getType()))
.filter(desc -> desc.getCategory() == category)
.findFirst().isPresent())
continue;
final TilePane palette_group = new TilePane();
palette_group.getStyleClass().add("palette_group");
palette_group.setPrefColumns(1);
palette_group.setMaxWidth(Double.MAX_VALUE);
palette_groups.put(category, palette_group);
palette_group.setHgap(2);
palette_group.setVgap(2);
final TitledPane pane = new TitledPane(category.getDescription(), palette_group);
pane.getStyleClass().add("palette_category");
parent.getChildren().add(pane);
}
return palette_groups;
}
public PluginManagerWidget(PluginManager m, Node graphic){
HBox content = new HBox(20);
content.setPadding(new Insets(0, 20, 10, 20));
this.manager = m;
ArrayList<TitledPane> plugins = manager.getPlugins();
accordion.getPanes().addAll(plugins);
disconnectTHis = new Button("Disconnect "+manager.getName(), AssetFactory.loadIcon("Disconnect-Device.png"));
disconnectTHis.setOnMousePressed( event -> {
new Thread(){
public void run(){
Thread.currentThread().setUncaughtExceptionHandler(new IssueReportingExceptionHandler());
setName("disconnect plugins");
Log.warning("Disconnect button for "+manager.getName()+" pressed");
getManager().getDevice().disconnect();
}
}.start();
});
setGraphic(AssetFactory.loadIcon("Bowler-Device-In-Manager.png"));
deviceName.setOnAction(event -> {
getManager().setName(deviceName.getText());
setText(manager.getName());
disconnectTHis.setText("Disconnect "+manager.getName());
});
Platform.runLater(()->deviceName.setText(manager.getName()));
content.setHgrow(accordion, Priority.ALWAYS);
content.getChildren().addAll(graphic,disconnectTHis,deviceName,accordion);
setContent(content);
setText(manager.getName());
}
public JFXLegendPanel(JFXContainer<? extends Region> parent) {
super(new TitledPane(), parent);
this.getControl().setContent(new Pane());
this.getControl().setCollapsible(false);
this.getControl().setAnimated(false);
this.getContentPane().setFocusTraversable(false);
}
public void bind(final Accordion accordion, final String propertyName) {
Object selectedPane = props.getProperty(propertyName);
for (TitledPane tp : accordion.getPanes()) {
if (tp.getText() != null && tp.getText().equals(selectedPane)) {
accordion.setExpandedPane(tp);
break;
}
}
accordion.expandedPaneProperty().addListener((ov, t, expandedPane) -> {
if (expandedPane != null) {
props.setProperty(propertyName, expandedPane.getText());
}
});
}