use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class DefinitionScopePanel method initLayout.
protected void initLayout() {
final TextField nameField = new TextField(ID_NAME, new PropertyModel<>(getModel(), DefinitionScopeDto.F_NAME));
nameField.add(new VisibleEnableBehaviour() {
@Override
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));
}
use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class PageTaskAdd method initAdvanced.
private void initAdvanced(Form mainForm) {
CheckBox runUntilNodeDown = new CheckBox(ID_RUN_UNTIL_NODW_DOWN, new PropertyModel<Boolean>(model, TaskAddDto.F_RUN_UNTIL_NODW_DOWN));
mainForm.add(runUntilNodeDown);
final IModel<Boolean> createSuspendedCheck = new PropertyModel<>(model, TaskAddDto.F_SUSPENDED_STATE);
CheckBox createSuspended = new CheckBox(ID_CREATE_SUSPENDED, createSuspendedCheck);
mainForm.add(createSuspended);
DropDownChoice threadStop = new DropDownChoice<>(ID_THREAD_STOP, new Model<ThreadStopActionType>() {
@Override
public ThreadStopActionType getObject() {
TaskAddDto dto = model.getObject();
// }
return dto.getThreadStop();
}
@Override
public void setObject(ThreadStopActionType object) {
model.getObject().setThreadStop(object);
}
}, WebComponentUtil.createReadonlyModelFromEnum(ThreadStopActionType.class), new EnumChoiceRenderer<ThreadStopActionType>(PageTaskAdd.this));
mainForm.add(threadStop);
mainForm.add(new TsaValidator(runUntilNodeDown, threadStop));
DropDownChoice misfire = new DropDownChoice<>(ID_MISFIRE_ACTION, new PropertyModel<MisfireActionType>(model, TaskAddDto.F_MISFIRE_ACTION), WebComponentUtil.createReadonlyModelFromEnum(MisfireActionType.class), new EnumChoiceRenderer<MisfireActionType>(PageTaskAdd.this));
mainForm.add(misfire);
}
use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class PageTaskAdd method initScheduling.
private void initScheduling(final Form mainForm) {
final WebMarkupContainer container = new WebMarkupContainer(ID_CONTAINER);
container.setOutputMarkupId(true);
mainForm.add(container);
final IModel<Boolean> recurringCheck = new PropertyModel<>(model, TaskAddDto.F_RECURRING);
final IModel<Boolean> boundCheck = new PropertyModel<>(model, TaskAddDto.F_BOUND);
final WebMarkupContainer boundContainer = new WebMarkupContainer(ID_BOUND_CONTAINER);
boundContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return recurringCheck.getObject();
}
});
boundContainer.setOutputMarkupId(true);
container.add(boundContainer);
final WebMarkupContainer intervalContainer = new WebMarkupContainer(ID_INTERVAL_CONTAINER);
intervalContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return recurringCheck.getObject();
}
});
intervalContainer.setOutputMarkupId(true);
container.add(intervalContainer);
final WebMarkupContainer cronContainer = new WebMarkupContainer(ID_CRON_CONTAINER);
cronContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return recurringCheck.getObject() && !boundCheck.getObject();
}
});
cronContainer.setOutputMarkupId(true);
container.add(cronContainer);
AjaxCheckBox recurring = new AjaxCheckBox(ID_RECURRING, recurringCheck) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(container);
}
};
mainForm.add(recurring);
AjaxCheckBox bound = new AjaxCheckBox(ID_BOUND, boundCheck) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(container);
}
};
boundContainer.add(bound);
Label boundHelp = new Label(ID_BOUND_HELP);
boundHelp.add(new InfoTooltipBehavior());
boundContainer.add(boundHelp);
TextField<Integer> interval = new TextField<>(ID_INTERVAL, new PropertyModel<Integer>(model, TaskAddDto.F_INTERVAL));
interval.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
intervalContainer.add(interval);
TextField<String> cron = new TextField<>(ID_CRON, new PropertyModel<String>(model, TaskAddDto.F_CRON));
cron.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
// if (recurringCheck.getObject() && !boundCheck.getObject()) {
// cron.setRequired(true);
// }
cronContainer.add(cron);
Label cronHelp = new Label(ID_CRON_HELP);
cronHelp.add(new InfoTooltipBehavior());
cronContainer.add(cronHelp);
final DateTimeField notStartBefore = new DateTimeField(ID_NO_START_BEFORE_FIELD, new PropertyModel<Date>(model, TaskAddDto.F_NOT_START_BEFORE)) {
@Override
protected DateTextField newDateTextField(String id, PropertyModel dateFieldModel) {
// todo i18n
return DateTextField.forDatePattern(id, dateFieldModel, "dd/MMM/yyyy");
}
};
notStartBefore.setOutputMarkupId(true);
mainForm.add(notStartBefore);
final DateTimeField notStartAfter = new DateTimeField(ID_NO_START_AFTER_FIELD, new PropertyModel<Date>(model, TaskAddDto.F_NOT_START_AFTER)) {
@Override
protected DateTextField newDateTextField(String id, PropertyModel dateFieldModel) {
// todo i18n
return DateTextField.forDatePattern(id, dateFieldModel, "dd/MMM/yyyy");
}
};
notStartAfter.setOutputMarkupId(true);
mainForm.add(notStartAfter);
mainForm.add(new StartEndDateValidator(notStartBefore, notStartAfter));
mainForm.add(new ScheduleValidator(getTaskManager(), recurring, bound, interval, cron));
}
use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class PageAccountActivation method initLayout.
private void initLayout() {
WebMarkupContainer activationContainer = new WebMarkupContainer(ID_ACTIVATION_CONTAINER);
activationContainer.setOutputMarkupId(true);
add(activationContainer);
activationContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !activated;
}
});
Form form = new Form<>(ID_MAIN_FORM);
activationContainer.add(form);
Label usernamePanel = new Label(ID_NAME, createStringResource("PageAccountActivation.activate.accounts.label", new PropertyModel<>(userModel, "name.orig")));
usernamePanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
return false;
}
});
form.add(usernamePanel);
PasswordTextField passwordPanel = new PasswordTextField(ID_PASSWORD, Model.of(new String()));
form.add(passwordPanel);
AjaxSubmitButton confirmPasswrod = new AjaxSubmitButton(ID_CONFIRM) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
propagatePassword(target, form);
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
getSession().error(getString("PageAccountActivation.account.activation.failed"));
target.add(getFeedbackPanel());
}
};
form.add(confirmPasswrod);
WebMarkupContainer confirmationContainer = new WebMarkupContainer(ID_CONFIRMATION_CONTAINER);
confirmationContainer.setOutputMarkupId(true);
confirmationContainer.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return activated;
}
});
add(confirmationContainer);
AjaxLink<Void> linkToLogin = new AjaxLink<Void>(ID_LINK_TO_LOGIN) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
setResponsePage(PageLogin.class);
}
};
confirmationContainer.add(linkToLogin);
RepeatingView activatedShadows = new RepeatingView(ID_ACTIVATED_SHADOWS);
confirmationContainer.add(activatedShadows);
List<ShadowType> shadowsToActivate = getShadowsToActivate();
if (shadowsToActivate.isEmpty()) {
LOGGER.error("No accounts to validate for user {}", userModel.getObject());
getSession().warn(getString("PageAccountActivation.nothing.to.activate"));
throw new RestartResponseException(PageLogin.class);
}
for (ShadowType shadow : shadowsToActivate) {
Label shadowDesc = new Label(activatedShadows.newChildId(), WebComponentUtil.getName(shadow) + " on resource " + WebComponentUtil.getName(shadow.getResourceRef()));
activatedShadows.add(shadowDesc);
}
}
use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class OperationResultPanel method createMessage.
private Label createMessage() {
Label message = null;
if (StringUtils.isNotBlank(getModelObject().getMessage())) {
PropertyModel<String> messageModel = new PropertyModel<String>(getModel(), "message");
message = new Label(ID_MESSAGE_LABEL, messageModel);
} else {
message = new Label(ID_MESSAGE_LABEL, new LoadableModel<Object>() {
private static final long serialVersionUID = 1L;
@Override
protected Object load() {
OpResult result = OperationResultPanel.this.getModelObject();
String resourceKey = OPERATION_RESOURCE_KEY_PREFIX + result.getOperation();
return getPage().getString(resourceKey, null, resourceKey);
}
});
}
//message.setRenderBodyOnly(true);
message.setOutputMarkupId(true);
return message;
}
Aggregations