use of com.google.gwt.user.client.ui.Tree in project che by eclipse.
the class PreviewViewImpl method setTreeOfChanges.
/** {@inheritDoc} */
@Override
public void setTreeOfChanges(final RefactoringPreview changes) {
showDiffPanel(false);
final SelectionModel<RefactoringPreview> selectionModel = new SingleSelectionModel<>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
RefactoringPreview selectedNode = (RefactoringPreview) ((SingleSelectionModel) selectionModel).getSelectedObject();
delegate.onSelectionChanged(selectedNode);
}
});
Tree tree = new Tree();
tree.getElement().setId("tree-of-changes");
for (RefactoringPreview parentChange : changes.getChildrens()) {
TreeItem treeItem = new TreeItem();
containerChanges.put(treeItem, parentChange);
createTreeElement(treeItem, parentChange.getText(), parentChange.getChildrens());
tree.addItem(treeItem);
}
tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
if (selectedElement != null) {
selectedElement.getStyle().setProperty("background", "transparent");
}
selectedElement = event.getSelectedItem().getWidget().getElement();
selectedElement.getStyle().setProperty("background", getEditorSelectionColor());
}
});
treePanel.add(tree);
}
use of com.google.gwt.user.client.ui.Tree in project pentaho-platform by pentaho.
the class MantleXul method enableUsersRolesTreeItem.
public void enableUsersRolesTreeItem(final boolean enabled) {
Timer t = new Timer() {
public void run() {
if (container != null) {
cancel();
String usersRolesLabel = Messages.getString("users") + "/" + Messages.getString("roles");
GwtTree adminCatTree = (GwtTree) container.getDocumentRoot().getElementById("adminCatTree");
TreeItem usersRolesTreeItem = null;
Tree adminTree = adminCatTree.getTree();
Iterator<TreeItem> adminTreeItr = adminTree.treeItemIterator();
while (adminTreeItr.hasNext()) {
usersRolesTreeItem = adminTreeItr.next();
if (usersRolesTreeItem.getText().equals(usersRolesLabel)) {
usersRolesTreeItem.setVisible(enabled);
break;
}
}
}
}
};
t.scheduleRepeating(250);
}
use of com.google.gwt.user.client.ui.Tree in project pentaho-platform by pentaho.
the class MantleXul method selectAdminCatTreeTreeItem.
public void selectAdminCatTreeTreeItem(final String treeLabel) {
GwtTree adminCatTree = (GwtTree) container.getDocumentRoot().getElementById("adminCatTree");
Tree adminTree = adminCatTree.getTree();
adminTree.setSelectedItem(null, true);
Iterator<TreeItem> adminTreeItr = adminTree.treeItemIterator();
while (adminTreeItr.hasNext()) {
TreeItem treeItem = adminTreeItr.next();
if (treeItem.getText().equals(treeLabel)) {
adminTree.setSelectedItem(treeItem, true);
break;
}
}
}
use of com.google.gwt.user.client.ui.Tree in project ovirt-engine by oVirt.
the class AbstractSanStorageList method createSanStorageListWidget.
protected void createSanStorageListWidget() {
tree = new Tree();
treeContainer.add(tree);
}
use of com.google.gwt.user.client.ui.Tree in project gwt-test-utils by gwt-test-utils.
the class TreeTest method beforeTreeTest.
@Before
public void beforeTreeTest() {
// Create a tree with a few items in it.
parent = new TreeItem(new SafeHtmlBuilder().appendEscaped("parent").toSafeHtml());
item0 = parent.addItem(new SafeHtmlBuilder().appendEscaped("item0").toSafeHtml());
item1 = parent.addItem(new SafeHtmlBuilder().appendEscaped("item1").toSafeHtml());
// Add a CheckBox to the tree
item2 = new TreeItem(new CheckBox("item2"));
parent.addItem(item2);
tree = new Tree();
tree.addItem(parent);
// Add it to the root panel.
RootPanel.get().add(tree);
assertThat(tree.isVisible()).isTrue();
clickedTreeItem = null;
}
Aggregations