use of org.csstudio.display.builder.model.widgets.TabsWidget.TabItemProperty in project org.csstudio.display.builder by kasemir.
the class TabsRepresentation method addTabs.
private void addTabs(final List<TabItemProperty> added) {
for (TabItemProperty item : added) {
final String name = item.name().getValue();
final Pane content = new Pane();
// 'Tab's are added with a Label as 'graphic'
// because that label allows setting the font.
// Quirk: Tabs will not show the label unless there's also a non-empty text
final Tab tab = new Tab(" ", content);
final Label label = new Label(name);
tab.setGraphic(label);
// !!
tab.setClosable(false);
tab.setUserData(item);
final int index = jfx_node.getTabs().size();
jfx_node.getTabs().add(tab);
addChildren(index, item.children().getValue());
item.name().addPropertyListener(tab_title_listener);
item.children().addPropertyListener(tab_children_listener);
}
}
use of org.csstudio.display.builder.model.widgets.TabsWidget.TabItemProperty in project org.csstudio.display.builder by kasemir.
the class WidgetTree method removeTabs.
private void removeTabs(final List<TabItemProperty> removed) {
for (TabItemProperty tab : removed) {
tab.children().removePropertyListener(children_listener);
tab.name().removePropertyListener(tab_name_listener);
final TreeItem<WidgetOrTab> tab_item = tab_name2tree.remove(tab.name());
tab_item.getParent().getChildren().remove(tab_item);
}
}
use of org.csstudio.display.builder.model.widgets.TabsWidget.TabItemProperty in project org.csstudio.display.builder by kasemir.
the class WidgetTree method removeWidget.
/**
* Remove widget from existing model & tree
* @param removed_widget
*/
private void removeWidget(final Widget removed_widget) {
if (removed_widget instanceof TabsWidget) {
final ArrayWidgetProperty<TabItemProperty> tabs = ((TabsWidget) removed_widget).propTabs();
tabs.removePropertyListener(tabs_property_listener);
removeTabs(tabs.getValue());
}
removed_widget.propName().removePropertyListener(name_listener);
final ChildrenProperty children = ChildrenProperty.getChildren(removed_widget);
if (children != null) {
children.removePropertyListener(children_listener);
for (Widget child : children.getValue()) removeWidget(child);
}
final TreeItem<WidgetOrTab> item = widget2tree.remove(removed_widget);
item.getParent().getChildren().remove(item);
}
use of org.csstudio.display.builder.model.widgets.TabsWidget.TabItemProperty in project org.csstudio.display.builder by kasemir.
the class WidgetTree method addTabs.
private void addTabs(final List<TabItemProperty> added) {
for (TabItemProperty tab : added) {
final TreeItem<WidgetOrTab> widget_item = widget2tree.get(tab.getWidget());
final TreeItem<WidgetOrTab> tab_item = new TreeItem<>(WidgetOrTab.of(tab));
widget_item.getChildren().add(tab_item);
tab_name2tree.put(tab.name(), tab_item);
tab.name().addPropertyListener(tab_name_listener);
for (Widget child : tab.children().getValue()) addWidget(child, -1);
tab.children().addPropertyListener(children_listener);
}
}
use of org.csstudio.display.builder.model.widgets.TabsWidget.TabItemProperty in project org.csstudio.display.builder by kasemir.
the class WidgetTree method addWidget.
/**
* Add widget to existing model & tree
* @param added_widget Widget to add
* @param index Index of widget within parent. -1 to add at end
*/
private void addWidget(final Widget added_widget, final int index) {
// Have widget and its parent in model
final Widget widget_parent = added_widget.getParent().get();
// Determine parent tree item
TreeItem<WidgetOrTab> item_parent = null;
if (widget_parent instanceof TabsWidget) {
for (TabItemProperty tab : ((TabsWidget) widget_parent).propTabs().getValue()) if (tab.children().getValue().contains(added_widget)) {
item_parent = tab_name2tree.get(tab.name());
break;
}
} else
item_parent = widget2tree.get(widget_parent);
Objects.requireNonNull(item_parent, "Cannot obtain parent item for " + added_widget);
// Create Tree item
final TreeItem<WidgetOrTab> item = new TreeItem<>(WidgetOrTab.of(added_widget));
widget2tree.put(added_widget, item);
item.setExpanded(true);
if (index >= 0)
// Add at same index into Tree
item_parent.getChildren().add(index, item);
else
// Append to end
item_parent.getChildren().add(item);
added_widget.propName().addPropertyListener(name_listener);
if (added_widget instanceof TabsWidget) {
final ArrayWidgetProperty<TabItemProperty> tabs = ((TabsWidget) added_widget).propTabs();
addTabs(tabs.getValue());
tabs.addPropertyListener(tabs_property_listener);
} else {
final ChildrenProperty children = ChildrenProperty.getChildren(added_widget);
if (children != null) {
children.addPropertyListener(children_listener);
for (Widget child : children.getValue()) addWidget(child, -1);
}
}
}
Aggregations