File: SRGeneralContentItemEditPanel.java

package info (click to toggle)
dicomscope 3.6.0-28
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,256 kB
  • sloc: java: 22,911; cpp: 5,957; sh: 270; makefile: 45
file content (235 lines) | stat: -rw-r--r-- 6,790 bytes parent folder | download | duplicates (9)
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
/*
 *
 *  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.sr;

import java.util.*;
import java.net.*;
import  de.microtherapy.tools.text.document.dicom.*;

import java.awt.*;
import java.awt.event.*;

import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
import javax.swing.tree.*;

import main.*;
import J2Ci.*;

/**
 * This class contains an abstract class
 * for editing a Content Item in a SR.
 * Each Content Item contains of a Concept Name
 * and an optional ObservationDateTime.
 * This class is a JPanel with a BorderLayout.
 * In the north the GUI for visualising and changing the
 * Concept Name is placed. In the south the
 * field for the Observation Date Time is placed
 * <p>
 * In the constructor the JPanel is build. Each extending class 
 * have to implement the {@link initContentItemGUI} method. This method is used
 * for placing the returned component in the center of this panel.
 *
 * @author Klaus Kleber
 * @since 20.08.1999
 */
public abstract class SRGeneralContentItemEditPanel extends JPanel 
{
    
    /**
    * Enable/disable the Listener
    */
    protected boolean isListenerEnabled = false;
    
   
    /**
    * Contains the documentTree.
    */ 
    protected jDSRDocumentTree documentTree;
    
    
    SRCodeChangePanel srConceptNamePanel;
    /**
    * Contains the Observation Date Time
    */
    private JLabel observationDateTimeLabel= new JLabel();
    
    
    
    /**
    * The node id oft the Content Item. This
    * value will be used for changing the value in node of the
    * jDSRDocumentTree 
    */
    protected int nodeId;
    /**
    * The identification of the Content Item  type.
    */
    protected int type;
    
    /**
    * The name of the context group 
    */
    private String contextGroupName;
    
    /**
     * Constructor. Be aware that initContentItemGUI()
     * will be called for placing the returned JComponent
     * in the center of this panel
     * @param documentTree jDSRDocumentTree
     * @param nodeId Contains id of the node
     * @param type The identification of the Content Item  type.
     * @param contextGroupName The name of the context group 
    */
    public SRGeneralContentItemEditPanel( jDSRDocumentTree documentTree, 
                                        int nodeId, 
                                        int type, 
                                        String contextGroupName)
    {
        this.documentTree = documentTree;
        this.nodeId = nodeId;
        this.type = type;
        this.contextGroupName = contextGroupName;
        
        srConceptNamePanel = new SRCodeChangePanel(documentTree, 
                                                    nodeId, type, contextGroupName, SRCodeChangePanel.CONCEPT_NAME);
        //Sets the type name of the Content Item
        setBorder(new TitledBorder(jDSRE_ValueType.getVTName(type)));
        
        setLayout(new BorderLayout(5,5));
        add(srConceptNamePanel, BorderLayout.NORTH);
        JPanel mainPanel = new JPanel(new BorderLayout());
        mainPanel.setBorder(new TitledBorder("Value"));
        mainPanel.add(initContentItemGUI());
        add(mainPanel, BorderLayout.CENTER);
        add(getObservationDateTimePanel(), BorderLayout.SOUTH);
        
        update();
        
        
    }
    /**
    * Returns the node id oft the Content Item. This
    * value will be used for changing the value in node of the
    * jDSRDocumentTree 
    * @return Returns the node id of the Content Item.
    */
    public int getNodeId()
    {
        return nodeId;
    }
    
    
    
    /**
    * Return The identification of the Content Item  type.
    * @return The identification of the Content Item type.
    */
    public int getType()
    {
        return type;
    }
    
    /**
    * Return the name of the Context Group.
    * @Return the name of the Context Group.
    */
    public String getContextGroupName()
    {
        return contextGroupName;
    }
    /**
    * Sets the name of the Context Group.
    * @param the name of the Context Group.
    */
    public void setContextGroupName(String contextGroupName)
    {
         this.contextGroupName = contextGroupName;
        srConceptNamePanel.setContextGroupName(contextGroupName);
        
    }
    
    
    /**
    * Initialise and returns  a Component containting a GUI for editing the 
    * value of a Content Item. Each Content Type has to 
    * build his own GUI.
    * @return Component containting a GUI for editing the 
    * value of a Content Item.
    */
    public abstract JComponent initContentItemGUI();
    
    
    /**
    * Updates the codeValueBox and the observationLabelthe srEditComponent with
    * values from the node
    * <p>
    * For updating the srEditComponet the update() 
    * method of this object will be called
    */
    private void update()
    {
        //diable the listeners
        isListenerEnabled = false;
        
        
        srConceptNamePanel.updateCode();
        String observationDateTime = documentTree.getCurrentObservationDateTime();
        if (observationDateTimeLabel != null) observationDateTimeLabel.setText(observationDateTime);
        
        
        isListenerEnabled= true;
    }
    
    
    
          
    /***
    * Creates and returns the GUI for the observation date and time
    * @return the GUI for the observation date and time
    */
    private JPanel getObservationDateTimePanel()
    {
        JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
        p.add(new JLabel("Observation Date Time: "));
        p.add(observationDateTimeLabel);
        return p;
    }
}
/*
 *  CVS Log
 *  $Log: SRGeneralContentItemEditPanel.java,v $
 *  Revision 1.1.1.1  2001/06/06 10:32:30  kleber
 *  Init commit for DICOMscope 3.5
 *  Create new CVS
 *
*/