Пример #1
0
  public Widget asWidget() {
    VerticalPanel layout = new VerticalPanel();
    layout.addStyleName("window-content");

    ConnectorForm form =
        new ConnectorForm(
            new FormToolStrip.FormCallback<ActivemqConnector>() {
              @Override
              public void onSave(Map<String, Object> changeset) {}

              @Override
              public void onDelete(ActivemqConnector entity) {}
            },
            type);

    form.setIsCreate(true);
    layout.add(form.asWidget());

    DialogueOptions options =
        new DialogueOptions(
            event -> {
              Form<ActivemqConnector> actualForm = form.getForm();
              FormValidation validation = actualForm.validate();
              if (!validation.hasErrors()) {
                ActivemqConnector entity = actualForm.getUpdatedEntity();
                entity.setType(type);
                presenter.onCreateConnector(entity);
              }
            },
            event -> presenter.closeDialogue());

    return new WindowContentBuilder(layout, options).build();
  }
Пример #2
0
  public void setProviderDetails(MessagingProvider provider) {

    serverName.setHTML(Console.MESSAGES.subsys_messaging(provider.getName()));

    form.edit(provider);
    form.setEnabled(false);

    addrDetails.setProvider(provider);
  }
Пример #3
0
 @Override
 protected FormAdapter<T> makeAddEntityForm() {
   Form<T> form = new Form(beanType);
   form.setNumColumns(1);
   form.setFields(
       getFormMetaData().findAttribute("name").getFormItemForAdd(),
       getFormMetaData().findAttribute("cacheContainer").getFormItemForAdd(this),
       getFormMetaData().findAttribute("clusteredCacheMode").getFormItemForAdd());
   return form;
 }
Пример #4
0
  Widget asWidget() {
    VerticalPanel layout = new VerticalPanel();
    layout.setStyleName("fill-layout");

    form =
        new Form<TransactionManager>(TransactionManager.class) {
          @Override
          public FormValidation validate() {
            return validateTx(super.validate());
          }
        };
    form.setNumColumns(2);

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

              @Override
              public void onDelete(TransactionManager entity) {}
            });
    toolstrip.providesDeleteOp(false);

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

    formValidationError = new Label("Form is invalid!");
    formValidationError.addStyleName("form-error-desc");
    formValidationError.getElement().getStyle().setLineHeight(9, PX);
    formValidationError.getElement().getStyle().setMarginBottom(5, PX);
    formValidationError.setVisible(false);
    layout.add(formValidationError.asWidget());

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

    layout.add(form.asWidget());

    return layout;
  }
 @Override
 protected FormAdapter<PeriodicRotatingFileHandler> makeAddEntityForm() {
   Form<PeriodicRotatingFileHandler> form = new Form(type);
   form.setNumColumns(1);
   form.setFields(
       formMetaData.findAttribute("name").getFormItemForAdd(),
       levelItemForAdd,
       formMetaData.findAttribute("filePath").getFormItemForAdd(),
       formMetaData.findAttribute("fileRelativeTo").getFormItemForAdd(),
       formMetaData.findAttribute("suffix").getFormItemForAdd());
   return form;
 }
Пример #6
0
  Widget asWidget() {

    VerticalPanel layout = new VerticalPanel();

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

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

              @Override
              public void onDelete(ServerGroupRecord entity) {
                presenter.onDeleteGroup(entity);
              }
            });

    toolstrip.providesDeleteOp(false);

    TextItem nameItem = new TextItem("name", "Name");
    profileItem = new ComboBoxItem("profileName", Console.CONSTANTS.common_label_profile());
    socketBindingItem =
        new ComboBoxItem("socketBinding", Console.CONSTANTS.common_label_socketBinding());
    socketBindingItem.setDefaultToFirstOption(true);

    form.setFields(nameItem, profileItem, socketBindingItem);

    final FormHelpPanel helpPanel =
        new FormHelpPanel(
            new FormHelpPanel.AddressCallback() {
              @Override
              public ModelNode getAddress() {
                ModelNode address = new ModelNode();
                address.add("server-group", "*");
                return address;
              }
            },
            form);

    layout.add(toolstrip.asWidget());
    layout.add(helpPanel.asWidget());
    layout.add(form.asWidget());

    form.setEnabled(false);

    return layout;
  }
Пример #7
0
  public Widget asWidget() {

    JndiNameItem jndiName = new JndiNameItem("jndiName", "JNDI Name");

    TextBoxItem groupId = new TextBoxItem("groupId", "Group ID", false);
    TextBoxItem connector = new TextBoxItem("connector", "Connector");

    CheckBoxItem failoverInitial = new CheckBoxItem("failoverInitial", "Failover Initial?");

    CheckBoxItem globalPools = new CheckBoxItem("useGlobalPools", "Global Pools?");

    NumberBoxItem threadPool = new NumberBoxItem("threadPoolMax", "Thread Pool Max");
    NumberBoxItem txBatch = new NumberBoxItem("transactionBatchSize", "Transaction Batch Size");

    if (isCreate) {

      TextBoxItem name = new TextBoxItem("name", "Name");

      form.setFields(name, jndiName, connector);
    } else {
      TextItem name = new TextItem("name", "Name");

      form.setFields(
          name, jndiName, connector, groupId, failoverInitial, threadPool, txBatch, globalPools);
    }

    FormHelpPanel helpPanel =
        new FormHelpPanel(
            new FormHelpPanel.AddressCallback() {
              @Override
              public ModelNode getAddress() {
                ModelNode address = Baseadress.get();
                address.add("subsystem", "messaging");
                address.add("hornetq-server", "*");
                address.add("connection-factory", "*");
                return address;
              }
            },
            form);

    FormLayout formLayout = new FormLayout().setForm(form).setHelp(helpPanel);

    if (provideTools) {
      FormToolStrip<ConnectionFactory> formTools =
          new FormToolStrip<ConnectionFactory>(form, callback);
      formLayout.setTools(formTools);
    }

    return formLayout.build();
  }
Пример #8
0
  @Override
  public void updateFrom(EESubsystem eeSubsystem) {
    form.edit(eeSubsystem);
    dataProvider.setList(eeSubsystem.getModules());

    moduleList.selectDefaultEntity();
  }
Пример #9
0
  @Override
  public void setEnabled(boolean b) {
    form.setEnabled(b);

    String text = b ? "Save" : "Edit";
    editBtn.setText(text);
  }
Пример #10
0
  public Widget asWidget() {

    DockLayoutPanel wrapper = new DockLayoutPanel(Style.Unit.PX);

    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("window-content");

    final Form<PropertyRecord> form = new Form<PropertyRecord>(PropertyRecord.class);

    TextBoxItem nameItem = new TextBoxItem("key", "Name");
    TextBoxItem valueItem = new TextBoxItem("value", "Value");
    CheckBoxItem bootItem = new CheckBoxItem("bootTime", "Boot-Time");

    if (Console.MODULES.getBootstrapContext().isStandalone() || !includeBootTime)
      form.setFields(nameItem, valueItem);
    else form.setFields(nameItem, valueItem, bootItem);

    DialogueOptions options =
        new DialogueOptions(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                // save
                PropertyRecord property = form.getUpdatedEntity();
                presenter.onCreateProperty(reference, property);
              }
            },
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                // cancel
                presenter.closePropertyDialoge();
              }
            });

    panel.add(form.asWidget());

    wrapper.addSouth(options, 35);
    wrapper.add(panel);
    return wrapper;
  }
Пример #11
0
  public Widget build() {

    if (null == form) throw new IllegalStateException("form not set");

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

    if (tools != null) layout.add(tools.asWidget());
    if (help != null) layout.add(help.asWidget());
    layout.add(form.asWidget());

    return layout;
  }
Пример #12
0
  Widget asWidget() {
    ToolStrip topLevelTools = new ToolStrip();
    topLevelTools.addToolButtonRight(
        new ToolButton(
            Console.CONSTANTS.common_label_add(),
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                presenter.launchNewAdminWizard();
              }
            }));

    ClickHandler clickHandler =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {

            final AdminObject selection = getCurrentSelection();

            if (selection != null) {
              Feedback.confirm(
                  Console.MESSAGES.deleteTitle("Admin Object"),
                  Console.MESSAGES.deleteConfirm("Admin Object" + selection.getJndiName()),
                  new Feedback.ConfirmationHandler() {
                    @Override
                    public void onConfirmation(boolean isConfirmed) {
                      if (isConfirmed) {
                        presenter.onRemoveAdmin(selection);
                      }
                    }
                  });
            }
          }
        };

    ToolButton deleteBtn = new ToolButton(Console.CONSTANTS.common_label_delete());
    deleteBtn.addClickHandler(clickHandler);
    topLevelTools.addToolButtonRight(deleteBtn);

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

                final AdminObject selection = getCurrentSelection();

                if (selection != null) {
                  selection.setEnabled(!selection.isEnabled());

                  Feedback.confirm(
                      Console.MESSAGES.modify("Admin Object"),
                      Console.MESSAGES.modifyConfirm("Admin Object " + selection.getJndiName()),
                      new Feedback.ConfirmationHandler() {
                        @Override
                        public void onConfirmation(boolean isConfirmed) {
                          if (isConfirmed) {
                            presenter.enOrDisbaleAdminObject(currentAdapter, selection);
                          }
                        }
                      });
                }
              }
            });
    topLevelTools.addToolButtonRight(disableBtn);

    // -------

    table =
        new DefaultCellTable<AdminObject>(
            10,
            new ProvidesKey<AdminObject>() {
              @Override
              public Object getKey(AdminObject item) {
                return item.getJndiName();
              }
            });

    dataProvider = new ListDataProvider<AdminObject>();
    dataProvider.addDataDisplay(table);

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

    Column<AdminObject, ImageResource> statusColumn =
        new Column<AdminObject, ImageResource>(new ImageResourceCell()) {
          @Override
          public ImageResource getValue(AdminObject ra) {

            ImageResource res = null;

            if (ra.isEnabled()) res = Icons.INSTANCE.status_good();
            else res = Icons.INSTANCE.status_bad();

            return res;
          }
        };

    table.addColumn(nameColumn, "Name");
    table.addColumn(statusColumn, "Enabled?");

    // ---

    configProperties = new PropertyEditor(this, true);

    // ----

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

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

    TextItem name = new TextItem("name", "Name");
    TextBoxItem jndiItem = new TextBoxItem("jndiName", "JNDI");
    TextBoxItem classItem = new TextBoxItem("adminClass", "Class Name");
    // CheckBoxItem enabled = new CheckBoxItem("enabled", "Enabled?");

    form.setFields(name, jndiItem, classItem);

    form.setEnabled(false);
    form.bind(table);

    FormToolStrip<AdminObject> tools =
        new FormToolStrip<AdminObject>(
            form,
            new FormToolStrip.FormCallback<AdminObject>() {
              @Override
              public void onSave(Map<String, Object> changeset) {
                presenter.onSaveAdmin(getCurrentSelection(), changeset);
              }

              @Override
              public void onDelete(AdminObject entity) {
                // not possible
              }
            });

    tools.providesDeleteOp(false);

    final FormHelpPanel helpPanel =
        new FormHelpPanel(
            new FormHelpPanel.AddressCallback() {
              @Override
              public ModelNode getAddress() {
                ModelNode address = Baseadress.get();
                address.add("subsystem", "resource-adapters");
                address.add("resource-adapter", "*");
                address.add("admin-objects", "*");
                return address;
              }
            },
            form);

    formpanel.add(tools.asWidget());
    formpanel.add(helpPanel.asWidget());
    formpanel.add(form.asWidget());

    table
        .getSelectionModel()
        .addSelectionChangeHandler(
            new SelectionChangeEvent.Handler() {

              public void onSelectionChange(SelectionChangeEvent event) {
                AdminObject selection = getCurrentSelection();
                configProperties.setProperties("", selection.getProperties());

                String nextState =
                    selection.isEnabled()
                        ? Console.CONSTANTS.common_label_disable()
                        : Console.CONSTANTS.common_label_enable();
                disableBtn.setText(nextState);
              }
            });

    // ----

    headline = new HTML("HEADLINE");
    headline.setStyleName("content-header-label");

    MultipleToOneLayout layout =
        new MultipleToOneLayout()
            .setPlain(true)
            .setHeadlineWidget(headline)
            .setTitle("TITLE")
            .setDescription(Console.CONSTANTS.subsys_jca_adminobject_desc())
            .setMaster(Console.MESSAGES.available("Admin Objects"), table)
            .setMasterTools(topLevelTools.asWidget())
            .addDetail("Attributes", formpanel)
            .addDetail("Properties", configProperties.asWidget());

    configProperties.setAllowEditProps(false);

    return layout.build();
  }
Пример #13
0
  @Override
  public Widget createWidget() {

    LayoutPanel layout = new RHSContentPanel("Servlet");

    layout.add(new ContentHeaderLabel("Servlet/HTTP Configuration"));
    layout.add(new ContentDescription(Console.CONSTANTS.subsys_web_desc()));
    // ----

    form = new Form(JSPContainerConfiguration.class);
    form.setNumColumns(2);

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

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

    toolStrip.providesDeleteOp(false);
    layout.add(toolStrip.asWidget());

    // ----

    CheckBoxItem disabled = new CheckBoxItem("disabled", "Disabled?");
    CheckBoxItem development = new CheckBoxItem("development", "Development?");
    TextBoxItem instanceId = new TextBoxItem("instanceId", "Instance ID", false);

    CheckBoxItem keepGenerated = new CheckBoxItem("keepGenerated", "Keep Generated?");
    NumberBoxItem checkInterval = new NumberBoxItem("checkInterval", "Check Interval");
    CheckBoxItem sourceFragment = new CheckBoxItem("displaySource", "Display Source?");

    form.setFields(disabled, development, instanceId);
    form.setFieldsInGroup(
        Console.CONSTANTS.common_label_advanced(),
        new DisclosureGroupRenderer(),
        keepGenerated,
        checkInterval,
        sourceFragment);

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

    layout.add(helpPanel.asWidget());

    layout.add(form.asWidget());
    form.setEnabled(false); // TODO:

    // ----

    TabPanel bottomLayout = new TabPanel();
    bottomLayout.addStyleName("default-tabpanel");
    bottomLayout.getElement().setAttribute("style", "padding-top:20px;");

    connectorList = new ConnectorList(presenter);
    bottomLayout.add(connectorList.asWidget(), "Connectors");

    serverList = new VirtualServerList(presenter);
    bottomLayout.add(serverList.asWidget(), "Virtual Servers");

    bottomLayout.selectTab(0);

    layout.add(bottomLayout);

    return layout;
  }
Пример #14
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();
  }
  Widget asWidget() {
    VerticalPanel layout = new VerticalPanel();
    layout.setStyleName("window-content");

    layout.add(new HTML("<h3>" + Console.CONSTANTS.subsys_jca_xadataSource_step4() + "</h3>"));

    form = new Form<XADataSource>(XADataSource.class);

    TextBoxItem user = new NonRequiredTextBoxItem("username", "Username");
    PasswordBoxItem pass =
        new PasswordBoxItem("password", "Password") {
          {
            setRequired(false);
          }
        };
    TextBoxItem domain = new NonRequiredTextBoxItem("securityDomain", "Security Domain");

    form.setFields(user, pass, domain);

    final FormHelpPanel helpPanel =
        new FormHelpPanel(
            new FormHelpPanel.AddressCallback() {
              @Override
              public ModelNode getAddress() {
                ModelNode address = Baseadress.get();
                address.add("subsystem", "datasources");
                address.add("xa-data-source", "*");
                return address;
              }
            },
            form);

    layout.add(helpPanel.asWidget());

    layout.add(form.asWidget());

    ClickHandler submitHandler =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            FormValidation validation = form.validate();
            if (!validation.hasErrors()) {
              wizard.onFinish(form.getUpdatedEntity());
            }
          }
        };

    ClickHandler cancelHandler =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            wizard.getPresenter().closeDialogue();
          }
        };

    DialogueOptions options =
        new DialogueOptions(
            "Done", submitHandler,
            "Cancel", cancelHandler);

    return new WindowContentBuilder(layout, options).build();
  }
 void edit(XADataSource entity) {
   form.edit(entity);
 }
Пример #17
0
  Widget asWidget() {
    table =
        new DefaultCellTable<JGroupsProtocol>(
            6,
            new ProvidesKey<JGroupsProtocol>() {
              @Override
              public Object getKey(JGroupsProtocol item) {
                return item.getType();
              }
            });
    dataProvider = new ListDataProvider<JGroupsProtocol>();
    dataProvider.addDataDisplay(table);

    TextColumn<JGroupsProtocol> type =
        new TextColumn<JGroupsProtocol>() {
          @Override
          public String getValue(JGroupsProtocol record) {
            return record.getType();
          }
        };

    table.addColumn(type, "Type");

    ToolStrip toolstrip = new ToolStrip();

    ToolButton addBtn =
        new ToolButton(
            Console.CONSTANTS.common_label_append(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                presenter.launchNewProtocolWizard();
              }
            });
    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("Protocol"),
                    Console.MESSAGES.deleteConfirm("Protocol"),
                    new Feedback.ConfirmationHandler() {
                      @Override
                      public void onConfirmation(boolean isConfirmed) {
                        if (isConfirmed) presenter.onDeleteProtocol(form.getEditedEntity());
                      }
                    });
              }
            });

    toolstrip.addToolButtonRight(removeBtn);

    // ------

    this.propertyEditor = new PropertyEditor(presenter, true);

    // ------

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

    TextItem typeField = new TextItem("type", "Type");
    TextBoxItem socket = new TextBoxItem("socketBinding", "Socket Binding");

    form.setFields(typeField, socket);
    form.setEnabled(false);

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

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

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

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

    headline = new HTML();
    headline.setStyleName("content-header-label");

    Widget panel =
        new MultipleToOneLayout()
            .setPlain(true)
            .setTitle("JGroups")
            .setHeadlineWidget(headline)
            .setDescription(Console.CONSTANTS.subsys_jgroups_protocol_desc())
            .setMaster(Console.MESSAGES.available("Protocols"), table)
            .setMasterTools(toolstrip.asWidget())
            .addDetail("Attributes", detail)
            .addDetail("Properties", propertyEditor.asWidget())
            .build();

    form.bind(table);
    propertyEditor.setAllowEditProps(false);

    table
        .getSelectionModel()
        .addSelectionChangeHandler(
            new SelectionChangeEvent.Handler() {
              @Override
              public void onSelectionChange(SelectionChangeEvent event) {
                JGroupsProtocol currentSelection = getCurrentSelection();
                List<PropertyRecord> properties = currentSelection.getProperties();
                if (properties != null)
                  propertyEditor.setProperties(
                      selectedStack.getName() + "_#_" + currentSelection.getType(), properties);
                else
                  propertyEditor.setProperties(
                      selectedStack.getName() + "_#_" + currentSelection.getType(),
                      Collections.EMPTY_LIST);
              }
            });
    return panel;
  }
Пример #18
0
 public DefaultCFForm(
     FormToolStrip.FormCallback<ActivemqConnectionFactory> callback, boolean provideTools) {
   this.callback = callback;
   this.provideTools = provideTools;
   form.setNumColumns(2);
 }
Пример #19
0
 public void clearValues() {
   form.clearValues();
 }
Пример #20
0
 @Override
 public void setJSPConfig(JSPContainerConfiguration jspConfig) {
   form.edit(jspConfig);
 }
Пример #21
0
 public void setSecurityConfig(List<ActivemqSecurityPattern> patterns) {
   secProvider.setList(patterns);
   secTable.selectDefaultEntity();
   form.setEnabled(false);
   serverName.setText("Security Settings: Provider " + presenter.getCurrentServer());
 }
Пример #22
0
 public DefaultCFForm(FormToolStrip.FormCallback<ActivemqConnectionFactory> callback) {
   this.callback = callback;
   form.setNumColumns(2);
 }
Пример #23
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;
  }
Пример #24
0
  public Widget asWidget() {

    LayoutPanel layout = new LayoutPanel();
    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("rhs-content-panel");

    ScrollPanel scroll = new ScrollPanel(panel);
    layout.add(scroll);

    layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

    serverName = new HTML("Replace me");
    serverName.setStyleName("content-header-label");

    panel.add(serverName);
    panel.add(new ContentDescription(Console.CONSTANTS.subsys_messaging_jms_provider_desc()));

    form = new Form(MessagingProvider.class);
    form.setNumColumns(2);

    CheckBoxItem persistenceItem = new CheckBoxItem("persistenceEnabled", "Persistence enabled?");
    CheckBoxItem securityItem = new CheckBoxItem("securityEnabled", "Security enabled?");
    CheckBoxItem messageCounterItem =
        new CheckBoxItem("messageCounterEnabled", "Message Counter enabled?");

    // TextItem connector = new TextItem("connectorBinding", "Connector Binding");
    // TextItem acceptor = new TextItem("acceptorBinding", "Acceptor Binding");

    form.setFields(persistenceItem, securityItem, messageCounterItem);
    // form.setFieldsInGroup("Connections", new DisclosureGroupRenderer(), acceptor, connector);

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

              @Override
              public void onDelete(MessagingProvider entity) {}
            });
    toolStrip.providesDeleteOp(false);

    panel.add(toolStrip.asWidget());

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

    panel.add(helpPanel.asWidget());
    Widget formWidget = form.asWidget();
    panel.add(formWidget);

    formWidget.getElement().setAttribute("style", "padding-bottom:20px;");

    // ------

    TabPanel bottomLayout = new TabPanel();
    bottomLayout.addStyleName("default-tabpanel");

    secDetails = new SecurityDetails(presenter);
    bottomLayout.add(secDetails.asWidget(), "Security");

    addrDetails = new AddressingDetails(presenter);
    bottomLayout.add(addrDetails.asWidget(), "Addressing");

    bottomLayout.selectTab(0);

    panel.add(bottomLayout);
    bottomLayout.getElement().setAttribute("style", "padding-top:10px");

    return layout;
  }
Пример #25
0
 public void edit(TransactionManager tm) {
   form.edit(tm);
 }
Пример #26
0
  @Override
  public Widget createWidget() {
    LayoutPanel layout = new LayoutPanel();

    FakeTabPanel titleBar = new FakeTabPanel("Socket Binding Groups");
    layout.add(titleBar);

    ToolStrip toolstrip = new ToolStrip();
    toolstrip.addToolButtonRight(
        new ToolButton(
            "Add",
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                presenter.launchNewSocketDialogue();
              }
            }));

    layout.add(toolstrip);

    // -----------
    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("rhs-content-panel");

    ContentHeaderLabel nameLabel = new ContentHeaderLabel("Socket Binding Declarations");

    HorizontalPanel horzPanel = new HorizontalPanel();
    horzPanel.getElement().setAttribute("style", "width:100%;");
    // Image image = new Image(Icons.INSTANCE.deployment());
    // horzPanel.add(image);
    // image.getElement().getParentElement().setAttribute("width", "25");

    horzPanel.add(nameLabel);

    panel.add(horzPanel);

    socketTable = new SocketTable();

    HorizontalPanel tableOptions = new HorizontalPanel();
    tableOptions.getElement().setAttribute("cellpadding", "2px");

    groupFilter = new ComboBox();
    groupFilter.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            presenter.onFilterGroup(event.getValue());
          }
        });
    Widget groupFilterWidget = groupFilter.asWidget();
    groupFilterWidget.getElement().setAttribute("style", "width:200px;");

    tableOptions.add(new Label("Socket Binding Group:"));
    tableOptions.add(groupFilterWidget);

    tableOptions.getElement().setAttribute("style", "float:right;");
    panel.add(tableOptions);
    DefaultCellTable socketTableWidget = socketTable.asWidget();
    panel.add(socketTableWidget);

    DefaultPager pager = new DefaultPager();
    pager.setPage(0);
    pager.setPageSize(6);
    pager.setDisplay(socketTableWidget);
    panel.add(pager);

    ScrollPanel scroll = new ScrollPanel(panel);
    layout.add(scroll);

    layout.setWidgetTopHeight(titleBar, 0, Style.Unit.PX, 26, Style.Unit.PX);
    layout.setWidgetTopHeight(toolstrip, 26, Style.Unit.PX, 30, Style.Unit.PX);
    layout.setWidgetTopHeight(scroll, 56, Style.Unit.PX, 100, Style.Unit.PCT);

    // -----------

    ToolStrip detailToolStrip = new ToolStrip();
    editBtn = new ToolButton(Console.CONSTANTS.common_label_edit());
    ClickHandler editHandler =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            SocketBinding editedEntity = form.getEditedEntity();
            if (editBtn.getText().equals(Console.CONSTANTS.common_label_edit())) {
              presenter.editSocketBinding(editedEntity);
            } else {
              presenter.saveSocketBinding(
                  editedEntity.getName(), editedEntity.getGroup(), form.getChangedValues());
            }
          }
        };
    editBtn.addClickHandler(editHandler);
    detailToolStrip.addToolButton(editBtn);

    ClickHandler clickHandler =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {

            SocketBinding socket = form.getEditedEntity();

            Feedback.confirm(
                "Delete Socket Binding",
                "Really delete this socket binding '" + socket.getName() + "' ?",
                new Feedback.ConfirmationHandler() {
                  @Override
                  public void onConfirmation(boolean isConfirmed) {
                    if (isConfirmed) {
                      presenter.onDelete(form.getEditedEntity());
                    }
                  }
                });
          }
        };
    ToolButton deleteBtn = new ToolButton(Console.CONSTANTS.common_label_delete());
    deleteBtn.addClickHandler(clickHandler);
    detailToolStrip.addToolButton(deleteBtn);

    panel.add(new ContentGroupLabel("Socket Binding"));

    panel.add(detailToolStrip);
    // ---

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

    TextItem nameItem = new TextItem("name", "Name");
    TextItem interfaceItem = new TextItem("interface", "Interface");
    NumberBoxItem portItem = new NumberBoxItem("port", "Port");
    TextBoxItem multicastItem = new TextBoxItem("multiCastAddress", "Multicast Address");
    NumberBoxItem multicastPortItem = new NumberBoxItem("multiCastPort", "Multicast Port");

    form.setFields(nameItem, interfaceItem, portItem, multicastItem, multicastPortItem);
    form.bind(socketTable.getCellTable());

    Widget formWidget = form.asWidget();
    form.setEnabled(false);

    final FormHelpPanel helpPanel =
        new FormHelpPanel(
            new FormHelpPanel.AddressCallback() {
              @Override
              public ModelNode getAddress() {
                ModelNode address = new ModelNode();
                address.add("socket-binding-group", form.getEditedEntity().getGroup());
                address.add("socket-binding", "*");
                return address;
              }
            },
            form);
    panel.add(helpPanel.asWidget());

    panel.add(formWidget);

    // ------------------------------------------

    return layout;
  }
