List of usage examples for org.apache.wicket.markup.html.form EnumChoiceRenderer EnumChoiceRenderer
public EnumChoiceRenderer()
From source file:com.evolveum.midpoint.web.page.admin.certification.DefinitionScopePanel.java
License:Apache License
protected void initLayout() { final TextField nameField = new TextField(ID_NAME, new PropertyModel<>(getModel(), DefinitionScopeDto.F_NAME)); nameField.add(new VisibleEnableBehaviour() { @Override//from w ww . java 2 s . c om public boolean isEnabled() { return true; } }); add(nameField); final TextArea descriptionField = new TextArea(ID_DESCRIPTION, new PropertyModel<>(getModel(), DefinitionScopeDto.F_DESCRIPTION)); descriptionField.add(new VisibleEnableBehaviour() { @Override public boolean isEnabled() { return true; } }); add(descriptionField); DropDownChoicePanel objectTypeChooser = new DropDownChoicePanel(ID_OBJECT_TYPE_CHOOSER, new PropertyModel(getModel(), DefinitionScopeDto.F_OBJECT_TYPE), WebComponentUtil.createReadonlyModelFromEnum(DefinitionScopeObjectType.class), new EnumChoiceRenderer<DefinitionScopeObjectType>()); add(objectTypeChooser); add(WebComponentUtil.createHelp(ID_OBJECT_TYPE_HELP)); TextArea filterTextArea = new TextArea(ID_SEARCH_FILTER, new PropertyModel<String>(getModel(), DefinitionScopeDto.F_SEARCH_FILTER_TEXT)); filterTextArea.setOutputMarkupId(true); add(filterTextArea); add(WebComponentUtil.createHelp(ID_SEARCH_FILTER_HELP)); add(new CheckBox(ID_INCLUDE_ASSIGNMENTS, new PropertyModel<Boolean>(getModel(), DefinitionScopeDto.F_INCLUDE_ASSIGNMENTS))); add(new CheckBox(ID_INCLUDE_INDUCEMENTS, new PropertyModel<Boolean>(getModel(), DefinitionScopeDto.F_INCLUDE_INDUCEMENTS))); add(WebComponentUtil.createHelp(ID_ASSIGNMENTS_INDUCEMENTS_HELP)); add(new CheckBox(ID_INCLUDE_RESOURCES, new PropertyModel<Boolean>(getModel(), DefinitionScopeDto.F_INCLUDE_RESOURCES))); add(new CheckBox(ID_INCLUDE_ROLES, new PropertyModel<Boolean>(getModel(), DefinitionScopeDto.F_INCLUDE_ROLES))); add(new CheckBox(ID_INCLUDE_ORGS, new PropertyModel<Boolean>(getModel(), DefinitionScopeDto.F_INCLUDE_ORGS))); add(new CheckBox(ID_INCLUDE_SERVICES, new PropertyModel<Boolean>(getModel(), DefinitionScopeDto.F_INCLUDE_SERVICES))); add(WebComponentUtil.createHelp(ID_INCLUDE_TARGET_TYPES_HELP)); add(new CheckBox(ID_INCLUDE_ENABLED_ITEMS_ONLY, new PropertyModel<Boolean>(getModel(), DefinitionScopeDto.F_INCLUDE_ENABLED_ITEMS_ONLY))); add(WebComponentUtil.createHelp(ID_INCLUDE_BY_STATUS_HELP)); }
From source file:com.evolveum.midpoint.web.page.admin.reports.component.AuditLogViewerPanel.java
License:Apache License
private void initParametersPanel(Form mainForm) { WebMarkupContainer parametersPanel = new WebMarkupContainer(ID_PARAMETERS_PANEL); parametersPanel.setOutputMarkupId(true); mainForm.add(parametersPanel);/*from w ww .j ava2s.c o m*/ DatePanel from = new DatePanel(ID_FROM, new PropertyModel<>(getModel(), AuditSearchDto.F_FROM)); DateValidator dateFromValidator = WebComponentUtil.getRangeValidator(mainForm, ItemPath.create(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); DatePanel to = new DatePanel(ID_TO, new PropertyModel<>(getModel(), AuditSearchDto.F_TO)); DateValidator dateToValidator = WebComponentUtil.getRangeValidator(mainForm, ItemPath.create(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); ItemPathPanel changedItemPanel = new ItemPathPanel(ID_CHANGED_ITEM, new PropertyModel<>(getModel(), AuditSearchDto.F_CHANGED_ITEM)); changedItemPanel.setOutputMarkupId(true); parametersPanel.add(changedItemPanel); TextPanel<String> hostIdentifier = new TextPanel<>(ID_HOST_IDENTIFIER, new PropertyModel<>(getModel(), AuditSearchDto.F_HOST_IDENTIFIER)); hostIdentifier.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior()); hostIdentifier.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour()); hostIdentifier.setOutputMarkupId(true); parametersPanel.add(hostIdentifier); DropDownChoicePanel<AuditEventTypeType> eventType = new DropDownChoicePanel<>(ID_EVENT_TYPE, new PropertyModel<>(getModel(), AuditSearchDto.F_EVENT_TYPE), new ListModel<>(Arrays.asList(AuditEventTypeType.values())), new EnumChoiceRenderer<>(), 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.setOutputMarkupId(true); eventStage.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return !isHistory; } }); parametersPanel.add(eventStage); ListModel<AuditEventStageType> eventStageListModel = new ListModel<>( Arrays.asList(AuditEventStageType.values())); PropertyModel<AuditEventStageType> eventStageModel = new PropertyModel<>(getModel(), AuditSearchDto.F_EVENT_STAGE); DropDownChoicePanel<AuditEventStageType> eventStageField = new DropDownChoicePanel<>(ID_EVENT_STAGE_FIELD, eventStageModel, eventStageListModel, new EnumChoiceRenderer<>(), true); eventStageField.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior()); eventStageField.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour()); eventStageField.setOutputMarkupId(true); eventStage.add(eventStageField); ListModel<OperationResultStatusType> outcomeListModel = new ListModel<>( Arrays.asList(OperationResultStatusType.values())); PropertyModel<OperationResultStatusType> outcomeModel = new PropertyModel<>(getModel(), AuditSearchDto.F_OUTCOME); DropDownChoicePanel<OperationResultStatusType> outcome = new DropDownChoicePanel<>(ID_OUTCOME, outcomeModel, outcomeListModel, new EnumChoiceRenderer<>(), 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<>(); 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<>(channelQnameList); PropertyModel<Channel> channelModel = new PropertyModel<>(getModel(), AuditSearchDto.F_CHANNEL); DropDownChoicePanel<Channel> channel = new DropDownChoicePanel<>(ID_CHANNEL, channelModel, Model.ofList(Arrays.asList(Channel.values())), new EnumChoiceRenderer<>(), 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<>(ID_INITIATOR_NAME, allowedClasses, objectReferenceTransformer, new PropertyModel<>(getModel(), AuditSearchDto.F_INITIATOR_NAME)); parametersPanel.add(chooseInitiatorPanel); WebMarkupContainer targetOwnerName = new WebMarkupContainer(ID_TARGET_OWNER_NAME); targetOwnerName.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return !isHistory; } }); parametersPanel.add(targetOwnerName); MultiValueChoosePanel<ObjectType> chooseTargetOwnerPanel = new SingleValueChoosePanel<>( ID_TARGET_OWNER_NAME_FIELD, allowedClasses, objectReferenceTransformer, new PropertyModel<>(getModel(), AuditSearchDto.F_TARGET_OWNER_NAME)); targetOwnerName.add(chooseTargetOwnerPanel); WebMarkupContainer targetName = new WebMarkupContainer(ID_TARGET_NAME); targetName.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return !isHistory; } }); parametersPanel.add(targetName); List<Class<? extends ObjectType>> allowedClassesAll = new ArrayList<>(); allowedClassesAll.addAll(ObjectTypes.getAllObjectTypes()); MultiValueChoosePanel<ObjectType> chooseTargetPanel = new MultiValueChoosePanel<>(ID_TARGET_NAME_FIELD, new PropertyModel<>(getModel(), AuditSearchDto.F_TARGET_NAMES_OBJECTS), allowedClassesAll); chooseTargetPanel.setOutputMarkupId(true); targetName.add(chooseTargetPanel); AjaxSubmitButton searchButton = new AjaxSubmitButton(ID_SEARCH_BUTTON, createStringResource("BasicSearchPanel.search")) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target) { updateAuditSearchStorage(getModel().getObject()); searchUpdatePerformed(target); } @Override protected void onError(AjaxRequestTarget target) { target.add(getPageBase().getFeedbackPanel()); } }; searchButton.setOutputMarkupId(true); parametersPanel.add(searchButton); AjaxSubmitButton resetSearchButton = new AjaxSubmitButton(ID_RESET_SEARCH_BUTTON, createStringResource("AuditLogViewerPanel.resetSearchButton")) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target) { resetAuditSearchStorage(); searchUpdatePerformed(target); } @Override protected void onError(AjaxRequestTarget target) { target.add(getPageBase().getFeedbackPanel()); } }; resetSearchButton.setOutputMarkupId(true); parametersPanel.add(resetSearchButton); WebMarkupContainer valueRefTargetNameContainer = new WebMarkupContainer(ID_VALUE_REF_TARGET_NAMES); valueRefTargetNameContainer.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return !isHistory; } }); parametersPanel.add(valueRefTargetNameContainer); MultiValueChoosePanel<ObjectType> chooseValueRefTargetNamePanel = new MultiValueChoosePanel<>( ID_VALUE_REF_TARGET_NAMES_FIELD, new PropertyModel<>(getModel(), AuditSearchDto.F_VALUE_REF_TARGET_NAME), allowedClassesAll); chooseValueRefTargetNamePanel.setOutputMarkupId(true); valueRefTargetNameContainer.add(chooseValueRefTargetNamePanel); }
From source file:com.evolveum.midpoint.web.page.admin.reports.component.AuditPopupPanel.java
License:Apache License
@SuppressWarnings("serial") protected void initLayout(final Component component) { TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<String>(getModel(), AuditReportDto.F_NAME), createStringResource("ObjectType.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, true); add(name);/*from ww w . ja v a2 s . c o m*/ TextFormGroup description = new TextFormGroup(ID_DESCRIPTION, new PropertyModel<String>(getModel(), AuditReportDto.F_DESCRIPTION), createStringResource("ObjectType.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, true); add(description); IModel choices = WebMiscUtil.createReadonlyModelFromEnum(ExportType.class); IChoiceRenderer renderer = new EnumChoiceRenderer(); DropDownFormGroup exportType = new DropDownFormGroup(ID_EXPORT_TYPE, new PropertyModel<ExportType>(getModel(), AuditReportDto.F_EXPORT_TYPE), choices, renderer, createStringResource("AuditPopulPanel.exportType.label"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); add(exportType); choices = WebMiscUtil.createReadonlyModelFromEnum(AuditEventType.class); DropDownFormGroup auditEventType = new DropDownFormGroup(ID_AUDITEVENTTYPE, new PropertyModel<AuditEventType>(getModel(), AuditReportDto.F_AUDITEVENTTYPE), choices, renderer, createStringResource("AuditPopupPanel.auditEventType"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); add(auditEventType); DateFormGroup dateFrom = new DateFormGroup(ID_DATE_FROM, new PropertyModel<XMLGregorianCalendar>(getModel(), AuditReportDto.F_FROM_GREG), createStringResource("AuditPopupPanel.dateFrom"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); add(dateFrom); DateFormGroup dateTo = new DateFormGroup(ID_DATE_TO, new PropertyModel<XMLGregorianCalendar>(getModel(), AuditReportDto.F_TO_GREG), createStringResource("AuditPopupPanel.dateTo"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); add(dateTo); }
From source file:com.evolveum.midpoint.web.page.admin.reports.component.ReconciliationPopupPanel.java
License:Apache License
private void initLayout(IModel<List<ResourceItemDto>> resources, final Component component) { TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<String>(getModel(), ReconciliationReportDto.F_NAME), createStringResource("ObjectType.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, true); add(name);/*from www . j a v a 2s.c om*/ TextFormGroup description = new TextFormGroup(ID_DESCRIPTION, new PropertyModel<String>(getModel(), ReconciliationReportDto.F_DESCRIPTION), createStringResource("ObjectType.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, true); add(description); IModel choices = WebMiscUtil.createReadonlyModelFromEnum(ExportType.class); IChoiceRenderer renderer = new EnumChoiceRenderer(); DropDownFormGroup exportType = new DropDownFormGroup(ID_EXPORT_TYPE, new PropertyModel<ExportType>(getModel(), ReconciliationReportDto.F_EXPORT_TYPE), choices, renderer, createStringResource("ReconciliationPopupPanel.exportFileType"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); add(exportType); DropDownFormGroup resourceDropDown = new DropDownFormGroup(ID_RESOURCE, createModel(resources.getObject()), resources, renderer, createStringResource("ReconciliationPopupPanel.resource"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); add(resourceDropDown); }
From source file:com.evolveum.midpoint.web.page.admin.reports.component.ReportConfigurationPanel.java
License:Apache License
@Override protected void initLayout() { TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<String>(getModel(), ReportDto.F_NAME), createStringResource("ObjectType.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, true); add(name);//from w w w. ja v a2 s. co m TextAreaFormGroup description = new TextAreaFormGroup(ID_DESCRIPTION, new PropertyModel<String>(getModel(), ReportDto.F_DESCRIPTION), createStringResource("ObjectType.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); add(description); IModel choices = WebMiscUtil.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, false); add(exportType); //todo useHibernateSession and orientation IModel<ObjectWrapper> wrapper = new LoadableModel<ObjectWrapper>(false) { @Override protected ObjectWrapper load() { PrismObject<ReportType> report = getModel().getObject().getObject(); return new ObjectWrapper(null, null, report, null, ContainerStatus.MODIFYING); } }; PrismObjectPanel properties = new PrismObjectPanel(ID_PROPERTIES, wrapper, null, null); add(properties); }
From source file:com.evolveum.midpoint.web.page.admin.reports.component.UserReportConfigPanel.java
License:Apache License
protected void initLayout(final Component component) { TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<String>(getModel(), UserReportDto.F_NAME), createStringResource("ObjectType.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, true); add(name);// w ww. j ava2 s .co m TextFormGroup description = new TextFormGroup(ID_DESCRIPTION, new PropertyModel<String>(getModel(), UserReportDto.F_DESCRIPTION), createStringResource("ObjectType.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, true); add(description); IModel choices = WebMiscUtil.createReadonlyModelFromEnum(ExportType.class); IChoiceRenderer renderer = new EnumChoiceRenderer(); DropDownFormGroup exportType = new DropDownFormGroup(ID_EXPORT_TYPE, new PropertyModel<ExportType>(getModel(), UserReportDto.F_EXPORT_TYPE), choices, renderer, createStringResource("UserReportConfigPanel.exportFileType"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); add(exportType); DateFormGroup dateFrom = new DateFormGroup(ID_DATE_FROM, new PropertyModel<XMLGregorianCalendar>(getModel(), UserReportDto.F_FROM_GREG), createStringResource("UserReportConfigPanel.dateFrom"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); add(dateFrom); DateFormGroup dateTo = new DateFormGroup(ID_DATE_TO, new PropertyModel<XMLGregorianCalendar>(getModel(), UserReportDto.F_TO_GREG), createStringResource("UserReportConfigPanel.dateTo"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); add(dateTo); }
From source file:com.evolveum.midpoint.web.page.admin.roles.component.MultiplicityPolicyDialog.java
License:Apache License
private void initLayout(WebMarkupContainer content) { Form form = new Form(ID_MAIN_FORM); form.setOutputMarkupId(true);//from w w w . j ava2 s . co m content.add(form); TextAreaFormGroup description = new TextAreaFormGroup(ID_DESCRIPTION, new PropertyModel<String>(model, MultiplicityPolicyConstraintType.F_DESCRIPTION.getLocalPart()), createStringResource("multiplicityContainer.label.description"), ID_LABEL_SIZE, ID_INPUT_SIZE); form.add(description); DropDownFormGroup enforcement = new DropDownFormGroup<>(ID_ENFORCEMENT, new PropertyModel<PolicyConstraintEnforcementType>(model, MultiplicityPolicyConstraintType.F_ENFORCEMENT.getLocalPart()), WebMiscUtil.createReadonlyModelFromEnum(PolicyConstraintEnforcementType.class), new EnumChoiceRenderer<PolicyConstraintEnforcementType>(), createStringResource("multiplicityContainer.label.enforcement"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); form.add(enforcement); WebMarkupContainer multiplicityContainer = new WebMarkupContainer(ID_MULTIPLICITY_CONTAINER); multiplicityContainer.setOutputMarkupId(true); form.add(multiplicityContainer); TextField multiplicity = new TextField<>(ID_MULTIPLICITY, new PropertyModel<String>(model, MultiplicityPolicyConstraintType.F_MULTIPLICITY.getLocalPart())); multiplicity.add(prepareMultiplicityValidator()); multiplicity.add(new VisibleEnableBehaviour() { @Override public boolean isEnabled() { return !unbounded; } }); multiplicityContainer.add(multiplicity); CheckBox multiplicityUnbounded = new CheckBox(ID_MULTIPLICITY_UNBOUND, new PropertyModel<Boolean>(this, MULTIPLICITY_UNBOUNDED)); multiplicityUnbounded.add(new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { model.getObject().setMultiplicity(MULTIPLICITY_UNBOUNDED); target.add(getMultiplicityContainer()); } }); multiplicityContainer.add(multiplicityUnbounded); initButtons(form); }
From source file:com.evolveum.midpoint.web.page.admin.roles.PageRole.java
License:Apache License
private void initLayout() { Form form = new Form(ID_MAIN_FORM); add(form);//from w ww. j a va 2 s .c o m TextFormGroup name = new TextFormGroup(ID_NAME, new PrismPropertyModel(model, RoleType.F_NAME), createStringResource("PageRoleEditor.label.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, true); form.add(name); TextAreaFormGroup description = new TextAreaFormGroup(ID_DESCRIPTION, new PrismPropertyModel(model, RoleType.F_DESCRIPTION), createStringResource("PageRoleEditor.label.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); form.add(description); TextFormGroup roleType = new TextFormGroup(ID_ROLE_TYPE, new PrismPropertyModel(model, RoleType.F_ROLE_TYPE), createStringResource("PageRoleEditor.label.type"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); form.add(roleType); CheckFormGroup requestable = new CheckFormGroup(ID_REQUESTABLE, new PrismPropertyModel(model, RoleType.F_REQUESTABLE), createStringResource("PageRoleEditor.label.requestable"), ID_LABEL_SIZE, ID_INPUT_SIZE); form.add(requestable); IModel choices = WebMiscUtil.createReadonlyModelFromEnum(ActivationStatusType.class); IChoiceRenderer renderer = new EnumChoiceRenderer(); DropDownFormGroup adminStatus = new DropDownFormGroup(ID_ADMIN_STATUS, new PrismPropertyModel(model, new ItemPath(RoleType.F_ACTIVATION, ActivationType.F_ADMINISTRATIVE_STATUS)), choices, renderer, createStringResource("ActivationType.administrativeStatus"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); form.add(adminStatus); DateFormGroup validFrom = new DateFormGroup(ID_DATE_FROM, new PrismPropertyModel(model, new ItemPath(RoleType.F_ACTIVATION, ActivationType.F_VALID_FROM)), createStringResource("ActivationType.validFrom"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); form.add(validFrom); DateFormGroup validTo = new DateFormGroup(ID_DATE_TO, new PrismPropertyModel(model, new ItemPath(RoleType.F_ACTIVATION, ActivationType.F_VALID_TO)), createStringResource("ActivationType.validTo"), ID_LABEL_SIZE, ID_INPUT_SIZE, false); form.add(validTo); AssignmentTablePanel assignments = new AssignmentTablePanel(ID_ASSIGNMENTS, new Model<AssignmentTableDto>(), createStringResource("PageRoleEditor.title.assignments")) { @Override public List<AssignmentType> getAssignmentTypeList() { return model.getObject().asObjectable().getAssignment(); } @Override public String getExcludeOid() { return model.getObject().asObjectable().getOid(); } }; form.add(assignments); AssignmentTablePanel inducements = new AssignmentTablePanel(ID_INDUCEMENTS, new Model<AssignmentTableDto>(), createStringResource("PageRoleEditor.title.inducements")) { @Override public List<AssignmentType> getAssignmentTypeList() { return model.getObject().asObjectable().getInducement(); } @Override public String getExcludeOid() { return model.getObject().asObjectable().getOid(); } }; form.add(inducements); AutzActionsTablePanel ap = new AutzActionsTablePanel(ID_AUTACTIONS, selected_autz); form.add(ap); initButtons(form); }
From source file:com.evolveum.midpoint.web.page.admin.server.handlers.ResourceRelatedHandlerPanel.java
License:Apache License
private void initLayout() { final VisibleEnableBehaviour visibleIfEdit = new VisibleEnableBehaviour() { @Override// w ww. j av a2s .co m public boolean isVisible() { return parentPage.isEdit(); } }; final VisibleEnableBehaviour visibleIfView = new VisibleEnableBehaviour() { @Override public boolean isVisible() { return !parentPage.isEdit(); } }; final VisibleEnableBehaviour enabledIfEdit = new VisibleEnableBehaviour() { @Override public boolean isEnabled() { return parentPage.isEdit(); } }; final VisibleEnableBehaviour visibleForResourceCoordinates = new VisibleEnableBehaviour() { @Override public boolean isVisible() { return getTaskDto().configuresResourceCoordinates(); } }; final WebMarkupContainer resourceRefContainer = new WebMarkupContainer(ID_RESOURCE_REF_CONTAINER); resourceRefContainer.add(visibleForResourceCoordinates); resourceRefContainer.setOutputMarkupId(true); add(resourceRefContainer); final DropDownChoice<TaskAddResourcesDto> resourceRef = new DropDownChoice<>(ID_RESOURCE_REF, new PropertyModel<TaskAddResourcesDto>(getModel(), ResourceRelatedHandlerDto.F_RESOURCE_REFERENCE), new AbstractReadOnlyModel<List<TaskAddResourcesDto>>() { @Override public List<TaskAddResourcesDto> getObject() { return createResourceList(); } }, new ChoiceableChoiceRenderer<TaskAddResourcesDto>()); resourceRef.setOutputMarkupId(true); resourceRef.add(enabledIfEdit); resourceRef.add(new AjaxFormComponentUpdatingBehavior("change") { @Override protected void onUpdate(AjaxRequestTarget target) { Task task = parentPage.createSimpleTask(OPERATION_LOAD_RESOURCE); OperationResult result = task.getResult(); List<QName> objectClassList = new ArrayList<>(); TaskAddResourcesDto resourcesDto = getModelObject().getResourceRef(); if (resourcesDto != null) { PrismObject<ResourceType> resource = WebModelServiceUtils.loadObject(ResourceType.class, resourcesDto.getOid(), parentPage, task, result); try { ResourceSchema schema = RefinedResourceSchema.getResourceSchema(resource, parentPage.getPrismContext()); schema.getObjectClassDefinitions(); for (Definition def : schema.getDefinitions()) { objectClassList.add(def.getTypeName()); } getModelObject().setObjectClassList(objectClassList); } catch (Exception e) { LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load object class list from resource.", e); error("Couldn't load object class list from resource."); } } target.add(resourceRefContainer); } }); resourceRefContainer.add(resourceRef); WebMarkupContainer kindContainer = new WebMarkupContainer(ID_KIND_CONTAINER); kindContainer.add(visibleForResourceCoordinates); add(kindContainer); final DropDownChoice kind = new DropDownChoice<>(ID_KIND, new PropertyModel<ShadowKindType>(getModel(), ResourceRelatedHandlerDto.F_KIND), WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), new EnumChoiceRenderer<ShadowKindType>()); kind.setOutputMarkupId(true); kind.setNullValid(true); kindContainer.add(kind); WebMarkupContainer intentContainer = new WebMarkupContainer(ID_INTENT_CONTAINER); intentContainer.add(visibleForResourceCoordinates); add(intentContainer); final TextField<String> intent = new TextField<>(ID_INTENT, new PropertyModel<String>(getModel(), ResourceRelatedHandlerDto.F_INTENT)); intentContainer.add(intent); intent.setOutputMarkupId(true); intent.add(enabledIfEdit); WebMarkupContainer objectClassContainer = new WebMarkupContainer(ID_OBJECT_CLASS_CONTAINER); objectClassContainer.add(visibleForResourceCoordinates); add(objectClassContainer); AutoCompleteSettings autoCompleteSettings = new AutoCompleteSettings(); autoCompleteSettings.setShowListOnEmptyInput(true); final AutoCompleteTextField<String> objectClass = new AutoCompleteTextField<String>(ID_OBJECT_CLASS, new PropertyModel<String>(getModel(), ResourceRelatedHandlerDto.F_OBJECT_CLASS), autoCompleteSettings) { @Override protected Iterator<String> getChoices(String input) { return prepareObjectClassChoiceList(input); } }; objectClass.add(enabledIfEdit); objectClassContainer.add(objectClass); WebMarkupContainer optionsContainer = new WebMarkupContainer(ID_OPTIONS_CONTAINER); optionsContainer.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return getTaskDto().configuresDryRun(); } }); add(optionsContainer); WebMarkupContainer dryRunContainer = new WebMarkupContainer(ID_DRY_RUN_CONTAINER); dryRunContainer.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return getTaskDto().configuresDryRun(); } }); optionsContainer.add(dryRunContainer); CheckBox dryRun = new CheckBox(ID_DRY_RUN, new PropertyModel<Boolean>(getModel(), ResourceRelatedHandlerDto.F_DRY_RUN)); dryRun.add(enabledIfEdit); dryRunContainer.add(dryRun); }
From source file:com.evolveum.midpoint.web.page.admin.users.component.OrgMemberPanel.java
License:Apache License
@Override protected void initSearch(Form form) { /// TODO: move to utils class?? List<ObjectTypes> objectTypes = Arrays.asList(ObjectTypes.values()); Collections.sort(objectTypes, new Comparator<ObjectTypes>() { @Override//from w w w . j a va2s . c o m public int compare(ObjectTypes o1, ObjectTypes o2) { Validate.notNull(o1); Validate.notNull(o2); String type1 = o1.getValue(); String type2 = o2.getValue(); return String.CASE_INSENSITIVE_ORDER.compare(type1, type2); } }); //////////// DropDownChoice<ObjectTypes> objectType = new DropDownChoice<ObjectTypes>(ID_SEARCH_BY_TYPE, Model.of(OBJECT_TYPES_DEFAULT), objectTypes, new EnumChoiceRenderer<ObjectTypes>()); objectType.add(new OnChangeAjaxBehavior() { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { refreshTable(target); } }); objectType.setOutputMarkupId(true); form.add(objectType); DropDownChoice<String> seachScrope = new DropDownChoice<String>(ID_SEARCH_SCOPE, Model.of(SEARCH_SCOPE_ONE), SEARCH_SCOPE_VALUES, new StringResourceChoiceRenderer("TreeTablePanel.search.scope")); seachScrope.add(new OnChangeAjaxBehavior() { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { refreshTable(target); } }); seachScrope.setOutputMarkupId(true); form.add(seachScrope); }