Example #1
0
  @SuppressWarnings("unchecked")
  Widget asWidget() {
    secTable = new DefaultCellTable<>(8, item -> item.getPattern() + "_" + item.getRole());
    secProvider = new ListDataProvider<>();
    secProvider.addDataDisplay(secTable);

    Column<ActivemqSecurityPattern, String> roleColumn =
        new Column<ActivemqSecurityPattern, String>(new TextCell()) {
          @Override
          public String getValue(ActivemqSecurityPattern object) {
            return object.getRole();
          }
        };

    Column<ActivemqSecurityPattern, String> patternColumn =
        new Column<ActivemqSecurityPattern, String>(new TextCell()) {
          @Override
          public String getValue(ActivemqSecurityPattern object) {
            return object.getPattern();
          }
        };

    secTable.addColumn(patternColumn, "Pattern");
    secTable.addColumn(roleColumn, "Role");

    form = new Form<>(ActivemqSecurityPattern.class);
    form.setNumColumns(2);
    form.bind(secTable);

    CheckBoxItem send = new CheckBoxItem("send", "Send?");
    CheckBoxItem consume = new CheckBoxItem("consume", "Consume?");
    CheckBoxItem manage = new CheckBoxItem("manage", "Manage?");

    CheckBoxItem createDQ = new CheckBoxItem("createDurableQueue", "CreateDurable?");
    CheckBoxItem deleteDQ = new CheckBoxItem("deleteDurableQueue", "DeleteDurable?");

    CheckBoxItem createNDQ = new CheckBoxItem("createNonDurableQueue", "CreateNonDurable?");
    CheckBoxItem deleteNDQ = new CheckBoxItem("deleteNonDurableQueue", "DeleteNonDurable?");

    form.setFields(send, consume, manage);
    form.setFieldsInGroup(
        Console.CONSTANTS.common_label_advanced(),
        new DisclosureGroupRenderer(),
        createDQ,
        deleteDQ,
        createNDQ,
        deleteNDQ);

    FormHelpPanel helpPanel =
        new FormHelpPanel(
            () -> {
              ModelNode address = Baseadress.get();
              address.add("subsystem", "messaging-activemq");
              address.add("server", "*");
              address.add("security-setting", "*");
              address.add("role", "*");
              return address;
            },
            form);

    FormToolStrip<ActivemqSecurityPattern> formTools =
        new FormToolStrip<>(
            form,
            new FormToolStrip.FormCallback<ActivemqSecurityPattern>() {
              @Override
              public void onSave(Map<String, Object> changeset) {
                presenter.onSaveSecDetails(form.getEditedEntity(), changeset);
              }

              @Override
              public void onDelete(ActivemqSecurityPattern entity) {}
            });

    ToolStrip tableTools = new ToolStrip();

    ToolButton addBtn =
        new ToolButton(
            Console.CONSTANTS.common_label_add(), event -> presenter.launchNewSecDialogue());
    addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_securityDetails());
    tableTools.addToolButtonRight(addBtn);

    ToolButton removeBtn =
        new ToolButton(
            Console.CONSTANTS.common_label_delete(),
            event ->
                Feedback.confirm(
                    Console.MESSAGES.deleteTitle("Security Config"),
                    Console.MESSAGES.deleteConfirm("Security Config"),
                    isConfirmed -> {
                      if (isConfirmed) {
                        presenter.onDeleteSecDetails(form.getEditedEntity());
                      }
                    }));

    tableTools.addToolButtonRight(removeBtn);

    VerticalPanel formPanel = new VerticalPanel();
    formPanel.addStyleName("fill-layout-width");

    formPanel.add(helpPanel.asWidget());
    formPanel.add(formTools.asWidget());
    formPanel.add(form.asWidget());

    serverName = new ContentHeaderLabel();

    MultipleToOneLayout layout =
        new MultipleToOneLayout()
            .setPlain(true)
            .setHeadlineWidget(serverName)
            .setDescription(
                "A security setting allows sets of permissions to be defined against queues based on their address.")
            .setMaster("Available security settings", secTable)
            .setMasterTools(tableTools.asWidget())
            .setDetail("Details", formPanel);

    return layout.build();
  }
