1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380
|
/*
*
* Copyright (C) 1999, Institute for MicroTherapy
*
* This software and supporting documentation were developed by
*
* University of Witten/Herdecke
* Department of Radiology and MicroTherapy
* Institute for MicroTherapy
* Medical computer science
*
* Universitaetsstrasse 142
* 44799 Bochum, Germany
*
* http://www.microtherapy.de/go/cs
* mailto:computer.science@microtherapy.de
*
* THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND THE INSTITUTE MAKES NO
* WARRANTY REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY
* OR FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES
* OR ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY
* AND PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
*
* Author : $Author: kleber $
* Last update : $Date: 2001/06/06 10:32:30 $
* Revision : $Revision: 1.1.1.1 $
* State: $State: Exp $
*/
package viewer.gui;
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
import java.util.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
import java.net.*;
import jToolkit.io.IconRetriever;
import J2Ci.*;
/**
* Contains the GUI for the status line.
* The is context sensitve. For each DSComponentType
* There is a seperate view.
*/
public class SignatureOverview extends JDialog
{
private JTabbedPane tab = new JTabbedPane();
private jDVInterface dvi;
private int numberOfValidPSSignatures;
private int numberOfUntrustedPSSignatures;
private int numberOfInvalidPSSignatures;
private int numberOfValidImageSignatures;
private int numberOfUntrustedImageSignatures;
private int numberOfInvalidImageSignatures;
private int numberOfValidSRSignatures;
private int numberOfUntrustedSRSignatures;
private int numberOfInvalidSRSignatures;
private InfoPanel imagePanel;
private InfoPanel psPanel;
private InfoPanel srPanel;
private OverviewPanel overViewPanel;
/**
* Contains a virtual URL. If the JEditorPane
* will be initialized with a String anchor in the
* HTML side cannot be resolved. Futhermore there HyperlinksEvents
* doesn't contain any URL. For this reason we set this ULR as base for
* the HTMLDocument in the JEditorPane
*/
private String helpCodeBase = "file://help/text.html";
public SignatureOverview(jDVInterface dvi)
{
super();
setTitle("Signature Status");
setModal(true);
this.dvi = dvi;
setLocation(200,200);
setSize(500,300);
JPanel centerPanel = new JPanel (new BorderLayout());
centerPanel.setBorder(new EtchedBorder());
getContentPane().setLayout(new BorderLayout());
getContentPane().add(centerPanel, BorderLayout.CENTER);
overViewPanel= new OverviewPanel();
imagePanel = new InfoPanel(jDVPSObjectType.DVPSS_image);
psPanel = new InfoPanel(jDVPSObjectType.DVPSS_presentationState);
srPanel = new InfoPanel(jDVPSObjectType.DVPSS_structuredReport);
tab.add("Overview",overViewPanel);
tab.add("Structured Report", srPanel);
tab.add("Image",imagePanel);
tab.add("Presentation State", psPanel);
centerPanel.add(tab);
JPanel buttonPanel = new JPanel();
JButton okButton = new JButton("OK");
okButton.setToolTipText("Close");
okButton.addActionListener(new CloseAction());
buttonPanel.add(okButton);
getContentPane().add(buttonPanel, BorderLayout.SOUTH);
setLocation(200,200);
}
public void setVisible(boolean flag, String type)
{
if (type.equals("Report"))tab.setSelectedComponent(srPanel);
else tab.setSelectedComponent(overViewPanel);
this.setVisible(flag);
}
public void setVisible(boolean flag)
{
if (flag)
{
imagePanel.updateHTML();
psPanel.updateHTML();
srPanel.updateHTML();
overViewPanel.updateValues();
}
super.setVisible(flag);
}
/**
* CloseAction
*/
public class CloseAction extends AbstractAction
{
public CloseAction()
{
super("Close");
}
public void actionPerformed(java.awt.event.ActionEvent e)
{
setVisible(false);
}
}
public class OverviewPanel extends JScrollPane
{
JLabel numberOfValidPSSignatureLabel = new JLabel();
JLabel numberOfUntrustedPSSignatureLabel= new JLabel();
JLabel numberOfInvalidPSSignatureLabel= new JLabel();
JLabel numberOfValidImageSignatureLabel= new JLabel();
JLabel numberOfUntrustedImageSignatureLabel= new JLabel();
JLabel numberOfInvalidImageSignatureLabel= new JLabel();
JLabel numberOfValidSRSignatureLabel= new JLabel();
JLabel numberOfUntrustedSRSignatureLabel= new JLabel();
JLabel numberOfInvalidSRSignatureLabel= new JLabel();
JLabel totalNumberOfValidSignatureLabel= new JLabel();
JLabel totalNumberOfUntrustedSignatureLabel= new JLabel();
JLabel totalNumberOfInvalidSignatureLabel= new JLabel();
int strutSize =5;
public OverviewPanel()
{
super();
JPanel p = new JPanel();
p.setBackground(Color.white);
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
p.setLayout(gbl);
//First line : header
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = 1;
gbc.weightx = 0;
gbc.insets = new Insets(0,0,0,0);
p.add(Box.createVerticalStrut(strutSize));
p.add(new JLabel(""), gbc);
gbc.anchor = GridBagConstraints.CENTER;
jToolkit.io.IconRetriever ir = new jToolkit.io.IconRetriever ();
p.add(Box.createHorizontalStrut(strutSize));
p.add(new JLabel(ir.getIcon(main.MainContext.iconPath+"valid.gif")), gbc);
p.add(Box.createHorizontalStrut(strutSize));
p.add(new JLabel(ir.getIcon(main.MainContext.iconPath+"untrusted.gif")), gbc);
gbc.gridwidth = GridBagConstraints.REMAINDER;
p.add(Box.createHorizontalStrut(strutSize));
p.add(new JLabel(ir.getIcon(main.MainContext.iconPath+"invalid.gif")), gbc);
//Second line
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = 1;
gbc.weightx = 0;
gbc.insets = new Insets(0,0,0,0);
p.add(Box.createVerticalStrut(strutSize));
JLabel nl = new JLabel("Structured Report: ");
Font f = nl.getFont();
Font headerFont = new Font(f.getName(), f.BOLD+f.ITALIC, ( f.getSize()+(int)( f.getSize()*0.2f)));
nl.setFont(headerFont);
p.add(nl, gbc);
gbc.anchor = GridBagConstraints.CENTER;
p.add(Box.createHorizontalStrut(strutSize));
p.add(numberOfValidSRSignatureLabel, gbc);
p.add(Box.createHorizontalStrut(strutSize));
p.add(numberOfUntrustedSRSignatureLabel, gbc);
gbc.gridwidth = GridBagConstraints.REMAINDER;
p.add(Box.createHorizontalStrut(strutSize));
p.add(numberOfInvalidSRSignatureLabel, gbc);
p.add(Box.createVerticalStrut(strutSize));
//line 3: image
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = 1;
gbc.weightx = 0;
gbc.insets = new Insets(0,0,0,0);
nl = new JLabel("Image: ");
nl.setFont(headerFont);
p.add(nl, gbc);
gbc.anchor = GridBagConstraints.CENTER;
p.add(Box.createHorizontalStrut(strutSize));
p.add(numberOfValidImageSignatureLabel, gbc);
p.add(Box.createHorizontalStrut(strutSize));
p.add(numberOfUntrustedImageSignatureLabel, gbc);
gbc.gridwidth = GridBagConstraints.REMAINDER;
p.add(Box.createHorizontalStrut(strutSize));
p.add(numberOfInvalidImageSignatureLabel, gbc);
p.add(Box.createVerticalStrut(strutSize));
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = 1;
gbc.weightx = 0;
gbc.insets = new Insets(0,0,0,0);
nl = new JLabel("Presentation State: ");
nl.setFont(headerFont);
p.add(nl, gbc);
gbc.anchor = GridBagConstraints.CENTER;
p.add(Box.createHorizontalStrut(strutSize));
p.add(numberOfValidPSSignatureLabel, gbc);
p.add(Box.createHorizontalStrut(strutSize));
p.add(numberOfUntrustedPSSignatureLabel, gbc);
gbc.gridwidth = GridBagConstraints.REMAINDER;
p.add(Box.createHorizontalStrut(strutSize));
p.add(numberOfInvalidPSSignatureLabel, gbc);
gbc.anchor= GridBagConstraints.NORTH;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(0,0,10,0);
p.add(new JSeparator(), gbc);
p.add(Box.createVerticalStrut(strutSize));
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.NONE;
gbc.gridwidth = 1;
gbc.weightx = 0;
gbc.insets = new Insets(0,0,0,0);
nl = new JLabel("Total: ");
nl.setFont(headerFont);
p.add(nl, gbc);
gbc.anchor = GridBagConstraints.CENTER;
p.add(Box.createHorizontalStrut(strutSize));
p.add(totalNumberOfValidSignatureLabel, gbc);
p.add(Box.createHorizontalStrut(strutSize));
p.add(totalNumberOfUntrustedSignatureLabel, gbc);
gbc.gridwidth = GridBagConstraints.REMAINDER;
p.add(Box.createHorizontalStrut(strutSize));
p.add(totalNumberOfInvalidSignatureLabel, gbc);
setViewportView(p);
}
public void updateValues()
{
int type;
type = jDVPSObjectType.DVPSS_presentationState;
int numberOfValidPSSignatures = dvi.getNumberOfCorrectSignatures(type);
int numberOfUntrustedPSSignatures = dvi.getNumberOfUntrustworthySignatures(type);
int numberOfInvalidPSSignatures= dvi.getNumberOfCorruptSignatures(type);
numberOfValidPSSignatureLabel.setText(new Integer(numberOfValidPSSignatures).toString());
numberOfUntrustedPSSignatureLabel.setText(new Integer(numberOfUntrustedPSSignatures).toString());
numberOfInvalidPSSignatureLabel.setText(new Integer(numberOfInvalidPSSignatures).toString());
type = jDVPSObjectType.DVPSS_image;
int numberOfValidImageSignatures= dvi.getNumberOfCorrectSignatures(type);
int numberOfUntrustedImageSignatures= dvi.getNumberOfUntrustworthySignatures(type);
int numberOfInvalidImageSignatures= dvi.getNumberOfCorruptSignatures(type);
numberOfValidImageSignatureLabel.setText(new Integer(numberOfValidImageSignatures).toString());
numberOfUntrustedImageSignatureLabel.setText(new Integer(numberOfUntrustedImageSignatures).toString());
numberOfInvalidImageSignatureLabel.setText(new Integer(numberOfInvalidImageSignatures).toString());
type = jDVPSObjectType.DVPSS_structuredReport;
int numberOfValidSRSignatures= dvi.getNumberOfCorrectSignatures(type);
int numberOfUntrustedSRSignatures= dvi.getNumberOfUntrustworthySignatures(type);
int numberOfInvalidSRSignatures = dvi.getNumberOfCorruptSignatures(type);
numberOfValidSRSignatureLabel.setText(new Integer(numberOfValidSRSignatures).toString());
numberOfUntrustedSRSignatureLabel.setText(new Integer(numberOfUntrustedSRSignatures).toString());
numberOfInvalidSRSignatureLabel.setText(new Integer(numberOfInvalidSRSignatures).toString());
int totalNumberOfValidSignatures= numberOfValidPSSignatures+numberOfValidImageSignatures+numberOfValidSRSignatures;
int totalNumberOfUntrustedSignatures=numberOfUntrustedPSSignatures+numberOfUntrustedImageSignatures+numberOfUntrustedSRSignatures;
int totalNumberOfInvalidSignatures = numberOfInvalidPSSignatures+numberOfInvalidImageSignatures+numberOfInvalidSRSignatures;
totalNumberOfValidSignatureLabel.setText(new Integer(totalNumberOfValidSignatures).toString());
totalNumberOfUntrustedSignatureLabel.setText(new Integer(totalNumberOfUntrustedSignatures).toString());
totalNumberOfInvalidSignatureLabel.setText(new Integer(totalNumberOfInvalidSignatures).toString());
repaint();
}
}
private class InfoPanel extends JScrollPane
{
int type;
boolean overview;
JReferenceEditorPane editorPane = new JReferenceEditorPane();
public InfoPanel()
{
this(-1, true);
}
public InfoPanel(int type)
{
this(type, false);
}
private InfoPanel(int type, boolean overview)
{
super();
this.type = type;
this.overview = overview;
HTMLEditorKit eKit;
HTMLDocument doc ;
//JEditorPane
editorPane.setEditable(false);
editorPane.setContentType("text/html");
editorPane.setEditable(false);
eKit = new HTMLEditorKit();
editorPane.setEditorKit(eKit);
setViewportView(editorPane);
}
public void updateHTML()
{
String s= "";
if (overview)s= dvi.getCurrentSignatureValidationOverview();
else s= dvi.getCurrentSignatureValidationHTML(type);
editorPane.setText(s);
}
}
}
/*
* CVS Log
* $Log: SignatureOverview.java,v $
* Revision 1.1.1.1 2001/06/06 10:32:30 kleber
* Init commit for DICOMscope 3.5
* Create new CVS
*
*/
|