public void onLaunchSuspendDialogue(Server server) {
   window = new DefaultWindow("Suspend Server Group");
   window.setWidth(480);
   window.setHeight(360);
   window.trapWidget(new ServerSuspendDialogue(this, server).asWidget());
   window.setGlassEnabled(true);
   window.center();
 }
 public void onLaunchSuspendDialogue() {
   window = new DefaultWindow("Suspend Server");
   window.setWidth(480);
   window.setHeight(360);
   window.trapWidget(new SuspendStandaloneDialogue(this).asWidget());
   window.setGlassEnabled(true);
   window.center();
 }
Example #3
0
  @Override
  public void launchNewPropertyDialoge(String reference) {
    window = new DefaultWindow(Console.MESSAGES.createTitle("Config Property"));
    window.setWidth(480);
    window.setHeight(360);

    window.trapWidget(new NewPropertyWizard(this, "").asWidget());

    window.setGlassEnabled(true);
    window.center();
  }
  private void showDetailModal(final ModelNode selection) {

    matchRulesForm.editTransient(selection);
    Widget windowContent = new WindowContentBuilder(popupLayout, popupDialogOptions).build();

    matchRulesWindow = new DefaultWindow("Match Rule");
    matchRulesWindow.setWidth(480);
    matchRulesWindow.setHeight(430);
    matchRulesWindow.trapWidget(windowContent);
    matchRulesWindow.setGlassEnabled(true);
    matchRulesWindow.center();
  }
  private void launchAddDialog(
      final String resourceName,
      final AddressTemplate template,
      final ResourceDescription resourceDescription,
      String... attributes) {
    DefaultWindow dialog = new DefaultWindow("New " + resourceName);
    //noinspection Duplicates
    AddResourceDialog addDialog =
        new AddResourceDialog(
                securityContext,
                resourceDescription,
                new AddResourceDialog.Callback() {
                  @Override
                  public void onAdd(ModelNode payload) {
                    dialog.hide();

                    String name = payload.get("name").asString();
                    ResourceAddress address = template.resolve(statementContext, name);
                    payload.get(OP).set(ADD);
                    payload.get(ADDRESS).set(address);
                    dispatcher.execute(
                        new DMRAction(payload),
                        new SimpleCallback<DMRResponse>() {
                          @Override
                          public void onFailure(Throwable caught) {
                            super.onFailure(caught);
                            readServiceProvider();
                          }

                          @Override
                          public void onSuccess(DMRResponse dmrResponse) {
                            Console.info(Console.MESSAGES.successfullyAdded(name));
                            readServiceProvider();
                          }
                        });
                  }

                  @Override
                  public void onCancel() {
                    dialog.hide();
                  }
                })
            .include(attributes);

    dialog.setWidth(640);
    dialog.setHeight(480);
    dialog.setWidget(addDialog);
    dialog.setGlassEnabled(true);
    dialog.center();
  }
  @Override
  public void launchNewPropertyDialoge(String reference) {
    propertyWindow = new DefaultWindow("New System Property");
    propertyWindow.setWidth(320);
    propertyWindow.setHeight(240);
    propertyWindow.addCloseHandler(
        new CloseHandler<PopupPanel>() {
          @Override
          public void onClose(CloseEvent<PopupPanel> event) {}
        });

    propertyWindow.setWidget(new NewPropertyWizard(this, reference).asWidget());

    propertyWindow.setGlassEnabled(true);
    propertyWindow.center();
  }
  public void onLaunchCopyWizard(final Server server) {

    window = new DefaultWindow("Copy Server Configuration");
    window.setWidth(480);
    window.setHeight(380);

    CopyServerWizard wizard = new CopyServerWizard(DomainRuntimePresenter.this);
    Widget widget = wizard.asWidget();

    wizard.setCurrentServerSelection(server);
    wizard.setHosts(hostStore.getHostNames(), hostStore.getSelectedHost());
    window.trapWidget(widget);

    window.setGlassEnabled(true);
    window.center();
  }
