use of com.evolveum.midpoint.web.component.form.MidpointForm in project midpoint by Evolveum.
the class UserMenuPanel method initLayout.
private void initLayout() {
WebMarkupContainer iconBox = new WebMarkupContainer(ID_ICON_BOX);
add(iconBox);
IModel<AbstractResource> jpegPhotoModel = loadJpegPhotoModel();
NonCachingImage img = new NonCachingImage(ID_PHOTO, jpegPhotoModel);
iconBox.add(img);
Label usernameLink = new Label(ID_USERNAME_LINK, (IModel<String>) this::getShortUserName);
add(usernameLink);
WebMarkupContainer panelIconBox = new WebMarkupContainer(ID_PANEL_ICON_BOX);
add(panelIconBox);
NonCachingImage panelImg = new NonCachingImage(ID_PANEL_PHOTO, jpegPhotoModel);
panelIconBox.add(panelImg);
Label username = new Label(ID_USERNAME, (IModel<String>) this::getShortUserName);
username.setRenderBodyOnly(true);
add(username);
Label focusType = new Label(ID_FOCUS_TYPE, getPageBase().createStringResource("PageTemplate." + getFocusType()));
add(focusType);
MidpointForm<?> form = new MidpointForm<>(ID_LOGOUT_FORM);
form.add(AttributeModifier.replace("action", (IModel<String>) () -> SecurityUtils.getPathForLogoutWithContextPath(getRequest().getContextPath(), getAuthenticatedModule().getPrefix())));
add(form);
WebMarkupContainer csrfField = SecurityUtils.createHiddenInputForCsrf(ID_CSRF_FIELD);
form.add(csrfField);
}
use of com.evolveum.midpoint.web.component.form.MidpointForm in project midpoint by Evolveum.
the class MultiplicityPolicyPanel method initLayout.
private void initLayout() {
Form form = new MidpointForm(ID_MAIN_FORM);
form.setOutputMarkupId(true);
add(form);
TextAreaFormGroup description = new TextAreaFormGroup(ID_DESCRIPTION, new PropertyModel<>(model, MultiplicityPolicyConstraintType.F_DESCRIPTION.getLocalPart()), createStringResource("multiplicityContainer.label.description"), ID_LABEL_SIZE, ID_INPUT_SIZE);
form.add(description);
WebMarkupContainer multiplicityContainer = new WebMarkupContainer(ID_MULTIPLICITY_CONTAINER);
multiplicityContainer.setOutputMarkupId(true);
form.add(multiplicityContainer);
TextField<String> multiplicity = new TextField<>(ID_MULTIPLICITY, new PropertyModel<>(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<>(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);
}
use of com.evolveum.midpoint.web.component.form.MidpointForm in project midpoint by Evolveum.
the class PageServices method initLayout.
protected void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<ServiceType> table = new MainObjectListPanel<ServiceType>(ID_TABLE, ServiceType.class) {
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_SERVICES;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
FocusListInlineMenuHelper<ServiceType> listInlineMenuHelper = new FocusListInlineMenuHelper<ServiceType>(ServiceType.class, PageServices.this, this) {
private static final long serialVersionUID = 1L;
protected boolean isShowConfirmationDialog(ColumnMenuAction action) {
return PageServices.this.isShowConfirmationDialog(action);
}
protected IModel<String> getConfirmationMessageModel(ColumnMenuAction action, String actionName) {
return PageServices.this.getConfirmationMessageModel(action, actionName);
}
};
return listInlineMenuHelper.createRowActions(getType());
}
@Override
protected List<ItemPath> getFixedSearchItems() {
List<ItemPath> fixedSearchItems = new ArrayList<>();
fixedSearchItems.add(ObjectType.F_NAME);
fixedSearchItems.add(AbstractRoleType.F_DISPLAY_NAME);
fixedSearchItems.add(AbstractRoleType.F_IDENTIFIER);
return fixedSearchItems;
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
}
use of com.evolveum.midpoint.web.component.form.MidpointForm in project midpoint by Evolveum.
the class PageUsers method initLayout.
protected void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<UserType> table = new MainObjectListPanel<>(ID_TABLE, UserType.class) {
// @Override
// protected void objectDetailsPerformed(AjaxRequestTarget target, UserType user) {
// WebComponentUtil.dispatchToObjectDetailsPage(UserType.class, user.getOid(), this, false);
// PageParameters parameters = new PageParameters();
// parameters.add(OnePageParameterEncoder.PARAMETER, user.getOid());
// navigateToNext(PageUser.class, parameters);
// }
@Override
protected UserProfileStorage.TableId getTableId() {
return TableId.TABLE_USERS;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return createRowActions();
}
@Override
protected List<ItemPath> getFixedSearchItems() {
List<ItemPath> fixedSearchItems = new ArrayList<>();
fixedSearchItems.add(UserType.F_NAME);
fixedSearchItems.add(UserType.F_GIVEN_NAME);
fixedSearchItems.add(UserType.F_FAMILY_NAME);
return fixedSearchItems;
}
@Override
protected String getNothingSelectedMessage() {
return getString("pageUsers.message.nothingSelected");
}
@Override
protected String getConfirmMessageKeyForSingleObject() {
return "pageUsers.message.confirmationMessageForMultipleObject";
}
@Override
protected String getConfirmMessageKeyForMultiObject() {
return "pageUsers.message.confirmationMessageForSingleObject";
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
}
use of com.evolveum.midpoint.web.component.form.MidpointForm in project midpoint by Evolveum.
the class MergeObjectsPanel method initLayout.
private void initLayout() {
MidpointForm mainForm = new MidpointForm(ID_FORM);
mainForm.setOutputMarkupId(true);
add(mainForm);
DropDownChoicePanel mergeTypeSelect = new DropDownChoicePanel(ID_MERGE_TYPE_SELECTOR, mergeTypeModel, mergeTypeChoicesModel);
mergeTypeSelect.getBaseFormComponent().add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
mergeResultObject = getMergeObjectsResult();
WebMarkupContainer resultObjectPanel = (WebMarkupContainer) get(ID_FORM).get(ID_OBJECTS_PANEL).get(ID_MERGE_RESULT_PANEL_CONTAINER);
resultObjectPanel.addOrReplace(getMergeResultObjectPanel());
target.add(resultObjectPanel);
}
});
mergeTypeSelect.setOutputMarkupId(true);
mainForm.add(mergeTypeSelect);
final WebMarkupContainer objectsPanel = new WebMarkupContainer(ID_OBJECTS_PANEL);
objectsPanel.setOutputMarkupId(true);
mainForm.addOrReplace(objectsPanel);
initObjectsPanel(objectsPanel);
AjaxButton switchDirectionButton = new AjaxButton(ID_SWITCH_DIRECTION_BUTTON, pageBase.createStringResource("MergeObjectsPanel.switchDirection")) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
F temp = mergeObjectModel.getObject();
mergeObjectModel.setObject(mergeWithObjectModel.getObject());
mergeWithObjectModel.setObject(temp);
initObjectsPanel(objectsPanel);
ajaxRequestTarget.add(objectsPanel);
}
};
switchDirectionButton.setOutputMarkupId(true);
mainForm.add(switchDirectionButton);
}
Aggregations