@Override protected void onDraw() { super.onDraw(); // wait until we have all of the sections before we show them. We don't use InitializableView // because, // it seems they are not supported (in the applicable renderView()) at this level. new Timer() { final long startTime = System.currentTimeMillis(); public void run() { if (isInitialized()) { if (null != detailsSection) { sectionStack.addSection(detailsSection); } if (null != helpSection) { sectionStack.addSection(helpSection); } if (null != controlsSection) { sectionStack.addSection(controlsSection); } if (null != pluginConfigSection) { sectionStack.addSection(pluginConfigSection); } if (null != scheduledJobsSection) { sectionStack.addSection(scheduledJobsSection); } addMember(sectionStack); markForRedraw(); } else { // don't wait forever, give up after 20s and show what we have long elapsedMillis = System.currentTimeMillis() - startTime; if (elapsedMillis > 20000) { initSectionCount = 5; } schedule(100); // Reschedule the timer. } } }.run(); // fire the timer immediately }
@Override protected void onDraw() { super.onDraw(); final TreeGrid treeGrid = new CustomResourceTypeTreeGrid(); treeGrid.setHeight100(); treeGrid.setTitle(MSG.view_type_resourceTypes()); treeGrid.setAnimateFolders(false); treeGrid.setResizeFieldsInRealTime(true); final TreeGridField name, plugin, category; name = new TreeGridField("name"); plugin = new TreeGridField("plugin"); category = new TreeGridField("category"); treeGrid.setFields(name, plugin, category); addMember(treeGrid); ResourceTypeCriteria criteria = new ResourceTypeCriteria(); criteria.addFilterIgnored((showIgnoredResourceTypes ? (Boolean) null : Boolean.FALSE)); criteria.fetchParentResourceTypes(true); criteria.setPageControl(PageControl.getUnlimitedInstance()); resourceTypeService.findResourceTypesByCriteria( criteria, new AsyncCallback<PageList<ResourceType>>() { public void onFailure(Throwable caught) { CoreGUI.getErrorHandler().handleError(MSG.widget_typeTree_loadFail(), caught); } public void onSuccess(PageList<ResourceType> result) { treeGrid.getTree().linkNodes(ResourceTypePluginTreeDataSource.buildNodes(result)); } }); }