/** * Adds a new attachment. * * @param file The attachment to add. */ public void addAttachment(FileAnnotationData file) { long userID = MetadataViewerAgent.getUserDetails().getId(); if (time == null) { time = file.getLastModified(); resultsButton.setToolTipText("Analysis run " + UIUtilities.formatTime(time)); } if (file.getOwner().getId() == userID) deleteButton.setVisible(true); if (!attachments.contains(file)) attachments.add(file); }
/** * Displays information about the analysis. * * @param p The location of the mouse pressed. */ private void displayInformation(Point p) { StringBuffer buf = new StringBuffer(); buf.append("<html><body>"); buf.append("<b>Analysis Run: </b>" + UIUtilities.formatTime(time)); buf.append("<br>"); buf.append("<b>Number of files: </b>" + attachments.size()); buf.append("<br>"); Iterator<FileAnnotationData> i = attachments.iterator(); while (i.hasNext()) { buf.append(i.next().getFileName()); buf.append("<br>"); } buf.append("</body></html>"); JLabel l = new JLabel(); l.setText(buf.toString()); TinyDialog d = new TinyDialog(null, l, TinyDialog.CLOSE_ONLY); d.setModal(true); d.getContentPane().setBackground(UIUtilities.BACKGROUND_COLOUR_EVEN); SwingUtilities.convertPointToScreen(p, this); d.pack(); d.setLocation(p); d.setVisible(true); }