protected void addModuleLabels( ModuleNode node, String prefix, String fullPrefix, char modSep, int nest, List<Deferral> deferred, int defthres) { // if we have a deferral list and more than two children, defer ourselves until later if (nest > 0 && node.countMods() > defthres) { deferred.add(new Deferral(fullPrefix, node)); return; } boolean atRoot = node.name.equals(""); if (node.mod != null) { final Def mod = node.mod; _modules.add(Widgets.newInlineLabel(" " + prefix)); Widget label = Widgets.newActionLabel( node.name, new ClickHandler() { public void onClick(ClickEvent event) { Value<Boolean> showing = _showing.get(mod.id); showing.update(!showing.get()); } }); Bindings.bindStateStyle(_showing.get(mod.id), _rsrc.styles().selected(), null, label); _modules.add(label); new Shower(_showing.get(mod.id), _moddefs) { protected Widget createWidget() { return createModulePanel(mod); } }; prefix = ""; nest += 1; } else if (node.children.size() > 1) { _modules.add(Widgets.newInlineLabel(" ")); _modules.add(Widgets.newLabel(prefix + node.name)); prefix = ""; nest += 1; } else if (!atRoot) { prefix = prefix + node.name + modSep; } fullPrefix = fullPrefix + node.name + modSep; if (node.children.size() > 0) { if (prefix.length() == 0 && !atRoot) { _modules.add(Widgets.newInlineLabel(" {")); } for (ModuleNode child : node.children) { addModuleLabels(child, prefix, fullPrefix, modSep, nest, deferred, defthres); } if (prefix.length() == 0 && !atRoot) { _modules.add(Widgets.newInlineLabel(" }")); } } }
protected Widget createModulePanel(final Def mod) { final FlowPanel defs = Widgets.newFlowPanel(); defs.add(Widgets.newLabel("Loading...")); _projsvc.getMembers( mod.id, new PanelCallback<Def[]>(defs) { public void onSuccess(final Def[] members) { defs.clear(); Widget title = Widgets.newLabel(mod.name, _styles.modtitle()); title.setTitle("" + mod.id); defs.add(title); int added = addMembers(defs, mod, true, members); if (added < members.length) { NonPublicPanel nonpubs = new NonPublicPanel() { protected void populate() { addMembers(this, mod, false, members); } }; defs.add(nonpubs.makeToggle("Non-public members")); defs.add(nonpubs); } } }); return defs; }
protected TypeHierPanel(long defId, DefMap defmap, final PopupGroup.Positioner repos) { add(Widgets.newLabel(_cmsgs.loading())); _defId = defId; _defmap = defmap; fetchTypes( new PanelCallback<Def[][]>(this) { public void onSuccess(Def[][] defs) { clear(); init(defs); repos.sizeDidChange(); } }); }
@Override // from SummaryPanel protected void updateContents(long projectId) { _linker = UsePopup.byModsInProject(_projectId); _modules.clear(); _moddefs.clear(); _types.clear(); _modules.add(Widgets.newLabel(_cmsgs.loading())); _projsvc.getModules( projectId, new PanelCallback<Def[]>(_modules) { public void onSuccess(Def[] modules) { _modules.clear(); initContents(modules); } }); }
protected void initContents(Def[] modules) { if (modules.length == 0) { _modules.add(Widgets.newLabel("No modules in this project?")); return; } // build the module hierarchy char modSep = '.'; // TODO ModuleNode root = ModuleNode.createTree(modSep, modules); // now flatten it into a bunch of links if (root.mod != null) { addModuleLabels(root, "", modSep, DEF_THRESH); // one nameless top-level module } else { for (ModuleNode top : root.children) { addModuleLabels(top, "", modSep, DEF_THRESH); } } }
protected void setInfoContent(String message) { setContent(Widgets.newLabel(message, "infoLabel")); }