Example #2
0
  @Override
  public Widget createWidget() {
    form = new Form<EESubsystem>(EESubsystem.class);

    CheckBoxItem isolation = new CheckBoxItem("isolatedSubdeployments", "Isolated Subdeployments?");

    form.setFields(isolation);
    form.setEnabled(false);

    FormToolStrip<EESubsystem> formToolStrip =
        new FormToolStrip<EESubsystem>(
            form,
            new FormToolStrip.FormCallback<EESubsystem>() {
              @Override
              public void onSave(Map<String, Object> changeset) {
                presenter.onSave(form.getEditedEntity(), changeset);
              }

              @Override
              public void onDelete(EESubsystem entity) {
                // cannot be removed
              }
            });
    formToolStrip.providesDeleteOp(false);

    FormHelpPanel helpPanel =
        new FormHelpPanel(
            new FormHelpPanel.AddressCallback() {
              @Override
              public ModelNode getAddress() {
                ModelNode address = Baseadress.get();
                address.add("subsystem", "ee");
                return address;
              }
            },
            form);

    Widget master = new FormLayout().setForm(form).setHelp(helpPanel).build();

    // -----
    // module list

    moduleList =
        new DefaultCellTable<Module>(
            5,
            new ProvidesKey<Module>() {
              @Override
              public Object getKey(Module item) {
                return item.getName() + "_" + item.getSlot();
              }
            });

    dataProvider = new ListDataProvider<Module>();
    dataProvider.addDataDisplay(moduleList);
    moduleList.setSelectionModel(new SingleSelectionModel());

    TextColumn<Module> name =
        new TextColumn<Module>() {
          @Override
          public String getValue(Module record) {
            return record.getName();
          }
        };

    TextColumn<Module> slot =
        new TextColumn<Module>() {
          @Override
          public String getValue(Module record) {
            return record.getSlot();
          }
        };

    moduleList.addColumn(name, "Name");
    moduleList.addColumn(slot, "Slot");

    ToolStrip moduleTools = new ToolStrip();
    ToolButton addBtn =
        new ToolButton(
            Console.CONSTANTS.common_label_add(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                presenter.launchNewModuleDialogue();
              }
            });
    addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_eESubsystemView());
    moduleTools.addToolButtonRight(addBtn);

    ToolButton button =
        new ToolButton(
            Console.CONSTANTS.common_label_remove(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {

                final Module module =
                    ((SingleSelectionModel<Module>) moduleList.getSelectionModel())
                        .getSelectedObject();
                if (null == module) return;

                Feedback.confirm(
                    Console.MESSAGES.deleteTitle("Module"),
                    Console.MESSAGES.deleteConfirm("Module"),
                    new Feedback.ConfirmationHandler() {
                      @Override
                      public void onConfirmation(boolean isConfirmed) {
                        if (isConfirmed) {
                          presenter.onRemoveModule(form.getEditedEntity(), module);
                        }
                      }
                    });
              }
            });
    button.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_remove_eESubsystemView());
    moduleTools.addToolButtonRight(button);

    VerticalPanel modulePanel = new VerticalPanel();
    modulePanel.setStyleName("fill-layout-width");

    modulePanel.add(moduleTools.asWidget());
    modulePanel.add(moduleList.asWidget());

    // ----

    Widget panel =
        new OneToOneLayout()
            .setTitle("EE")
            .setHeadline("EE Subsystem")
            .setDescription(Console.CONSTANTS.subsys_ee_desc())
            .setMaster("Subsystem Defaults", master)
            .setMasterTools(formToolStrip.asWidget())
            .setDetail("Global Modules", modulePanel)
            .build();

    modulePanel.getElement().setAttribute("style", "padding-top:5px");

    return panel;
  }
