Exemplo n.º 1
0
  private void initLoggers() {
    initRoot();

    ISortableDataProvider<LoggerConfiguration, String> provider =
        new ListDataProvider<>(
            this, new PropertyModel<List<LoggerConfiguration>>(getModel(), "loggers"));
    TablePanel table = new TablePanel<>(ID_LOGGERS_TABLE, provider, initLoggerColumns());
    table.setOutputMarkupId(true);
    table.setShowPaging(true);
    add(table);

    AjaxButton addStandardLogger =
        new AjaxButton(
            ID_BUTTON_ADD_STANDARD_LOGGER,
            createStringResource("LoggingConfigPanel.button.addStandardLogger")) {

          @Override
          public void onClick(AjaxRequestTarget target) {
            addStandardLoggerPerformed(target);
          }
        };
    add(addStandardLogger);

    AjaxButton addComponentLogger =
        new AjaxButton(
            "addComponentLogger",
            createStringResource("LoggingConfigPanel.button.addComponentLogger")) {

          @Override
          public void onClick(AjaxRequestTarget target) {
            addComponentLoggerPerformed(target);
          }
        };
    add(addComponentLogger);

    AjaxButton addClassLogger =
        new AjaxButton(
            "addClassLogger", createStringResource("LoggingConfigPanel.button.addClassLogger")) {

          @Override
          public void onClick(AjaxRequestTarget target) {
            addClassLoggerPerformed(target);
          }
        };
    add(addClassLogger);

    AjaxButton deleteLogger =
        new AjaxButton(
            "deleteLogger", createStringResource("LoggingConfigPanel.button.deleteLogger")) {

          @Override
          public void onClick(AjaxRequestTarget target) {
            deleteLoggerPerformed(target);
          }
        };
    add(deleteLogger);
  }
Exemplo n.º 2
0
  private void searchPerformed(AjaxRequestTarget target) {
    ObjectQuery query = createQuery();

    TablePanel panel = getTable();
    DataTable table = panel.getDataTable();
    AccountContentDataProvider provider = (AccountContentDataProvider) table.getDataProvider();
    provider.setQuery(query);
    table.setCurrentPage(0);

    target.add(panel);
    target.add(getFeedbackPanel());
  }
Exemplo n.º 3
0
  private void clearSearchPerformed(AjaxRequestTarget target) {
    searchModel.setObject(new AccountContentSearchDto());

    TablePanel panel = getTable();
    DataTable table = panel.getDataTable();
    AccountContentDataProvider provider = (AccountContentDataProvider) table.getDataProvider();
    provider.setQuery(null);

    ResourcesStorage storage = getSessionStorage().getResources();
    storage.setAccountContentSearch(searchModel.getObject());
    storage.setAccountContentPaging(null);
    panel.setCurrentPage(null);

    target.add(get(ID_SEARCH_FORM));
    target.add(panel);
  }
Exemplo n.º 4
0
  private void initAppenders() {
    ISortableDataProvider<AppenderConfiguration, String> provider =
        new ListDataProvider<>(
            this,
            new PropertyModel<List<AppenderConfiguration>>(getModel(), LoggingDto.F_APPENDERS));

    TablePanel table = new TablePanel<>(ID_TABLE_APPENDERS, provider, initAppenderColumns());
    table.setOutputMarkupId(true);
    table.setShowPaging(false);
    add(table);

    AjaxButton addConsoleAppender =
        new AjaxButton(
            ID_BUTTON_ADD_CONSOLE_APPENDER,
            createStringResource("LoggingConfigPanel.button.addConsoleAppender")) {

          @Override
          public void onClick(AjaxRequestTarget target) {
            addConsoleAppenderPerformed(target);
          }
        };
    add(addConsoleAppender);

    AjaxButton addFileAppender =
        new AjaxButton(
            ID_BUTTON_ADD_FILE_APPENDER,
            createStringResource("LoggingConfigPanel.button.addFileAppender")) {

          @Override
          public void onClick(AjaxRequestTarget target) {
            addFileAppenderPerformed(target);
          }
        };
    add(addFileAppender);

    AjaxButton deleteAppender =
        new AjaxButton(
            ID_BUTTON_DELETE_APPENDER,
            createStringResource("LoggingConfigPanel.button.deleteAppender")) {

          @Override
          public void onClick(AjaxRequestTarget target) {
            deleteAppenderPerformed(target);
          }
        };
    add(deleteAppender);
  }
Exemplo n.º 5
0
  private void adjustLoggersTablePage(TablePanel loggersTable, LoggingDto dto) {
    if (loggersTable != null && dto.getLoggers().size() > 10) {
      DataTable table = loggersTable.getDataTable();

      if (table != null) {
        table.setCurrentPage((long) (dto.getLoggers().size() / 10));
      }
    }
  }
Exemplo n.º 6
0
  private void initLayout() {
    Form searchForm = new Form(ID_SEARCH_FORM);
    add(searchForm);

    CheckBox nameCheck =
        new CheckBox(ID_NAME_CHECK, new PropertyModel(searchModel, AccountContentSearchDto.F_NAME));
    searchForm.add(nameCheck);

    CheckBox identifiersCheck =
        new CheckBox(
            ID_IDENTIFIERS_CHECK,
            new PropertyModel(searchModel, AccountContentSearchDto.F_IDENTIFIERS));
    searchForm.add(identifiersCheck);

    BasicSearchPanel<AccountContentSearchDto> basicSearch =
        new BasicSearchPanel<AccountContentSearchDto>(ID_BASIC_SEARCH) {

          @Override
          protected IModel<String> createSearchTextModel() {
            return new PropertyModel<>(searchModel, AccountContentSearchDto.F_SEARCH_TEXT);
          }

          @Override
          protected void searchPerformed(AjaxRequestTarget target) {
            PageContentAccounts.this.searchPerformed(target);
          }

          @Override
          protected void clearSearchPerformed(AjaxRequestTarget target) {
            PageContentAccounts.this.clearSearchPerformed(target);
          }
        };
    searchForm.add(basicSearch);

    Form mainForm = new Form(ID_MAIN_FORM);
    add(mainForm);

    AccountContentDataProvider provider =
        new AccountContentDataProvider(
            this,
            new PropertyModel<String>(resourceModel, "oid"),
            createObjectClassModel(),
            createUseObjectCountingModel()) {

          @Override
          protected void addInlineMenuToDto(AccountContentDto dto) {
            addRowMenuToTable(dto);
          }
        };
    provider.setQuery(createQuery());

    List<IColumn> columns = initColumns();
    TablePanel table =
        new TablePanel(
            ID_TABLE,
            provider,
            columns,
            UserProfileStorage.TableId.PAGE_RESOURCE_ACCOUNTS_PANEL,
            getItemsPerPage(UserProfileStorage.TableId.PAGE_RESOURCE_ACCOUNTS_PANEL));
    table.setOutputMarkupId(true);
    mainForm.add(table);

    initDialog();
  }
Exemplo n.º 7
0
  private void initLayout(final boolean oldPasswordVisible) {
    model = (LoadableModel<MyPasswordsDto>) getModel();

    Label oldPasswordLabel =
        new Label(
            ID_OLD_PASSWORD_LABEL, createStringResource("PageSelfCredentials.oldPasswordLabel"));
    add(oldPasswordLabel);
    oldPasswordLabel.add(
        new VisibleEnableBehaviour() {

          private static final long serialVersionUID = 1L;

          @Override
          public boolean isVisible() {
            return oldPasswordVisible;
          }
        });

    Label passwordLabel =
        new Label(ID_PASSWORD_LABEL, createStringResource("PageSelfCredentials.passwordLabel1"));
    add(passwordLabel);

    PasswordTextField oldPasswordField =
        new PasswordTextField(
            ID_OLD_PASSWORD_FIELD, new PropertyModel<String>(model, MyPasswordsDto.F_OLD_PASSWORD));
    oldPasswordField.setRequired(false);
    oldPasswordField.setResetPassword(false);
    add(oldPasswordField);
    oldPasswordField.add(
        new VisibleEnableBehaviour() {

          private static final long serialVersionUID = 1L;

          public boolean isVisible() {
            return oldPasswordVisible;
          };
        });

    PasswordPanel passwordPanel =
        new PasswordPanel(
            ID_PASSWORD_PANEL,
            new PropertyModel<ProtectedStringType>(model, MyPasswordsDto.F_PASSWORD));
    passwordPanel.getBaseFormComponent().add(new AttributeModifier("autofocus", ""));
    add(passwordPanel);

    WebMarkupContainer accountContainer = new WebMarkupContainer(ID_ACCOUNTS_CONTAINER);

    List<IColumn<PasswordAccountDto, String>> columns = initColumns();
    ListDataProvider<PasswordAccountDto> provider =
        new ListDataProvider<PasswordAccountDto>(
            this, new PropertyModel<List<PasswordAccountDto>>(model, MyPasswordsDto.F_ACCOUNTS));
    TablePanel accounts = new TablePanel(ID_ACCOUNTS_TABLE, provider, columns);
    accounts.setItemsPerPage(30);
    accounts.setShowPaging(false);
    if (model.getObject().getPropagation() != null
        && model
            .getObject()
            .getPropagation()
            .equals(CredentialsPropagationUserControlType.MAPPING)) {
      accountContainer.setVisible(false);
    }
    accountContainer.add(accounts);

    AjaxLink help =
        new AjaxLink(ID_BUTTON_HELP) {
          private static final long serialVersionUID = 1L;

          @Override
          public void onClick(AjaxRequestTarget target) {
            showHelpPerformed(target);
          }
        };
    accountContainer.add(help);

    add(accountContainer);
  }
  private void initLayout(final IModel<TaskDto> taskDtoModel) {

    WebMarkupContainer threadsConfigurationPanel =
        new WebMarkupContainer(ID_THREADS_CONFIGURATION_PANEL);
    add(threadsConfigurationPanel);

    threadsConfigurationPanel.add(
        new VisibleEnableBehaviour() {
          @Override
          public boolean isVisible() {
            return taskDtoModel.getObject().configuresWorkerThreads();
          }
        });

    final TextField<Integer> workerThreads =
        new TextField<>(
            ID_WORKER_THREADS, new PropertyModel<Integer>(taskDtoModel, TaskDto.F_WORKER_THREADS));
    workerThreads.setOutputMarkupId(true);
    workerThreads.add(
        new VisibleEnableBehaviour() {
          @Override
          public boolean isEnabled() {
            return parentPage.isEdit();
          }
        });
    threadsConfigurationPanel.add(workerThreads);

    VisibleEnableBehaviour hiddenWhenEditingOrNoSubtasks =
        new VisibleEnableBehaviour() {
          @Override
          public boolean isVisible() {
            return !parentPage.isEdit() && !taskDtoModel.getObject().getSubtasks().isEmpty();
          }
        };

    Label subtasksLabel =
        new Label(ID_SUBTASKS_LABEL, new ResourceModel("pageTaskEdit.subtasksLabel"));
    subtasksLabel.add(hiddenWhenEditingOrNoSubtasks);
    add(subtasksLabel);
    SubtasksPanel subtasksPanel =
        new SubtasksPanel(
            ID_SUBTASKS_PANEL,
            new PropertyModel<List<TaskDto>>(taskDtoModel, TaskDto.F_SUBTASKS),
            parentPage.getWorkflowManager().isEnabled());
    subtasksPanel.add(hiddenWhenEditingOrNoSubtasks);
    add(subtasksPanel);

    VisibleEnableBehaviour hiddenWhenNoSubtasks =
        new VisibleEnableBehaviour() {
          @Override
          public boolean isVisible() {
            TaskDto taskDto = taskDtoModel.getObject();
            return taskDto != null && !taskDto.getTransientSubtasks().isEmpty();
          }
        };

    Label workerThreadsTableLabel =
        new Label(ID_WORKER_THREADS_TABLE_LABEL, new ResourceModel("TaskStatePanel.workerThreads"));
    workerThreadsTableLabel.add(hiddenWhenNoSubtasks);
    add(workerThreadsTableLabel);
    List<IColumn<WorkerThreadDto, String>> columns = new ArrayList<>();
    columns.add(
        new PropertyColumn(
            createStringResourceStatic(this, "TaskStatePanel.subtaskName"),
            WorkerThreadDto.F_NAME));
    columns.add(
        new EnumPropertyColumn<WorkerThreadDto>(
            createStringResourceStatic(this, "TaskStatePanel.subtaskState"),
            WorkerThreadDto.F_EXECUTION_STATUS));
    columns.add(
        new PropertyColumn(
            createStringResourceStatic(this, "TaskStatePanel.subtaskObjectsProcessed"),
            WorkerThreadDto.F_PROGRESS));
    ISortableDataProvider<WorkerThreadDto, String> threadsProvider =
        new ListDataProvider<>(
            this,
            new AbstractReadOnlyModel<List<WorkerThreadDto>>() {
              @Override
              public List<WorkerThreadDto> getObject() {
                List<WorkerThreadDto> rv = new ArrayList<>();
                TaskDto taskDto = taskDtoModel.getObject();
                if (taskDto != null) {
                  for (TaskDto subtaskDto : taskDto.getTransientSubtasks()) {
                    rv.add(new WorkerThreadDto(subtaskDto));
                  }
                }
                return rv;
              }
            });
    TablePanel<WorkerThreadDto> workerThreadsTablePanel =
        new TablePanel<>(ID_WORKER_THREADS_TABLE, threadsProvider, columns);
    workerThreadsTablePanel.add(hiddenWhenNoSubtasks);
    add(workerThreadsTablePanel);
  }