Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / examples / Simulator / DOVEBrowser / VisCompFactory.java
blob200d0113ec7d52d13a911c5027cc884b6b4af2ae
1 //
2 // = FILENAME
3 // VisCompFactory.java
4 //
5 // = AUTHOR
6 // Michael Kircher (mk1@cs.wustl.edu)
7 //
8 // = DESCRIPTION
9 // This class serves as factory for Visualization Components
11 // ============================================================================
13 import java.beans.*;
15 class VisCompFactory {
17 VisComp getNewVisComp (int property, String name) {
19 ClassLoader classLoader_ = this.getClass().getClassLoader();
21 VisComp visComp_ = null;
22 String visCompName_ = "VisComp";
23 switch (property) {
24 case Properties.DOUBLE:
25 visCompName_ = "Double"+visCompName_;
26 break;
27 case Properties.NAVIGATION:
28 visCompName_ = "Navigation"+visCompName_;
29 break;
30 case Properties.WEAPONS:
31 visCompName_ = "Weapons"+visCompName_;
32 break;
33 case Properties.PERSIAN:
34 visCompName_ = "Persian"+visCompName_;
35 break;
36 case Properties.MULTIDOUBLE:
37 visCompName_ = "MultiDouble"+visCompName_;
38 break;
39 default: return null;
41 try {
42 System.out.println ("Trying to connect: " + visCompName_+ " .. ");
43 visComp_ = (VisComp) Beans.instantiate (classLoader_, visCompName_);
44 visComp_.setName (name);
45 System.out.println ("Connected: " + visCompName_);
46 return visComp_;
48 catch (Exception e) {
49 System.out.println ("Unable to load JavaBean: " + e);
50 return null;