KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > xml > elements > specialpanels > XMLActualParametersTableControlPanel


1 /* XMLActualParametersListControlPanel.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
12 package org.enhydra.jawe.xml.elements.specialpanels;
13
14 import org.enhydra.jawe.xml.*;
15 import org.enhydra.jawe.xml.panels.*;
16 import org.enhydra.jawe.xml.elements.*;
17
18 import java.util.*;
19 import javax.swing.*;
20 import java.awt.*;
21 import java.awt.event.*;
22
23 /**
24  * Creates a control panel for table panel.
25  */

26 public class XMLActualParametersTableControlPanel extends XMLTableControlPanel {
27    public XMLActualParametersTableControlPanel (XMLCollection myOwner,
28                                                 String JavaDoc title, boolean isVertical,boolean hasBorder) {
29
30       super(myOwner,title,isVertical,hasBorder);
31
32       Dimension dim=getPreferredDimension(new String JavaDoc[]{"x"});
33       final XMLButton buttonView=new XMLButton("","ViewFormalParameters",dim);
34       buttonView.setToolTipText(XMLUtil.getLanguageDependentString("ViewFormalParametersKey"));
35
36       add(Box.createRigidArea(new Dimension(0,10)));
37       add(buttonView);
38
39       // action listener for viewing formal params
40
buttonView.addActionListener(new ActionListener() {
41                public void actionPerformed(ActionEvent e) {
42                   XMLGroupPanel gp=(XMLGroupPanel)getParent().getParent();
43                   XMLComboPanel cp=(XMLComboPanel)gp.getComponent(0);
44                   JComboBox cb=cp.getComboBox();
45                   Object JavaDoc sel=cp.getSelectedItem();
46                   if (!(sel instanceof XMLComplexElement)) return;
47                   XMLComplexElement selected=(XMLComplexElement)sel;
48                   if (selected==null) return;
49                   FormalParameters fps=(FormalParameters)selected.get("FormalParameters");
50                   if (fps==null) { // 'selected' is instance of Application
51
Object JavaDoc tmp=selected.get("Choice");
52                      tmp=((XMLChoice)tmp).getChoosen();
53                      if (tmp instanceof FormalParameters) {
54                         fps=(FormalParameters)tmp;
55                      }
56                   }
57                   if (fps!=null) {
58                      XMLElementDialog de=new XMLElementDialog(getDialog(),
59                                                               selected.toString() + " - " + fps.toLabel());
60                      de.editXMLElement(fps.getPanel(),false,false);
61                   }
62                   gp=(XMLGroupPanel)getParent();
63                   // if the position of ActualParameters' panel change on Tool
64
// or SubFlow panel, getComponent(2) should be also changed
65
XMLActualParametersPanel app=(XMLActualParametersPanel)gp.getComponent(0);
66
67                   app.setFormalParameters(fps);
68
69                   JTable t=((XMLTablePanel)controlledPanel).getTable();
70                   t.requestFocus();
71                }
72             });
73
74    }
75
76 }
77
78
Popular Tags