Example #3
0
  @Override
  public Widget createWidget() {

    ProvidesKey<DeploymentRecord> key =
        new ProvidesKey<DeploymentRecord>() {
          @Override
          public Object getKey(DeploymentRecord deploymentRecord) {
            return deploymentRecord.getName();
          }
        };
    deploymentTable = new DefaultCellTable<DeploymentRecord>(8, key);
    final SingleSelectionModel<DeploymentRecord> selectionModel =
        new SingleSelectionModel<DeploymentRecord>();
    deploymentTable.setSelectionModel(selectionModel);

    dataProvider = new ListDataProvider<DeploymentRecord>(key);
    dataProvider.addDataDisplay(deploymentTable);

    // ---

    final ToolStrip toolStrip = new ToolStrip();
    ToolButton addBtn =
        new ToolButton(
            Console.CONSTANTS.common_label_add(),
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                presenter.launchNewDeploymentDialoge(null, false);
              }
            });
    addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_deploymentListView());
    toolStrip.addToolButtonRight(addBtn);

    toolStrip.addToolButtonRight(
        new ToolButton(
            Console.CONSTANTS.common_label_remove(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent clickEvent) {
                DeploymentRecord selection = selectionModel.getSelectedObject();
                if (selection != null) {
                  new DeploymentCommandDelegate(
                          DeploymentListView.this.presenter,
                          DeploymentCommand.REMOVE_FROM_STANDALONE)
                      .execute(selection);
                }
              }
            }));

    toolStrip.addToolButtonRight(
        new ToolButton(
            Console.CONSTANTS.common_label_enOrDisable(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent clickEvent) {
                DeploymentRecord selection = selectionModel.getSelectedObject();
                if (selection != null) {
                  new DeploymentCommandDelegate(
                          DeploymentListView.this.presenter, DeploymentCommand.ENABLE_DISABLE)
                      .execute(selection);
                }
              }
            }));

    toolStrip.addToolButtonRight(
        new ToolButton(
            "Update",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent clickEvent) {
                DeploymentRecord selection = selectionModel.getSelectedObject();
                if (selection != null) {
                  new DeploymentCommandDelegate(
                          DeploymentListView.this.presenter, DeploymentCommand.UPDATE_CONTENT)
                      .execute(selection);
                }
              }
            }));

    filter = new DeploymentFilter(dataProvider);
    toolStrip.addToolWidget(filter.asWidget());

    TitleColumn dplNameColumn = new TitleColumn() {};

    TextColumn<DeploymentRecord> dplRuntimeColumn =
        new TextColumn<DeploymentRecord>() {
          @Override
          public String getValue(DeploymentRecord record) {
            String title = null;
            if (record.getRuntimeName().length() > 27)
              title = record.getRuntimeName().substring(0, 26) + "...";
            else title = record.getRuntimeName();
            return title;
          }
        };

    deploymentTable.addColumn(dplNameColumn, Console.CONSTANTS.common_label_name());
    deploymentTable.addColumn(dplRuntimeColumn, Console.CONSTANTS.common_label_runtimeName());
    deploymentTable.addColumn(makeEnabledColumn(), Console.CONSTANTS.common_label_enabled());

    Form<DeploymentRecord> form = new Form<DeploymentRecord>(DeploymentRecord.class);
    form.setNumColumns(2);
    form.setEnabled(true);
    TextAreaItem name = new TextAreaItem("name", "Name");
    TextAreaItem runtimeName = new TextAreaItem("runtimeName", "Runtime Name");
    // TextBoxItem sha = new TextBoxItem("sha", "SHA");
    form.setFields(name, runtimeName);

    form.bind(deploymentTable);

    MultipleToOneLayout layout =
        new MultipleToOneLayout()
            .setTitle(Console.CONSTANTS.common_label_deployments())
            .setHeadline(Console.CONSTANTS.common_label_deployments())
            .setDescription(
                "Currently deployed application components. Deployments that have been added through the filesystem will not be managable through the web interface.")
            .setMaster(Console.MESSAGES.available("Deployments"), deploymentTable)
            .setMasterTools(toolStrip)
            .setDetail(Console.CONSTANTS.common_label_selection(), form.asWidget());

    return layout.build();
  }
