Ejemplo n.º 1
0
  // ==========================================================================
  @Override
  public void setupInterface() {

    pipe.getjProgressBar().setIndeterminate(true);
    setEnabledComponents(false);

    new Thread(
            new Runnable() {
              @Override
              public void run() {

                ArrayList arrayList = null;

                try {

                  pipe.getjButton1().setText("close");
                  pipe.getjButton1()
                      .setIcon(
                          new ImageIcon(getClass().getResource("/views/images/shutdown-mini.png")));

                  pipe.getjButton2().setText("add");
                  pipe.getjButton2()
                      .setIcon(new ImageIcon(getClass().getResource("/views/images/add.gif")));

                  addListeners();

                  hm.put("collector", collector);
                  hm.put("request", "get default data pipes");
                  arrayList = (ArrayList) new Linker().sendReceiveObject(hm);

                  pipe.getjRadioButtonInactive().setSelected(true);

                  ViewUtilities.fillJComboBox(
                      pipe.getjComboBoxChain(), (String[]) arrayList.get(0));
                  ViewUtilities.fillJComboBox(
                      pipe.getjComboBoxDirection(), (String[]) arrayList.get(1));
                  ViewUtilities.fillJlist(pipe.getjListFilterLeft(), (String[]) arrayList.get(2));
                  ViewUtilities.fillJlist(pipe.getjListFilterRight(), (String[]) arrayList.get(3));
                  ViewUtilities.fillJComboBox(
                      pipe.getjComboBoxServiceLevel(), (String[]) arrayList.get(4));

                } catch (Exception e) {
                  NOTIFICATIONS.error("Unexpected error", e);
                } finally {
                  setEnabledComponents(true);
                  pipe.getjProgressBar().setIndeterminate(false);
                }
              }
            })
        .start();
  } // end setupInterface
Ejemplo n.º 2
0
  // ==========================================================================
  private void add() {

    pipe.getjProgressBar().setIndeterminate(true);
    setEnabledComponents(false);

    new Thread(
            new Runnable() {
              @Override
              public void run() {

                String message = null;
                ArrayList data = new ArrayList();

                try {

                  data.add("null");
                  data.add(pipe.getjTextFieldName().getText());
                  data.add(pipe.getjRadioButtonActive().isSelected());
                  data.add(pipe.getjComboBoxChain().getSelectedItem());
                  data.add(pipe.getjComboBoxDirection().getSelectedItem());
                  data.add(ViewUtilities.getDataJList(pipe.getjListFilterLeft()));
                  data.add(ViewUtilities.getDataJList(pipe.getjListFilterRight()));
                  data.add(pipe.getjComboBoxServiceLevel().getSelectedItem());

                  hm.put("collector", collector);
                  hm.put("request", "save pipes");
                  hm.put("data", data);

                  message = (String) new Linker().sendReceiveObject(hm);

                  controllerPipes.reloadTable();
                  NOTIFICATIONS.information(message, true);

                  setVisible(false);

                } catch (Exception e) {
                  NOTIFICATIONS.error("Unexpected error", e);
                } finally {
                  pipe.getjProgressBar().setIndeterminate(false);
                  setEnabledComponents(true);
                }
              }
            })
        .start();
  } // end add