// -------------------------------------------------------------------------------------
  public void updateFileList(String selectedComponent, final SimpleComboBox<String> listFiles) {
    service = (ServiceManagerWebServiceAsync) Registry.get("guiservice");
    service.getFileList(
        LeftPanelLogin.session_id,
        selectedComponent,
        new AsyncCallback<ArrayList<String>>() {
          @Override
          public void onFailure(Throwable caught) {
            Dispatcher.forwardEvent(MainEvents.error, caught);
          }

          @Override
          public void onSuccess(ArrayList<String> result) {
            if (result != null) {
              listFiles.removeAll();
              listFiles.clear();
              for (String file : result) {
                listFiles.add(file);
              }
            } else {
              removeAll();
              ((TextArea) textArea)
                  .setValue(
                      "Session time elapsed! Please log out, log in again and refresh the selected option");
              add(textArea);
              layout(true);
            }
          }
        });
  }
Esempio n. 2
0
  public RightIPSPanel() {
    setHeading("Broker Use Case: IPS");
    setLayout(new FitLayout());

    service = (ServiceManagerWebServiceAsync) Registry.get("guiservice");

    service.getIPSurl(
        LeftPanelLogin.session_id,
        new AsyncCallback<String>() {
          public void onFailure(Throwable caught) {
            System.out.println("Error: getIPSurl");
            Dispatcher.forwardEvent(MainEvents.error, caught);
          }

          public void onSuccess(String result) {
            System.out.println("Successfully executed: getIPSurl");
            removeAll();

            if (result.substring(0, 0).equals("-")) {
              textScreen = result;
              ((TextArea) textArea).setValue(textScreen);
              add(textArea);
              layout(true);
            } else {
              IPSurl = result;
              Frame frame = new Frame(IPSurl);
              frame.setWidth("100%");
              add(frame);
              System.out.println("IPS url = " + IPSurl);
              setLayoutOnChange(true);
              layout(true);
            }
          }
        });
  }
  // -------------------------------------------------------------------------------------
  public void updateFileContent() {
    if (listFiles.getSelectedIndex() != -1) {
      service = (ServiceManagerWebServiceAsync) Registry.get("guiservice");
      service.getFile(
          LeftPanelLogin.session_id,
          selectedComponent,
          listFiles.getSimpleValue(),
          new AsyncCallback<String>() {

            @Override
            public void onFailure(Throwable caught) {
              Dispatcher.forwardEvent(MainEvents.error, caught);
            }

            @Override
            public void onSuccess(String result) {
              if (result != null) {
                if (!result.equals(currentOutput)) {
                  output.setValue(result);
                }
              } else {
                removeAll();
                ((TextArea) textArea)
                    .setValue(
                        "Session time elapsed! Please log out, log in again and refresh the selected option");
                add(textArea);
                layout(true);
              }
            }
          });
    } else {
      output.setEmptyText("Please select a file to display.");
    }
  }