Example #4
0
  Widget asWidget() {

    table =
        new DefaultCellTable<MailSession>(
            8,
            new ProvidesKey<MailSession>() {
              @Override
              public Object getKey(MailSession item) {
                return item.getJndiName();
              }
            });
    dataProvider = new ListDataProvider<MailSession>();
    dataProvider.addDataDisplay(table);

    TextColumn<MailSession> jndiName =
        new TextColumn<MailSession>() {
          @Override
          public String getValue(MailSession record) {
            return record.getJndiName();
          }
        };

    Column<MailSession, MailSession> option =
        new Column<MailSession, MailSession>(
            new ViewLinkCell<MailSession>(
                Console.CONSTANTS.common_label_view(),
                new ActionCell.Delegate<MailSession>() {
                  @Override
                  public void execute(MailSession selection) {
                    presenter
                        .getPlaceManager()
                        .revealPlace(
                            new PlaceRequest(NameTokens.MailPresenter)
                                .with("name", selection.getJndiName()));
                  }
                })) {
          @Override
          public MailSession getValue(MailSession manager) {
            return manager;
          }
        };

    table.addColumn(jndiName, "JNDI Name");
    table.addColumn(option, "Option");

    ToolStrip toolstrip = new ToolStrip();

    ToolButton addBtn =
        new ToolButton(
            Console.CONSTANTS.common_label_add(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                presenter.launchNewSessionWizard();
              }
            });
    addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_mailSessionView());
    toolstrip.addToolButtonRight(addBtn);

    ToolButton removeBtn =
        new ToolButton(
            Console.CONSTANTS.common_label_remove(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                Feedback.confirm(
                    Console.MESSAGES.deleteTitle("Mail Session"),
                    Console.MESSAGES.deleteConfirm("Mail Session"),
                    new Feedback.ConfirmationHandler() {
                      @Override
                      public void onConfirmation(boolean isConfirmed) {
                        if (isConfirmed) presenter.onDelete(form.getEditedEntity());
                      }
                    });
              }
            });
    removeBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_remove_mailSessionView());
    toolstrip.addToolButtonRight(removeBtn);

    // ------

    form = new Form<MailSession>(MailSession.class);
    form.setNumColumns(2);

    TextItem jndi = new TextItem("jndiName", "JNDI Name");
    CheckBoxItem debug = new CheckBoxItem("debug", "Debug Enabled?");
    TextBoxItem from = new TextBoxItem("from", "Default From");

    form.setFields(jndi, debug, from);
    form.setEnabled(false);

    FormHelpPanel helpPanel =
        new FormHelpPanel(
            new FormHelpPanel.AddressCallback() {
              @Override
              public ModelNode getAddress() {
                ModelNode address = Baseadress.get();
                address.add("subsystem", "mail");
                address.add("mail-session", "*");
                return address;
              }
            },
            form);

    FormToolStrip<MailSession> formToolStrip =
        new FormToolStrip<MailSession>(
            form,
            new FormToolStrip.FormCallback<MailSession>() {
              @Override
              public void onSave(Map<String, Object> changeset) {
                presenter.onSave(form.getEditedEntity(), changeset);
              }

              @Override
              public void onDelete(MailSession entity) {}
            });
    formToolStrip.providesDeleteOp(false);

    Widget detail = new FormLayout().setForm(form).setHelp(helpPanel).build();

    Widget panel =
        new MultipleToOneLayout()
            .setPlain(true)
            .setTitle("Mail")
            .setHeadline("Mail Sessions")
            .setDescription(Console.CONSTANTS.subsys_mail_session_desc())
            .setMaster(Console.MESSAGES.available("Mail Session"), table)
            .setMasterTools(toolstrip.asWidget())
            .setDetailTools(formToolStrip.asWidget())
            .setDetail(Console.CONSTANTS.common_label_selection(), detail)
            .build();

    form.bind(table);

    return panel;
  }