KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > packager > listeners > SelectTarget_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 DeployTool
14  *
15  *******************************************************************************/

16
17 package packager.listeners;
18
19 import Jmc.baseGui.*;
20 import Jmc.baseTools.*;
21 import Jmc.commonGui.*;
22 import java.io.*;
23
24 import packager.model.*;
25
26 /**
27  * @author Dirk
28  *
29  * date: 13.04.2004
30  * project: DeployTool
31  *
32  * <p>
33  * This listener's execution method is called whenever a selection on the target tree-view has been made.
34  * </p>
35  */

36 public class SelectTarget_li implements base_guiListener
37 {
38   /**
39        * <p>
40        * Execution method of the listener
41        * </p><p>
42        *
43        * </p><p>
44        * @param xParam widget which provided the event
45        * </p>
46        */

47     public void pcmf_execListener(base_guiObj xParam) throws Exception JavaDoc
48     {
49     // get all relevant objects
50
base_treeView_if l_tree = (base_treeView_if)xParam;
51     base_text_if l_label = (base_text_if)base_registredObject.pcmf_getObjByName("targetLabel");
52     MainModel l_model = (MainModel)xParam.pcmf_getAppl().pcmf_getGuiObj().pcmf_getModel();
53     File l_file = null;
54     
55     // test whether a selection or an expansion event occurred - only selection is processed here
56
if (l_tree.pcmf_getToggled() == null && l_tree.pcmf_getValue() instanceof base_treeNode)
57     {
58       Object JavaDoc l_obj = ((base_treeNode)l_tree.pcmf_getValue()).pcmf_getValue();
59       if (l_obj instanceof File)
60       {
61         l_file = (File)((base_treeNode)l_tree.pcmf_getValue()).pcmf_getValue();
62         l_label.pcmf_getGuiObj().pcmf_setValue("Target: " + l_file.getAbsolutePath());
63       }
64       else
65         l_label.pcmf_getGuiObj().pcmf_setValue("Target: " + l_obj.toString());
66     
67       // set target in the main model
68
l_model.pcmf_setTarget(((base_treeNode)l_tree.pcmf_getValue()));
69       
70       // update views
71
l_model.pcmf_updateTargetView();
72     }
73     }
74 }
75
Popular Tags