use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class InternalsCountersPanel method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
setOutputMarkupId(true);
Label thresholdCounter = new Label(ID_THRESHOLD_COUNTER, createStringResource("InternalsCountersPanel.thresholds"));
add(thresholdCounter);
ListView<InternalCounters> countersTable = new ListView<>(ID_COUNTERS_TABLE, Arrays.asList(InternalCounters.values())) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<InternalCounters> item) {
InternalCounters counter = item.getModelObject();
Label label = new Label(ID_COUNTER_LABEL, createStringResource("InternalCounters." + counter.getKey()));
item.add(label);
Label valueLabel = new Label(ID_COUNTER_VALUE, new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
long val = InternalMonitor.getCount(counter);
return Long.toString(val);
}
});
item.add(valueLabel);
}
};
add(countersTable);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class LoggingConfigurationTabPanel method initLayout.
protected void initLayout() {
try {
ItemPanelSettingsBuilder builder = new ItemPanelSettingsBuilder();
builder.visibilityHandler(itemWrapper -> getLoggingVisibility(itemWrapper.getPath()));
Panel loggingPanel = getPageBase().initItemPanel(ID_LOGGING, LoggingConfigurationType.COMPLEX_TYPE, getModel(), builder.build());
add(loggingPanel);
} catch (SchemaException e) {
LOGGER.error("Cannot create panel for logging: {}", e.getMessage(), e);
getSession().error("Cannot create panle for logging");
}
PrismContainerWrapperModel<LoggingConfigurationType, ClassLoggerConfigurationType> loggerModel = PrismContainerWrapperModel.fromContainerWrapper(getModel(), LoggingConfigurationType.F_CLASS_LOGGER);
MultivalueContainerListPanel<ClassLoggerConfigurationType> loggersMultivalueContainerListPanel = new MultivalueContainerListPanel<ClassLoggerConfigurationType>(ID_LOGGERS, ClassLoggerConfigurationType.class) {
private static final long serialVersionUID = 1L;
@Override
protected List<SearchItemDefinition> initSearchableItems(PrismContainerDefinition<ClassLoggerConfigurationType> containerDef) {
List<SearchItemDefinition> defs = new ArrayList<>();
SearchFactory.addSearchPropertyDef(containerDef, ClassLoggerConfigurationType.F_APPENDER, defs);
SearchFactory.addSearchPropertyDef(containerDef, ClassLoggerConfigurationType.F_PACKAGE, defs);
defs.addAll(SearchFactory.createExtensionDefinitionList(containerDef));
return defs;
}
@Override
protected void newItemPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation) {
PrismContainerValue<ClassLoggerConfigurationType> newLogger = loggerModel.getObject().getItem().createNewValue();
PrismContainerValueWrapper<ClassLoggerConfigurationType> newLoggerWrapper = getLoggersMultivalueContainerListPanel().createNewItemContainerValueWrapper(newLogger, loggerModel.getObject(), target);
loggerEditPerformed(target, Model.of(newLoggerWrapper), null);
}
@Override
protected boolean isCreateNewObjectVisible() {
return true;
}
@Override
protected IModel<PrismContainerWrapper<ClassLoggerConfigurationType>> getContainerModel() {
return loggerModel;
}
@Override
protected String getStorageKey() {
return SessionStorage.KEY_LOGGING_TAB_LOGGER_TABLE;
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.LOGGING_TAB_LOGGER_TABLE;
}
@Override
protected List<IColumn<PrismContainerValueWrapper<ClassLoggerConfigurationType>, String>> createDefaultColumns() {
return initLoggersBasicColumns(loggerModel);
}
@Override
protected void editItemPerformed(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ClassLoggerConfigurationType>> rowModel, List<PrismContainerValueWrapper<ClassLoggerConfigurationType>> listItems) {
loggerEditPerformed(target, rowModel, listItems);
}
};
add(loggersMultivalueContainerListPanel);
PrismContainerWrapperModel<LoggingConfigurationType, AppenderConfigurationType> appenderModel = PrismContainerWrapperModel.fromContainerWrapper(getModel(), LoggingConfigurationType.F_APPENDER);
MultivalueContainerListPanelWithDetailsPanel<AppenderConfigurationType> appendersMultivalueContainerListPanel = new MultivalueContainerListPanelWithDetailsPanel<AppenderConfigurationType>(ID_APPENDERS, AppenderConfigurationType.class) {
private static final long serialVersionUID = 1L;
@Override
protected void newItemPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation) {
newAppendersClickPerformed(target, appenderModel);
}
@Override
protected boolean isCreateNewObjectVisible() {
return true;
}
@Override
protected IModel<PrismContainerWrapper<AppenderConfigurationType>> getContainerModel() {
return appenderModel;
}
@Override
protected boolean isHeaderVisible() {
return false;
}
@Override
protected String getStorageKey() {
return SessionStorage.KEY_LOGGING_TAB_APPENDER_TABLE;
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.LOGGING_TAB_APPENDER_TABLE;
}
@Override
protected List<IColumn<PrismContainerValueWrapper<AppenderConfigurationType>, String>> createDefaultColumns() {
return initAppendersBasicColumns(appenderModel);
}
@Override
protected MultivalueContainerDetailsPanel<AppenderConfigurationType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<AppenderConfigurationType>> item) {
return LoggingConfigurationTabPanel.this.getAppendersMultivalueContainerDetailsPanel(item);
}
@Override
protected List<Component> createToolbarButtonsList(String idButton) {
List<Component> bar = new ArrayList<>();
// MidpointForm appenderTypeForm = new MidpointForm(ID_CHOICE_APPENDER_TYPE_FORM);
AjaxSubmitButton newObjectIcon = new AjaxSubmitButton(idButton, new Model<>("<i class=\"fa fa-plus\"></i>")) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target) {
newItemPerformed(target, null);
}
};
newObjectIcon.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isCreateNewObjectVisible();
}
@Override
public boolean isEnabled() {
return isNewObjectButtonEnabled();
}
});
newObjectIcon.add(AttributeModifier.append("class", createStyleClassModelForNewObjectIcon()));
// appenderTypeForm.add(newObjectIcon);
bar.add(newObjectIcon);
List<QName> appendersChoicesList = new ArrayList<>();
appendersChoicesList.add(FileAppenderConfigurationType.COMPLEX_TYPE);
appendersChoicesList.add(SyslogAppenderConfigurationType.COMPLEX_TYPE);
DropDownChoicePanel<QName> appenderChoice = new DropDownChoicePanel<>(idButton, new Model<>(FileAppenderConfigurationType.COMPLEX_TYPE), Model.ofList(appendersChoicesList), new QNameIChoiceRenderer("LoggingConfigurationTabPanel.appendersChoice"));
appenderChoice.setOutputMarkupId(true);
LoggingConfigurationTabPanel.this.appenderChoice = appenderChoice;
bar.add(appenderChoice);
// bar.add(appenderTypeForm);
return bar;
}
};
add(appendersMultivalueContainerListPanel);
IModel<PrismContainerWrapper<LoggingAuditingConfigurationType>> auditModel = PrismContainerWrapperModel.fromContainerWrapper(getModel(), LoggingConfigurationType.F_AUDITING);
try {
Panel auditPanel = getPageBase().initItemPanel(ID_AUDITING, LoggingAuditingConfigurationType.COMPLEX_TYPE, auditModel, new ItemPanelSettingsBuilder().build());
add(auditPanel);
} catch (SchemaException e) {
LOGGER.error("Cannot create panel for auditing: {}", e.getMessage(), e);
getSession().error("Cannot create panel for auditing.");
}
setOutputMarkupId(true);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class ProgressPanel method initLayout.
private void initLayout() {
MidpointForm progressForm = new MidpointForm<>(ID_PROGRESS_FORM, true);
add(progressForm);
WebMarkupContainer contentsPanel = new WebMarkupContainer(ID_CONTENTS_PANEL);
contentsPanel.setOutputMarkupId(true);
progressForm.add(contentsPanel);
ListView<ProgressReportActivityDto> statusItemsListView = new ListView<>(ID_ACTIVITIES, (IModel<List<ProgressReportActivityDto>>) () -> {
ProgressReporter reporter = reporterModel.getProcessData();
ProgressDto progressDto = reporter.getProgress();
return progressDto.getProgressReportActivities();
}) {
@Override
protected void populateItem(ListItem<ProgressReportActivityDto> item) {
populateStatusItem(item);
}
};
contentsPanel.add(statusItemsListView);
StatisticsDtoModel statisticsModel = new StatisticsDtoModel();
statisticsPanel = new StatisticsPanel(ID_STATISTICS, statisticsModel);
contentsPanel.add(statisticsPanel);
ListView<String> logItemsListView = new ListView<>(ID_LOG_ITEMS, (IModel<List<String>>) () -> {
ProgressReporter reporter = reporterModel.getProcessData();
ProgressDto progressDto = reporter.getProgress();
return progressDto.getLogItems();
}) {
@Override
protected void populateItem(ListItem item) {
item.add(new Label(ID_LOG_ITEM, item.getModel()));
}
};
contentsPanel.add(logItemsListView);
Label executionTime = new Label(ID_EXECUTION_TIME, (IModel<String>) () -> {
ProgressReporter reporter = reporterModel.getProcessData();
if (reporter.getOperationDurationTime() > 0) {
return getString("ProgressPanel.ExecutionTimeWhenFinished", reporter.getOperationDurationTime());
} else if (reporter.getOperationStartTime() > 0) {
return getString("ProgressPanel.ExecutionTimeWhenRunning", (System.currentTimeMillis() - reporter.getOperationStartTime()) / 1000);
} else {
return null;
}
});
contentsPanel.add(executionTime);
initButtons(progressForm);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class ExecuteChangeOptionsPanel method createOptionsDropdownButton.
private void createOptionsDropdownButton(List<InlineMenuItem> items) {
DropdownButtonDto model = new DropdownButtonDto(null, GuiStyleConstants.CLASS_OPTIONS_BUTTON_ICON, getPageBase().createStringResource("ExecuteChangeOptionsPanel.options").getString(), items);
DropdownButtonPanel dropdownButtonPanel = new DropdownButtonPanel(ID_OPTIONS, model) {
@Override
protected void populateMenuItem(String componentId, ListItem<InlineMenuItem> menuItem) {
InlineMenuItem item = menuItem.getModelObject();
if (!(item instanceof CheckboxMenuItem)) {
super.populateMenuItem(componentId, menuItem);
return;
}
CheckboxMenuItem checkboxMenuItem = (CheckboxMenuItem) item;
CheckBoxPanel panel = new CheckBoxPanel(componentId, checkboxMenuItem.getCheckBoxModel(), checkboxMenuItem.getLabel(), null) {
@Override
public void onUpdate(AjaxRequestTarget target) {
// checkboxMenuItem.getCheckBoxModel().setObject(!checkboxMenuItem.getCheckBoxModel().getObject());
}
};
panel.setOutputMarkupId(true);
menuItem.add(panel);
}
@Override
protected String getSpecialButtonClass() {
return "btn-sm btn-default btn-margin-right";
}
@Override
protected String getSpecialDropdownMenuClass() {
return "execute-options";
}
@Override
protected String getSpecialLabelClass() {
return "execute-options-label";
}
};
add(dropdownButtonPanel);
dropdownButtonPanel.setOutputMarkupId(true);
}
use of org.apache.wicket.markup.html.list.ListItem in project midpoint by Evolveum.
the class CorrelationContextPanel method initLayout.
@Override
protected void initLayout() {
IModel<CorrelationContextDto> correlationCtxModel = createCorrelationContextModel();
ListView<String> headers = new ListView<>(ID_HEADERS, new PropertyModel<>(correlationCtxModel, F_OPTION_HEADERS)) {
@Override
protected void populateItem(ListItem<String> item) {
item.add(new Label(ID_HEADER, item.getModel()));
}
};
add(headers);
ListView<CorrelationOptionDto> actions = new ListView<>(ID_ACTIONS, new PropertyModel<>(correlationCtxModel, CorrelationContextDto.F_CORRELATION_OPTIONS)) {
@Override
protected void populateItem(ListItem<CorrelationOptionDto> item) {
AjaxButton actionButton = new AjaxButton(ID_ACTION) {
@Override
public void onClick(AjaxRequestTarget target) {
CaseType correlationCase = getObjectDetailsModels().getObjectType();
WorkItemId workItemId = WorkItemId.of(correlationCase.getWorkItem().get(0));
AbstractWorkItemOutputType output = new AbstractWorkItemOutputType().outcome(item.getModelObject().getIdentifier());
Task task = getPageBase().createSimpleTask("DecideCorrelation");
OperationResult result = task.getResult();
try {
getPageBase().getCaseService().completeWorkItem(workItemId, output, task, result);
result.computeStatusIfUnknown();
} catch (Throwable e) {
result.recordFatalError("Cannot finish correlation process, " + e.getMessage(), e);
}
getPageBase().showResult(result);
target.add(getPageBase().getFeedbackPanel());
}
};
actionButton.add(new Label(ID_ACTION_LABEL, item.getModelObject().isNewOwner() ? TEXT_CREATE_NEW : TEXT_CORRELATE));
item.add(actionButton);
}
};
add(actions);
ListView<CorrelationOptionDto> referenceIds = new ListView<>(ID_NAMES, new PropertyModel<>(correlationCtxModel, CorrelationContextDto.F_CORRELATION_OPTIONS)) {
@Override
protected void populateItem(ListItem<CorrelationOptionDto> item) {
// A full-object reference to the candidate owner
ReadOnlyModel<ObjectReferenceType> referenceModel = new ReadOnlyModel<>(() -> {
CorrelationOptionDto optionDto = item.getModelObject();
if (!optionDto.isNewOwner()) {
return ObjectTypeUtil.createObjectRefWithFullObject(optionDto.getObject());
} else {
// GUI cannot currently open object that does not exist in the repository.
return null;
}
});
item.add(new LinkedReferencePanel<>(ID_NAME, referenceModel));
}
};
add(referenceIds);
ListView<CorrelationPropertyDefinition> rows = new ListView<>(ID_ROWS, new PropertyModel<>(correlationCtxModel, CorrelationContextDto.F_CORRELATION_PROPERTIES)) {
@Override
protected void populateItem(ListItem<CorrelationPropertyDefinition> item) {
// First column contains the property name
item.add(new Label(ID_ATTR_NAME, new PropertyModel<>(item.getModel(), CorrelationPropertyDefinition.F_DISPLAY_NAME)));
// Here are columns for values for individual options
item.add(createColumnsForPropertyRow(correlationCtxModel, item));
}
};
add(rows);
}
Aggregations