Exemplo n.º 1
0
  /** {@inheritDoc} */
  @Override
  public void onViewClicked(@Nonnull final KeyItem key) {
    service.getPublicKey(
        key,
        new AsyncRequestCallback<PublicKey>(
            dtoUnmarshallerFactory.newUnmarshaller(PublicKey.class)) {
          @Override
          public void onSuccess(PublicKey result) {
            loader.hide(constant.loaderGetPublicSshKeyMessage(key.getHost()));
            dialogFactory
                .createMessageDialog(
                    constant.publicSshKeyField() + key.getHost(), result.getKey(), null)
                .show();
          }

          @Override
          public void onFailure(Throwable exception) {
            loader.hide(constant.loaderGetPublicSshKeyMessage(key.getHost()));
            notificationManager.showError(
                SafeHtmlUtils.fromString(exception.getMessage()).asString());
            eventBus.fireEvent(new ExceptionThrownEvent(exception));
          }
        });
  }