本文整理汇总了Java中com.google.gwt.user.client.ui.TreeItem.getUserObject方法的典型用法代码示例。如果您正苦于以下问题:Java TreeItem.getUserObject方法的具体用法?Java TreeItem.getUserObject怎么用?Java TreeItem.getUserObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.TreeItem
的用法示例。
在下文中一共展示了TreeItem.getUserObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSelection
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
DatasetWidget datasetWidget = datasetButton.getDatasetWidget();
boolean isFromMyDatasetWidget = event.getSource().equals(datasetWidget);
if (isFromMyDatasetWidget) {
TreeItem item = event.getSelectedItem();
Object variableUserObject = item.getUserObject();
if (variableUserObject instanceof VariableSerializable) {
VariableSerializable variable = (VariableSerializable) variableUserObject;
// Remove extra variable UserLists before
// applyVariableChange
// TODO: Replace this with a higher level method or use
// events
variableControls.removeListBoxesExceptFirst();
if ( variable.getAttributes().get("grid_type").equals(vizGalVariable.getAttributes().get("grid_type") )) {
applyVariableChange(variable, true);
} else {
Window.alert("LAS cannot compare data on a grid with in-situ data.");
}
}
}
}
示例2: onSelection
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
TreeItem item = event.getSelectedItem();
currentlySelected = item;
TreeItem child = item.getChild(0);
if ( child != null && child.getText().equals(DatasetWidget.LOADING) ) {
CategorySerializable cat = (CategorySerializable) item.getUserObject();
Util.getRPCService().getCategories(cat.getID(), null, categoryCallback);
}
// Open the item. Work around double firing bug.
// http://code.google.com/p/google-web-toolkit/issues/detail?id=3660&q=Tree%20selection&colspec=ID%20Type%20Status%20Owner%20Milestone%20Summary%20Stars
TreeItem selItem = event.getSelectedItem();
TreeItem parent = selItem.getParentItem();
selItem.getTree().setSelectedItem(parent, false); // null is ok
if(parent != null)
parent.setSelected(false); // not compulsory
selItem.setState(!selItem.getState(), false);
}
示例3: evaluesFolderIcon
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Evalues actual folder icon to prevent other user interaction with the same folder
* this ensures icon and object hasChildsValue are consistent
*/
public void evaluesFolderIcon(TreeItem item) {
GWTFolder folderItem = (GWTFolder) item.getUserObject();
preventFolderInconsitences(item);
// Looks if must change icon on parent if now has no childs and properties with user security atention
if ((folderItem.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE) {
if (folderItem.isHasChildren()) {
item.setHTML(Util.imageItemHTML("img/menuitem_childs.gif", folderItem.getName(), "top"));
} else {
item.setHTML(Util.imageItemHTML("img/menuitem_empty.gif", folderItem.getName(), "top"));
}
} else {
if (folderItem.isHasChildren()) {
item.setHTML(Util.imageItemHTML("img/menuitem_childs_ro.gif", folderItem.getName(), "top"));
} else {
item.setHTML(Util.imageItemHTML("img/menuitem_empty_ro.gif", folderItem.getName(), "top"));
}
}
}
示例4: 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);
}
}
示例5: onSelection
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
@Override
public void onSelection(SelectionEvent<TreeItem> event)
{
TreeItem itemSelected = event.getSelectedItem();
if (itemSelected.getUserObject() == null)
{
return;
}
String type = (String) itemSelected.getUserObject();
if (type.equals("table"))
{
loadExpressionCollectionViewForTable(itemSelected.getText());
}
else if (type.equals("person"))
{
loadExpressionCollectionViewForPerson(itemSelected.getText());
}
else if (type.equals("target"))
{
loadExpressionCollectionViewForTarget(Double.parseDouble(itemSelected.getText()));
}
}
示例6: removeChildrenXKeepButtons
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
public static Vector removeChildrenXKeepButtons(TreeItem parentTreeItem, String name) {
Vector itemsToDelete = new Vector();
Vector buttonTreeItems = new Vector();
for (int i = 0; i < parentTreeItem.getChildCount(); i++) {
TreeItem treeItem = parentTreeItem.getChild(i);
if (treeItem.getUserObject() != null) {
if (treeItem.getUserObject().equals(name)) {
itemsToDelete.add(treeItem);
}
else if (((String) treeItem.getUserObject()).startsWith(ApplicationItem.button)) {
buttonTreeItems.add(treeItem);
itemsToDelete.add(treeItem);
}
}
}
Iterator itemsToDeleteIterator = itemsToDelete.iterator();
while(itemsToDeleteIterator.hasNext()) {
parentTreeItem.removeItem((TreeItem) itemsToDeleteIterator.next());
}
return buttonTreeItems;
}
示例7: preventFolderInconsitences
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Prevents folder inconsistences between server ( multi user deletes folder ) and tree
* nodes drawn
*
* @param item The tree node
*/
public void preventFolderInconsitences(TreeItem item) {
GWTFolder folderItem = (GWTFolder) item.getUserObject();
// Case that must remove all items node
if (item.getChildCount() > 0 && !folderItem.isHasChildren()) {
while (item.getChildCount() > 0) {
item.getChild(0).remove();
}
}
if (item.getChildCount() < 1 && !folderItem.isHasChildren()) {
folderItem.setHasChildren(false);
}
}
示例8: onTreeItemSelected
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
public void onTreeItemSelected(TreeItem item) {
currentlySelected = item;
Object u = item.getUserObject();
if ( u instanceof VariableSerializable ) {
VariableSerializable v = (VariableSerializable) u;
}
}
示例9: onOpen
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
@Override
public void onOpen(OpenEvent<TreeItem> event) {
TreeItem item = event.getTarget();
currentlySelected = item;
if ( item.getChild(0).getText().equals(DatasetWidget.LOADING) ) {
CategorySerializable cat = (CategorySerializable) item.getUserObject();
Util.getRPCService().getCategories(cat.getID(), null, categoryCallback);
}
}
示例10: setAuthenticated
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
public void setAuthenticated(String auth_url, String value) {
for ( int i = 0; i < datasetWidget.getItemCount(); i++ ) {
TreeItem item = datasetWidget.getItem(i);
Object u = item.getUserObject();
if ( u instanceof CategorySerializable ) {
CategorySerializable cat = (CategorySerializable) u;
String url = cat.getAttributes().get("remote_las");
if ( url != null && url.equals(auth_url) ) {
cat.setAttribute("authenticated", value);
}
}
}
}
示例11: evaluesFolderIcon
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Evalues actual folder icon to prevent other user interaction with the same folder
* this ensures icon and object hasChildsValue are consistent
*/
public void evaluesFolderIcon(TreeItem item) {
GWTFolder folderItem = (GWTFolder) item.getUserObject();
preventFolderInconsitences(item);
// Looks if must change icon on parent if now has no childs and properties with user security atention
if (folderItem.isHasChildren()) {
item.setHTML(Util.imageItemHTML("img/menuitem_childs.gif", folderItem.getName(), "top"));
} else {
item.setHTML(Util.imageItemHTML("img/menuitem_empty.gif", folderItem.getName(), "top"));
}
}
示例12: preventFolderInconsitences
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Prevents folder incosistences between server ( multi user deletes folder
* ) and tree nodes drawed
*
* @param item
* The tree node
*/
public void preventFolderInconsitences(TreeItem item) {
GWTFolder folderItem = (GWTFolder) item.getUserObject();
// Case that must remove all items node
if (item.getChildCount() > 0 && !folderItem.isHasChildren()) {
while (item.getChildCount() > 0) {
item.getChild(0).remove();
}
}
if (item.getChildCount() < 1 && !folderItem.isHasChildren()) {
folderItem.setHasChildren(false);
}
}
示例13: preventFolderInconsitences
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Prevents folder incosistences between server ( multi user deletes folder ) and tree
* nodes drawed
*
* @param item The tree node
*/
public void preventFolderInconsitences(TreeItem item) {
GWTFolder folderItem = (GWTFolder) item.getUserObject();
// Case that must remove all items node
if (item.getChildCount() > 0 && !folderItem.isHasChildren()) {
while (item.getChildCount() > 0) {
item.getChild(0).remove();
}
}
if (item.getChildCount() < 1 && !folderItem.isHasChildren()) {
folderItem.setHasChildren(false);
}
}
示例14: changePathBeforeRenaming
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Change recursivelly all the childs path
*
* @param oldPath
* The old path
* @param newPath
* The new path
* @param itemToChange
* The tree item to change the path
*/
public void changePathBeforeRenaming(String oldPath, String newPath, TreeItem itemToChange) {
for (int i = 0; i < itemToChange.getChildCount(); i++) {
TreeItem tmpItem = itemToChange.getChild(i);
GWTFolder gwtFolder = ((GWTFolder) tmpItem.getUserObject());
gwtFolder.setPath(gwtFolder.getPath().replaceAll(oldPath, newPath));
gwtFolder.setParentPath(gwtFolder.getParentPath().replaceAll(oldPath, newPath));
if (tmpItem.getChildCount() > 0) {
changePathBeforeRenaming(oldPath, newPath, tmpItem);
}
}
}
示例15: evaluesFolderIcon
import com.google.gwt.user.client.ui.TreeItem; //导入方法依赖的package包/类
/**
* Evalues actual folder icon to prevent other user interaction with the
* same folder this ensures icon and object hasChildsValue are consistent
*/
public void evaluesFolderIcon(TreeItem item) {
GWTFolder folderItem = (GWTFolder) item.getUserObject();
preventFolderInconsitences(item);
// On case folder is subscribed mus change icon
String subscribed = "";
if (folderItem.isSubscribed()) {
subscribed = "_subscribed";
}
// Looks if must change icon on parent if now has no childs and
// properties with user security atention
if ((folderItem.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE) {
if (folderItem.isHasChildren()) {
item.setHTML(Util.imageItemHTML("img/menuitem_childs" + subscribed + ".gif", folderItem
.getName(), "top"));
} else {
item.setHTML(Util.imageItemHTML("img/menuitem_empty" + subscribed + ".gif", folderItem
.getName(), "top"));
}
} else {
if (folderItem.isHasChildren()) {
item.setHTML(Util.imageItemHTML("img/menuitem_childs_ro" + subscribed + ".gif", folderItem
.getName(), "top"));
} else {
item.setHTML(Util.imageItemHTML("img/menuitem_empty_ro" + subscribed + ".gif", folderItem
.getName(), "top"));
}
}
}