List of usage examples for com.google.gwt.user.client.ui TreeItem TreeItem
TreeItem(boolean isRoot)
From source file:org.jboss.wise.gwt.client.view.EndpointsView.java
License:Open Source License
public void setData(List<Service> data) { endpointsMap.clear();//from w w w . j av a 2 s . c o m rootNode.removeItems(); if (data != null) { for (Service s : data) { TreeItem serviceItem = new TreeItem(SafeHtmlUtils.fromString(s.getName())); rootNode.addItem(serviceItem); for (Port p : s.getPorts()) { TreeItem portItem = new TreeItem(SafeHtmlUtils.fromString(p.getName())); serviceItem.addItem(portItem); serviceItem.setState(true); for (Operation o : p.getOperations()) { TreeItem tItem = new TreeItem(SafeHtmlUtils.fromString(o.getFullName())); portItem.addItem(tItem); portItem.setState(true); tItem.addStyleName("endpoint"); endpointsMap.put(tItem, o); } } } } }
From source file:org.jboss.wise.gwt.client.view.InvocationView.java
License:Open Source License
public InvocationView() { SimplePanel contentDetailsDecorator = new SimplePanel(); contentDetailsDecorator.setWidth("100%"); contentDetailsDecorator.setWidth("640px"); initWidget(contentDetailsDecorator); VerticalPanel contentDetailsPanel = new VerticalPanel(); contentDetailsPanel.setWidth("100%"); StepLabel stepTitle = new StepLabel("Step 3 of 3: Result Data"); contentDetailsPanel.add(stepTitle);/*ww w .j a va 2 s. c o m*/ Tree.Resources resources = new TreeImageResource(); rootNode = new Tree(resources); rootNode.addItem(new TreeItem(SafeHtmlUtils.fromString(""))); contentDetailsPanel.add(rootNode); // result msg display area previewMessageDisplayPanel.setDisplayRefreshButton(false); contentDetailsPanel.add(previewMessageDisplayPanel); menuPanel.getNextButton().setHTML("Cancel"); contentDetailsPanel.add(menuPanel); contentDetailsDecorator.add(contentDetailsPanel); }
From source file:org.jboss.wise.gwt.client.view.InvocationView.java
License:Open Source License
public void setData(RequestResponse result) { rootNode.addItem(new TreeItem(new Label(result.getOperationFullName()))); if (result.getErrorMessage() != null) { TreeItem tItem = new TreeItem(new Label(result.getErrorMessage())); tItem.addStyleName("soapFault"); rootNode.addItem(tItem);/*from w w w . ja va 2 s . co m*/ } responseMessage = result.getResponseMessage(); TreeElement rootParamNode = result.getTreeElement(); if (rootParamNode != null) { for (TreeElement child : rootParamNode.getChildren()) { TreeItem parentItem = generateDisplayObject(new TreeItem(), child); parentItem.setState(true); rootNode.addItem(parentItem.getChild(0)); } } }
From source file:org.kuali.student.core.organization.ui.client.mvc.view.OrgTree.java
License:Educational Community License
protected void onLoad() { if (!loaded) { loaded = true;//from www .ja va2s. c o m orgRpcServiceAsync.getOrgHierarchies(new KSAsyncCallback<List<OrgHierarchyInfo>>() { public void onSuccess(List<OrgHierarchyInfo> result) { if (result != null && !result.isEmpty()) { final int firstValue = 0; for (final OrgHierarchyInfo orgHInfo : result) { // setting maxLevel to -1 to obtain only the root Node orgRpcServiceAsync.getOrgDisplayTree(orgHInfo.getRootOrgId(), orgHInfo.getId(), -1, new KSAsyncCallback<List<OrgTreeInfo>>() { @Override public void onSuccess(List<OrgTreeInfo> result) { OrgTreeInfo root = result.get(firstValue); TreeItem item = new TreeItem( new RootNode(root.getOrgId(), root.getDisplayName(), root.getPositions(), root.getOrgHierarchyId())); tree.addItem(item); item.addItem(""); } }); } } } }); } }
From source file:org.kuali.student.core.organization.ui.client.mvc.view.OrgTree.java
License:Educational Community License
protected void getOrgTree(final String orgId, final String hierarchyId, final TreeItem node) { //Setting Max level to 1 to obtain relations at the first level. orgRpcServiceAsync.getOrgDisplayTree(orgId, hierarchyId, 1, new KSAsyncCallback<List<OrgTreeInfo>>() { @Override//from w w w.ja v a 2s.com public void onSuccess(List<OrgTreeInfo> result) { for (OrgTreeInfo orgTreeInfo : result) { if (!orgTreeInfo.getOrgId().equals(orgId)) { TreeItem item = new TreeItem(new OrgWidget(orgTreeInfo.getOrgId(), orgTreeInfo.getDisplayName(), orgTreeInfo.getPositions(), hierarchyId)); node.addItem(item); item.addItem(""); } } node.getChild(0).remove(); node.setState(true, false); } }); }
From source file:org.mindinformatics.gwt.domeo.plugins.annotation.comment.ui.tile.TCommentTile.java
License:Apache License
public void createProvenanceBar(HorizontalPanel provenance, final MAnnotation annotation) { int step = 0; try {//from w ww .j av a2s . c o m Resources resource = Domeo.resources; Image editIcon = new Image(resource.editLittleIcon()); editIcon.setTitle("Edit Item"); editIcon.setStyleName(ATileComponent.tileResources.css().button()); //editIcon.addClickHandler(ActionEditAnnotation.getClickHandler(_domeo, this, _listener, getAnnotation())); step = 1; Image showIcon = new Image(resource.showLittleIcon()); showIcon.setTitle("Show Item in Context"); showIcon.setStyleName(ATileComponent.tileResources.css().button()); showIcon.addClickHandler(ActionShowAnnotation.getClickHandler(_domeo, this, getAnnotation())); step = 2; /* Image addCommentIcon = new Image(resource.addCommentIcon()); addCommentIcon.setTitle("Comment on item"); addCommentIcon.setStyleName(ATileComponent.tileResources.css().button()); addCommentIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { showCommentForm(); } }); step=3; Image commentBranchIcon = new Image(resource.splitCommentIcon()); commentBranchIcon.setTitle("Comment on item"); commentBranchIcon.setStyleName(ATileComponent.tileResources.css().button()); commentBranchIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { showCommentBranchForm(); } }); step=4; */ //final CommentsViewerPanel viewer = _viewer; final MAnnotation ann = _annotation; submitButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (addCommentBody.getText().trim().length() == 0) return; MAnnotationSelector selector = AnnotationFactory.createAnnotationSelector( _domeo.getAgentManager().getUserPerson(), _domeo.getPersistenceManager().getCurrentResource(), ann); MCommentAnnotation annotation = AnnotationFactory.createComment( _domeo.getPersistenceManager().getCurrentSet(), _domeo.getAgentManager().getUserPerson(), _domeo.getAgentManager().getSoftware(), _domeo.getPersistenceManager().getCurrentResource(), selector, addCommentBody.getText()); if (addCommentTitle.getValue() != null && addCommentTitle.getValue().trim().length() > 0) { annotation.setTitle(addCommentTitle.getValue()); } _domeo.getAnnotationPersistenceManager().addAnnotationOfAnnotation(annotation, ann, _domeo.getAnnotationPersistenceManager().getSetByAnnotationId(ann.getLocalId())); ASideTab tab = _domeo.getDiscussionSideTab(); ASidePanel panel = _domeo.getSidePanelsFacade().getPanelForTab(tab); ((ICommentsRefreshableComponent) panel).refreshFromRoot(); _domeo.refreshAnnotationComponents(); TCommentTile c = new TCommentTile(_domeo, _listener); TreeItem i = new TreeItem(c.getTile()); i.setState(true); c.initializeLens(annotation); hideCommentForm(); //viewer.refreshThreadsTree(); } }); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hideCommentForm(); } }); Image deleteIcon = new Image(resource.deleteLittleIcon()); deleteIcon.setTitle("Delete Item"); deleteIcon.setStyleName(ATileComponent.tileResources.css().button()); deleteIcon.addClickHandler(ActionDeleteAnnotation.getClickHandler(_domeo, this, getAnnotation())); step = 5; _domeo.getLogger().debug(this, "" + annotation.getCreator()); _domeo.getLogger().debug(this, annotation.getCreator().getUri()); // TODO move to an abstract tile class if (((BooleanPreference) _domeo.getPreferences().getPreferenceItem(Domeo.class.getName(), Domeo.PREF_DISPLAY_PROVENANCE)).getValue()) { if (annotation.getCreator().getUri().equals(_domeo.getAgentManager().getUserPerson().getUri())) { if (((BooleanPreference) _domeo.getPreferences().getPreferenceItem(Domeo.class.getName(), Domeo.PREF_DISPLAY_USER_PROVENANCE)).getValue()) { provenance.clear(); step = 6; // TODO Externalize the icon management to the plugins if (SelectorUtils.isOnMultipleTargets(annotation.getSelectors())) { Image ic = new Image(Domeo.resources.multipleLittleIcon()); ic.setTitle("Annotation on multiple targets"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else if (annotation.getSelector() != null && annotation.getSelector().getTarget() instanceof MOnlineImage) { Image ic = new Image(Domeo.resources.littleImageIcon()); ic.setTitle("Annotation on image"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { if (SelectorUtils.isOnAnnotation(annotation.getSelectors())) { if (((MCommentAnnotation) annotation).getTitle() != null && ((MCommentAnnotation) annotation).getTitle().trim().length() > 0) { Image ic = new Image(Domeo.resources.splitCommentIcon()); ic.setTitle("Discussion branch"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { Image ic = new Image(Domeo.resources.littleCommentIcon()); ic.setTitle("Discussion comment"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } } else if (SelectorUtils.isOnResourceTarget(annotation.getSelectors())) { Image ic = new Image(Domeo.resources.littleCommentsIcon()); ic.setTitle("Annotation on annotation"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { Image ic = new Image(Domeo.resources.littleTextIcon()); ic.setTitle("Annotation on text"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } } step = 7; provenance.add(new HTML( "<span style='font-weight: bold; font-size: 12px; color: #696969'>By Me</span> <span style='padding-left:5px' title='" + annotation.getFormattedCreationDate() + "'>" + elaspedTime((new Date()).getTime() - annotation.getCreatedOn().getTime()) + " ago</span>")); if (!(annotation.getSelector() instanceof MTargetSelector) && !(annotation.getSelector() instanceof MAnnotationSelector)) { provenance.add(showIcon); provenance.setCellWidth(showIcon, "22px"); provenance.add(editIcon); provenance.setCellWidth(editIcon, "22px"); } // provenance.add(addCommentIcon); // provenance.setCellHorizontalAlignment(addCommentIcon, HasHorizontalAlignment.ALIGN_LEFT); // provenance.setCellWidth(addCommentIcon, "22px"); // provenance.add(commentBranchIcon); // provenance.setCellHorizontalAlignment(commentBranchIcon, HasHorizontalAlignment.ALIGN_LEFT); // provenance.setCellWidth(commentBranchIcon, "22px"); provenance.add(deleteIcon); provenance.setCellHorizontalAlignment(deleteIcon, HasHorizontalAlignment.ALIGN_LEFT); provenance.setCellWidth(deleteIcon, "22px"); } else { provenance.setVisible(false); } } else { provenance.clear(); step = 8; if (SelectorUtils.isOnMultipleTargets(annotation.getSelectors())) { Image ic = new Image(Domeo.resources.multipleLittleIcon()); ic.setTitle("Annotation on multiple targets"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else if (annotation.getSelector() != null && annotation.getSelector().getTarget() instanceof MOnlineImage) { Image ic = new Image(Domeo.resources.littleImageIcon()); ic.setTitle("Annotation on image"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { Image ic = new Image(Domeo.resources.littleTextIcon()); ic.setTitle("Annotation on text"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } step = 9; provenance.add(new HTML("<span style='font-weight: bold; font-size: 12px; color: #696969'>By " + annotation.getCreator().getName() + "</span> <span style='padding-left:5px; font-size: 12px; color: #696969;' title='" + annotation.getFormattedCreationDate() + "'>" + elaspedTime((new Date()).getTime() - annotation.getCreatedOn().getTime()) + " ago</span>")); provenance.add(showIcon); provenance.add(editIcon); //provenance.add(commentBranchIcon); //provenance.add(addCommentIcon); provenance.add(deleteIcon); } } else { provenance.setVisible(false); } } catch (Exception e) { _domeo.getLogger().exception(this, "Provenance bar generation exception @" + step + " " + e.getMessage()); } }
From source file:org.mindinformatics.gwt.domeo.plugins.annotation.commentaries.linear.ui.tile.TLinearCommentTile.java
License:Apache License
public void createProvenanceBar(HorizontalPanel provenance, final MAnnotation annotation) { int step = 0; try {// w w w. jav a 2s .c o m Resources resource = Domeo.resources; Image editIcon = new Image(resource.editLittleIcon()); editIcon.setTitle("Edit Item"); editIcon.setStyleName(ATileComponent.tileResources.css().button()); //editIcon.addClickHandler(ActionEditAnnotation.getClickHandler(_domeo, this, _listener, getAnnotation())); step = 1; Image showIcon = new Image(resource.showLittleIcon()); showIcon.setTitle("Show Item in Context"); showIcon.setStyleName(ATileComponent.tileResources.css().button()); showIcon.addClickHandler(ActionShowAnnotation.getClickHandler(_domeo, this, getAnnotation())); step = 2; /* Image addCommentIcon = new Image(resource.addCommentIcon()); addCommentIcon.setTitle("Comment on item"); addCommentIcon.setStyleName(ATileComponent.tileResources.css().button()); addCommentIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { showCommentForm(); } }); step=3; Image commentBranchIcon = new Image(resource.splitCommentIcon()); commentBranchIcon.setTitle("Comment on item"); commentBranchIcon.setStyleName(ATileComponent.tileResources.css().button()); commentBranchIcon.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { showCommentBranchForm(); } }); step=4; */ //final CommentsViewerPanel viewer = _viewer; final MAnnotation ann = _annotation; submitButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (addCommentBody.getText().trim().length() == 0) return; MAnnotationSelector selector = AnnotationFactory.createAnnotationSelector( _domeo.getAgentManager().getUserPerson(), _domeo.getPersistenceManager().getCurrentResource(), ann); MLinearCommentAnnotation annotation = LinearCommentsFactory.createLinearComment( _domeo.getAgentManager().getUserPerson(), _domeo.getAgentManager().getSoftware(), selector, addCommentBody.getText()); if (addCommentTitle.getValue() != null && addCommentTitle.getValue().trim().length() > 0) { annotation.setTitle(addCommentTitle.getValue()); } _domeo.getAnnotationPersistenceManager().addAnnotationOfAnnotation(annotation, ann, _domeo.getAnnotationPersistenceManager().getSetByAnnotationId(ann.getLocalId())); ASideTab tab = _domeo.getLinearCommentsSideTab(); ASidePanel panel = _domeo.getSidePanelsFacade().getPanelForTab(tab); ((ICommentsRefreshableComponent) panel).refreshFromRoot(); _domeo.refreshAnnotationComponents(); TLinearCommentTile c = new TLinearCommentTile(_domeo, _listener); TreeItem i = new TreeItem(c.getTile()); i.setState(true); c.initializeLens(annotation); hideCommentForm(); //viewer.refreshThreadsTree(); } }); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hideCommentForm(); } }); Image deleteIcon = new Image(resource.deleteLittleIcon()); deleteIcon.setTitle("Delete Item"); deleteIcon.setStyleName(ATileComponent.tileResources.css().button()); deleteIcon.addClickHandler(ActionDeleteAnnotation.getClickHandler(_domeo, this, getAnnotation())); step = 5; _domeo.getLogger().debug(this, "" + annotation); step = 50; //_domeo.getLogger().debug(this, ""+annotation.getCreator()); step = 500; _domeo.getLogger().debug(this, annotation.getCreator().getUri()); step = 5000; // TODO move to an abstract tile class if (((BooleanPreference) _domeo.getPreferences().getPreferenceItem(Domeo.class.getName(), Domeo.PREF_DISPLAY_PROVENANCE)).getValue()) { if (annotation.getCreator().getUri().equals(_domeo.getAgentManager().getUserPerson().getUri())) { if (((BooleanPreference) _domeo.getPreferences().getPreferenceItem(Domeo.class.getName(), Domeo.PREF_DISPLAY_USER_PROVENANCE)).getValue()) { provenance.clear(); step = 6; // TODO Externalize the icon management to the plugins if (SelectorUtils.isOnMultipleTargets(annotation.getSelectors())) { Image ic = new Image(Domeo.resources.multipleLittleIcon()); ic.setTitle("Annotation on multiple targets"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else if (annotation.getSelector() != null && annotation.getSelector().getTarget() instanceof MOnlineImage) { Image ic = new Image(Domeo.resources.littleImageIcon()); ic.setTitle("Annotation on image"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { if (SelectorUtils.isOnAnnotation(annotation.getSelectors())) { if (((MLinearCommentAnnotation) annotation).getTitle() != null && ((MCommentAnnotation) annotation).getTitle().trim().length() > 0) { Image ic = new Image(Domeo.resources.splitCommentIcon()); ic.setTitle("Discussion branch"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { Image ic = new Image(Domeo.resources.commentIcon()); ic.setTitle("Discussion comment"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } } else if (SelectorUtils.isOnResourceTarget(annotation.getSelectors())) { Image ic = new Image(Domeo.resources.littleCommentsIcon()); ic.setTitle("Annotation on annotation"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { Image ic = new Image(Domeo.resources.littleTextIcon()); ic.setTitle("Annotation on text"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } } step = 7; provenance.add(new HTML( "<span style='font-weight: bold; font-size: 12px; color: #696969'>By Me</span> <span style='padding-left:5px' title='" + annotation.getFormattedCreationDate() + "'>" + elaspedTime((new Date()).getTime() - annotation.getCreatedOn().getTime()) + " ago</span>")); if (!(annotation.getSelector() instanceof MTargetSelector) && !(annotation.getSelector() instanceof MAnnotationSelector)) { provenance.add(showIcon); provenance.setCellWidth(showIcon, "22px"); provenance.add(editIcon); provenance.setCellWidth(editIcon, "22px"); } // provenance.add(addCommentIcon); // provenance.setCellHorizontalAlignment(addCommentIcon, HasHorizontalAlignment.ALIGN_LEFT); // provenance.setCellWidth(addCommentIcon, "22px"); // provenance.add(commentBranchIcon); // provenance.setCellHorizontalAlignment(commentBranchIcon, HasHorizontalAlignment.ALIGN_LEFT); // provenance.setCellWidth(commentBranchIcon, "22px"); provenance.add(deleteIcon); provenance.setCellHorizontalAlignment(deleteIcon, HasHorizontalAlignment.ALIGN_LEFT); provenance.setCellWidth(deleteIcon, "22px"); } else { provenance.setVisible(false); } } else { provenance.clear(); step = 8; if (SelectorUtils.isOnMultipleTargets(annotation.getSelectors())) { Image ic = new Image(Domeo.resources.multipleLittleIcon()); ic.setTitle("Annotation on multiple targets"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else if (annotation.getSelector() != null && annotation.getSelector().getTarget() instanceof MOnlineImage) { Image ic = new Image(Domeo.resources.littleImageIcon()); ic.setTitle("Annotation on image"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } else { Image ic = new Image(Domeo.resources.littleTextIcon()); ic.setTitle("Annotation on text"); provenance.add(ic); provenance.setCellWidth(ic, "18px"); } step = 9; provenance.add(new HTML("<span style='font-weight: bold; font-size: 12px; color: #696969'>By " + annotation.getCreator().getName() + "</span> <span style='padding-left:5px; font-size: 12px; color: #696969;' title='" + annotation.getFormattedCreationDate() + "'>" + elaspedTime((new Date()).getTime() - annotation.getCreatedOn().getTime()) + " ago</span>")); provenance.add(showIcon); provenance.add(editIcon); //provenance.add(commentBranchIcon); //provenance.add(addCommentIcon); provenance.add(deleteIcon); } } else { provenance.setVisible(false); } } catch (Exception e) { _domeo.getLogger().exception(this, "Provenance bar generation exception @" + step + " " + e.getMessage()); } }
From source file:org.onecmdb.ui.gwt.toolkit.client.view.tree.ChangeTreeRootTree.java
License:Open Source License
protected void loadRootObject(final TreeItem item) { control.getRootObject(new AsyncCallback() { public void onFailure(Throwable caught) { item.removeItems();/*from ww w. ja v a 2 s.c o m*/ item.addItem(new TreeItem(new Label("ERROR: " + caught.getMessage()))); } public void onSuccess(Object result) { item.removeItems(); if (result instanceof Object[]) { Object objects[] = (Object[]) result; for (int i = 0; i < objects.length; i++) { TreeItem childItem = newTreeItem(objects[i], false); item.addItem(childItem); } } else { TreeItem childItem = newTreeItem(result, false); item.addItem(childItem); } } }); }
From source file:org.onecmdb.ui.gwt.toolkit.client.view.tree.CITreeWidget.java
License:Open Source License
public CITreeWidget(final ITreeControl control) { this.control = control; tree = new Tree(); tree.addTreeListener(this); TreeItem item = new TreeItem("Populating...."); //tree.addItem(item); control.getRootObject(new AsyncCallback() { public void onFailure(Throwable caught) { tree.addItem(new TreeItem(new Label("ERROR: " + caught.getMessage()))); }//from w ww.ja v a 2 s . c om public void onSuccess(Object result) { tree.clear(); if (control.isHideRoot()) { if (result instanceof Object[]) { Object objects[] = (Object[]) result; for (int i = 0; i < objects.length; i++) { control.getChildren(objects[i], null, new AsyncCallback() { public void onFailure(Throwable caught) { tree.addItem(new TreeItem(new Label("ERROR: " + caught.getMessage()))); } public void onSuccess(Object result) { addRootObject(result); } }); } } else { control.getChildren(result, null, new AsyncCallback() { public void onFailure(Throwable caught) { tree.addItem(new TreeItem(new Label("ERROR: " + caught.getMessage()))); } public void onSuccess(Object result) { addRootObject(result); } }); } } else { addRootObject(result); } } }); VerticalPanel vPanel = new VerticalPanel(); vPanel.setVerticalAlignment(vPanel.ALIGN_TOP); search = new QueryCriteriaWidget(this); vPanel.add(search); vPanel.setCellWidth(search, "100%"); if (!control.showSearch()) { search.setVisible(false); } vPanel.add(tree); vPanel.setCellWidth(tree, "100%"); vPanel.setCellHeight(tree, "100%"); vPanel.setCellVerticalAlignment(tree, VerticalPanel.ALIGN_TOP); initWidget(vPanel); }
From source file:org.onecmdb.ui.gwt.toolkit.client.view.tree.CITreeWidget.java
License:Open Source License
public void onTreeItemStateChanged(final TreeItem item) { final long start = System.currentTimeMillis(); if (item.getState()) { if (item.getUserObject() instanceof GroupData) { GroupData gData = (GroupData) item.getUserObject(); updateChildren(item, gData.getUserData(), gData.getFirstItem()); return; }// ww w . j av a 2 s.co m currentItem = item; // Open start populate with entries. this.control.getChildCount(item.getUserObject(), new AsyncCallback() { public void onFailure(Throwable caught) { item.removeItems(); item.addItem(new TreeItem(new Label("ERROR: " + caught.getMessage()))); } public void onSuccess(Object result) { if (result instanceof Integer) { Integer totalCount = (Integer) result; Integer maxResult = CITreeWidget.this.control.getMaxResult(); if (maxResult != null && (totalCount.intValue() > maxResult.intValue())) { // Start adding groups... int groups = totalCount.intValue() / maxResult.intValue(); int rest = totalCount.intValue() % maxResult.intValue(); if (rest > 0) { groups++; } item.removeItems(); for (int i = 0; i < groups; i++) { TreeItem groupItem = new TreeItem(); int start = 1; int stop = maxResult.intValue(); if (i > 0) { start = (i * maxResult.intValue()) + 1; stop = ((i + 1) * maxResult.intValue()); if (stop > totalCount.intValue()) { stop = totalCount.intValue(); } } groupItem.setText("[" + start + ".." + stop + "]"); groupItem .setUserObject(new GroupData(item.getUserObject(), new Integer(start - 1))); groupItem.addItem(new TreeItem("Loading...")); item.addItem(groupItem); } } else { updateChildren(item, item.getUserObject(), null); } } } }); } else { //item.removeItems(); //updateCountItem(item); } if (CITreeWidget.this.control.getTreeListener() != null) { CITreeWidget.this.control.getTreeListener().onTreeItemStateChanged(item); } }