Details
-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
7u15
-
Windows 7 32-Bit
jdk1.7.0_15
Description
IF on an accordion an changelistener is added to the expandedpane property and in his changelistener the layoutX and layoutY Position of the accordion is changed, the unexpanded accordion stays at its old place. If the unexpanded accordion is clicked on again, an other expanded accordion appears and the unexpanded accordion disappears. To unexpand, you have to unexpand both accordions, although there is only one accorion in the java-code.
hbox.getChildren().addAll(pc, bc);
final Accordion ac = new Accordion();
final TitledPane tp = new TitledPane();
tp.setText(cantonTeacherData.getCantonAbbreviation());
tp.setContent(hbox);
tp.setCollapsible(true);
ac.getPanes().add(tp);
hbox.getChildren().remove(0);
hbox.getChildren().remove(0);
ac.setLayoutX(point.getX());
ac.setLayoutY(point.getY());
ac.expandedPaneProperty().addListener(new ChangeListener<TitledPane>() {
@Override
public void changed(ObservableValue<? extends TitledPane> observable, TitledPane oldValue, TitledPane newValue) {
if (newValue != null) {
//adds the elements, so that width of the accordion is fully expanded
hbox.getChildren().addAll(pc, bc);
ac.setLayoutX(0);
ac.setLayoutY(0);
ac.toFront();
} else {
//makes the unexpanded accordions width only the width of the title
hbox.getChildren().remove(0);
hbox.getChildren().remove(0);
ac.setLayoutX(point.getX());
ac.setLayoutY(point.getY());
}
}
});
hbox.getChildren().addAll(pc, bc);
final Accordion ac = new Accordion();
final TitledPane tp = new TitledPane();
tp.setText(cantonTeacherData.getCantonAbbreviation());
tp.setContent(hbox);
tp.setCollapsible(true);
ac.getPanes().add(tp);
hbox.getChildren().remove(0);
hbox.getChildren().remove(0);
ac.setLayoutX(point.getX());
ac.setLayoutY(point.getY());
ac.expandedPaneProperty().addListener(new ChangeListener<TitledPane>() {
@Override
public void changed(ObservableValue<? extends TitledPane> observable, TitledPane oldValue, TitledPane newValue) {
if (newValue != null) {
//adds the elements, so that width of the accordion is fully expanded
hbox.getChildren().addAll(pc, bc);
ac.setLayoutX(0);
ac.setLayoutY(0);
ac.toFront();
} else {
//makes the unexpanded accordions width only the width of the title
hbox.getChildren().remove(0);
hbox.getChildren().remove(0);
ac.setLayoutX(point.getX());
ac.setLayoutY(point.getY());
}
}
});