本文整理汇总了Java中com.google.gwt.user.client.ui.Tree.addSelectionHandler方法的典型用法代码示例。如果您正苦于以下问题:Java Tree.addSelectionHandler方法的具体用法?Java Tree.addSelectionHandler怎么用?Java Tree.addSelectionHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.Tree
的用法示例。
在下文中一共展示了Tree.addSelectionHandler方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onModuleLoad
import com.google.gwt.user.client.ui.Tree; //导入方法依赖的package包/类
/**
* This is the entry point method.
*/
public void onModuleLoad() {
HorizontalPanel mainPanel = new HorizontalPanel();
final MiddlePanel mPanel = new MiddlePanel();
Tree menu = new Tree();
menu.addSelectionHandler(new SelectionHandler<TreeItem>() {
public void onSelection(SelectionEvent<TreeItem> event) {
mPanel.set((MenuItem) event.getSelectedItem());
}
});
initMenu(menu);
mainPanel.add(menu);
mainPanel.add(mPanel);
menu.setSelectedItem(menu.getItem(0));
mainPanel.setStyleName("mvp4gshowcase");
RootPanel.get()
.add(mainPanel);
}
示例2: FolderSelectTree
import com.google.gwt.user.client.ui.Tree; //导入方法依赖的package包/类
/**
* Folder Tree
*/
public FolderSelectTree() {
tree = new Tree();
rootItem.setStyleName("okm-TreeItem");
rootItem.setUserObject(new GWTFolder());
rootItem.setSelected(true);
rootItem.setState(true);
tree.setStyleName("okm-Tree");
tree.addItem(rootItem);
tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
boolean refresh = true;
TreeItem item = event.getSelectedItem();
// Case that not refreshing tree and file browser ( right click )
if (actualItem.equals(item)) {
refresh = false;
} else {
// Disables actual item because on changing active node by
// application this it's not changed automatically
if (!actualItem.equals(item)) {
actualItem.setSelected(false);
actualItem = item;
} else {
refresh = false;
}
}
if (refresh) {
refresh(true);
}
}
});
actualItem = tree.getItem(0);
initWidget(tree);
}
示例3: ExpressionView
import com.google.gwt.user.client.ui.Tree; //导入方法依赖的package包/类
/**
* Instantiates a new expression view.
*/
public ExpressionView()
{
super();
setSpacing(5);
Button btnRefresh = new Button("Refresh");
btnRefresh.addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
refreshButtonPressed();
}
});
add(btnRefresh);
HorizontalPanel horizontalPanel = new HorizontalPanel();
horizontalPanel.setSpacing(10);
add(horizontalPanel);
horizontalPanel.setSize("517px", "279px");
Tree tree = new Tree();
tree.addSelectionHandler(this);
horizontalPanel.add(tree);
trtmByPerson = new TreeItem(SafeHtmlUtils.fromString("By Person"));
tree.addItem(trtmByPerson);
trtmByTable = new TreeItem(SafeHtmlUtils.fromString("By Table"));
tree.addItem(trtmByTable);
trtmByTarget = new TreeItem(SafeHtmlUtils.fromString("By Target"));
tree.addItem(trtmByTarget);
verticalPanel = new VerticalPanel();
horizontalPanel.add(verticalPanel);
}
示例4: setTreeOfChanges
import com.google.gwt.user.client.ui.Tree; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void setTreeOfChanges(final RefactoringPreview changes) {
showDiffPanel(false);
final SelectionModel<RefactoringPreview> selectionModel = new SingleSelectionModel<>();
selectionModel.addSelectionChangeHandler(
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(
event -> {
if (selectedElement != null) {
selectedElement.getStyle().setProperty("background", "transparent");
}
selectedElement = event.getSelectedItem().getWidget().getElement();
selectedElement.getStyle().setProperty("background", getEditorSelectionColor());
});
treePanel.add(tree);
}
示例5: initNavigationTree
import com.google.gwt.user.client.ui.Tree; //导入方法依赖的package包/类
private Tree initNavigationTree() {
Tree navTree = new Tree();
List<GalleryTreeNode> mainNodes = galleryTree.getMainNodes();
populateNavigationTree(mainNodes, navTree);
navTree.addSelectionHandler(new SelectionHandler<TreeItem>() {
public void onSelection(SelectionEvent<TreeItem> event) {
TreeItem ti = event.getSelectedItem();
GalleryTreeNode node = (GalleryTreeNode) ti.getUserObject();
treeItemClicked(ti, node);
}
});
return navTree;
}
示例6: FolderSelectTree
import com.google.gwt.user.client.ui.Tree; //导入方法依赖的package包/类
/**
* Folder Tree
*/
public FolderSelectTree() {
tree = new Tree();
rootItem.setStyleName("okm-TreeItem");
rootItem.setUserObject(new GWTFolder());
rootItem.setSelected(true);
rootItem.setState(true);
tree.setStyleName("okm-Tree");
tree.addItem(rootItem);
tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
boolean refresh = true;
TreeItem item = event.getSelectedItem();
// Enables or disables move button ( evalues security to move to folder with permissions )
if (rootItem.equals(item)) {
Main.get().categoriesPopup.enable(false);
} else {
Main.get().categoriesPopup.enable(true);
}
// Case that not refreshing tree and file browser ( right click )
if (actualItem.equals(item)) {
refresh = false;
} else {
// Disables actual item because on changing active node by
// application this it's not changed automatically
if (!actualItem.equals(item)) {
actualItem.setSelected(false);
actualItem = item;
} else {
refresh = false;
}
}
if (refresh) {
refresh(true);
}
}
});
actualItem = tree.getItem(0);
initWidget(tree);
}
示例7: FolderSelectTree
import com.google.gwt.user.client.ui.Tree; //导入方法依赖的package包/类
/**
* Folder Tree
*/
public FolderSelectTree() {
tree = new Tree();
rootItem.setStyleName("okm-TreeItem");
rootItem.setUserObject(new GWTFolder());
rootItem.setSelected(true);
rootItem.setState(true);
tree.setStyleName("okm-Tree");
tree.addItem(rootItem);
tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
boolean refresh = true;
TreeItem item = event.getSelectedItem();
// Enables or disables move button ( evalues security to move to folder with permissions )
if (rootItem.equals(item)) {
Main.get().wizardPopup.categoriesWidget.enable(false);
} else {
Main.get().wizardPopup.categoriesWidget.enable(true);
}
// Case that not refreshing tree and file browser ( right click )
if (actualItem.equals(item)) {
refresh = false;
} else {
// Disables actual item because on changing active node by
// application this it's not changed automatically
if (!actualItem.equals(item)) {
actualItem.setSelected(false);
actualItem = item;
} else {
refresh = false;
}
}
if (refresh) {
refresh(true);
}
}
});
actualItem = tree.getItem(0);
initWidget(tree);
}
示例8: FolderSelectTree
import com.google.gwt.user.client.ui.Tree; //导入方法依赖的package包/类
/**
* Folder Tree
*/
public FolderSelectTree() {
tree = new Tree();
rootItem.setStyleName("okm-TreeItem");
rootItem.setUserObject(new GWTFolder());
rootItem.setSelected(true);
rootItem.setState(true);
tree.setStyleName("okm-Tree");
tree.addItem(rootItem);
tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
boolean refresh = true;
TreeItem item = event.getSelectedItem();
// Case that not refreshing tree and file browser ( right click )
if (actualItem.equals(item)) {
refresh = false;
} else {
// Disables actual item because on changing active node by
// application this it's not changed automatically
if (!actualItem.equals(item)) {
actualItem.setSelected(false);
actualItem = item;
} else {
refresh = false;
}
}
// Enables or disables move button ( evalues security to move to folder with permissions )
if (rootItem.equals(actualItem)) {
Main.get().mainPanel.desktop.navigator.thesaurusTree.thesaurusSelectPopup.enable(false);
} else {
Main.get().mainPanel.desktop.navigator.thesaurusTree.thesaurusSelectPopup.enable(true);
}
if (refresh) {
refresh(true);
}
}
});
actualItem = tree.getItem(0);
initWidget(tree);
}
示例9: FolderSelectTree
import com.google.gwt.user.client.ui.Tree; //导入方法依赖的package包/类
/**
* Folder Tree
*/
public FolderSelectTree() {
tree = new Tree();
rootItem.setStyleName("okm-TreeItem");
rootItem.setUserObject(new GWTFolder());
rootItem.setSelected(true);
rootItem.setState(true);
tree.setStyleName("okm-Tree");
tree.addItem(rootItem);
tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
boolean refresh = true;
TreeItem item = event.getSelectedItem();
// Enables or disables move button ( evalues security to move to folder with permissions )
if (rootItem.equals(item)) {
Main.get().mainPanel.desktop.navigator.categoriesTree.categoriesSelectPopup.enable(false);
} else {
Main.get().mainPanel.desktop.navigator.categoriesTree.categoriesSelectPopup.enable(true);
}
// Case that not refreshing tree and file browser ( right click )
if (actualItem.equals(item)) {
refresh = false;
} else {
// Disables actual item because on changing active node by
// application this it's not changed automatically
if (!actualItem.equals(item)) {
actualItem.setSelected(false);
actualItem = item;
} else {
refresh = false;
}
}
if (refresh) {
refresh(true);
}
}
});
actualItem = tree.getItem(0);
initWidget(tree);
}
示例10: FolderSelectTree
import com.google.gwt.user.client.ui.Tree; //导入方法依赖的package包/类
/**
* Folder Tree
*/
public FolderSelectTree() {
tree = new Tree();
rootItem.setStyleName("okm-TreeItem");
rootItem.setUserObject(new GWTFolder());
rootItem.setSelected(true);
rootItem.setState(true);
tree.setStyleName("okm-Tree");
tree.addItem(rootItem);
tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
boolean refresh = true;
TreeItem item = event.getSelectedItem();
// Enables or disables move button ( evalues security to move to folder with permissions )
evaluateSecurityToAction(item);
// Case that not refreshing tree and file browser ( right click )
if (actualItem.equals(item)) {
refresh = false;
} else {
// Disables actual item because on changing active node by
// application this it's not changed automatically
if (!actualItem.equals(item)) {
actualItem.setSelected(false);
actualItem = item;
} else {
refresh = false;
}
}
if (refresh) {
refresh(true);
}
}
});
actualItem = tree.getItem(0);
initWidget(tree);
}