KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > packager > listeners > AddZip_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
23 import packager.model.*;
24
25 /**
26  * @author Dirk
27  *
28  * date: 13.04.2004
29  * project: DeployTool
30  *
31  * <p>
32  * This listener's execution method is called when the button "create zip" is pressed or the
33  * context menu-entry is called and a new zip name has been typed in.
34  * Everything what happens here is quite similar to the description in "AddFolder_li.java".
35  * No further explanation here.
36  * </p>
37  */

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

49     public void pcmf_execListener(base_guiObj xParam) throws Exception JavaDoc
50     {
51     base_treeView_if l_targetTree = (base_treeView_if)base_registredObject.pcmf_getObjByName("targetTree");
52     base_optionDlg_if l_dlg = (base_optionDlg_if)base_registredObject.pcmf_getObjByName("optDlg1");
53     base_appl_if l_appl = xParam.pcmf_getAppl();
54     String JavaDoc l_name = l_dlg.pcmf_getGuiObj().pcmf_getValue().toString();
55     MainModel l_model = (MainModel)xParam.pcmf_getAppl().pcmf_getGuiObj().pcmf_getModel();
56
57     try
58     {
59       base_treeNode l_node = (base_treeNode)l_appl.pcmf_getGuiObj().pcmf_newModelValue("newcontainer", false);
60       base_treeNode l_select = (base_treeNode)l_targetTree.pcmf_getValue();
61       if (l_select != null)
62       {
63         if (l_select.pcmf_getSubNode(l_name) != null)
64         {
65           base_treeNode l_message = (base_treeNode)l_appl.pcmf_getGuiObj().pcmf_newModelValue("errorMsg", false);
66           l_message.pcmf_setName("insert");
67           l_message.pcmf_setValue("similar node is already available");
68
69           l_model.pcmf_addMessage(l_message);
70           return;
71         }
72         l_node.pcmf_setValue("new zip://" + l_model.pcmf_getTarget().pcmf_getValue().toString() + "\\" + l_name);
73         l_select.pcmf_addNode(l_name, l_node);
74         l_select.pcmf_unhide();
75       };
76
77       l_targetTree.pcmf_repaint();
78     }
79     catch (Exception JavaDoc e)
80     {
81       base_treeNode l_message = (base_treeNode)l_appl.pcmf_getGuiObj().pcmf_newModelValue("errorMsg", false);
82       l_message.pcmf_setName("selection");
83       l_message.pcmf_setValue("no insert parent selected");
84
85       l_model.pcmf_addMessage(l_message);
86       return;
87     };
88
89     };
90 }
91
Popular Tags