KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > xml > elements > Package


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

10
11 package org.enhydra.jawe.xml.elements;
12
13 import org.enhydra.jawe.xml.*;
14 import org.enhydra.jawe.xml.panels.*;
15
16 import java.util.*;
17 import javax.swing.*;
18 import javax.swing.tree.*;
19 import org.w3c.dom.*;
20
21 /**
22  * Represents the main element of WfMC schema.
23  */

24 public class Package extends XMLComplexElement {
25    private final static String JavaDoc XMLNS = "http://www.wfmc.org/2002/XPDL1.0";
26    private final static String JavaDoc XMLNS_XPDL = "http://www.wfmc.org/2002/XPDL1.0";
27    private final static String JavaDoc XMLNS_XSI = "http://www.w3.org/2001/XMLSchema-instance";
28    private final static String JavaDoc XSI_SCHEMA_LOCATION = "http://www.wfmc.org/2002/XPDL1.0 http://wfmc.org/standards/docs/TC-1025_schema_10_xpdl.xsd";
29
30    private transient XMLInterface xmlInterface;
31
32    private PackageHeader refPackageHeader=new PackageHeader();
33    private RedefinableHeader refRedefinableHeader=new RedefinableHeader(this); // min=0
34
private ConformanceClass refConformanceClass=new ConformanceClass(); // min=0
35
private Script refScript=new Script (); // min=0
36
private ExternalPackages refExternalPackages=new ExternalPackages(this); // min=0
37
private TypeDeclarations refTypeDeclarations=new TypeDeclarations(this); // min=0
38
private Participants refParticipants;
39    private Applications refApplications=new Applications(this); // min=0
40
private DataFields refDataFields=new DataFields(this); // min=0
41
private WorkflowProcesses refWorkflowProcesses=new WorkflowProcesses(this); // min=0
42
private ExtendedAttributes refExtendedAttributes=new ExtendedAttributes(this);
43
44    private Namespaces refNamespaces=new Namespaces(this);
45
46    private XMLAttribute attrId=new XMLAttribute("Id"); // required
47
private XMLAttribute attrName=new XMLAttribute("Name");
48
49    /**
50     * Indicates if this package is made by JaWE.
51     */

52    private String JavaDoc madeBy="";
53
54    /**
55     * If this package is made by JaWE, indicates it's version.
56     */

57    private String JavaDoc version="";
58
59    private Set allMyExternalPackages=new HashSet();
60    private DefaultTreeModel treeModel;
61    private DefaultMutableTreeNode myNode;
62
63    /** Enables canceling of changes to the extended attributes collection. */
64    private ExtendedAttributes clonedEAs;
65
66    /**
67     * Creates a new instance of the class.
68     *
69     * @param xmlInterface Instance of main class of this application.
70     */

71    public Package (XMLInterface xmlInterface) {
72       super();
73
74       this.xmlInterface=xmlInterface;
75
76       myNode=new DefaultMutableTreeNode(this);
77       treeModel=new DefaultTreeModel(myNode);
78
79       refParticipants=new Participants(this); // min=0
80

81       // create default xpdl namespace attribute
82
Namespace xpdlNS=new Namespace();
83       xpdlNS.set("Name","xpdl");
84       xpdlNS.set("location",XMLNS_XPDL);
85       xpdlNS.setReadOnly(true);
86       refNamespaces.add(xpdlNS);
87
88       fillStructure ();
89    }
90
91    /**
92     * Defines the super-class method. Read the explanation for
93     * this method within XMLComplexElement class.
94     */

95    protected void fillStructure () {
96       isRequired=true;
97       attrId.setRequired(true);
98       complexStructure.add(attrId);
99       attributes.add(attrId);
100       complexStructure.add(attrName);
101       attributes.add(attrName);
102       refPackageHeader.setRequired(true);
103       complexStructure.add(refPackageHeader);
104       complexStructure.add(refRedefinableHeader);
105       complexStructure.add(refConformanceClass);
106       complexStructure.add(refScript);
107       complexStructure.add(refExternalPackages);
108       complexStructure.add(refTypeDeclarations);
109       complexStructure.add(refParticipants);
110       complexStructure.add(refApplications);
111       complexStructure.add(refDataFields);
112       complexStructure.add(refWorkflowProcesses);
113       complexStructure.add(refExtendedAttributes);
114    }
115
116    public void setReadOnly (boolean ro) {
117       super.setReadOnly(ro);
118       refNamespaces.setReadOnly(ro);
119    }
120
121    /**
122     * Indicates if package read from XML document) is made by JaWE
123     *
124     * @return <tt>true</tt> if package is made by JaWE, <tt>false</tt> otherwise.
125     */

126    public boolean isMadeByJaWE () {
127       return madeBy.equals("JaWE");
128    }
129
130    /**
131     * Indicates which version of JaWE was package made by.
132     */

133    public String JavaDoc getVersion () {
134       return version;
135    }
136
137    /**
138     * Indicates which is the current version of JaWE.
139     */

140    public String JavaDoc getCurrentVersion () {
141       return "1.4.2";
142    }
143
144    public XMLInterface getXMLInterface () {
145       return xmlInterface;
146    }
147
148    /**
149     * Collects information about all newly inserted external
150     * packages, which root package is specified one, and which
151     * wasn't inserted until now.
152     */

153    protected void insertFromExternal (ExternalPackage ep) {
154       // all newly inserted packages
155
Package JavaDoc extP=xmlInterface.openPackage(ep.toString(),false);
156       // set the user.dir to the original
157
try {
158          System.setProperty("user.dir",xmlInterface.getParentDirectory(this));
159       } catch (Exception JavaDoc ex) {}
160       Set newlyInsertedPackages=extP.allMyExternalPackages;
161       newlyInsertedPackages.add(extP);
162       newlyInsertedPackages.removeAll(allMyExternalPackages);
163       newlyInsertedPackages.remove(this);
164       allMyExternalPackages.addAll(newlyInsertedPackages);
165       insertFromExternals(newlyInsertedPackages,extP);
166    }
167    /**
168     * Inserts all required entities from external packages specified
169     * within the set.
170     */

171    private void insertFromExternals (Set extPackages,Package JavaDoc beginAt) {
172       Iterator it=extPackages.iterator();
173       while (it.hasNext()) {
174          Package JavaDoc ext=(Package JavaDoc)it.next();
175          insertFromExternal(ext);
176       }
177       if (!isReadOnly()) {
178          if (beginAt!=null) {
179             insertNodeIntoModel(beginAt);
180          } else {
181             it=refExternalPackages.toCollection().iterator();
182             while (it.hasNext()) {
183                ExternalPackage ep=(ExternalPackage)it.next();
184                Package JavaDoc referencedP=xmlInterface.getExternalPackageByRelativeFilePath(ep.toString(),this);
185                if (referencedP!=null && allMyExternalPackages.contains(referencedP)) {
186                   insertNodeIntoModel(referencedP);
187                }
188             }
189          }
190       }
191
192    }
193
194    private void insertFromExternal (Package JavaDoc ep) {
195       refApplications.insertFromExternal(ep);
196       refParticipants.insertFromExternal(ep);
197       refWorkflowProcesses.insertFromExternal(ep);
198    }
199
200    public DefaultTreeModel getTreeModel() {
201       return treeModel;
202    }
203
204    //create tree with all nodes in XPDL definiton
205
public DefaultTreeModel getPackageTreeModel() {
206       return new DefaultTreeModel(getNode());
207    }
208
209    private void insertNodeIntoModel(Package JavaDoc extP) {
210
211       DefaultMutableTreeNode rn=new DefaultMutableTreeNode(extP);
212       int hmc=myNode.getChildCount();
213
214       treeModel.insertNodeInto(rn,myNode,hmc);
215
216       insertNodesRecursivly(rn);
217    }
218
219    private void insertNodesRecursivly(DefaultMutableTreeNode node) {
220       Package JavaDoc insertMyExtPackages=(Package JavaDoc)node.getUserObject();
221       if (insertMyExtPackages.refExternalPackages.size()>0) {
222          Iterator it=insertMyExtPackages.refExternalPackages.
223             toCollection().iterator();
224          while (it.hasNext()) {
225             String JavaDoc eps=((ExternalPackage)it.next()).toString();
226             Package JavaDoc child=xmlInterface.getExternalPackageByRelativeFilePath(eps,insertMyExtPackages);
227             //System.out.println("Pkg for "+eps+" is "+child);
228
if (child!=null) {
229                DefaultMutableTreeNode jr=new DefaultMutableTreeNode(child);
230                int hmc=node.getChildCount();
231                treeModel.insertNodeInto(jr,node,hmc);
232                if (!amIAlreadyInserted(jr)) {
233                   insertNodesRecursivly(jr);
234                }
235             }
236          }
237       }
238
239    }
240
241
242    private boolean amIAlreadyInserted (DefaultMutableTreeNode dmtn) {
243       Object JavaDoc[] userObjects=dmtn.getUserObjectPath();
244       Object JavaDoc userObj=dmtn.getUserObject();
245       if (userObjects==null || userObjects.length<2) {
246          return false;
247       }
248       for (int i=0; i<userObjects.length-1; i++) {
249          if (userObjects[i]==userObj) {
250             return true;
251          }
252       }
253       return false;
254    }
255
256    /**
257     * Checks if some entities from specified external package (and all
258     * packages that it references - except one that are referenced in
259     * some other way (e.g. cross-reference, or duplicated reference))
260     * are in use by this package elements.
261     *
262     * @return <tt>true</tt> if external reference can be removed (case
263     * when it's entities are not in use), <tt>false</tt> otherwise.
264     */

265    protected boolean canRemoveExternalPackage (ExternalPackage ep) {
266       Set toCheck=findAllPackagesToRemove(ep);
267       //System.out.println("All packages that need to be checked for removal are:"+toCheck);
268
Iterator itCheck=toCheck.iterator();
269       while (itCheck.hasNext()) {
270          Package JavaDoc pkg=(Package JavaDoc)itCheck.next();
271          //System.out.println("Checking package "+pkg);
272
WorkflowProcesses wps=(WorkflowProcesses)pkg.
273             get("WorkflowProcesses");
274          Participants ps=(Participants)pkg.
275             get("Participants");
276          Applications aps=(Applications)pkg.
277             get("Applications");
278
279          // check if any workflow process that is own directly by package
280
// p is referenced from subflow activity
281
Iterator it=wps.toCollection().iterator();
282          while (it.hasNext()) {
283             WorkflowProcess wp=(WorkflowProcess)it.next();
284             if (!refWorkflowProcesses.canRemoveElement(wp)) {
285                return false;
286             }
287          }
288          //System.out.println("Workflows are not in use");
289
// check if any participants are in use
290
it=ps.toCollection().iterator();
291          while (it.hasNext()) {
292             Participant p=(Participant)it.next();
293             // The first limitation is due to recursion
294
// if (!refParticipants.canRemoveElement(p)) {
295
if (!refParticipants.canRemoveParticipant(p)) {
296                return false;
297             }
298          }
299          //System.out.println("Participants are not in use");
300
// check if any application is in use by the tool of activity
301
it=aps.toCollection().iterator();
302          while (it.hasNext()) {
303             Application app=(Application)it.next();
304             // if (!refApplications.canRemoveElement(app)) {
305
if (!refApplications.canRemoveApplication(app)) {
306                return false;
307             }
308          }
309          //System.out.println("Applications are not in use");
310
}
311
312       return true;
313    }
314
315    protected void removeExternal (ExternalPackage ep) {
316       Set toRemove=findAllPackagesToRemove(ep);
317       // The top package to remove must be get here,
318
// before it is removed from hash table, otherwise
319
// the tree node will not be removed
320
Package JavaDoc pToRemove=xmlInterface.getExternalPackageByRelativeFilePath(ep.toString(),this);
321       //System.out.println("All packages that need to be removed are:"+toRemove);
322
Iterator itRemove=toRemove.iterator();
323       while (itRemove.hasNext()) {
324          Package JavaDoc pkg=(Package JavaDoc)itRemove.next();
325          //System.out.println("Removing package "+pkg);
326
refApplications.removeFromExternal(pkg);
327          //System.out.println("Apps are removed!");
328
refParticipants.removeFromExternal(pkg);
329          //System.out.println("Participants are removed!");
330
refWorkflowProcesses.removeFromExternal(pkg);
331          //System.out.println("Workflows are removed!");
332
xmlInterface.closePackage(pkg.get("Id").toString());
333          //System.out.println("Model is closed!");
334
allMyExternalPackages.remove(pkg);
335       }
336
337       // remove node from Jsplit pane tree
338
if (pToRemove!=null) {
339          removeNodeFromModel(pToRemove);
340          allMyExternalPackages.remove(pToRemove);
341          //System.out.println("Node is removed!");
342
}
343
344       // due to a calculating of packages to remove,
345
// the reference to removed ext. packes is left
346
// so it must be removed
347
//refExternalPackages.toCollection().remove(ep);
348
}
349
350    private void removeNodeFromModel(Package JavaDoc extP) {
351       for (Enumeration e=myNode.children(); e.hasMoreElements();) {
352          DefaultMutableTreeNode child=(DefaultMutableTreeNode)e.nextElement();
353          if (child.getUserObject()==extP) {
354             treeModel.removeNodeFromParent(child);
355             break;
356          }
357       }
358    }
359
360    private Set findAllPackagesToRemove (ExternalPackage ep) {
361       // Find which packages must be checked and removed if user wants
362
// to remove given external package reference,
363
// the procedure is as follows:
364
// 1. Put external package, and all packages that external
365
// package references, into one collection
366
// 2. Put all external packages and all packages that
367
// they are referencing (except the one to be removed)
368
// into second collection
369
// 3. Find the elements from 1. collection that are contained
370
// in 2. collection, and remove it from 1. collection
371
// 4. Return packages from 1. collection
372
// All this is done because of possible cross-reference of packages
373

374       // 1. step
375
Set firstColl=new HashSet();
376       Package JavaDoc toRemove=xmlInterface.getExternalPackageByRelativeFilePath(ep.toString(),this);
377       firstColl.add(toRemove);
378       //System.out.println("TRM="+toRemove);
379
firstColl.addAll(toRemove.allMyExternalPackages);
380
381       // 2. step
382
Set secondColl=new HashSet();
383       // first add this main package
384
secondColl.add(this);
385       Iterator it=refExternalPackages.toCollection().iterator();
386       while (it.hasNext()) {
387          ExternalPackage epack=(ExternalPackage)it.next();
388          if (epack!=ep) {
389             Package JavaDoc notToRemove=xmlInterface.getExternalPackageByRelativeFilePath(epack.toString(),this);
390             //System.out.println("NTRM="+notToRemove);
391
secondColl.add(notToRemove);
392             secondColl.addAll(notToRemove.allMyExternalPackages);
393          }
394       }
395
396       // 3. step
397
//System.out.println("First coll="+firstColl);
398
//System.out.println("Second coll="+secondColl);
399
firstColl.removeAll(secondColl);
400       //System.out.println("Result coll="+firstColl);
401
// 4. step
402
return firstColl;
403    }
404
405    /**
406     * Returns a workflow process with specified ID.
407     * <p>NOTE: This method should be called immediately after
408     * import of an XML file (during a creation of
409     * graph), otherwise it may
410     * not give the desired result.
411     *
412     * @param ID The 'Id' attribute of wanted instance of
413     * WorkflowProcess element defined within a
414     * XML file.
415     * @return Returns the instance of WorkflowProcess element
416     * that have the specified ID as an 'Id' attribute
417     * if it exist among all defined processes within
418     * package, if it doesn't exist, <tt>null</tt> is
419     * returned.
420     */

421    public WorkflowProcess getWorkflowProcess(String JavaDoc ID) {
422       return refWorkflowProcesses.getWorkflowProcess(ID);
423    }
424
425    /**
426     * Overrides super-class method to retreive the value
427     * of this class "Id" attribute.
428     * This is used when displaying instance of this class
429     * within dialog.
430     *
431     * @return The "Id" attribute value of this class.
432     */

433    public String JavaDoc toString() {
434       return attrId.toString();
435    }
436
437    /**
438     * Prepares the one of the group panels that contains some of
439     * this element editable fields.
440     *
441     * @param no The ordinal number of group panel to be shown.
442     * @return XMLPanel to be shown.
443     */

444    public XMLPanel getPanel (int no) {
445       XMLPanel p;
446       switch (no) {
447          case 1:
448             clonedEAs=(ExtendedAttributes)refExtendedAttributes.clone();
449             p=new XMLGroupPanel(this,
450                                 new XMLElement[] {
451                      attrId,
452                         attrName,
453                         refConformanceClass,
454                         refScript,
455                         clonedEAs
456                   },XMLUtil.getLanguageDependentString("GeneralKey"));
457             break;
458          case 2:
459             p=refPackageHeader.getPanel();
460             break;
461          case 3:
462             p=refRedefinableHeader.getPanel();
463             break;
464          case 4:
465             p=refExternalPackages.getPanel();
466             break;
467          case 5:
468             p=refTypeDeclarations.getPanel();
469             break;
470          case 6:
471             p=refParticipants.getPanel();
472             break;
473          case 7:
474             p=refApplications.getPanel();
475             break;
476          case 8:
477             p=refDataFields.getPanel();
478             break;
479          case 9:
480             p=refWorkflowProcesses.getPanel();
481             break;
482          case 10:
483             p=refNamespaces.getPanel();
484             break;
485          default:
486             p=new XMLPanel();
487       }
488       return p;
489    }
490
491
492    /**
493     * Prepares the tabbed panel to show editable fields of Package.
494     * Panel consists of nine tabs that logically comprises the
495     * Package elements to be edited.
496     * <p>NOTE: This method is never used, panels are retrieved one by one
497     * calling the method with the same name but with ordinal
498     * number of wanted panel as an argument.
499     *
500     * @return XMLPanel to be shown.
501     */

502    public XMLPanel getPanel () {
503       XMLPanel[] p=new XMLPanel[10];
504       for (int i=0; i<10; i++) {
505          p[i]=getPanel(i+1);
506       }
507       XMLTabbedPanel tp=new XMLTabbedPanel(this,p);
508
509       return tp;
510    }
511
512    // It is very important because of our parser to set
513
// user defined properties first
514
/**
515     * Overrides super-class method to realize this class specific
516     * writting to XML file.
517     *
518     * @return The string for a WfMC DTD Package element tag.
519     */

520    public void toXML (Node parent) throws DOMException {
521       // prepearing extended attributes
522

523       // remove all internally used ext. attribs
524
Set easToRemove=new HashSet();
525       // ************ Version ext. attrib.
526
ExtendedAttribute ea=new ExtendedAttribute(refExtendedAttributes);
527       ea.set("Name","Version");
528       ea.set("Value",getCurrentVersion());
529       ((ArrayList)refExtendedAttributes.toCollection()).add(0,ea);
530       easToRemove.add(ea);
531
532       // ************ MadeBy ext. attrib.
533
ea=new ExtendedAttribute(refExtendedAttributes);
534       ea.set("Name","MadeBy");
535       ea.set("Value","JaWE");
536       ((ArrayList)refExtendedAttributes.toCollection()).add(0,ea);
537       easToRemove.add(ea);
538
539       // ******** some stuff to put within attributes
540
Node node = ((Document) parent).createElement(name);
541       ((Element) node).setAttribute("xmlns", XMLNS);
542       //((Element) node).setAttribute("xmlns:xpdl", XMLNS_XPDL);
543
// save additional namespaces
544
Iterator itNs=refNamespaces.toCollection().iterator();
545       while (itNs.hasNext()) {
546          Namespace ns=(Namespace)itNs.next();
547          ((Element) node).setAttribute("xmlns:"+ns.get("Name").toString(),
548                                        ns.get("location").toString());
549       }
550       ((Element) node).setAttribute("xmlns:xsi", XMLNS_XSI);
551       ((Element) node).setAttribute("xsi:schemaLocation", XSI_SCHEMA_LOCATION);
552
553       for (Iterator it = complexStructure.iterator(); it.hasNext();) {
554          XMLElement el = (XMLElement) it.next();
555          el.toXML(node);
556       }
557       parent.appendChild(node);
558
559       //removing internally used ext. attribs - otherwise, it would be duplicated
560
refExtendedAttributes.toCollection().removeAll(easToRemove);
561    }
562
563    /**
564     * Overrides super-class method to realize this class specific
565     * reading from XML file.
566     *
567     * @param node root node
568     */

569    public void fromXML (Node node) {
570       refNamespaces.clear();
571       refConformanceClass.set("GraphConformance","");
572
573       processAttributes(node);
574       NamedNodeMap attribs=node.getAttributes();
575       for (int i=0; i<attribs.getLength(); i++) {
576          Node n=attribs.item(i);
577          String JavaDoc nn=n.getNodeName();
578          if (nn.startsWith("xmlns:") && !nn.equals("xmlns:xsi")) {
579             Namespace ns=new Namespace();
580             ns.set("Name",nn.substring(6,nn.length()));
581             ns.get("location").fromXML(n);
582             refNamespaces.add(ns);
583             if (nn.equals("xmlns:xpdl") && ns.get("location").toString().equalsIgnoreCase(XMLNS_XPDL)) {
584                ns.setReadOnly(true);
585             }
586          }
587       }
588
589       // now, when attributes are parsed, the id of package is known, and the
590
// prefix for generating IDs of all collections needs to be set
591
attrId.setReadOnly(true);
592       setIDPrefixForCollections ();
593
594       processElements(node);
595
596       //adjusting extended attrib. (if this is made by PE)
597
// remove all internally used ext. attribs
598
Set easToRemove=new HashSet();
599
600       // putting user defined properties where they belong
601
Iterator it=refExtendedAttributes.toCollection().iterator();
602       while (it.hasNext()) {
603          ExtendedAttribute eup=(ExtendedAttribute)it.next();
604          String JavaDoc ID=eup.get("Name").toValue().toString();
605
606          if (ID.equals("MadeBy") && madeBy.length()==0) {
607             madeBy=eup.get("Value").toValue().toString();
608             easToRemove.add(eup);
609          }
610          if (ID.equals("Version") && version.length()==0) {
611             version=eup.get("Value").toValue().toString();
612             easToRemove.add(eup);
613          }
614       }
615
616       //removing internally used ext. attribs - otherwise, it would
617
// be shown within ea list
618
refExtendedAttributes.toCollection().removeAll(easToRemove);
619
620    }
621
622    /** Sets proper ID prefix for all Id generators (XMLCollection class instances). */
623    public void setIDPrefixForCollections () {
624       String JavaDoc idPref=attrId.toValue().toString()+XMLCollectionElement.ID_DELIMITER;
625       refApplications.setIDPrefix(idPref+"App");
626       refDataFields.setIDPrefix(idPref+"Dat");
627       refParticipants.setIDPrefix(idPref+"Par");
628       refTypeDeclarations.setIDPrefix(idPref+"Typ");
629       refWorkflowProcesses.setIDPrefix(idPref+"Wor");
630    }
631
632    /**
633     * Returns a hashtable. The keys are external packages of this package,
634     * and values are Integers that describes the depth of external package
635     * within current package.
636     */

637    public Set getAllExternalPackages () {
638       return allMyExternalPackages;
639    }
640
641    /**
642     * Adds to collection of external packages the all packages that
643     * given external package references.
644     */

645    public void addExternalPackages(Package JavaDoc externalPkg) {
646       allMyExternalPackages.addAll(externalPkg.allMyExternalPackages);
647       allMyExternalPackages.remove(this);
648    }
649
650    /**
651     * Adds single external package to collection of external packages.
652     */

653    public void addExternalPackage(Package JavaDoc externalPkg) {
654       allMyExternalPackages.add(externalPkg);
655    }
656
657    /**
658     * Called after importing of XML file to insert entities from
659     * external packages, to set the proper Participant
660     * objects for Responsibles of Package and for every WorkflowProcess
661     * within a Package, according on Responsible ID's read from XML.
662     */

663    public void afterImporting () {
664       // first import all entities from externaly referenced packages
665
//System.out.println("After imporing for package "+toString()+" is called");
666
//System.out.println("I am pkg "+toString()+", my ext pkgs="+allMyExternalPackages);
667
insertFromExternals(allMyExternalPackages,null);
668
669       refRedefinableHeader.afterImporting();
670
671       // adjusting external packages
672
//refExternalPackages.afterImporting();
673

674       // adjusting responsibles for each workflow process,
675
// performer for each activity within workflow process
676
// and collecting workflow process information
677
Iterator it=refWorkflowProcesses.toCollection().iterator();
678       while (it.hasNext()) {
679          WorkflowProcess wp=(WorkflowProcess)it.next();
680          // collecting workflow process information
681
wp.afterImporting();
682       }
683
684    }
685
686    public boolean isValidEnter (XMLPanel p) {
687       // must be set in try-catch block because the panel
688
// can be either XMLTabbedPanel or XMLGroupPanel
689
try {
690          XMLTextPanel tp=(XMLTextPanel)((XMLGroupPanel)p).getPanel(0);
691          String JavaDoc IDToCheck=tp.getText();
692          if (!XMLCollection.isIdValid(IDToCheck)) {
693             String JavaDoc message=XMLUtil.getLanguageDependentString("ErrorIDMustBeValid");
694             String JavaDoc dialogTitle=XMLUtil.getLanguageDependentString("DialogIDIsNotValid");
695             XMLPanel.errorMessage(p.getDialog(),dialogTitle,"",message);
696             ((JTextField)tp.getComponent(2)).requestFocus();
697             return false;
698          }
699       } catch (Exception JavaDoc ex){}
700       try {
701          if (!refRedefinableHeader.isValidEnter(((XMLTabbedPanel)p).getTabbedPanel(2))) {
702             return false;
703          }
704       } catch (Exception JavaDoc ex) {}
705       if (clonedEAs!=null) {
706          complexStructure.remove(refExtendedAttributes);
707          refExtendedAttributes=clonedEAs;
708          complexStructure.add(12,refExtendedAttributes);
709       }
710       return true;
711    }
712
713 }
714
715
Popular Tags