Exemplo n.º 1
0
    private void getFileList() {
      myMessage.stateChanged("REMOTEFILELIST");
      URL theURL = null;
      ;
      try {
        theURL = new URL(myProperties.getProperty("BASEURL"));
      } catch (MalformedURLException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }
      ;

      String theRemoteBaseDir = myProperties.getProperty("REMOTEBASEDIR");
      Properties props = System.getProperties();
      props.put("http.proxyHost", myProperties.getProperty("PROXYHOST"));
      props.put("http.proxyPort", myProperties.getProperty("PROXYPORT"));
      String data = "";
      try {
        data =
            URLEncoder.encode("filelocation", "UTF-8")
                + "="
                + URLEncoder.encode(theRemoteBaseDir, "UTF-8");
        data +=
            "&"
                + URLEncoder.encode("fileprocess", "UTF-8")
                + "="
                + URLEncoder.encode("REMOTEFILELIST", "UTF-8");

        URLConnection conn = theURL.openConnection();
        conn.setDoOutput(true);
        OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
        wr.write(data);
        wr.flush();
        myMessage.messageChanged(0, "Get the File List");
        // Get the response
        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String line2;
        myFileList = new HashMap<String, List>();
        while (((line2 = rd.readLine()) != null) && !isCancelled()) {
          CSV parser = new CSV('|');
          List theFileList = parser.parse(line2);
          // myFileList.put((String)theFileList.get(1), theFileList);
          for (int i = 0; i < theFileList.size(); i++) {
            if (i == 1) {
              myFileList.put((String) theFileList.get(i), theFileList);
            }
          }
        }
        rd.close();
      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
Exemplo n.º 2
0
  /** Class for testing this. */
  private static class TestClass implements Cloneable {
    private String _String = "This string is my name.";
    private String[] _StringArray = {"one", "two", "three"};
    private int _int = Integer.MIN_VALUE;
    private Integer _Integer = new Integer(Integer.MAX_VALUE);
    private double _double = Double.MIN_VALUE;
    private Double _Double = new Double(Double.MAX_VALUE);
    private Properties _Properties = System.getProperties();
    private File _File = new File("/");
    private Object _Object = new Font("Monospaced", Font.PLAIN, 12);
    private JButton _button = new JButton("I'm a button!");

    public void setName(String string) {
      _String = string;
    }

    public String getName() {
      return _String;
    }

    public void setStringArray(String[] array) {
      _StringArray = array;
    }

    public String[] getStringArray() {
      return _StringArray;
    }

    public void setInt(int val) {
      _int = val;
    }

    public int getInt() {
      return _int;
    }

    public void setInteger(Integer val) {
      _Integer = val;
    }

    public Integer getInteger() {
      return _Integer;
    }

    public void setDoub(double val) {
      _double = val;
    }

    public double getDoub() {
      return _double;
    }

    public void setDouble(Double val) {
      _Double = val;
    }

    public Double getDouble() {
      return _Double;
    }

    public void setProperties(Properties props) {
      _Properties = props;
    }

    public Properties getProperties() {
      return _Properties;
    }

    public void setFile(File f) {
      _File = f;
    }

    public File getFile() {
      return _File;
    }

    public void setButton(JButton button) {
      _button = button;
    }

    public JButton getButton() {
      return _button;
    }

    public void setObject(Object o) {
      _Object = o;
    }

    public Object getObject() {
      return _Object;
    }

    public Object clone() {
      try {
        return super.clone();
      } catch (CloneNotSupportedException ex) {
        return null;
      }
    }
  }
Exemplo n.º 3
0
  public ProcessFrame(Properties theProperties) {
    super(new BorderLayout());
    // myFile = theFile;
    myProperties = theProperties;
    Properties props = System.getProperties();
    props.put("http.proxyHost", myProperties.getProperty("PROXYHOST"));
    props.put("http.proxyPort", myProperties.getProperty("PROXYPORT"));

    // Create the demo's UI.
    StartButton = new JButton("Start");
    StartButton.setActionCommand("start");
    StartButton.addActionListener(this);
    cancelButton = new JButton("Cancel");
    cancelButton.setActionCommand("cancel");
    cancelButton.addActionListener(this);
    cancelButton.setEnabled(false);

    myDownloadOptions = new JComboBox(myDownloadOptionsStr);

    progressBar = new JProgressBar(0, 100);
    progressBar.setValue(0);
    progressBar.setStringPainted(true);
    progressBar2 = new JProgressBar(0, 100);
    progressBar2.setValue(0);
    progressBar2.setStringPainted(true);
    progressBar3 = new JProgressBar(0, 100);
    progressBar4 = new JProgressBar(0, 100);
    progressBar5 = new JProgressBar(0, 100);
    progressBar3.setValue(0);
    progressBar3.setStringPainted(true);
    progressBar4.setValue(0);
    progressBar4.setStringPainted(true);
    progressBar5.setValue(0);
    progressBar5.setStringPainted(true);

    taskOutput = new JTextArea(5, 20);

    final JPopupMenu taskPopupMenu = new JPopupMenu();
    JMenuItem clearMenuItem = new JMenuItem("Clear");
    clearMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            if (actionEvent.getActionCommand().equals("Clear")) {
              taskOutput.setText("");
            }
          }
        });
    taskPopupMenu.add(clearMenuItem);
    taskOutput.setMargin(new Insets(5, 5, 5, 5));
    taskOutput.setEditable(false);
    taskOutput.addMouseListener(
        new MouseAdapter() {
          private void showIfPopupTrigger(MouseEvent mouseEvent) {
            if (mouseEvent.isPopupTrigger()) {
              taskPopupMenu.show(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY());
            }
          }

          public void mousePressed(MouseEvent mouseEvent) {
            showIfPopupTrigger(mouseEvent);
          }

          public void mouseReleased(MouseEvent mouseEvent) {
            showIfPopupTrigger(mouseEvent);
          }
        });

    JPanel panel = new JPanel();
    JPanel panel2 = new JPanel();
    panel.setLayout(new GridBagLayout());
    panel2.setLayout(new GridBagLayout());
    panel.add(
        progressBar4,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(11, 11, 0, 0),
            0,
            0));
    panel.add(
        new JLabel("TOTAL"),
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 11, 0, 0),
            0,
            0));
    panel.add(
        progressBar,
        new GridBagConstraints(
            2,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(11, 11, 0, 0),
            0,
            0));
    panel.add(
        new JLabel("REMOTE DOWNLOAD"),
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 11, 0, 0),
            0,
            0));
    panel.add(
        progressBar2,
        new GridBagConstraints(
            2,
            3,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(11, 11, 0, 0),
            0,
            0));
    panel.add(
        new JLabel("REMOTE SPLIT"),
        new GridBagConstraints(
            1,
            3,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 11, 0, 0),
            0,
            0));
    panel.add(
        progressBar3,
        new GridBagConstraints(
            2,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(11, 11, 0, 0),
            0,
            0));
    panel.add(
        new JLabel("LOCAL DOWNLOAD"),
        new GridBagConstraints(
            1,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 11, 0, 0),
            0,
            0));
    panel.add(
        progressBar5,
        new GridBagConstraints(
            2,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(11, 11, 0, 0),
            0,
            0));
    panel.add(
        new JLabel("LOCAL JOIN"),
        new GridBagConstraints(
            1,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 11, 0, 0),
            0,
            0));
    panel2.add(
        myDownloadOptions,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 13, 4, 0),
            0,
            0));
    panel2.add(
        StartButton,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 13, 4, 0),
            0,
            0));
    panel2.add(
        cancelButton,
        new GridBagConstraints(
            3,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 13, 4, 0),
            0,
            0));

    add(panel, BorderLayout.PAGE_START);
    add(panel2, BorderLayout.CENTER);
    add(new JScrollPane(taskOutput), BorderLayout.PAGE_END);

    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
  }