Example #1
0
  public AttachVolume() {
    Portal.CLOUD.listServers(
        0,
        50,
        new AsyncCallback<ServerList>() {

          @Override
          public void onSuccess(ServerList result) {
            for (Server s : result) {
              serverId.addItem(s.getName() + " " + s.getId(), s.getId());
            }
          }

          @Override
          public void onFailure(Throwable caught) {}
        });
    initWidget(uiBinder.createAndBindUi(this));
  }
Example #2
0
  @UiHandler({"save"})
  void onSaveClick(ClickEvent event) {

    Portal.CLOUD.attachVolume(
        volume.getId(),
        serverId.getValue(serverId.getSelectedIndex()),
        new AsyncCallback<Volume>() {

          @Override
          public void onSuccess(Volume result) {
            Portal.MODAL.hide();
            listener.onAttach(result);
          }

          @Override
          public void onFailure(Throwable caught) {}
        });
  }
Example #3
0
  public ImagePicker() {

    grid = new Grid(5, 4);

    grid.getElement().getStyle().setWidth(100.0, Unit.PCT);
    grid.getElement().getStyle().setTableLayout(TableLayout.FIXED);

    initWidget(grid);

    Portal.CLOUD.listImages(
        0,
        5,
        new AsyncCallback<ImageList>() {

          @Override
          public void onFailure(Throwable caught) {
            Window.alert(caught.getMessage());
          }

          @Override
          public void onSuccess(final ImageList result) {

            for (int row = 0; row < result.getList().size(); row++) {
              int col = 0;
              grid.setText(row, col++, result.getList().get(row).getId());
              grid.setText(row, col++, result.getList().get(row).getName());
              grid.setText(row, col++, result.getList().get(row).getStatus());
              final int finalRow = row;
              Button b =
                  new Button(
                      "select",
                      new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                          value = result.getList().get(finalRow).getId();
                          listener.onImageSelected();
                        }
                      });
              grid.setWidget(row, col++, b);
            }
          }
        });
  }