本文整理汇总了Java中com.google.gwt.user.client.ui.TreeItem.addItem方法的典型用法代码示例。如果您正苦于以下问题:Java TreeItem.addItem方法的具体用法?Java TreeItem.addItem怎么用?Java TreeItem.addItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.TreeItem
的用法示例。
在下文中一共展示了TreeItem.addItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBuiltInBlocksTree
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Constructs a tree item for built-in blocks.
*
* @return tree item
*/
public TreeItem getBuiltInBlocksTree() {
initBundledImages();
TreeItem builtinNode = new TreeItem(new HTML("<span>" + MESSAGES.builtinBlocksLabel()
+ "</span>"));
for (final String drawerName : BUILTIN_DRAWER_NAMES) {
Image drawerImage = new Image(bundledImages.get(drawerName));
TreeItem itemNode = new TreeItem(new HTML("<span>" + drawerImage
+ getBuiltinDrawerNames(drawerName) + "</span>"));
SourceStructureExplorerItem sourceItem = new BlockSelectorItem() {
@Override
public void onSelected() {
fireBuiltinDrawerSelected(drawerName);
}
};
itemNode.setUserObject(sourceItem);
builtinNode.addItem(itemNode);
}
builtinNode.setState(true);
return builtinNode;
}
示例2: getGenericComponentsTree
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Constructs a tree item for generic ("Advanced") component blocks for
* component types that appear in form.
*
* @param form
* only component types that appear in this Form will be included
* @return tree item for this form
*/
public TreeItem getGenericComponentsTree(MockForm form) {
Map<String, String> typesAndIcons = Maps.newHashMap();
form.collectTypesAndIcons(typesAndIcons);
TreeItem advanced = new TreeItem(new HTML("<span>" + MESSAGES.anyComponentLabel() + "</span>"));
List<String> typeList = new ArrayList<String>(typesAndIcons.keySet());
Collections.sort(typeList);
for (final String typeName : typeList) {
TreeItem itemNode = new TreeItem(new HTML("<span>" + typesAndIcons.get(typeName)
+ MESSAGES.textAnyComponentLabel()
+ ComponentsTranslation.getComponentName(typeName) + "</span>"));
SourceStructureExplorerItem sourceItem = new BlockSelectorItem() {
@Override
public void onSelected() {
fireGenericDrawerSelected(typeName);
}
};
itemNode.setUserObject(sourceItem);
advanced.addItem(itemNode);
}
return advanced;
}
示例3: addFolder
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Adds folders to actual item if not exists or refreshes it values
*
* @param actualItem The actual item active
* @param newItem New item to be added, or refreshed
*/
public void addFolder(TreeItem actualItem, TreeItem newItem) {
int i = 0;
boolean found = false;
int count = actualItem.getChildCount();
GWTFolder folder;
GWTFolder newFolder = (GWTFolder) newItem.getUserObject();
String folderPath = newFolder.getPath();
for (i = 0; i < count; i++) {
folder = (GWTFolder) actualItem.getChild(i).getUserObject();
// If item is found actualizate values
if ((folder).getPath().equals(folderPath)) {
found = true;
actualItem.getChild(i).setVisible(true);
actualItem.getChild(i).setUserObject(newFolder);
evaluesFolderIcon(actualItem.getChild(i));
}
}
if (!found) {
evaluesFolderIcon(newItem);
actualItem.addItem(newItem);
}
}
示例4: setImportFolderUI
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
private void setImportFolderUI(final TreeItem treeItem, final Node rootNode, final Node newRootNode) {
for (Node childNode : rootNode.getChildren()) {
if (rootNode != null && rootNode.getLabel() != null && rootNode.getLabel().getDisplayName() != null
&& !rootNode.getLabel().getDisplayName().trim().isEmpty()) {
Node node = new Node();
node.getLabel().setDisplayName(childNode.getLabel().getDisplayName());
node.getLabel().setKey(childNode.getLabel().getKey());
node.setParent(childNode.getParent());
CheckBox checkBox = new CheckBox();
checkBox.setText(childNode.getLabel().getDisplayName().trim());
TreeItem childTree = new TreeItem(checkBox);
treeItem.addItem(childTree);
createUI(childNode.getLabel().isMandatory(), checkBox, node, childTree);
node.setParent(newRootNode);
newRootNode.getChildren().add(node);
if (childNode.getChildren() != null && !childNode.getChildren().isEmpty()) {
setImportFolderUI(childTree, childNode, node);
}
}
}
}
示例5: changeHelpPanel
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/***********************************
****** HELP STUFF ******
***********************************/
private void changeHelpPanel(SubTabs subMenu) {
// change root item
rootItem.setText(subMenu + " Help");
rootItem.removeItems();
SubTabInterface subTabObj = getSubTab(subMenu);
if (subTabObj != null) {
HelpSliderConsts[] helpVals = subTabObj.getHelpSliderContent();
if (helpVals != null) {
for (int i = 0; i < helpVals.length; i++) {
TreeItem helpItem = new TreeItem(SafeHtmlUtils.fromString(helpVals[i].getTitle()));
TreeItem content = new TreeItem(SafeHtmlUtils.fromString(helpVals[i].getContent()));
helpItem.setState(false);
helpItem.addItem(content);
rootItem.addItem(helpItem);
}
}
}
rootItem.setState(true);
resize();
}
示例6: insertTreeItem
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
private void insertTreeItem(TreeItem treeItem,
TreeItem nestedTreeItem,
TerminationConfigOption terminationConfigOption) {
if (treeItem.getChildCount() == 0) {
treeItem.addItem(nestedTreeItem);
} else {
for (int i = 0; i < treeItem.getChildCount(); i++) {
TerminationTreeItemContent childTreeItemContent = (TerminationTreeItemContent) treeItem.getChild(i).getUserObject();
if (terminationConfigOption.ordinal() < childTreeItemContent.getTerminationConfigOption().ordinal()) {
treeItem.insertItem(i,
nestedTreeItem);
break;
}
if (i == treeItem.getChildCount() - 1) {
treeItem.addItem(nestedTreeItem);
break;
}
}
}
}
示例7: processChildren
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
void processChildren(TreeItem rootItem, TreeItemGVO[] children, String uuid, String parent, String context) {
if (children != null) {
for (int i = 0; i < children.length; i++) {
TreeItemGVO componentGVO = children[i];
UIObject uiObject = renderChildComponent(componentGVO, uuid, parent, context);
if (uiObject instanceof QTreeItem) {
QTreeItem treeItem = (QTreeItem) uiObject;
treeItem.setState(componentGVO.getExpand().booleanValue());
rootItem.addItem(treeItem);
// TODO set Tree
RendererHelper.fillIn(componentGVO, treeItem.getLabel(), uuid, parent, context);
processChildren(treeItem, componentGVO.getChildren(), uuid, parent, context);
}
RendererHelper.fillIn(componentGVO, uiObject, uuid, parent, context);
}
}
}
示例8: addItemToParent
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的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]);
}
}
示例9: setFullyQualifiedClassNames
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
public void setFullyQualifiedClassNames( final List<String> fullyQualifiedClassNames ) {
if ( tree.getItem( 0 ) != null ) {
tree.clear();
}
if ( fullyQualifiedClassNames != null ) {
for ( String type : fullyQualifiedClassNames ) {
final TreeItem it = new TreeItem();
it.setHTML( AbstractImagePrototype.create( DRLTextEditorResources.INSTANCE.images().classImage() ).getHTML()
+ "<small style=\"cursor: pointer\">"
+ type + "</small>" );
it.setUserObject( new ClassUserObject( type + "( )",
type ) );
tree.addItem( it );
it.addItem( Util.toSafeHtml( LAZY_LOAD ) );
}
}
}
示例10: setupMainMenuOption
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Add an option to the main menu.
*
* @param parent
* the {@link TreeItem} that is the option
* @param content
* the {@link ContentWidget} to display when selected
* @param image
* the icon to display next to the {@link TreeItem}
*/
// private void setupMainMenuOption(TreeItem parent, ContentWidget content,
// AbstractImagePrototype image) {
// // Create the TreeItem
// TreeItem option = parent.addItem(image.getHTML() + " "
// + content.getName());
//
// // Map the item to its history token and content widget
// itemWidgets.put(option, content);
// itemTokens.put(getContentWidgetToken(content), option);
// }
private void setupMainMenuOption(TreeItem parent, PageState state,
AbstractImagePrototype image) {
// Create the TreeItem
TreeItem option = parent.addItem(image.getHTML() + " "
+ state.getMenuDisplayName());
// Map the item to its history token and content widget
itemStates.put(option, state);
pageClassItems.put(state.getPageClassName(), option);
}
示例11: buildTree
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
@Override
protected TreeItem buildTree() {
TreeItem itemNode = super.buildTree();
// Recursively build the tree for child components
for (MockComponent child : children) {
itemNode.addItem(child.buildTree());
}
itemNode.setState(expanded);
return itemNode;
}
示例12: expandTreeItem
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
public void expandTreeItem(TreeItem father, List<FileWrapper> files) {
father.removeItems();
for (FileWrapper file : files) {
if (file.getKind() == FileType.DIR) {
TreeItem newItem = new TreeItem(file.getName());
father.addItem(newItem);
if (file.isSubFolderContained()) {
newItem.addItem(LocaleDictionary.get().getMessageValue(FolderManagementMessages.LOADING));
}
}
}
}
示例13: createFilterTreeItem
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
private TreeItem createFilterTreeItem(Filter filter) {
FlexTable title = new FlexTable();
title.setWidget(0, 0, new DeleteFilterButton(filter, parentSubTab));
TreeItem filterItem = new TreeItem(title);
filterItem.setUserObject(filter);
filterItem.setState(true);
if (filter instanceof RowFilter) {
RowFilter rowFilter = (RowFilter) filter;
title.setWidget(0, 1, new Label(rowFilter.getVisibility()
+ rowFilter.getColumn().getDisplayHeader()));
title.setWidget(1, 1, new Label(" where column is " + rowFilter.getOperation() + " "
+ rowFilter.getInput()));
} else if (filter instanceof ColumnFilter) {
ColumnFilter columnFilter = (ColumnFilter) filter;
ArrayList<Column> columns = columnFilter.getColumnFilterHeaders();
if (columns.size() == 1) {
title.setWidget(0, 1, new Label(columnFilter.getVisibility().getDisplayText() + " "
+ columns.get(0).getDisplayHeader()));
} else {
title.setWidget(0, 1, new Label(columnFilter.getVisibility().getDisplayText() + " ..."));
for (Column column : columns) {
filterItem.addItem(new Label(column.getDisplayHeader()));
}
}
}
return filterItem;
}
示例14: createTree
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的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: addItem
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
private TreeItem addItem(TreeItem parentItem, ScreenMenuItem widget) {
TreeItem childItem = new TreeItem();
childItem.setWidget(widget);
parentItem.addItem(childItem);
widget.addClickListener(this);
return(childItem);
}