Example #8
0
 public void askToActivateSubsystem() {
   final DefaultWindow window = new DefaultWindow(Console.CONSTANTS.subsys_osgi());
   window.setWidth(320);
   window.setHeight(140);
   window.trapWidget(
       new MessageWindow(
               Console.MESSAGES.subsys_osgi_activate(),
               new MessageWindow.Result() {
                 @Override
                 public void result(boolean result) {
                   window.hide();
                   if (result) activateSubsystem();
                 }
               })
           .asWidget());
   window.setGlassEnabled(true);
   window.center();
 }
  private void showVersionInfo(String json) {
    DefaultWindow window = new DefaultWindow("Management Model Versions");
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(
        new CloseHandler<PopupPanel>() {
          @Override
          public void onClose(CloseEvent<PopupPanel> event) {}
        });

    TextArea textArea = new TextArea();
    textArea.setStyleName("fill-layout");
    textArea.setText(json);

    window.setWidget(textArea);

    window.setGlassEnabled(true);
    window.center();
  }
Example #10
0
  protected void activateSubsystem() {
    // Since it takes a few moments for the subsystem to activate we're showing a window indicating
    // this
    final DefaultWindow window = new DefaultWindow(Console.CONSTANTS.subsys_osgi());
    window.setWidth(320);
    window.setHeight(140);
    window.trapWidget(new HTML(Console.MESSAGES.subsys_osgi_activating()));
    window.setGlassEnabled(true);
    window.center();

    AddressBinding address = bundleMetaData.getAddress();
    ModelNode operation =
        address.asSubresource(
            RuntimeBaseAddress.get()); // get an operation on the parent address...
    operation.get(ModelDescriptionConstants.OP).set("activate");

    dispatcher.execute(
        new DMRAction(operation),
        new SimpleCallback<DMRResponse>() {
          @Override
          public void onSuccess(DMRResponse result) {
            Timer t =
                new Timer() {
                  @Override
                  public void run() {
                    window.hide();
                    onReset();
                  }
                };
            t.schedule(4000);
          }

          @Override
          public void onFailure(Throwable caught) {
            window.hide();
            super.onFailure(caught);
          }
        });
  }
  private ToolStrip setupTableButtons() {
    ToolStrip tools = new ToolStrip();
    ToolButton addButton =
        new ToolButton(
            Console.CONSTANTS.common_label_add(),
            event -> {
              ModelNodeFormBuilder.FormAssets addFormAssets =
                  new ModelNodeFormBuilder()
                      .setResourceDescription(resourceDescription)
                      .setCreateMode(true)
                      .unsorted()
                      .exclude("permissions")
                      .setCreateNameAttribute(false)
                      .setSecurityContext(securityContext)
                      .build();
              addFormAssets.getForm().setEnabled(true);

              DefaultWindow dialog = new DefaultWindow(Console.MESSAGES.newTitle("Permission"));
              AddResourceDialog.Callback callback =
                  new AddResourceDialog.Callback() {
                    @Override
                    public void onAdd(ModelNode payload) {
                      circuit.dispatch(
                          new AddListAttribute(
                              ElytronStore.CONSTANT_PERMISSION_MAPPER_ADDRESS,
                              "permissions",
                              permissionMapping,
                              payload));
                      dialog.hide();
                    }

                    @Override
                    public void onCancel() {
                      dialog.hide();
                    }
                  };
              AddResourceDialog addDialog =
                  new AddResourceDialog(addFormAssets, resourceDescription, callback);
              dialog.setWidth(480);
              dialog.setHeight(360);
              dialog.setWidget(addDialog);
              dialog.setGlassEnabled(true);
              dialog.center();
            });
    ToolButton removeButton =
        new ToolButton(
            Console.CONSTANTS.common_label_delete(),
            event -> {
              final ModelNode selection = selectionModel.getSelectedObject();
              if (selection != null) {
                Feedback.confirm(
                    "Filter",
                    Console.MESSAGES.deleteConfirm(
                        "Permission " + selection.get("class-name").asString()),
                    isConfirmed -> {
                      if (isConfirmed) {
                        circuit.dispatch(
                            new RemoveListAttribute(
                                ElytronStore.CONSTANT_PERMISSION_MAPPER_ADDRESS,
                                permissionMapping,
                                "permissions",
                                selection));
                      }
                    });
              }
            });
    tools.addToolButtonRight(addButton);
    tools.addToolButtonRight(removeButton);
    return tools;
  }
