use of javafx.scene.control.TreeItem 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 javafx.scene.control.TreeItem 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);
}
}
}
use of javafx.scene.control.TreeItem in project blue by kunstmusik.
the class SoundObjectExportPane method submitSoundObject.
private void submitSoundObject() {
try {
TreePath path = soundObjectLibraryTree.getSelectionPath();
if (path == null) {
return;
}
Object userObj = path.getLastPathComponent();
TreeItem<LibraryItem<SoundObject>> node = (TreeItem<LibraryItem<SoundObject>>) userObj;
if (!node.isLeaf()) {
return;
}
SoundObject soundObject = node.getValue().getValue();
DefaultMutableTreeNode tempNode = (DefaultMutableTreeNode) categoryTree.getSelectionPath().getLastPathComponent();
BlueShareSoundObjectCategory category = (BlueShareSoundObjectCategory) tempNode.getUserObject();
String username = namePasswordPanel.getUsername();
String password = namePasswordPanel.getPassword();
int categoryId = category.getCategoryId();
String name = soundObject.getName();
String soundObjectType = soundObject.getClass().getName();
String description = descriptionText.getText();
String soundObjectText = soundObject.saveAsXML(new HashMap<>()).toString();
System.out.println(soundObject.saveAsXML(new HashMap<>()).getTextString());
BlueShareRemoteCaller.submitSoundObject(username, password, categoryId, name, soundObjectType, description, soundObjectText);
} catch (IOException | XmlRpcException e) {
JOptionPane.showMessageDialog(null, "Error submitting SoundObject" + "\n\n" + e.getLocalizedMessage(), BlueSystem.getString("common.error"), JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
return;
}
JOptionPane.showMessageDialog(null, "SoundObject was successfully received.", BlueSystem.getString("common.success"), JOptionPane.PLAIN_MESSAGE);
}
use of javafx.scene.control.TreeItem in project uPMT by coco35700.
the class AddPropertyToClassCommand method execute.
@Override
public void execute() {
// adding the new property to the scheme
TreeItem<TypeController> newType = new TreeItem<TypeController>();
TypeController tc = new TypeController(newp, controller.getType());
newType.setValue(tc);
tree.getChildren().add(newType);
tree.setExpanded(true);
controller.getAddPropertySchemeController().update(newp);
MainViewTransformations.updateGrid(main);
main.needToSave();
}
use of javafx.scene.control.TreeItem in project certmgr by hdecarne.
the class StoreController method updateDetailsViewHelper.
private void updateDetailsViewHelper(TreeItem<AttributeModel> parentItem, Attributes attribute, boolean expand) {
TreeItem<AttributeModel> attributeItem = new TreeItem<>(new AttributeModel(attribute));
List<Attributes> attributeChildren = attribute.children();
int childCount = attributeChildren.size();
int childIndex = 0;
for (Attributes child : attributeChildren) {
if (childIndex >= DETAILS_VIEW_ATTRIBUTE_LIMIT) {
attributeItem.getChildren().add(new TreeItem<>(new AttributeModel(StoreI18N.formatSTR_TEXT_DETAILS_OMITTED(childCount - childIndex))));
break;
}
updateDetailsViewHelper(attributeItem, child, false);
childIndex++;
}
parentItem.getChildren().add(attributeItem);
attributeItem.setExpanded(expand);
}
Aggregations