Horus Doc || Java GUI Reference || Doxygen's quick Index  

CorbaMethodDialog Class Reference

A dialog box for calling a Corba function. More...

List of all members.

Public Methods

 CorbaMethodDialog (JFrame frame, String intfName, String opName, java.lang.Object user)
 Constructor. More...

void addPair (String label, JComponent comp)
boolean valid ()
void actionPerformed (ActionEvent e)


Detailed Description

A dialog box for calling a Corba function.


Constructor & Destructor Documentation

CorbaMethodDialog::CorbaMethodDialog JFrame    frame,
String    intfName,
String    opName,
java.lang.Object    user
[inline]
 

Constructor.

00035 {
00036     super(frame, "CorbaMethodDialog", false);
00037 
00038     _user = user;
00039 
00040     IntRepManager irMgr = IntRepManager.defaultIrMgr();
00041     OperationDef opDef = irMgr.describeOperation(intfName, opName);
00042     if(opDef == null) {
00043         ErrorStreamArea.println("Operation "+opName+" not found in "+intfName);
00044         _opName = null;
00045         return;
00046     }
00047 
00048     getContentPane().add(createContents());
00049     getRootPane().setDefaultButton(_butOk);
00050 
00051     ParameterDescription[] parameters = opDef.params();
00052     _opName = opName;
00053     _nArgs = parameters.length;
00054     _argChoice = new CorbaObjectChoice[_nArgs];
00055 
00056     _resChoice = ChoiceFactory.getChoice(opDef.result());
00057     addPair(_resChoice.name(), _resChoice.inputRes());
00058 
00059     addPair("=", new JLabel("                              "));
00060 
00061     _objChoice = ChoiceFactory.getInterfaceChoice("IDL:HxCorba/"+intfName+":1.0", intfName);
00062     addPair(_objChoice.name(), _objChoice.inputObj());
00063 
00064     addPair(".", null);
00065     addPair(opName, null);
00066     addPair("(", null);
00067 
00068     for(int i=0; i<_nArgs; i++) {
00069         _argChoice[i] = ChoiceFactory.getChoice(parameters[i].type);
00070         addPair(_argChoice[i].name()+" "+parameters[i].name,
00071             _argChoice[i].inputArg());
00072 
00073         Any val = irMgr.getDefaultValue(intfName, opName, parameters[i].name);
00074         if(val != null) _argChoice[i].setInitialValue(val);
00075     }
00076 
00077     addPair(")", null);
00078 
00079     pack();
00080     setLocationRelativeTo(null);
00081 }


Member Function Documentation

void CorbaMethodDialog::addPair String    label,
JComponent    comp
[inline]
 

00084 {
00085     if(comp instanceof JTextField)
00086         ((JTextField)comp).addActionListener(this);
00087     else if(comp instanceof JComboBox)
00088         ((JComboBox)comp).getEditor().addActionListener(this);
00089 
00090     _panel.addPair(label, comp);
00091 }

boolean CorbaMethodDialog::valid   [inline]
 

00094 {
00095     return _opName != null;
00096 }

void CorbaMethodDialog::actionPerformed ActionEvent    e [inline]
 

00100 {
00101     if(!(e.getSource() instanceof JButton)) { //TextField or ComboBox
00102         _butOk.requestFocus();
00103         boolean done = doInvoke();
00104         if(done) setVisible(false);
00105     }
00106     else if (e.getActionCommand().equals("Apply")) {
00107         doInvoke();
00108     }
00109     else if (e.getActionCommand().equals("Ok")) {
00110         boolean done = doInvoke();
00111         if(done) setVisible(false);
00112     }
00113     else if(e.getActionCommand().equals("Cancel")) {
00114         setVisible(false);
00115     }
00116 }


The documentation for this class was generated from the following file:
Generated on Mon Jan 27 15:11:17 2003 for JavaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001