View Javadoc

1   /**
2    * The contents of this file are subject to the Mozilla Public License Version 1.1
3    * (the "License"); you may not use this file except in compliance with the License.
4    * You may obtain a copy of the License at http://www.mozilla.org/MPL/
5    * Software distributed under the License is distributed on an "AS IS" basis,
6    * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
7    * specific language governing rights and limitations under the License.
8    *
9    * The Original Code is ""  Description:
10   * ""
11   *
12   * The Initial Developer of the Original Code is University Health Network. Copyright (C)
13   * 2001.  All Rights Reserved.
14   *
15   * Contributor(s): ______________________________________.
16   *
17   * Alternatively, the contents of this file may be used under the terms of the
18   * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are
19   * applicable instead of those above.  If you wish to allow use of your version of this
20   * file only under the terms of the GPL and not to allow others to use your version
21   * of this file under the MPL, indicate your decision by deleting  the provisions above
22   * and replace  them with the notice and other provisions required by the GPL License.
23   * If you do not delete the provisions above, a recipient may use your version of
24   * this file under either the MPL or the GPL.
25   */
26  /*
27   * To change this template, choose Tools | Templates
28   * and open the template in the editor.
29   */
30  package ca.uhn.hl7v2.testpanel.ui;
31  
32  import java.net.URL;
33  import java.util.HashMap;
34  import java.util.Map;
35  
36  import javax.swing.Icon;
37  import javax.swing.ImageIcon;
38  
39  /**
40   * 
41   * @author James
42   */
43  public class ImageFactory {
44  	// ~ Static fields/initializers
45  	// -------------------------------------------------------------------------------------
46  
47  	private static Map<String, ImageIcon> ourIcons = new HashMap<String, ImageIcon>();
48  
49  	// ~ Methods
50  	// --------------------------------------------------------------------------------------------------------
51  
52  	public static ImageIcon getButtonExecute() {
53  		return getImageIcon("ca/uhn/hl7v2/testpanel/images/button_execute.png");
54  	}
55  
56  	public static ImageIcon getProfile() {
57  		return getImageIcon("ca/uhn/hl7v2/testpanel/images/profile.png");
58  	}
59  
60  	public static ImageIcon getProfileGroup() {
61  		return getImageIcon("ca/uhn/hl7v2/testpanel/images/new_tree.png");
62  	}
63  
64  	public static ImageIcon getFile() {
65  		return getImageIcon("ca/uhn/hl7v2/testpanel/images/file.png");
66  	}
67  
68  	public static ImageIcon getTable() {
69  		return getImageIcon("ca/uhn/hl7v2/testpanel/images/table.png");
70  	}
71  
72  	public static ImageIcon getNo() {
73  		return getImageIcon("ca/uhn/hl7v2/testpanel/images/no.png");
74  	}
75  
76  	private static ImageIcon getImageIcon(String theLocation) {
77  		ImageIcon retVal = ourIcons.get(theLocation);
78  
79  		if (retVal == null) {
80  			URL resource = ImageFactory.class.getClassLoader().getResource(theLocation);
81  			if (resource == null) {
82  				throw new Error(theLocation);
83  			}
84  			retVal = new ImageIcon(resource);
85  			ourIcons.put(theLocation, retVal);
86  		}
87  
88  		return retVal;
89  	}
90  
91  	public static ImageIcon getInterfaceOff() {
92  		return getImageIcon("ca/uhn/hl7v2/testpanel/images/interface_off.png");
93  	}
94  
95  	public static ImageIcon getHapi64() {
96  		return getImageIcon("ca/uhn/hl7v2/testpanel/images/hapi_64.png");
97  	}
98  
99  	public static ImageIcon getInterfaceOn() {
100 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/interface_on.png");
101 	}
102 
103 	public static Icon getInterfaceStarting() {
104 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/interface_starting.png");
105 	}
106 
107 	public static ImageIcon getMessageHl7() {
108 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/message_hl7.png");
109 	}
110 
111 	public static ImageIcon getMessageIn() {
112 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/message_in.png");
113 	}
114 
115 	public static ImageIcon getMessageOut() {
116 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/message_out.png");
117 	}
118 
119 	public static ImageIcon getMessageXml() {
120 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/message_xml.png");
121 	}
122 
123 	public static ImageIcon getTabLog() {
124 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/tab_log.png");
125 	}
126 
127 	public static ImageIcon getTest() {
128 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/test.png");
129 	}
130 
131 	public static ImageIcon getTestFailed() {
132 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/test_failed.png");
133 	}
134 
135 	public static ImageIcon getTestPassed() {
136 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/test_passed.png");
137 	}
138 
139 	public static ImageIcon getTestRunning() {
140 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/test_running.png");
141 	}
142 
143 	public static ImageIcon getTreeBundle() {
144 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/tree_bundle.png");
145 	}
146 
147 	public static ImageIcon getTreeLeaf() {
148 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/tree_leaf.png");
149 	}
150 
151 	public static ImageIcon getValFailed() {
152 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/val_failed.png");
153 	}
154 
155 	public static Icon getValFailedChild() {
156 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/val_failed_child.png");
157 	}
158 
159 	public static ImageIcon getValPassed() {
160 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/val_passed.png");
161 	}
162 
163 	public static ImageIcon getValPassedGreen() {
164 		return getImageIcon("ca/uhn/hl7v2/testpanel/images/val_passed_green.png");
165 	}
166 }