Example #12
0
  private void _showAddDialog(
      final ModelNode address,
      boolean isSingleton,
      SecurityContext securityContext,
      ModelNode description) {
    List<Property> tuples = address.asPropertyList();
    String type = "";
    if (tuples.size() > 0) {
      type = tuples.get(tuples.size() - 1).getName();
    }

    ModelNodeFormBuilder builder =
        new ModelNodeFormBuilder()
            .setCreateMode(true)
            .setSingleton(isSingleton)
            .setResourceDescription(description)
            .setSecurityContext(securityContext);

    ModelNodeFormBuilder.FormAssets assets = builder.build();

    final ModelNodeForm form = assets.getForm();
    form.setEnabled(true);

    if (form.hasWritableAttributes()) {
      final DefaultWindow window = new DefaultWindow(Console.MESSAGES.createResource(type));
      window.addStyleName("browser-view");

      DialogueOptions options =
          new DialogueOptions(
              new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                  // save
                  FormValidation validation = form.validate();
                  if (!validation.hasErrors()) {
                    presenter.onAddChildResource(address, form.getUpdatedEntity());
                    window.hide();
                  }
                }
              },
              new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                  // cancel
                  window.hide();
                }
              });

      VerticalPanel layout = new VerticalPanel();
      layout.setStyleName("fill-layout-width");
      ModelNode opDescription = description.get("operations").get("add").get("description");
      ContentDescription text = new ContentDescription(opDescription.asString());
      layout.add(text);
      layout.add(assets.asWidget());

      WindowContentBuilder content = new WindowContentBuilder(layout, options);
      window.trapWidget(content.build());
      window.setGlassEnabled(true);
      window.setWidth(480);
      window.setHeight(360);
      window.center();
    } else {
      // no writable attributes
      Feedback.alert(
          Console.CONSTANTS.cannotCreateChildResource(),
          Console.MESSAGES.noConfigurableAttributes(address.toString()));
    }
  }
Example #13
0
 public void normalWindow() {
   if (window != null && window.isAttached()) {
     window.setHeight(NORMAL_WINDOW_HEIGHT);
     window.center();
   }
 }
Example #14
0
 public void biggerWindow() {
   if (window != null && window.isAttached()) {
     window.setHeight(BIGGER_WINDOW_HEIGHT);
     window.center();
   }
 }
  private ToolStrip mainTableTools() {
    ToolStrip tools = new ToolStrip();
    ToolButton addButton =
        new ToolButton(
            Console.CONSTANTS.common_label_add(),
            event -> {
              ModelNodeFormBuilder.FormAssets addFormAssets =
                  new ModelNodeFormBuilder()
                      .setResourceDescription(resourceDescription)
                      .setCreateMode(true)
                      .unsorted()
                      .setCreateNameAttribute(false)
                      .setSecurityContext(securityContext)
                      .build();
              addFormAssets.getForm().setEnabled(true);
              addFormAssets
                  .getForm()
                  .addFormValidator(
                      (formItems, formValidation) -> {

                        // at least one field is necessary to fill
                        boolean allEmpty = true;
                        for (FormItem formItem : formItems) {
                          if (!formItem.isUndefined()) {
                            allEmpty = false;
                            break;
                          }
                        }
                        if (allEmpty) {
                          formValidation.addError("match-abstract-type");
                          FormItem mechanismNameFormItem =
                              formItem(formItems, "match-abstract-type");
                          mechanismNameFormItem.setErrMessage(
                              "At least one field must contain valid values.");
                          mechanismNameFormItem.setErroneous(true);
                        }
                      });

              DefaultWindow dialog = new DefaultWindow(Console.MESSAGES.newTitle("Match Rule"));
              AddResourceDialog.Callback callback =
                  new AddResourceDialog.Callback() {
                    @Override
                    public void onAdd(ModelNode payload) {
                      for (Property node : payload.asPropertyList()) {
                        // remove undefined attributes
                        if (!node.getValue().isDefined()) {
                          payload.remove(node.getName());
                        }
                      }
                      circuit.dispatch(
                          new AddListAttribute(
                              ElytronStore.AUTHENTICATION_CONTEXT_ADDRESS,
                              MATCH_RULES,
                              authContextName,
                              payload));
                      dialog.hide();
                    }

                    @Override
                    public void onCancel() {
                      dialog.hide();
                    }
                  };
              AddResourceDialog addDialog =
                  new AddResourceDialog(addFormAssets, resourceDescription, callback);
              dialog.setWidth(480);
              dialog.setHeight(510);
              dialog.setWidget(addDialog);
              dialog.setGlassEnabled(true);
              dialog.center();
            });
    ToolButton removeButton =
        new ToolButton(
            Console.CONSTANTS.common_label_delete(),
            event -> {
              final ModelNode selection = selectionModel.getSelectedObject();
              if (selection != null) {
                Feedback.confirm(
                    "Match Rule",
                    Console.MESSAGES.deleteConfirm("Match Rule " + selection.asString()),
                    isConfirmed -> {
                      if (isConfirmed) {
                        circuit.dispatch(
                            new RemoveListAttribute(
                                ElytronStore.AUTHENTICATION_CONTEXT_ADDRESS,
                                authContextName,
                                MATCH_RULES,
                                selection));
                      }
                    });
              }
            });
    tools.addToolButtonRight(addButton);
    tools.addToolButtonRight(removeButton);
    return tools;
  }
