diff options
Diffstat (limited to 'odk/examples/java/Inspector/MethodParametersDialog.java')
-rw-r--r-- | odk/examples/java/Inspector/MethodParametersDialog.java | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/odk/examples/java/Inspector/MethodParametersDialog.java b/odk/examples/java/Inspector/MethodParametersDialog.java index a2ebf7e66c41..803873703afb 100644 --- a/odk/examples/java/Inspector/MethodParametersDialog.java +++ b/odk/examples/java/Inspector/MethodParametersDialog.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.reflection.ParamInfo; @@ -63,7 +63,7 @@ public class MethodParametersDialog extends JDialog{ private ActionListener oActionListener; private JButton jHelpButton = new JButton("Help"); private JButton jOKButton = new JButton("Ok"); - private JButton jInvokeButton = new JButton("Invoke"); + private JButton jInvokeButton = new JButton("Invoke"); private Object m_oReturnButton = null; private Object m_oUnoObject = null; private Object m_oUnoReturnObject = null; @@ -71,8 +71,8 @@ public class MethodParametersDialog extends JDialog{ private JPanel jResultPanel = null; private boolean bisdiposed = false; private XUnoMethodNode m_xUnoMethodNode; - - + + public MethodParametersDialog(XUnoMethodNode _xUnoMethodNode){ m_xUnoMethodNode = _xUnoMethodNode; m_xIdlMethod = _xUnoMethodNode.getXIdlMethod(); @@ -80,8 +80,8 @@ public class MethodParametersDialog extends JDialog{ m_oUnoObject = m_xUnoMethodNode.getUnoObject(); Object[] m_aParameterObjects = new Object[m_aParamInfo.length]; } - - + + public Vector getMethodObjects() { super.setModal(true); addBorderPanel(getContentPane(), BorderLayout.NORTH); @@ -99,7 +99,7 @@ public class MethodParametersDialog extends JDialog{ for (int i = 0; i < m_aParameterPanels.length; i++){ m_aParameterPanels[i] = new ParameterPanel(m_aParamInfo[i]); jPnlParamContainer.add(m_aParameterPanels[i]); - } + } jPnlParamContainer.add(new ButtonPanel(), java.awt.BorderLayout.SOUTH); getContentPane().add(jPnlParamContainer, java.awt.BorderLayout.CENTER); pack(); @@ -108,7 +108,7 @@ public class MethodParametersDialog extends JDialog{ super.setFocusable(true); super.setFocusableWindowState(true); super.requestFocus(); - m_aParameterPanels[0].getInputComponent().requestFocusInWindow(); + m_aParameterPanels[0].getInputComponent().requestFocusInWindow(); setVisible(true); if (!bisdiposed){ Vector aMethodObjects = new Vector(); @@ -122,8 +122,8 @@ public class MethodParametersDialog extends JDialog{ return null; } } - - + + private void insertResultPanel(Exception _oInvocationException){ boolean bAddPanel = false; if (jResultPanel == null){ @@ -143,22 +143,22 @@ public class MethodParametersDialog extends JDialog{ } jResultPanel.add(jLblResult,BorderLayout.WEST); if (bAddPanel){ - int nPos = jPnlParamContainer.getComponentCount() - 1; + int nPos = jPnlParamContainer.getComponentCount() - 1; jPnlParamContainer.add(jResultPanel, nPos); } super.pack(); super.validate(); } - - + + private Object[] getParameterValues(){ Object[] oParameterValues = new Object[m_aParameterPanels.length]; for (int i = 0; i < m_aParameterPanels.length; i++){ oParameterValues[i] = m_aParameterPanels[i].getValue(); - } + } return oParameterValues; } - + private boolean isCompleted(){ boolean bIsCompleted = true; @@ -167,11 +167,11 @@ public class MethodParametersDialog extends JDialog{ if (!bIsCompleted){ break; } - } + } return bIsCompleted; } - - + + private void addBorderPanel(java.awt.Container _jContainer, String _sLayout){ JPanel jPnlBorder = new JPanel(); jPnlBorder.setPreferredSize(new java.awt.Dimension(10, 10)); @@ -184,8 +184,8 @@ public class MethodParametersDialog extends JDialog{ jPnlBorder.setMaximumSize(new java.awt.Dimension(10, 10)); _jContainer.add(jPnlBorder); } - - + + private class ParameterPanel extends JPanel{ private JComponent m_jComponent; private TypeClass m_aTypeClass = null; @@ -207,13 +207,13 @@ public class MethodParametersDialog extends JDialog{ addGapPanel(jPnlCenter1); switch (m_aTypeClass.getValue()){ case TypeClass.BOOLEAN_value: - jComboBox.setBackground(new java.awt.Color(255, 255, 255)); + jComboBox.setBackground(new java.awt.Color(255, 255, 255)); jComboBox.setPreferredSize(new java.awt.Dimension(50, 19)); jComboBox.addItem("True"); jComboBox.addItem("False"); jComboBox.addKeyListener(new UpdateUIAdapter()); jPnlCenter1.add(jComboBox); - m_jComponent = jComboBox; + m_jComponent = jComboBox; break; case TypeClass.BYTE_value: case TypeClass.CHAR_value: @@ -230,20 +230,20 @@ public class MethodParametersDialog extends JDialog{ jTextField.setPreferredSize(new java.awt.Dimension(50, 19)); jTextField.addKeyListener(new UpdateUIAdapter()); jPnlCenter1.add(jTextField); - m_jComponent = jTextField; + m_jComponent = jTextField; break; default: System.out.println("Type " + m_aTypeClass.getValue() + " not yet defined in 'ParameterPanel()'"); - } + } add(jPnlCenter1, java.awt.BorderLayout.CENTER); JPanel jPnlEast = new JPanel(); - add(jPnlEast, BorderLayout.EAST); + add(jPnlEast, BorderLayout.EAST); } - + private JComponent getInputComponent(){ return m_jComponent; } - + public Object getValue(){ Object oReturn = null; if (m_jComponent instanceof JTextField){ @@ -256,8 +256,8 @@ public class MethodParametersDialog extends JDialog{ } return oReturn; } - - + + public boolean isCompleted(){ if (m_jComponent instanceof JTextField){ return !((JTextField) m_jComponent).getText().equals(""); @@ -268,7 +268,7 @@ public class MethodParametersDialog extends JDialog{ } } - + private class UpdateUIAdapter extends KeyAdapter{ public void keyReleased(KeyEvent e){ boolean bIsCompleted = isCompleted(); @@ -280,8 +280,8 @@ public class MethodParametersDialog extends JDialog{ } } } - - + + private class ButtonPanel extends JPanel{ public ButtonPanel(){ @@ -295,7 +295,7 @@ public class MethodParametersDialog extends JDialog{ public void actionPerformed(ActionEvent e) { oActionListener.actionPerformed(e); } - }); + }); jHelpButton.setEnabled(oActionListener != null); jPnlBottomCenter.add(jHelpButton); addGapPanel(jPnlBottomCenter); @@ -305,7 +305,7 @@ public class MethodParametersDialog extends JDialog{ invokeParameterMethod(); dispose(); } - }); + }); jOKButton.setEnabled(isCompleted()); jInvokeButton.setEnabled(isCompleted()); jInvokeButton.addActionListener(new ActionListener() { @@ -313,7 +313,7 @@ public class MethodParametersDialog extends JDialog{ invokeParameterMethod(); } }); - + jPnlBottomCenter.add(jOKButton); addGapPanel(jPnlBottomCenter); jPnlBottomCenter.add(jInvokeButton); @@ -327,18 +327,18 @@ public class MethodParametersDialog extends JDialog{ dispose(); } }); - + jPnlBottomCenter.add(jCancelButton); add(jPnlBottomCenter); } } - - + + public void addActionListener(ActionListener _oActionListener){ oActionListener = _oActionListener; - jHelpButton.setEnabled(oActionListener != null); + jHelpButton.setEnabled(oActionListener != null); } - + public void invokeParameterMethod(){ try{ @@ -348,6 +348,6 @@ public class MethodParametersDialog extends JDialog{ } catch (Exception ex) { insertResultPanel(ex); m_oUnoReturnObject = null; - }} - + }} + } |