private String getAlignedAvailabilityResults( long total, long up, long down, long unknown, long disabled) { StringBuilder results = new StringBuilder(); results.append("<table><tr>"); if (0 == total) { results.append( getColumn( false, "<img height=\"12\" width=\"12\" src=\"" + ImageManager.getFullImagePath(ImageManager.getAvailabilityIcon(null)) + "\" /> 0")); results.append(getColumn(true)); results.append(getColumn(false)); } else { if (up > 0) { String imagePath = ImageManager.getFullImagePath( ImageManager.getAvailabilityIconFromAvailType(AvailabilityType.UP)); results.append( getColumn(false, " <img height=\"12\" width=\"12\" src=\"" + imagePath + "\" />", up)); } else { results.append( getColumn( false, " <img src=\"" + ImageManager.getBlankIcon() + "\" width=\"12px\" height=\"12px\" />")); } if (down > 0) { String imagePath = ImageManager.getFullImagePath( ImageManager.getAvailabilityIconFromAvailType(AvailabilityType.DOWN)); results.append( getColumn( false, " <img height=\"12\" width=\"12\" src=\"" + imagePath + "\" />", down)); } else { results.append( getColumn( false, " <img src=\"" + ImageManager.getBlankIcon() + "\" width=\"12px\" height=\"12px\" />")); } if (disabled > 0) { String imagePath = ImageManager.getFullImagePath( ImageManager.getAvailabilityIconFromAvailType(AvailabilityType.DISABLED)); results.append( getColumn( false, " <img height=\"12\" width=\"12\" src=\"" + imagePath + "\" />", disabled)); } else { results.append( getColumn( false, " <img src=\"" + ImageManager.getBlankIcon() + "\" width=\"12px\" height=\"12px\" />")); } if (unknown > 0) { String imagePath = ImageManager.getFullImagePath( ImageManager.getAvailabilityIconFromAvailType(AvailabilityType.UNKNOWN)); results.append( getColumn( false, " <img height=\"12\" width=\"12\" src=\"" + imagePath + "\" />", unknown)); } else { results.append( getColumn( false, " <img src=\"" + ImageManager.getBlankIcon() + "\" width=\"1px\" height=\"1px\" />")); } } results.append("</tr></table>"); return results.toString(); }
private void prepareDetailsSection(SectionStack stack, ServerPlugin plugin) { DynamicForm form = new DynamicForm(); form.setMargin(10); form.setWidth100(); form.setWrapItemTitles(false); form.setNumCols(4); StaticTextItem nameItem = new StaticTextItem("name", MSG.common_title_name()); nameItem.setValue(plugin.getName()); StaticTextItem displayNameItem = new StaticTextItem("displayName", MSG.common_title_display_name()); displayNameItem.setValue(plugin.getDisplayName()); StaticTextItem versionItem = new StaticTextItem("version", MSG.common_title_version()); versionItem.setValue(plugin.getVersion()); StaticTextItem md5Item = new StaticTextItem("MD5", "MD5"); md5Item.setValue(plugin.getMD5()); StaticTextItem pathItem = new StaticTextItem("path", MSG.common_title_path()); pathItem.setValue(plugin.getPath()); StaticTextItem ampsItem = new StaticTextItem("ampsVersion", "AMPS " + MSG.common_title_version()); ampsItem.setValue(plugin.getAmpsVersion()); StaticTextItem descItem = new StaticTextItem("desc", MSG.common_title_description()); descItem.setValue(plugin.getDescription()); StaticTextItem mtimeItem = new StaticTextItem("mtime", MSG.common_title_lastUpdated()); mtimeItem.setValue( TimestampCellFormatter.format( Long.valueOf(plugin.getMtime()), TimestampCellFormatter.DATE_TIME_FORMAT_MEDIUM)); StaticTextItem kindItem = new StaticTextItem("kind", MSG.common_title_kind()); switch (plugin.getDeployment()) { case AGENT: kindItem.setValue(MSG.view_admin_plugins_agent()); break; case SERVER: kindItem.setValue(MSG.view_admin_plugins_server()); break; } CanvasItem enabledItem = new CanvasItem("enabled", MSG.common_title_enabled()); Img img = new Img(ImageManager.getAvailabilityIcon(plugin.isEnabled()), 16, 16); enabledItem.setCanvas(img); StaticTextItem typeItem = new StaticTextItem("type", MSG.common_title_type()); typeItem.setValue(plugin.getType()); form.setItems( displayNameItem, nameItem, versionItem, ampsItem, md5Item, kindItem, descItem, pathItem, mtimeItem, enabledItem, typeItem); SectionStackSection section = new SectionStackSection(MSG.common_title_details()); section.setExpanded(true); section.setItems(form); detailsSection = section; ++initSectionCount; return; }