Example #16
0
  private void showDetail(final Message msg) {

    msg.setNew(false);

    final DefaultWindow window =
        new DefaultWindow(Console.CONSTANTS.common_label_messageDetailTitle());

    window.setWidth(480);
    window.setHeight(360);
    window.setGlassEnabled(true);

    // ImageResource icon = MessageCenterView.getSeverityIcon(msg.getSeverity());
    // AbstractImagePrototype prototype = AbstractImagePrototype.create(icon);

    SafeHtmlBuilder html = new SafeHtmlBuilder();

    // TODO: XSS prevention?
    html.appendHtmlConstant(msg.getSeverity().getTag());
    html.appendHtmlConstant("&nbsp;");
    html.appendHtmlConstant(msg.getFired().toString());
    html.appendHtmlConstant("<h3 id='consise-message'>");
    html.appendHtmlConstant(msg.getConciseMessage());
    html.appendHtmlConstant("</h3>");
    html.appendHtmlConstant("<p/>");

    String detail = msg.getDetailedMessage() != null ? msg.getDetailedMessage() : "";

    html.appendHtmlConstant(
        "<pre style='font-family:tahoma, verdana, sans-serif;' id='detail-message'>");
    html.appendHtmlConstant(detail);
    html.appendHtmlConstant("</pre>");

    final HTML widget = new HTML(html.toSafeHtml());
    widget.getElement().setAttribute("style", "margin:5px");

    DialogueOptions options =
        new DialogueOptions(
            "OK",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent clickEvent) {
                window.hide();
              }
            },
            Console.CONSTANTS.common_label_cancel(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent clickEvent) {
                window.hide();
              }
            });

    options.getSubmit().setAttribute("aria-describedby", "consise-message detail-message");

    Widget windowContent = new WindowContentBuilder(widget, options).build();

    TrappedFocusPanel trap =
        new TrappedFocusPanel(windowContent) {
          @Override
          protected void onAttach() {
            super.onAttach();

            Scheduler.get()
                .scheduleDeferred(
                    new Scheduler.ScheduledCommand() {
                      @Override
                      public void execute() {
                        getFocus().onFirstButton();
                      }
                    });
          }
        };

    window.setWidget(trap);

    window.addCloseHandler(
        new CloseHandler<PopupPanel>() {

          @Override
          public void onClose(CloseEvent<PopupPanel> event) {
            messagePopup.getMessageList().getSelectionModel().setSelected(msg, false);
            messagePopup.hide();
          }
        });

    messagePopup.hide();
    window.center();
  }