KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > actions > ExternalPackages


1 /*
2  * Authors:
3  * Stefanovic Nenad chupo@iis.ns.ac.yu
4  * Bojanic Sasa sasaboy@neobee.net
5  * Puskas Vladimir vpuskas@eunet.yu
6  * Pilipovic Goran zboniek@uns.ac.yu
7  *
8  */

9
10 package org.enhydra.jawe.actions;
11
12 import org.enhydra.jawe.*;
13 import org.enhydra.jawe.xml.*;
14 import org.enhydra.jawe.xml.panels.*;
15
16 import javax.swing.*;
17 import java.util.*;
18 import java.awt.event.ActionEvent JavaDoc;
19
20
21 /**
22  * Class that realizes <B>external packages</B> action.
23  */

24 public class ExternalPackages extends ActionBase {
25
26    public ExternalPackages (PackageEditor editor) {
27       super(editor);
28    }
29
30    public void actionPerformed(ActionEvent JavaDoc e) {
31       PackageEditor pe=(PackageEditor)editor;
32       if (!pe.isInitialized()) {
33          pe.enterPackageID();
34       }
35       if (JaWE.getInstance().getFilename()==null) {
36          String JavaDoc msg=ResourceManager.getLanguageDependentString(
37             "InformationFileNeedToBeSavedBeforeAddingExternalPackages");
38          JaWE.getInstance().message(msg,JOptionPane.INFORMATION_MESSAGE);
39          return;
40       }
41       XMLPanel p=pe.getXMLPackage().getPanel(4);
42
43       XMLElementDialog d=new XMLElementDialog((JFrame)pe.getWindow(),
44          ResourceManager.getLanguageDependentString("PackageKey")+" '"+
45          pe.getXMLPackage().get("Id").toString()+"' - "+
46          ResourceManager.getLanguageDependentString("ExternalPackagesKey"));
47       Set pre=new HashSet(JaWE.getInstance().getXMLInterface().getAllPackageIds());
48       d.editXMLElement(p,false,false);
49       Set post=new HashSet(JaWE.getInstance().getXMLInterface().getAllPackageIds());
50       // CREATES GRAPHS FOR NEWLY INSERTED EXTERNAL PACKAGES
51
post.removeAll(pre);
52       Iterator it=post.iterator();
53       while (it.hasNext()) {
54          pe.createGraphForPackage(JaWE.getInstance().getXMLInterface().getPackageById((String JavaDoc)it.next()),true);
55       }
56    }
57 }
58
Popular Tags