⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eventmanagerui.java

📁 Software Testing Automation Framework (STAF)的开发代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                }            };        fPythonService.setToolTipText("Checking \"Python\" indicates that "+            "the text entered\nfor \"Target Service\" contains Python code.");        gbc.gridwidth = 1;        optionsPanel.add(fPythonService, gbc);        optionsPanel.add(Box.createHorizontalStrut(10), gbc);        fServiceTF = new JTextField(20)            {                public JToolTip createToolTip()                {                    MultiLineToolTip tip = new MultiLineToolTip();                    tip.setComponent(this);                    return tip;                }            };        fServiceTF.setToolTipText("The service for the STAF command you wish " +            "to have executed.\nThis field is required. If the text contains " +            "Python code, then\nselect \"Python\" next to the \"Target " +            "Service\" label.");        gbc.gridwidth = GridBagConstraints.REMAINDER;        gbc.weightx = 1.0;        optionsPanel.add(fServiceTF, gbc);        gbc.weightx = 0;        optionsPanel.add(Box.createVerticalStrut(3), gbc);        JLabel requestLabel = new JLabel("Target Request:");        requestLabel.setOpaque(true);        requestLabel.setForeground(Color.black);        gbc.gridwidth = 1;        optionsPanel.add(requestLabel, gbc);        optionsPanel.add(Box.createHorizontalStrut(10), gbc);        fPythonRequest = new JCheckBox("Python", false)            {                public JToolTip createToolTip()                {                    MultiLineToolTip tip = new MultiLineToolTip();                    tip.setComponent(this);                    return tip;                }            };        fPythonRequest.setToolTipText("Checking \"Python\" indicates that "+            "the text entered\nfor \"Target Request\" contains Python code.");        gbc.gridwidth = 1;        optionsPanel.add(fPythonRequest, gbc);        optionsPanel.add(Box.createHorizontalStrut(10), gbc);        fRequestTF = new JTextField(40)            {                public JToolTip createToolTip()                {                    MultiLineToolTip tip = new MultiLineToolTip();                    tip.setComponent(this);                    return tip;                }            };        fRequestTF.setToolTipText("The STAF request you wish to have " +            "executed. This\nfield is required. If the text contains Python " +            "code, then\nselect \"Python\" next to the \"Target " +            "Request\" label.");        gbc.gridwidth = GridBagConstraints.REMAINDER;        gbc.weightx = 1.0;        optionsPanel.add(fRequestTF, gbc);        gbc.weightx = 0;        optionsPanel.add(Box.createVerticalStrut(3), gbc);        JLabel prepareLabel = new JLabel("Prepare Script:");        prepareLabel.setOpaque(true);        prepareLabel.setForeground(Color.black);        gbc.gridwidth = 1;        optionsPanel.add(prepareLabel, gbc);        optionsPanel.add(Box.createHorizontalStrut(10), gbc);        fPrepareTA = new JTextArea(5, 40)            {                public JToolTip createToolTip()                {                    MultiLineToolTip tip = new MultiLineToolTip();                    tip.setComponent(this);                    return tip;                }            };        fPrepareTA.setToolTipText("Any Python code that you wish to have " +            "evaluated prior to\nthe evaluation of any PYTHONMACHINE, " +            "PYTHONSERVICE,\nor PYTHONREQUEST options. This field is " +            "optional.");        fPrepareTA.setBorder(new BevelBorder(BevelBorder.LOWERED));        gbc.gridwidth = GridBagConstraints.REMAINDER;        gbc.weightx = 1.0;        optionsPanel.add(fPrepareTA, gbc);        gbc.weightx = 0;        optionsPanel.add(Box.createVerticalStrut(3), gbc);        gbc.weightx = 0;        optionsPanel.add(Box.createVerticalStrut(3), gbc);        JLabel typeLabel = new JLabel("Type:");        typeLabel.setOpaque(true);        typeLabel.setForeground(Color.black);        gbc.gridwidth = 1;        optionsPanel.add(typeLabel, gbc);        optionsPanel.add(Box.createHorizontalStrut(10), gbc);        fTypeTF = new JTextField(20)            {                public JToolTip createToolTip()                {                    MultiLineToolTip tip = new MultiLineToolTip();                    tip.setComponent(this);                    return tip;                }            };        fTypeTF.setToolTipText("This specifies the Event Type for which this " +            "\ncommand will be registered. This field is required.");        gbc.gridwidth = GridBagConstraints.REMAINDER;        gbc.weightx = 1.0;        optionsPanel.add(fTypeTF, gbc);        gbc.weightx = 0;        optionsPanel.add(Box.createVerticalStrut(3), gbc);        JLabel subtypeLabel = new JLabel("Subtype:");        subtypeLabel.setOpaque(true);        subtypeLabel.setForeground(Color.black);        gbc.gridwidth = 1;        optionsPanel.add(subtypeLabel, gbc);        optionsPanel.add(Box.createHorizontalStrut(10), gbc);        fSubtypeTF = new JTextField(20)            {                public JToolTip createToolTip()                {                    MultiLineToolTip tip = new MultiLineToolTip();                    tip.setComponent(this);                    return tip;                }            };        fSubtypeTF.setToolTipText("This specifies the Event SubType for which" +            " this \ncommand will be registered. This field is optional.");        gbc.gridwidth = GridBagConstraints.REMAINDER;        gbc.weightx = 1.0;        optionsPanel.add(fSubtypeTF, gbc);        gbc.weightx = 0;        optionsPanel.add(Box.createVerticalStrut(3), gbc);        JPanel outerPanel = new JPanel();        outerPanel.setLayout(new BorderLayout());        outerPanel.setBorder(new TitledBorder("EventManager Register options"));        outerPanel.add(BorderLayout.CENTER, new JScrollPane(optionsPanel));        JPanel buttonPanel = new JPanel();        buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));        fRegisterButton = new JButton("Register");        fRegisterButton.addActionListener(this);        buttonPanel.add(fRegisterButton);        fCancelButton = new JButton("Cancel");        fCancelButton.addActionListener(this);        buttonPanel.add(fCancelButton);        outerPanel.add(BorderLayout.SOUTH, buttonPanel);        fRegistrationDialog.getContentPane().add(outerPanel);        fRegistrationDialog.setSize(new Dimension(650, 360));        fRegistrationDialog.setLocationRelativeTo(this);    }    public void showErrorDialog(Component comp, String message)    {        JTextPane messagePane = new JTextPane();        messagePane.setFont(new Font("Dialog", Font.BOLD, 12));        messagePane.setEditable(false);        messagePane.setText(message);        messagePane.select(0,0);        JScrollPane scrollPane = new JScrollPane(messagePane);        scrollPane.setPreferredSize(new Dimension(400, 100));        JOptionPane.showMessageDialog(comp, scrollPane,                                      "EventManager Error",                                      JOptionPane.ERROR_MESSAGE);    }    public Vector getRegistrationTable()    {        String listRequest = "LIST LONG";        String eventManagerMachine = fServiceMachineTF.getText();        String eventManagerService = fServiceNameTF.getText();        STAFResult result = fHandle.submit2(eventManagerMachine,                                            eventManagerService,                                            listRequest);        if (result.rc != STAFResult.Ok)        {            showErrorDialog(this, "Error listing the registrations.\nRC=" +                result.rc + " Result=" + result.result);            return null;        }        STAFMarshallingContext mc =            STAFMarshallingContext.unmarshall(result.result);        STAFMapClassDefinition mcd =            mc.getMapClassDefinition(            "STAF/Service/EventManager/EventManagerID");        fEntryList = (java.util.List)mc.getRootObject();        Iterator idIter = fEntryList.iterator();        Vector idData = new Vector();        while (idIter.hasNext())        {            Map registrationMap = (Map)idIter.next();            String id = (String)registrationMap.get("eventManagerID");            String description = (String)registrationMap.get("description");            String machine = (String)registrationMap.get("machine");            String service = (String)registrationMap.get("service");            String request = (String)registrationMap.get("request");            Vector row = new Vector();            row.add(id);            row.add(description);            row.add(machine);            row.add(service);            row.add(request);            idData.add(row);        }        return idData;    }    class RegisterModel extends DefaultTableModel    {        public RegisterModel(Vector data, Vector columns)        {            super(data, columns);        }        public boolean isCellEditable(int row, int col)        {            return false;        }    }    class MultiLineToolTip extends JToolTip    {        public MultiLineToolTip()        {            setUI(new MultiLineToolTipUI());        }    }        class MultiLineToolTipUI extends MetalToolTipUI    {        String[] lines;        int maxWidth = 0;        public void paint(Graphics g, JComponent c)        {            FontMetrics metrics =                Toolkit.getDefaultToolkit().getFontMetrics(g.getFont());            Dimension size = c.getSize();            g.setColor(c.getBackground());            g.fillRect(0, 0, size.width, size.height);            g.setColor(c.getForeground());            if (lines != null)            {                for (int i = 0; i < lines.length; i++)                {                    g.drawString(lines[i], 3, (metrics.getHeight()) * ( i + 1));                }            }        }        public Dimension getPreferredSize(JComponent c)        {            FontMetrics metrics =                Toolkit.getDefaultToolkit().getFontMetrics(c.getFont());            String tipText = ((JToolTip)c).getTipText();            if (tipText == null)            {                tipText = "";            }            BufferedReader br = new BufferedReader(new StringReader(tipText));            String line;            int maxWidth = 0;            Vector lineVector = new Vector();            try            {                while ((line = br.readLine()) != null)                {                    int width =                        SwingUtilities.computeStringWidth(metrics,line);                    if (maxWidth < width)                    {                        maxWidth = width;                    }                    lineVector.addElement(line);                }            }            catch (IOException ex)            {                ex.printStackTrace();            }            int numberOfLines = lineVector.size();            if (numberOfLines < 1)            {                lines = null;                numberOfLines = 1;            }            else            {                lines = new String[numberOfLines];                int i = 0;     

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -