use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class AuditLogViewerPanel method initParametersPanel.
private void initParametersPanel(Form mainForm) {
WebMarkupContainer parametersPanel = new WebMarkupContainer(ID_PARAMETERS_PANEL);
parametersPanel.setOutputMarkupId(true);
mainForm.add(parametersPanel);
PropertyModel<XMLGregorianCalendar> fromModel = new PropertyModel<XMLGregorianCalendar>(auditSearchDto, AuditSearchDto.F_FROM);
DatePanel from = new DatePanel(ID_FROM, fromModel);
DateValidator dateFromValidator = WebComponentUtil.getRangeValidator(mainForm, new ItemPath(AuditSearchDto.F_FROM));
dateFromValidator.setMessageKey("AuditLogViewerPanel.dateValidatorMessage");
dateFromValidator.setDateFrom((DateTimeField) from.getBaseFormComponent());
for (FormComponent<?> formComponent : from.getFormComponents()) {
formComponent.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
}
from.setOutputMarkupId(true);
parametersPanel.add(from);
PropertyModel<XMLGregorianCalendar> toModel = new PropertyModel<XMLGregorianCalendar>(auditSearchDto, AuditSearchDto.F_TO);
DatePanel to = new DatePanel(ID_TO, toModel);
DateValidator dateToValidator = WebComponentUtil.getRangeValidator(mainForm, new ItemPath(AuditSearchDto.F_FROM));
dateToValidator.setMessageKey("AuditLogViewerPanel.dateValidatorMessage");
dateToValidator.setDateTo((DateTimeField) to.getBaseFormComponent());
for (FormComponent<?> formComponent : to.getFormComponents()) {
formComponent.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
}
to.setOutputMarkupId(true);
parametersPanel.add(to);
PropertyModel<ItemPathDto> changedItemModel = new PropertyModel<ItemPathDto>(auditSearchDto, AuditSearchDto.F_CHANGED_ITEM);
ItemPathPanel changedItemPanel = new ItemPathPanel(ID_CHANGED_ITEM, changedItemModel, pageBase);
// changedItemPanel.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
// changedItemPanel.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
changedItemPanel.setOutputMarkupId(true);
parametersPanel.add(changedItemPanel);
PropertyModel<String> hostIdentifierModel = new PropertyModel<>(auditSearchDto, AuditSearchDto.F_HOST_IDENTIFIER);
TextPanel<String> hostIdentifier = new TextPanel<>(ID_HOST_IDENTIFIER, hostIdentifierModel);
hostIdentifier.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
hostIdentifier.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
hostIdentifier.setOutputMarkupId(true);
parametersPanel.add(hostIdentifier);
ListModel<AuditEventTypeType> eventTypeListModel = new ListModel<AuditEventTypeType>(Arrays.asList(AuditEventTypeType.values()));
PropertyModel<AuditEventTypeType> eventTypeModel = new PropertyModel<AuditEventTypeType>(auditSearchDto, AuditSearchDto.F_EVENT_TYPE);
DropDownChoicePanel<AuditEventTypeType> eventType = new DropDownChoicePanel<AuditEventTypeType>(ID_EVENT_TYPE, eventTypeModel, eventTypeListModel, new EnumChoiceRenderer<AuditEventTypeType>(), true);
eventType.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
eventType.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
eventType.setOutputMarkupId(true);
parametersPanel.add(eventType);
WebMarkupContainer eventStage = new WebMarkupContainer(ID_EVENT_STAGE);
eventStage.add(visibilityByKey(visibilityMap, EVENT_STAGE_LABEL_VISIBILITY));
eventStage.setOutputMarkupId(true);
parametersPanel.add(eventStage);
ListModel<AuditEventStageType> eventStageListModel = new ListModel<AuditEventStageType>(Arrays.asList(AuditEventStageType.values()));
PropertyModel<AuditEventStageType> eventStageModel = new PropertyModel<AuditEventStageType>(auditSearchDto, AuditSearchDto.F_EVENT_STAGE);
DropDownChoicePanel<AuditEventStageType> eventStageField = new DropDownChoicePanel<AuditEventStageType>(ID_EVENT_STAGE_FIELD, eventStageModel, eventStageListModel, new EnumChoiceRenderer<AuditEventStageType>(), true);
eventStageField.add(visibilityByKey(visibilityMap, EVENT_STAGE_FIELD_VISIBILITY));
eventStageField.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
eventStageField.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
eventStageField.setOutputMarkupId(true);
eventStage.add(eventStageField);
ListModel<OperationResultStatusType> outcomeListModel = new ListModel<OperationResultStatusType>(Arrays.asList(OperationResultStatusType.values()));
PropertyModel<OperationResultStatusType> outcomeModel = new PropertyModel<OperationResultStatusType>(auditSearchDto, AuditSearchDto.F_OUTCOME);
DropDownChoicePanel<OperationResultStatusType> outcome = new DropDownChoicePanel<OperationResultStatusType>(ID_OUTCOME, outcomeModel, outcomeListModel, new EnumChoiceRenderer<OperationResultStatusType>(), true);
outcome.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
outcome.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
outcome.setOutputMarkupId(true);
parametersPanel.add(outcome);
List<String> channelList = WebComponentUtil.getChannelList();
List<QName> channelQnameList = new ArrayList<QName>();
for (int i = 0; i < channelList.size(); i++) {
String channel = channelList.get(i);
if (channel != null) {
QName channelQName = QNameUtil.uriToQName(channel);
channelQnameList.add(channelQName);
}
}
ListModel<QName> channelListModel = new ListModel<QName>(channelQnameList);
PropertyModel<QName> channelModel = new PropertyModel<QName>(auditSearchDto, AuditSearchDto.F_CHANNEL);
DropDownChoicePanel<QName> channel = new DropDownChoicePanel<QName>(ID_CHANNEL, channelModel, channelListModel, new QNameChoiceRenderer(), true);
channel.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
channel.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
channel.setOutputMarkupId(true);
parametersPanel.add(channel);
List<Class<? extends ObjectType>> allowedClasses = new ArrayList<>();
allowedClasses.add(UserType.class);
MultiValueChoosePanel<ObjectType> chooseInitiatorPanel = new SingleValueChoosePanel<ObjectReferenceType, ObjectType>(ID_INITIATOR_NAME, allowedClasses, objectReferenceTransformer, new PropertyModel<ObjectReferenceType>(auditSearchDto, AuditSearchDto.F_INITIATOR_NAME));
parametersPanel.add(chooseInitiatorPanel);
WebMarkupContainer targetOwnerName = new WebMarkupContainer(ID_TARGET_OWNER_NAME);
targetOwnerName.add(visibilityByKey(visibilityMap, TARGET_OWNER_LABEL_VISIBILITY));
parametersPanel.add(targetOwnerName);
MultiValueChoosePanel<ObjectType> chooseTargerOwnerPanel = new SingleValueChoosePanel<ObjectReferenceType, ObjectType>(ID_TARGET_OWNER_NAME_FIELD, allowedClasses, objectReferenceTransformer, new PropertyModel<ObjectReferenceType>(auditSearchDto, AuditSearchDto.F_TARGET_OWNER_NAME));
chooseTargerOwnerPanel.add(visibilityByKey(visibilityMap, TARGET_OWNER_FIELD_VISIBILITY));
targetOwnerName.add(chooseTargerOwnerPanel);
WebMarkupContainer targetName = new WebMarkupContainer(ID_TARGET_NAME);
targetName.add(visibilityByKey(visibilityMap, TARGET_NAME_LABEL_VISIBILITY));
parametersPanel.add(targetName);
List<Class<? extends ObjectType>> allowedClassesAll = new ArrayList<>();
allowedClassesAll.addAll(ObjectTypes.getAllObjectTypes());
MultiValueChoosePanel<ObjectType> chooseTargetPanel = new MultiValueChoosePanel<ObjectType>(ID_TARGET_NAME_FIELD, new PropertyModel<List<ObjectType>>(auditSearchDto, AuditSearchDto.F_TARGET_NAMES_OBJECTS), allowedClassesAll);
chooseTargetPanel.setOutputMarkupId(true);
chooseTargetPanel.add(visibilityByKey(visibilityMap, TARGET_NAME_FIELD_VISIBILITY));
targetName.add(chooseTargetPanel);
AjaxSubmitButton ajaxButton = new AjaxSubmitButton(ID_SEARCH_BUTTON, createStringResource("BasicSearchPanel.search")) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
auditLogStorage.setSearchDto(searchDto);
auditLogStorage.setPageNumber(0);
Form mainForm = (Form) getParent().getParent();
addOrReplaceTable(mainForm);
getFeedbackPanel().getFeedbackMessages().clear();
target.add(getFeedbackPanel());
target.add(mainForm);
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
target.add(getFeedbackPanel());
}
};
WebMarkupContainer valueRefTargetNameContainer = new WebMarkupContainer(ID_VALUE_REF_TARGET_NAMES);
valueRefTargetNameContainer.add(visibilityByKey(visibilityMap, TARGET_NAME_LABEL_VISIBILITY));
parametersPanel.add(valueRefTargetNameContainer);
MultiValueChoosePanel<ObjectType> chooseValueRefTargetNamePanel = new MultiValueChoosePanel<ObjectType>(ID_VALUE_REF_TARGET_NAMES_FIELD, new PropertyModel<List<ObjectType>>(auditSearchDto, AuditSearchDto.F_VALUE_REF_TARGET_NAME), allowedClassesAll);
chooseValueRefTargetNamePanel.setOutputMarkupId(true);
chooseValueRefTargetNamePanel.add(visibilityByKey(visibilityMap, VALUE_REF_TARGET_NAME_FIELD_VISIBILITY));
valueRefTargetNameContainer.add(chooseValueRefTargetNamePanel);
ajaxButton.setOutputMarkupId(true);
parametersPanel.add(ajaxButton);
}
use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class ReportConfigurationPanel method initLayout.
protected void initLayout() {
TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<String>(getModel(), ID_NAME), createStringResource("ObjectType.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
add(name);
TextAreaFormGroup description = new TextAreaFormGroup(ID_DESCRIPTION, new PropertyModel<String>(getModel(), ID_DESCRIPTION), createStringResource("ObjectType.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
add(description);
IModel choices = WebComponentUtil.createReadonlyModelFromEnum(ExportType.class);
IChoiceRenderer renderer = new EnumChoiceRenderer();
DropDownFormGroup exportType = new DropDownFormGroup(ID_EXPORT_TYPE, new PropertyModel<ExportType>(getModel(), ReportDto.F_EXPORT_TYPE), choices, renderer, createStringResource("ReportType.export"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
add(exportType);
TextFormGroup virtualizerKickOn = null;
DropDownFormGroup virtualizer = new DropDownFormGroup(ID_VIRTUALIZER, new PropertyModel<String>(getModel(), ReportDto.F_VIRTUALIZER), createVirtualizerListModel(), new ChoiceRenderer<String>(), createStringResource("ReportType.virtualizer"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
//virtualizer.add(new VirtualizerAjaxFormUpdatingBehaviour(virtualizerKickOn));
add(virtualizer);
virtualizerKickOn = new TextFormGroup(ID_VIRTUALIZER_KICKON, new PropertyModel<String>(getModel(), ReportDto.F_VIRTUALIZER_KICKON), createStringResource("ReportType.virtualizerKickOn"), ID_LABEL_SIZE, "col-md-4", false);
add(virtualizerKickOn);
TextFormGroup maxPages = new TextFormGroup(ID_MAXPAGES, new PropertyModel<String>(getModel(), ReportDto.F_MAXPAGES), createStringResource("ReportType.maxPages"), ID_LABEL_SIZE, "col-md-4", false);
add(maxPages);
TextFormGroup timeout = new TextFormGroup(ID_TIMEOUT, new PropertyModel<String>(getModel(), ReportDto.F_TIMEOUT), createStringResource("ReportType.timeout"), ID_LABEL_SIZE, "col-md-4", false);
add(timeout);
}
use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class RunReportPopupPanel method createParameterPanel.
private WebMarkupContainer createParameterPanel(final IModel<JasperReportParameterDto> parameterModel) {
WebMarkupContainer paramPanel = new WebMarkupContainer("paramPanel");
paramPanel.setOutputMarkupId(true);
String paramValue = new PropertyModel<String>(parameterModel, "name").getObject();
StringResourceModel paramDisplay = PageBase.createStringResourceStatic(RunReportPopupPanel.this, "runReportPopupContent.param.name." + paramValue, new Object[] {});
// use display name rather than property name
paramPanel.add(new Label("name", paramDisplay));
String paramClass = new PropertyModel<String>(parameterModel, "nestedTypeAsString").getObject();
if (StringUtils.isBlank(paramClass)) {
paramClass = new PropertyModel<String>(parameterModel, "typeAsString").getObject();
}
paramClass = paramClass == null ? "" : paramClass.substring(paramClass.lastIndexOf(".") + 1);
paramPanel.add(new Label("type", paramClass));
ListView<JasperReportValueDto> listView = new ListView<JasperReportValueDto>(ID_VALUE_LIST, new PropertyModel<>(parameterModel, "value")) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<JasperReportValueDto> item) {
item.add(createInputMarkup(item.getModel(), parameterModel.getObject()));
}
};
listView.setOutputMarkupId(true);
paramPanel.add(listView);
return paramPanel;
}
use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class RunReportPopupPanel method createTypedInputPanel.
private InputPanel createTypedInputPanel(String componentId, IModel<JasperReportValueDto> model, String expression, JasperReportParameterDto param) {
InputPanel panel;
Class<?> type;
try {
if (param.isMultiValue()) {
type = param.getNestedType();
} else {
type = param.getType();
}
} catch (ClassNotFoundException e) {
getSession().error("Could not find parameter type definition. Check the configuration.");
throw new RestartResponseException(getPageBase());
}
if (type.isEnum()) {
panel = WebComponentUtil.createEnumPanel(type, componentId, new PropertyModel<>(model, expression), this);
} else if (XMLGregorianCalendar.class.isAssignableFrom(type)) {
panel = new DatePanel(componentId, new PropertyModel<>(model, expression));
} else if (param.getProperties() != null && param.getProperties().getTargetType() != null) {
// render autocomplete box
LookupTableType lookup = new LookupTableType();
panel = new AutoCompleteTextPanel<String>(componentId, new LookupPropertyModel<>(model, expression, lookup, false), String.class) {
@Override
public Iterator<String> getIterator(String input) {
return prepareAutoCompleteList(input, lookup, param).iterator();
}
};
} else {
panel = new TextPanel<>(componentId, new PropertyModel<>(model, expression), type);
}
List<FormComponent> components = panel.getFormComponents();
for (FormComponent component : components) {
component.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
}
panel.setOutputMarkupId(true);
return panel;
}
use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class PageReport method initLayout.
private void initLayout() {
Form mainForm = new Form(ID_MAIN_FORM);
add(mainForm);
List<ITab> tabs = new ArrayList<>();
tabs.add(new AbstractTab(createStringResource("PageReport.basic")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer getPanel(String panelId) {
return new ReportConfigurationPanel(panelId, model);
}
});
tabs.add(new AbstractTab(createStringResource("PageReport.jasperTemplate")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer getPanel(String panelId) {
return new JasperReportConfigurationPanel(panelId, model);
// IModel<String> title = PageReport.this.createStringResource("PageReport.jasperTemplate");
// IModel<String> data = new Base64Model(new PrismPropertyModel<>(model, ReportType.F_TEMPLATE));
// return new AceEditorPanel(panelId, title, data);
}
});
tabs.add(new AbstractTab(createStringResource("PageReport.jasperTemplateStyle")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer getPanel(String panelId) {
IModel<String> title = PageReport.this.createStringResource("PageReport.jasperTemplateStyle");
IModel<String> data = new Base64Model(new PropertyModel(model, "templateStyle"));
return new AceEditorPanel(panelId, title, data);
}
});
// tabs.add(new AbstractTab(createStringResource("PageReport.fullXml")) {
//
// @Override
// public WebMarkupContainer getPanel(String panelId) {
// IModel<String> title = PageReport.this.createStringResource("PageReport.fullXml");
//
// AceEditorPanel panel = new AceEditorPanel(panelId, title, createFullXmlModel());
// panel.getEditor().add(createFullXmlValidator());
// return panel;
// }
// });
TabbedPanel<ITab> reportTabPanel = WebComponentUtil.createTabPanel(ID_TAB_PANEL, this, tabs, null);
reportTabPanel.setOutputMarkupId(true);
mainForm.add(reportTabPanel);
initButtons(mainForm);
}
Aggregations