@Test public void tooltipTypes() { types.add(FIRST_TYPE); types.add(SECOND_TYPE); assertThat(DisplayUtil.getTooltipText(node)) .contains(types.toString()); }
public static String getTooltipText(GraphEntity entity) { Map<String, Object> properties = entity.getPropertyContainer().getProperties(); String start = "<p width=\"" + LABEL_TEXT_WIDTH + "px\"><b>"; String typesRepresentation = entity.isTypesSingle() ? entity.getTypes().get(0) : entity.getTypes().toString(); StringBuilder sb = new StringBuilder(start) .append(entity.getTypesName()) .append("</b>: ") .append(typesRepresentation) .append("</p>"); Stream<Map.Entry<String, Object>> strings = properties.entrySet().stream() .filter(IS_STRING_VALUE) .limit(MAX_TOOLTIP_PROPERTIES); Stream<Map.Entry<String, Object>> other = properties.entrySet().stream() .filter(IS_STRING_VALUE.negate()) .limit(MAX_TOOLTIP_PROPERTIES); Stream.concat(strings, other) .limit(MAX_TOOLTIP_PROPERTIES) .forEach(entry -> sb.append(start) .append(entry.getKey()) .append("</b>: ") .append(truncate(entry.getValue().toString(), MAX_TEXT_LENGTH)) .append("</p>") ); if (properties.size() > MAX_TOOLTIP_PROPERTIES) { sb.append("<p>...</p>"); } return "<html>" + sb.toString() + "</html>"; }
DisplayUtil { public static String getTooltipText(GraphEntity entity) { Map<String, Object> properties = entity.getPropertyContainer().getProperties(); String start = "<p width=\"" + LABEL_TEXT_WIDTH + "px\"><b>"; String typesRepresentation = entity.isTypesSingle() ? entity.getTypes().get(0) : entity.getTypes().toString(); StringBuilder sb = new StringBuilder(start) .append(entity.getTypesName()) .append("</b>: ") .append(typesRepresentation) .append("</p>"); Stream<Map.Entry<String, Object>> strings = properties.entrySet().stream() .filter(IS_STRING_VALUE) .limit(MAX_TOOLTIP_PROPERTIES); Stream<Map.Entry<String, Object>> other = properties.entrySet().stream() .filter(IS_STRING_VALUE.negate()) .limit(MAX_TOOLTIP_PROPERTIES); Stream.concat(strings, other) .limit(MAX_TOOLTIP_PROPERTIES) .forEach(entry -> sb.append(start) .append(entry.getKey()) .append("</b>: ") .append(truncate(entry.getValue().toString(), MAX_TEXT_LENGTH)) .append("</p>") ); if (properties.size() > MAX_TOOLTIP_PROPERTIES) { sb.append("<p>...</p>"); } return "<html>" + sb.toString() + "</html>"; } }
DisplayUtil { public static String getTooltipText(GraphEntity entity) { Map<String, Object> properties = entity.getPropertyContainer().getProperties(); String start = "<p width=\"" + LABEL_TEXT_WIDTH + "px\"><b>"; String typesRepresentation = entity.isTypesSingle() ? entity.getTypes().get(0) : entity.getTypes().toString(); StringBuilder sb = new StringBuilder(start) .append(entity.getTypesName()) .append("</b>: ") .append(typesRepresentation) .append("</p>"); Stream<Map.Entry<String, Object>> strings = properties.entrySet().stream() .filter(IS_STRING_VALUE) .limit(MAX_TOOLTIP_PROPERTIES); Stream<Map.Entry<String, Object>> other = properties.entrySet().stream() .filter(IS_STRING_VALUE.negate()) .limit(MAX_TOOLTIP_PROPERTIES); Stream.concat(strings, other) .limit(MAX_TOOLTIP_PROPERTIES) .forEach(entry -> sb.append(start) .append(entry.getKey()) .append("</b>: ") .append(truncate(entry.getValue().toString(), MAX_TEXT_LENGTH)) .append("</p>") ); if (properties.size() > MAX_TOOLTIP_PROPERTIES) { sb.append("<p>...</p>"); } return "<html>" + sb.toString() + "</html>"; }  }
DisplayUtil { public static String getTooltipText(GraphEntity entity) { Map<String, Object> properties = entity.getPropertyContainer().getProperties(); String start = "<p width=\"" + LABEL_TEXT_WIDTH + "px\"><b>"; String typesRepresentation = entity.isTypesSingle() ? entity.getTypes().get(0) : entity.getTypes().toString(); StringBuilder sb = new StringBuilder(start) .append(entity.getTypesName()) .append("</b>: ") .append(typesRepresentation) .append("</p>"); Stream<Map.Entry<String, Object>> strings = properties.entrySet().stream() .filter(IS_STRING_VALUE) .limit(MAX_TOOLTIP_PROPERTIES); Stream<Map.Entry<String, Object>> other = properties.entrySet().stream() .filter(IS_STRING_VALUE.negate()) .limit(MAX_TOOLTIP_PROPERTIES); Stream.concat(strings, other) .limit(MAX_TOOLTIP_PROPERTIES) .forEach(entry -> sb.append(start) .append(entry.getKey()) .append("</b>: ") .append(truncate(entry.getValue().toString(), MAX_TEXT_LENGTH)) .append("</p>") ); if (properties.size() > MAX_TOOLTIP_PROPERTIES) { sb.append("<p>...</p>"); } return "<html>" + sb.toString() + "</html>"; }  static String getProperty(GraphNode node); static String getType(GraphNode node); static String getTooltipTitle(GraphEntity entity); static String getTooltipText(GraphEntity entity); }
DisplayUtil { public static String getTooltipText(GraphEntity entity) { Map<String, Object> properties = entity.getPropertyContainer().getProperties(); String start = "<p width=\"" + LABEL_TEXT_WIDTH + "px\"><b>"; String typesRepresentation = entity.isTypesSingle() ? entity.getTypes().get(0) : entity.getTypes().toString(); StringBuilder sb = new StringBuilder(start) .append(entity.getTypesName()) .append("</b>: ") .append(typesRepresentation) .append("</p>"); Stream<Map.Entry<String, Object>> strings = properties.entrySet().stream() .filter(IS_STRING_VALUE) .limit(MAX_TOOLTIP_PROPERTIES); Stream<Map.Entry<String, Object>> other = properties.entrySet().stream() .filter(IS_STRING_VALUE.negate()) .limit(MAX_TOOLTIP_PROPERTIES); Stream.concat(strings, other) .limit(MAX_TOOLTIP_PROPERTIES) .forEach(entry -> sb.append(start) .append(entry.getKey()) .append("</b>: ") .append(truncate(entry.getValue().toString(), MAX_TEXT_LENGTH)) .append("</p>") ); if (properties.size() > MAX_TOOLTIP_PROPERTIES) { sb.append("<p>...</p>"); } return "<html>" + sb.toString() + "</html>"; }  static String getProperty(GraphNode node); static String getType(GraphNode node); static String getTooltipTitle(GraphEntity entity); static String getTooltipText(GraphEntity entity);  }