/** * Generate the appropriate HTML for pool name (redirected info if necessary) * * @param redirects * @param poolInfo * @return Pair of group and pool html */ public static PoolInfoHtml getPoolInfoHtml(Map<PoolInfo, PoolInfo> redirects, PoolInfo poolInfo) { String redirectAttributes = null; if (redirects != null) { PoolInfo destination = redirects.get(poolInfo); if (destination != null) { redirectAttributes = "Redirected to " + PoolInfo.createStringFromPoolInfo(destination); } } String spanTag = (redirectAttributes != null) ? "<span class=\"ui-state-disabled\" title=\"" + redirectAttributes + "\">" : "<span>"; String groupHtml = spanTag + poolInfo.getPoolGroupName() + "</span>"; String poolHtml = spanTag + (poolInfo.getPoolName() == null ? "-" : poolInfo.getPoolName()) + "</span>"; return new PoolInfoHtml(groupHtml, poolHtml); }
/** * True if should be shown for this filtering. * * @param poolInfo Pool info to check * @param poolGroupFilterSet Set of valid pool groups * @param poolInfoFilterSet Set of valid pool infos * @return True if should be shown. */ public static boolean showPoolInfo( PoolInfo poolInfo, Set<String> poolGroupFilterSet, Set<PoolInfo> poolInfoFilterSet) { // If there are no filters, show everything if (poolGroupFilterSet.isEmpty() && poolInfoFilterSet.isEmpty()) { return true; } if (poolGroupFilterSet.contains(poolInfo.getPoolGroupName())) { return true; } else if (poolInfoFilterSet.contains(poolInfo)) { return true; } return false; }