Button b = new Button("Toggle Rendering");
b.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
MPart part = dd.getSelectionModel().getSelectedItem();
part.setToBeRendered(!part.isToBeRendered());
}
});
hbox.getChildren().add(b);
vbox.getChildren().add(hbox);
}
{
HBox hbox = new HBox(10);
final ComboBox<MPart> dd = new ComboBox<>();
dd.setCellFactory(new Callback<ListView<MPart>, ListCell<MPart>>() {
@Override
public ListCell<MPart> call(ListView<MPart> param) {
return new ListCell<MPart>() {
@Override
protected void updateItem(MPart item, boolean empty) {
super.updateItem(item, empty);
if( item != null ) {
setText(item.getLocalizedLabel());
}
}
};
}
});
dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MPart.class, null)));
hbox.getChildren().add(dd);
Button b = new Button("Toggle Visibile");
b.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
MPart part = dd.getSelectionModel().getSelectedItem();
part.setVisible(!part.isVisible());
}
});
hbox.getChildren().add(b);
vbox.getChildren().add(hbox);
}
{
HBox hbox = new HBox(10);
final ComboBox<MElementContainer> dd = new ComboBox<>();
dd.setCellFactory(new Callback<ListView<MElementContainer>, ListCell<MElementContainer>>() {
@Override
public ListCell<MElementContainer> call(ListView<MElementContainer> param) {
return new ListCell<MElementContainer>() {
@Override
protected void updateItem(MElementContainer item, boolean empty) {
super.updateItem(item, empty);
if( item != null ) {
setText(item.getClass().getSimpleName());
}
}
};
}
});
dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MElementContainer.class, null)));
hbox.getChildren().add(dd);
Button b = new Button("Add new Part");
b.setOnAction(new EventHandler<ActionEvent>() {
@SuppressWarnings("unchecked")
@Override
public void handle(ActionEvent event) {
MElementContainer container = dd.getSelectionModel().getSelectedItem();
MPart p = BasicFactoryImpl.eINSTANCE.createPart();
p.setLabel("New Part");
p.setContributionURI("bundleclass://at.bestsolution.efxclipse.testcases.e4/at.bestsolution.efxclipse.testcases.e4.parts.ContentPanel");
container.getChildren().add(p);
}
});
hbox.getChildren().add(b);
vbox.getChildren().add(hbox);
}
{
HBox hbox = new HBox(10);
final ComboBox<MElementContainer> dd = new ComboBox<>();
dd.setCellFactory(new Callback<ListView<MElementContainer>, ListCell<MElementContainer>>() {
@Override
public ListCell<MElementContainer> call(ListView<MElementContainer> param) {
return new ListCell<MElementContainer>() {
@Override
protected void updateItem(MElementContainer item, boolean empty) {
super.updateItem(item, empty);
if( item != null ) {
setText(item.getClass().getSimpleName());
}
}
};
}
});
dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MElementContainer.class, null)));
hbox.getChildren().add(dd);
Button b = new Button("Remove last Part");
b.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
MElementContainer container = dd.getSelectionModel().getSelectedItem();
container.getChildren().remove(container.getChildren().size()-1);
}
});
hbox.getChildren().add(b);
vbox.getChildren().add(hbox);
}
{
HBox hbox = new HBox(10);
final ComboBox<MElementContainer> dd = new ComboBox<>();
dd.setCellFactory(new Callback<ListView<MElementContainer>, ListCell<MElementContainer>>() {
@Override
public ListCell<MElementContainer> call(ListView<MElementContainer> param) {
return new ListCell<MElementContainer>() {
@Override
protected void updateItem(MElementContainer item, boolean empty) {
super.updateItem(item, empty);
if( item != null ) {
setText(item.getClass().getSimpleName());
}
}
};
}
});
dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MElementContainer.class, null)));
hbox.getChildren().add(dd);
Button b = new Button("Move last Part");
b.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
MElementContainer container = dd.getSelectionModel().getSelectedItem();
Object o = container.getChildren().remove(container.getChildren().size()-1);
container.getChildren().add(container.getChildren().size()-1, o);
}
});
hbox.getChildren().add(b);
vbox.getChildren().add(hbox);
}
{
HBox hbox = new HBox(10);
final ComboBox<MPart> dd = new ComboBox<>();
dd.setCellFactory(new Callback<ListView<MPart>, ListCell<MPart>>() {
@Override
public ListCell<MPart> call(ListView<MPart> param) {
return new ListCell<MPart>() {
@Override
protected void updateItem(MPart item, boolean empty) {
super.updateItem(item, empty);
if( item != null ) {
setText(item.getLocalizedLabel());
}
}
};
}
});
dd.setItems(FXCollections.observableArrayList(modelService.findElements(perspective == null ? application : perspective, null, MPart.class, null)));
hbox.getChildren().add(dd);
Button b = new Button("Detach");
b.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
MPart part = dd.getSelectionModel().getSelectedItem();
modelService.detach(part, 0, 0, 300, 300);
}
});
hbox.getChildren().add(b);
vbox.getChildren().add(hbox);