本文整理汇总了Java中com.google.gwt.user.client.ui.Tree类的典型用法代码示例。如果您正苦于以下问题:Java Tree类的具体用法?Java Tree怎么用?Java Tree使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Tree类属于com.google.gwt.user.client.ui包,在下文中一共展示了Tree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveState
import com.google.gwt.user.client.ui.Tree; //导入依赖的package包/类
public void saveState() {
List<String> nodes = new ArrayList<String>();
nodes.add(iStackPanel.getStackText(iStackPanel.getSelectedIndex()));
for (int i = 0; i < iStackPanel.getWidgetCount(); i++) {
if (iStackPanel.getWidget(i) instanceof Tree) {
Tree t = (Tree)iStackPanel.getWidget(i);
for (int j = 0; j < t.getItemCount(); j++) {
openedNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
}
}
}
String sideBarCookie = "";
for (String node: nodes) {
if (!sideBarCookie.isEmpty()) sideBarCookie += "|";
sideBarCookie += node;
}
Cookies.setCookie("UniTime:MobileMenu", sideBarCookie);
}
示例2: restoreState
import com.google.gwt.user.client.ui.Tree; //导入依赖的package包/类
public void restoreState() {
Set<String> nodes = new HashSet<String>();
String sideBarCookie = Cookies.getCookie("UniTime:MobileMenu");
if (sideBarCookie != null)
for (String node: sideBarCookie.split("\\|"))
nodes.add(node);
for (int i = 0 ; i < iStackPanel.getWidgetCount(); i++) {
if (nodes.contains(iStackPanel.getStackText(i))) {
iStackPanel.showStack(i);
}
if (iStackPanel.getWidget(i) instanceof Tree) {
Tree t = (Tree)iStackPanel.getWidget(i);
for (int j = 0; j < t.getItemCount(); j++) {
openNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
}
}
}
}
示例3: restoreState
import com.google.gwt.user.client.ui.Tree; //导入依赖的package包/类
public void restoreState() {
Set<String> nodes = new HashSet<String>();
String sideBarCookie = Cookies.getCookie("UniTime:SideBar");
if (sideBarCookie != null)
for (String node: sideBarCookie.split("\\|"))
nodes.add(node);
iDisclosurePanel.setOpen(nodes.contains("Root") || sideBarCookie == null);
if (iUseStackPanel)
for (int i = 0 ; i < iStackPanel.getWidgetCount(); i++) {
if (nodes.contains(iStackPanel.getStackText(i))) {
iStackPanel.showStack(i);
}
if (iStackPanel.getWidget(i) instanceof Tree) {
Tree t = (Tree)iStackPanel.getWidget(i);
for (int j = 0; j < t.getItemCount(); j++) {
openNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
}
}
}
else
for (int i = 0; i < iTree.getItemCount(); i++) {
openNodes(nodes, iTree.getItem(i), null);
}
}
示例4: 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);
}
示例5: parse
import com.google.gwt.user.client.ui.Tree; //导入依赖的package包/类
/**
* @param wadlXmlString
*/
public void parse(String wadlXmlString) {
// remove unnecessary whitespaces
wadlXmlString = wadlXmlString.replaceAll(">\\s*<", "><");
// remove <!-- comment nodes -->
wadlXmlString = wadlXmlString.replaceAll("<!--.*?-->", "");
try {
// reset the application
GuiFactory.resetApplication();
Document wadl = XMLParser.parse(wadlXmlString);
if (startParsing(wadl)) {
uploadDialogBox.setVisible(true);
uploadDialogBox.hide();
// if the parsing succeeded render a tree from the parsed wadl
WadlTreeRoot wadlTreeRoot = new WadlTreeRoot();
Tree wadlTree = wadlTreeRoot.buildTree(application);
WadlPanel.wadlArea.setWidget(wadlTree);
GuiFactory.toggleButtonsEnabled(true);
WadlPanel.fullscreenButton.click();
}
} catch (DOMParseException e) {
alertInvalidWadlAndRetry(GuiFactory.strings.invalidWadl());
}
}
示例6: Mailboxes
import com.google.gwt.user.client.ui.Tree; //导入依赖的package包/类
/**
* Constructs a new mailboxes widget.
*/
public Mailboxes() {
Images images = GWT.create(Images.class);
tree = new Tree(images);
TreeItem root = new TreeItem(
imageItemHTML(images.home(), "[email protected]"));
tree.addItem(root);
addImageItem(root, "Inbox", images.inbox());
addImageItem(root, "Drafts", images.drafts());
addImageItem(root, "Templates", images.templates());
addImageItem(root, "Sent", images.sent());
addImageItem(root, "Trash", images.trash());
root.setState(true);
initWidget(tree);
}
示例7: addItemToParent
import com.google.gwt.user.client.ui.Tree; //导入依赖的package包/类
private void addItemToParent(UIObject parentNode)
{
if (parentNode instanceof Tree)
{
((Tree) parentNode).addItem(this);
}
else if (parentNode instanceof TreeItem)
{
TreeItem parentNodeItem = (TreeItem) parentNode;
int childCount = parentNodeItem.getChildCount();
int nodeDepth = 0;
for (TreeItem ancestor = parentNodeItem; ancestor != null; ancestor = ancestor.getParentItem())
{
nodeDepth++;
}
parentNodeItem.addItem(this);
String colors[] = { "#F5F5F2", "#DBDAD8", "#F9F8F6", "#E7E7E3" };
int colorIndex = ((nodeDepth % 2) + (childCount % 2)) % 2;
getElement().getStyle().setBackgroundColor(colors[colorIndex]);
}
}
示例8: saveState
import com.google.gwt.user.client.ui.Tree; //导入依赖的package包/类
public void saveState() {
List<String> nodes = new ArrayList<String>();
if (iUseStackPanel) {
nodes.add(iStackPanel.getStackText(iStackPanel.getSelectedIndex()));
for (int i = 0; i < iStackPanel.getWidgetCount(); i++) {
if (iStackPanel.getWidget(i) instanceof Tree) {
Tree t = (Tree)iStackPanel.getWidget(i);
for (int j = 0; j < t.getItemCount(); j++) {
openedNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
}
}
}
} else {
for (int i = 0; i < iTree.getItemCount(); i++) {
openedNodes(nodes, iTree.getItem(i), null);
}
}
String sideBarCookie = "";
if (iDisclosurePanel.isOpen()) sideBarCookie += "Root";
for (String node: nodes) {
if (!sideBarCookie.isEmpty()) sideBarCookie += "|";
sideBarCookie += node;
}
sideBarCookie += "|W:" + iPanel.getElement().getClientWidth();
Cookies.setCookie("UniTime:SideBar", sideBarCookie);
resizeWideTables();
}
示例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();
// 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: getTreeItem
import com.google.gwt.user.client.ui.Tree; //导入依赖的package包/类
/**
* Allows to retrieve the tree item by name
* @param tree the tree to take the item from
* @param itemText the text of the item we want to get the sate of
* @return the tree item with the given text, or null if there is no such item
*/
private static TreeItem getTreeItem( final Tree tree, final String itemText ) {
if( tree != null ) {
for( int i = 0; i < tree.getItemCount(); i++ ) {
TreeItem oldTreeItem = tree.getItem( i );
if( oldTreeItem.getText().equals( itemText ) ) {
return oldTreeItem;
}
}
}
return null;
}
示例11: getItemState
import com.google.gwt.user.client.ui.Tree; //导入依赖的package包/类
/**
* Allows to retrieve the tree item state
* @param tree the tree to take the item from
* @param itemText the text of the item we want to get the sate of
* @return true if the item does not exist, or it exists and its state is true
*/
private static boolean getItemState( final Tree tree, final String itemText ) {
TreeItem treeItem = getTreeItem( tree, itemText );
if( treeItem != null ) {
return treeItem.getState();
}
return true;
}
示例12: 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);
}
示例13: FiltersDataPanel
import com.google.gwt.user.client.ui.Tree; //导入依赖的package包/类
public FiltersDataPanel(FilterSubTab parentPanel) {
this.parentSubTab = parentPanel;
getElement().setId("filters_container");
FlowPanel panel = new FlowPanel();
// panel.add( new HTML("<h2 id=\"filter_header\">" + HtmlConsts.SPACE + "Filters</h2>"));
FlexTable filterGroupButtons = new FlexTable();
filterGroupButtons.setWidget(0, 0, new SaveFilterGroupButton(parentSubTab));
copyButton = new SaveAsFilterGroupButton(parentSubTab);
filterGroupButtons.setWidget(0, 1, copyButton);
removeButton = new RemoveFilterGroupButton(parentSubTab);
filterGroupButtons.setWidget(0, 2, removeButton);
panel.add(filterGroupButtons);
HTML filterText = new HTML("<h2 id=\"filter_header\">Filters Applied</h2>");
filterText.getElement().setId("filter_desc_title");
VerticalPanel filterGlobal = new VerticalPanel();
FlexTable paginationTable = new FlexTable();
paginationTable.setHTML(0, 0, "<p id=\"filter_header\">Submissions per page</p>");
paginationTable.setWidget(0, 1, new PaginationNumTextBox(parentSubTab));
filterGlobal.add(paginationTable);
filterGlobal.add(filterText);
panel.add(filterGlobal);
// Filters applied header
filterHeader = new FlowPanel();
panel.add(filterHeader);
// create tree
filtersTree = new Tree();
panel.add(filtersTree);
// create the root as the new filter button
addFilter = new AddFilterButton(parentPanel);
add(panel);
}
示例14: createTree
import com.google.gwt.user.client.ui.Tree; //导入依赖的package包/类
private Tree createTree() {
Tree tree = new Tree();
/*TreeItem widgets =*/ tree.addItem("Widgets");
/*TreeItem lists =*/ tree.addItem("Lists and Menus");
TreeItem popups = tree.addItem("Popups");
popups.addItem(createTreeItem("Message Box", new CwMessageBox()));
/*TreeItem tables =*/ tree.addItem("Tables");
return tree;
}
示例15: 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);
}