/** Show the filter dialog */ public void showDialog() { empty_border = new EmptyBorder(5, 5, 0, 5); indent_border = new EmptyBorder(5, 25, 5, 5); include_panel = new ServiceFilterPanel("Include messages based on target service:", filter_include_list); exclude_panel = new ServiceFilterPanel("Exclude messages based on target service:", filter_exclude_list); status_box = new JCheckBox("Filter messages based on status:"); status_box.addActionListener(this); status_active = new JRadioButton("Active messages only"); status_active.setSelected(true); status_active.setEnabled(false); status_complete = new JRadioButton("Complete messages only"); status_complete.setEnabled(false); status_group = new ButtonGroup(); status_group.add(status_active); status_group.add(status_complete); if (filter_active || filter_complete) { status_box.setSelected(true); status_active.setEnabled(true); status_complete.setEnabled(true); if (filter_complete) { status_complete.setSelected(true); } } status_options = new JPanel(); status_options.setLayout(new BoxLayout(status_options, BoxLayout.Y_AXIS)); status_options.add(status_active); status_options.add(status_complete); status_options.setBorder(indent_border); status_panel = new JPanel(); status_panel.setLayout(new BorderLayout()); status_panel.add(status_box, BorderLayout.NORTH); status_panel.add(status_options, BorderLayout.CENTER); status_panel.setBorder(empty_border); ok_button = new JButton("Ok"); ok_button.addActionListener(this); cancel_button = new JButton("Cancel"); cancel_button.addActionListener(this); buttons = new JPanel(); buttons.setLayout(new FlowLayout()); buttons.add(ok_button); buttons.add(cancel_button); panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(include_panel); panel.add(exclude_panel); panel.add(status_panel); panel.add(buttons); dialog = new JDialog(); dialog.setTitle("SOAP Monitor Filter"); dialog.setContentPane(panel); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.setModal(true); dialog.pack(); Dimension d = dialog.getToolkit().getScreenSize(); dialog.setLocation((d.width - dialog.getWidth()) / 2, (d.height - dialog.getHeight()) / 2); ok_pressed = false; dialog.show(); }
@Override public void actionPerformed(ActionEvent arg0) { try { URL url = new URL(excelUrl); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); int filesize = connection.getContentLength(); float totalDataRead = 0; java.io.BufferedInputStream in = new java.io.BufferedInputStream(connection.getInputStream()); java.io.FileOutputStream fos = new java.io.FileOutputStream(excelName); java.io.BufferedOutputStream bout = new BufferedOutputStream(fos, 14921); byte[] data = new byte[14921]; int i = 0; JOptionPane jop2 = new JOptionPane("VitalHealth Test Automation Framework"); JDialog k2 = jop2.createDialog("Please wait till file is downloaded"); k2.setModal(false); k2.setVisible(true); while ((i = in.read(data, 0, 14921)) >= 0) { totalDataRead = totalDataRead + i; bout.write(data, 0, i); float Percent = (totalDataRead * 100) / filesize; } bout.close(); in.close(); // fos.close(); k2.dispose(); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Sample Configuration file downloaded"); } }