Пример #27
0
  public Widget asWidget() {

    final TabPanel tabs = new TabPanel();
    tabs.setStyleName("default-tabpanel");

    // -------

    VerticalPanel layout = new VerticalPanel();
    layout.setStyleName("window-content");

    // Create a FormPanel and point it at a service.
    final FormPanel form = new FormPanel();
    String url = Console.getBootstrapContext().getProperty(BootstrapContext.DEPLOYMENT_API);
    form.setAction(url);

    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);

    // Create a panel to hold all of the form widgets.
    VerticalPanel panel = new VerticalPanel();
    panel.getElement().setAttribute("style", "width:100%");
    form.setWidget(panel);

    // Create a FileUpload widgets.
    final FileUpload upload = new FileUpload();
    upload.setName("uploadFormElement");
    panel.add(upload);

    final HTML errorMessages = new HTML("Please chose a file!");
    errorMessages.setStyleName("error-panel");
    errorMessages.setVisible(false);
    panel.add(errorMessages);

    // Add a 'submit' button.

    ClickHandler cancelHandler =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            window.hide();
          }
        };

    ClickHandler submitHandler =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {

            errorMessages.setVisible(false);

            // verify form
            String filename = upload.getFilename();

            if (tabs.getTabBar().getSelectedTab() == 1) {
              // unmanaged content
              if (unmanagedForm.validate().hasErrors()) {
                return;
              } else {
                wizard.onCreateUnmanaged(unmanagedForm.getUpdatedEntity());
              }
            } else if (filename != null && !filename.equals("")) {
              loading =
                  Feedback.loading(
                      Console.CONSTANTS.common_label_plaseWait(),
                      Console.CONSTANTS.common_label_requestProcessed(),
                      new Feedback.LoadingCallback() {
                        @Override
                        public void onCancel() {}
                      });
              form.submit();
            } else {
              errorMessages.setVisible(true);
            }
          }
        };

    DialogueOptions options =
        new DialogueOptions(
            Console.CONSTANTS.common_label_next(), submitHandler,
            Console.CONSTANTS.common_label_cancel(), cancelHandler);

    // Add an event handler to the form.
    form.addSubmitCompleteHandler(
        new FormPanel.SubmitCompleteHandler() {
          @Override
          public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {

            getLoading().hide();

            String html = event.getResults();

            // Step 1: upload content, retrieve hash value
            try {

              String json = html;

              try {
                if (!GWT.isScript()) // TODO: Formpanel weirdness
                json = html.substring(html.indexOf(">") + 1, html.lastIndexOf("<"));
              } catch (StringIndexOutOfBoundsException e) {
                // if I get this exception it means I shouldn't strip out the html
                // this issue still needs more research
                Log.debug("Failed to strip out HTML.  This should be preferred?");
              }

              JSONObject response = JSONParser.parseLenient(json).isObject();
              JSONObject result = response.get("result").isObject();
              String hash = result.get("BYTES_VALUE").isString().stringValue();
              // step2: assign name and group
              wizard.onUploadComplete(upload.getFilename(), hash);

            } catch (Exception e) {
              Log.error(Console.CONSTANTS.common_error_failedToDecode() + ": " + html, e);
            }

            // Option 2: Unmanaged content

          }
        });

    String stepText =
        "<h3>"
            + Console.CONSTANTS.common_label_step()
            + "1/2: "
            + Console.CONSTANTS.common_label_deploymentSelection()
            + "</h3>";
    layout.add(new HTML(stepText));
    HTML description = new HTML();
    description.setHTML(Console.CONSTANTS.common_label_chooseFile());
    description.getElement().setAttribute("style", "padding-bottom:15px;");
    layout.add(description);
    layout.add(form);
    tabs.add(layout, "Managed");

    // Unmanaged form only for new deployments
    if (!wizard.isUpdate()) {
      VerticalPanel unmanagedPanel = new VerticalPanel();
      unmanagedPanel.setStyleName("window-content");

      String unmanagedText =
          "<h3>" + Console.CONSTANTS.common_label_step() + "1/1: Specify Deployment</h3>";
      unmanagedPanel.add(new HTML(unmanagedText));

      unmanagedForm = new Form<DeploymentRecord>(DeploymentRecord.class);
      TextAreaItem path = new TextAreaItem("path", "Path");
      TextBoxItem relativeTo = new TextBoxItem("relativeTo", "Relative To", false);

      TextBoxItem name = new TextBoxItem("name", "Name");
      TextBoxItem runtimeName = new TextBoxItem("runtimeName", "Runtime Name");
      CheckBoxItem archive = new CheckBoxItem("archive", "Is Archive?");
      archive.setValue(true);
      unmanagedForm.setFields(path, relativeTo, archive, name, runtimeName);
      unmanagedPanel.add(unmanagedForm.asWidget());
      tabs.add(unmanagedPanel, "Unmanaged");
    }

    tabs.selectTab(0);
    return new WindowContentBuilder(tabs, options).build();
  }
Пример #28
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;
  }
Пример #29
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();
  }
Пример #30
0
 public void bind(DefaultCellTable<ServerGroupRecord> serverGroupTable) {
   form.bind(serverGroupTable);
 }