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; }
// from interface Context public void setContent(Widget content) { if (_wrapper != null) { RootPanel.get(CLIENT_DIV).remove(_wrapper); _wrapper = null; _content = null; } if (content != null) { _content = content; _wrapper = Widgets.newFlowPanel( Widgets.newSimplePanel("content", content), Widgets.newImage("images/page_cap.png", "endcap"), Widgets.newHTML("Everything's <a href=\"/privacy.html\">Privacy Policy</a>")); RootPanel.get(CLIENT_DIV).add(_wrapper); } }
protected void addModuleLabels(ModuleNode root, String prefix, char modSep, int defthres) { List<Deferral> deferred = new ArrayList<Deferral>(); addModuleLabels(root, prefix, prefix, modSep, 0, deferred, defthres); _modules.add(Widgets.newHTML("<br/>")); for (Deferral def : deferred) { addModuleLabels(def.node, def.prefix, modSep, DEF_THRESH_2); } }
protected Widget makeLabel(Def def) { if (def == null) { return Widgets.newInlineLabel(""); } SpanWidget label = new SpanWidget.Plain(StringUtil.isBlank(def.name) ? "<anon>" : def.name, def); if (def.id != _defId) { new UsePopup.Popper(def.id, label, UsePopup.TYPE, _defmap, true).setGroup(_pgroup); } return DefUtil.adornDef(def, label); }
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 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")); }