@Override public String toString() { StringBuilder buf = new StringBuilder(getDisplayValue(this, Tag.StudyDescription)); buf.append(" ["); //$NON-NLS-1$ buf.append(getDisplayValue(this, Tag.ModalitiesInStudy)); buf.append("] "); //$NON-NLS-1$ LocalDateTime studyDate = TagD.dateTime(Tag.StudyDate, Tag.StudyTime, this); if (studyDate != null) { buf.append(TagUtil.formatDateTime(studyDate)); buf.append(" "); //$NON-NLS-1$ } buf.append(getDisplayValue(this, Tag.AccessionNumber)); return buf.toString(); } };
private void writeStudyDateTime(StringBuilder html) { TagW tagDate = TagD.getNullable(Tag.StudyDate, null); if (tagDate != null && html != null && dcmItems != null) { LocalDateTime date = TagD.dateTime(Tag.StudyDateAndTime, dcmItems); if (date != null) { html.append("<B>"); //$NON-NLS-1$ html.append(tagDate.getDisplayedName()); html.append("</B>"); //$NON-NLS-1$ html.append(StringUtil.COLON_AND_SPACE); html.append(TagUtil.formatDateTime(date)); } } }
protected static String getFormattedText(Object value, String format) { if (value == null) { return StringUtil.EMPTY_STRING; } String str; if (value instanceof String) { str = (String) value; } else if (value instanceof String[]) { str = Arrays.asList((String[]) value).stream().collect(Collectors.joining("\\")); //$NON-NLS-1$ } else if (value instanceof TemporalAccessor) { str = TagUtil.formatDateTime((TemporalAccessor) value); } else if (value instanceof TemporalAccessor[]) { str = Stream.of((TemporalAccessor[]) value).map(TagUtil::formatDateTime).collect(Collectors.joining(", ")); //$NON-NLS-1$ } else if (value instanceof float[]) { float[] array = (float[]) value; str = IntStream.range(0, array.length).mapToObj(i -> String.valueOf(array[i])) .collect(Collectors.joining(", ")); //$NON-NLS-1$ } else if (value instanceof double[]) { str = DoubleStream.of((double[]) value).mapToObj(String::valueOf).collect(Collectors.joining(", ")); //$NON-NLS-1$ } else if (value instanceof int[]) { str = IntStream.of((int[]) value).mapToObj(String::valueOf).collect(Collectors.joining(", ")); //$NON-NLS-1$ } else { str = value.toString(); } if (StringUtil.hasText(format) && !"$V".equals(format.trim())) { //$NON-NLS-1$ return formatValue(str, value instanceof Float || value instanceof Double, format); } return str == null ? StringUtil.EMPTY_STRING : str; }
public String getDisplayName() { String desc = TagD.getTagValue(this, Tag.SeriesDescription, String.class); if (StringUtil.hasText(desc)) { return desc; } switch (type) { case NAME: return name; case DATE: return TagUtil.formatDateTime(date); case NONE: default: return DEFAULT_SERIE_NAME; } }
public String getToolTipText() { TagReadable s = (TagReadable) getUserObject(); Thumbnailable thumb = (Thumbnailable) s.getTagValue(TagW.Thumbnail); if (thumb != null) { try { File path = thumb.getThumbnailPath(); if (path != null) { URL url = path.toURI().toURL(); if (url != null) { StringBuilder buf = new StringBuilder(); buf.append("<html>"); //$NON-NLS-1$ buf.append("<img src=\""); //$NON-NLS-1$ buf.append(url.toString()); buf.append("\"><br>"); //$NON-NLS-1$ LocalDateTime date = TagD.dateTime(Tag.SeriesDate, Tag.SeriesTime, s); if (date != null) { buf.append(TagUtil.formatDateTime(date)); } buf.append("</html>"); //$NON-NLS-1$ return buf.toString(); } } } catch (Exception e) { LOGGER.error("Display tooltip", e); //$NON-NLS-1$ } } return null; }
public String getToolTipText() { TagReadable s = (TagReadable) getUserObject(); Thumbnailable thumb = (Thumbnailable) s.getTagValue(TagW.Thumbnail); if (thumb != null) { try { File path = thumb.getThumbnailPath(); if (path != null) { URL url = path.toURI().toURL(); if (url != null) { StringBuilder buf = new StringBuilder(); buf.append("<html>"); //$NON-NLS-1$ buf.append("<img src=\""); //$NON-NLS-1$ buf.append(url.toString()); buf.append("\"><br>"); //$NON-NLS-1$ LocalDateTime date = TagD.dateTime(Tag.SeriesDate, Tag.SeriesTime, s); if (date != null) { buf.append(TagUtil.formatDateTime(date)); } buf.append("</html>"); //$NON-NLS-1$ return buf.toString(); } } } catch (Exception e) { LOGGER.error("Display tooltip", e); //$NON-NLS-1$ } } return null; }
@Override public String getToolTipText(final MouseEvent evt) { Point pt = evt.getPoint(); final int index = locationToIndex(pt); final Rectangle thumBounds = getCellBounds(index, index); if (thumBounds == null || !thumBounds.contains(pt)) { return null; } final E item = getModel().getElementAt(index); if (item == null || item.getName() == null) { return null; } StringBuilder toolTips = new StringBuilder(); toolTips.append("<html>"); //$NON-NLS-1$ toolTips.append(item.getName()); toolTips.append("<br>"); //$NON-NLS-1$ toolTips.append(Messages.getString("JIThumbnailList.size")); //$NON-NLS-1$ toolTips.append(StringUtil.COLON_AND_SPACE); toolTips.append(FileUtil.humanReadableByte(item.getLength(), false)); toolTips.append("<br>"); //$NON-NLS-1$ toolTips.append(Messages.getString("JIThumbnailList.date")); //$NON-NLS-1$ toolTips.append(StringUtil.COLON_AND_SPACE); toolTips.append(TagUtil.formatDateTime(Instant.ofEpochMilli(item.getLastModified()))); toolTips.append("<br>"); //$NON-NLS-1$ toolTips.append("</html>"); //$NON-NLS-1$ return toolTips.toString(); }
if (date != null) { html.append(" * "); //$NON-NLS-1$ html.append(TagUtil.formatDateTime(date)); html.append(" - "); //$NON-NLS-1$ String name = TagD.getDicomPersonName(v.getString(Tag.VerifyingObserverName));
html.append(", "); //$NON-NLS-1$ html.append(TagUtil.formatDateTime(contentDateTime));