KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Raptor > listeners > openCBrowser_li


1 /*******************************************************************************
2  * Copyright (c) 2004, Dirk von der Weiden.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution.
6  *
7  * Contributors:
8  * Dirk von der Weiden - initial API and implementation
9  *
10  * Created on 04.04.2004
11  *
12  * date: 04.04.2004
13  * project: WiSer Builder
14  *
15  *******************************************************************************/

16
17 package Raptor.listeners;
18
19 import Jmc.baseGui.*;
20 import Jmc.commonGui.*;
21 import Jmc.connector.*;
22 import Jmc.baseTools.*;
23 import java.util.*;
24
25 import Raptor.model.*;
26
27 /**
28  * @author Dirk
29  *
30  * date: 13.02.2004
31  * project: WiSer-Builder
32  *
33  * <p>
34  * ...
35  * </p>
36  */

37 public class openCBrowser_li implements base_guiListener
38 {
39   private remote_treeNode pem_listEntries = new remote_treeNode("le");
40   private base_guiObj pem_input = null;
41   
42     /**
43      *
44      */

45     public openCBrowser_li() throws Exception JavaDoc
46     {
47         super();
48     }
49
50     /**
51          * <p>
52          * Does...
53          * </p><p>
54          *
55          * @return a Type with
56          * </p><p>
57          * @param
58          * </p>
59          */

60     public void pcmf_execListener(base_guiObj xParam) throws Exception JavaDoc
61     {
62     classBrowser l_cBrowser = new classBrowser();
63     Vector l_classes = null;
64     
65     base_dialog_if l_br = (base_dialog_if)base_registredObject.pcmf_getObjByName("CBrowser_dlg");
66     base_listBox_if l_list = (base_listBox_if)base_registredObject.pcmf_getObjByName("CBrowserList");
67     l_list.pcmf_clearListBox();
68     
69     // Liste leeren
70
this.pem_listEntries.pcmf_clearAndRelease();
71     
72     // zugehöriges Inputfeld setzen
73
this.pem_input = (base_guiObj)xParam.pcmf_getParentNode().pcmf_getSubNode("Input");
74     
75     // interface lesen
76
String JavaDoc l_if = ((base_guiObj)base_registredObject.pcmf_getObjByName("fact_interfaces")).pcmf_getValue().toString();
77     if (l_if.equals("N.A."))
78     {
79       raptor_mainModel l_model = (raptor_mainModel)xParam.pcmf_getAppl().pcmf_getGuiObj().pcmf_getModel();
80       l_model.pcmf_addMessage("- no factory-settings of this widget", raptor_mainModel.RAPTOR_INFO);
81       return;
82     };
83     
84     if (xParam.pcmf_getObjName().equals("viewSelect"))
85         l_if = "Jmc.baseTools.base_view";
86     
87     l_if = l_if.substring(0, l_if.indexOf(",") == -1?l_if.length():l_if.indexOf(","));
88     ((base_guiObj)base_registredObject.pcmf_getObjByName("CBrowserIf")).pcmf_setValue(l_if);
89     
90     Class JavaDoc l_cl = Class.forName(l_if);
91     
92     // Workaround für ServletContainer mit wegen ClassLoader
93
String JavaDoc l_addCp = (String JavaDoc)base_environment.pcmf_getParameter("environment.xml", "SERVLET", "CLASSPATH");
94     l_addCp = base_tools.pcmf_stringSubst(l_addCp, "{$ROOT}", base_environment.pcmf_getRootDir());
95     l_classes = l_cBrowser.pcmf_getClasses(l_addCp, l_cl);
96             
97     Iterator l_it = l_classes.iterator();
98     remote_treeNode l_node = null;
99     Class JavaDoc l_cl2 = null;
100     while (l_it.hasNext())
101     {
102       l_cl2=(Class JavaDoc)l_it.next();
103       l_node = new remote_treeNode(l_cl2.toString());
104       l_node.pcmf_setValue(l_cl2.toString());
105       l_node.pcmf_setIcon((base_image_if)base_registredObject.pcmf_getObjByName("class_icon"));
106       pem_listEntries.pcmf_addNode(l_cl2.toString(), l_node);
107       l_list.pcmf_addValueObj(l_cl2.toString(), l_node);
108     }
109     l_br.pcmf_displayDialog();
110     l_list.pcmf_setSelectedRow(0);
111     }
112   
113   public void pcmf_setSelection()
114   {
115     String JavaDoc l_res = (String JavaDoc)((base_listBox_if)base_registredObject.pcmf_getObjByName("CBrowserList")).pcmf_getValue();
116
117     if (l_res != null && l_res.equals("") == false)
118       this.pem_input.pcmf_setValue(l_res.substring(6));
119   }
120 }
Popular Tags