use of org.apache.wicket.model.StringResourceModel in project ocvn by devgateway.
the class TooltipLabel method onConfigure.
/*
* (non-Javadoc)
*
* @see org.apache.wicket.Component#onConfigure()
*/
@Override
protected void onConfigure() {
super.onConfigure();
helpModelText = new StringResourceModel(fieldId + ".help", this);
helpModelText.setDefaultValue("");
if (!helpModelText.getString().isEmpty()) {
tooltipConfig = new CustomTooltipConfig();
add(new TooltipBehavior(helpModelText, tooltipConfig));
setVisibilityAllowed(!ComponentUtil.isViewMode());
} else {
setVisibilityAllowed(false);
}
}
use of org.apache.wicket.model.StringResourceModel in project midpoint by Evolveum.
the class ConfirmationPanel method initLayout.
private void initLayout(IModel<String> message) {
WebMarkupContainer panel = new WebMarkupContainer(ID_PANEL);
Label label = new Label(ID_CONFIRM_TEXT, message);
label.setEscapeModelStrings(getLabelEscapeModelStrings());
panel.add(label);
AjaxButton yesButton = new AjaxButton(ID_YES, new StringResourceModel("confirmationDialog.yes", this, null)) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
yesPerformed(target);
}
};
panel.add(yesButton);
AjaxButton noButton = new AjaxButton(ID_NO, new StringResourceModel("confirmationDialog.no", this, null)) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
noPerformed(target);
}
};
panel.add(noButton);
add(panel);
}
use of org.apache.wicket.model.StringResourceModel in project midpoint by Evolveum.
the class DeleteAllPanel method initLayout.
private void initLayout(WebMarkupContainer content) {
CheckBox deleteUsersCheckbox = new CheckBox(ID_CHB_USERS, new PropertyModel<Boolean>(model, DeleteAllDto.F_USERS));
deleteUsersCheckbox.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
updateLabelModel(target, ID_TEXT_USERS);
}
});
content.add(deleteUsersCheckbox);
CheckBox deleteOrgsCheckbox = new CheckBox(ID_CHB_ORG, new PropertyModel<Boolean>(model, DeleteAllDto.F_ORGS));
deleteOrgsCheckbox.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
updateLabelModel(target, ID_TEXT_ORGS);
}
});
content.add(deleteOrgsCheckbox);
CheckBox deleteAccountShadowsCheckbox = new CheckBox(ID_CHB_ACCOUNT_SHADOW, new PropertyModel<Boolean>(model, DeleteAllDto.F_ACC_SHADOW));
deleteAccountShadowsCheckbox.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
updateLabelModel(target, ID_TEXT_ACC_SHADOWS);
}
});
content.add(deleteAccountShadowsCheckbox);
CheckBox deleteNonAccountShadowsCheckbox = new CheckBox(ID_CHB_NON_ACCOUNT_SHADOW, new PropertyModel<Boolean>(model, DeleteAllDto.F_NON_ACC_SHADOW));
deleteNonAccountShadowsCheckbox.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
updateLabelModel(target, ID_TEXT_NON_ACC_SHADOW);
}
});
content.add(deleteNonAccountShadowsCheckbox);
Label usersLabel = new Label(ID_TEXT_USERS, new LoadableModel<String>() {
@Override
protected String load() {
return createDeleteUsersMessage();
}
});
usersLabel.setOutputMarkupId(true);
content.add(usersLabel);
Label orgsLabel = new Label(ID_TEXT_ORGS, new LoadableModel<String>() {
@Override
protected String load() {
return createDeleteOrgUnitsMessage();
}
});
orgsLabel.setOutputMarkupId(true);
content.add(orgsLabel);
Label accShadowsLabel = new Label(ID_TEXT_ACC_SHADOWS, new LoadableModel<String>() {
@Override
protected String load() {
return createDeleteAccountShadowsMessage();
}
});
accShadowsLabel.setOutputMarkupId(true);
content.add(accShadowsLabel);
Label nonAccShadowsLabel = new Label(ID_TEXT_NON_ACC_SHADOW, new LoadableModel<String>() {
@Override
protected String load() {
return createDeleteNonAccountShadowsMessage();
}
});
nonAccShadowsLabel.setOutputMarkupId(true);
content.add(nonAccShadowsLabel);
Label countLabel = new Label(ID_TOTAL, new LoadableModel<String>() {
@Override
protected String load() {
return createTotalMessage();
}
});
countLabel.setOutputMarkupId(true);
content.add(countLabel);
AjaxButton yesButton = new AjaxButton(ID_YES, new StringResourceModel("deleteAllDialog.yes", this, null)) {
@Override
public void onClick(AjaxRequestTarget target) {
yesPerformed(target);
}
};
content.add(yesButton);
AjaxButton noButton = new AjaxButton(ID_NO, new StringResourceModel("deleteAllDialog.no", this, null)) {
@Override
public void onClick(AjaxRequestTarget target) {
noPerformed(target);
}
};
content.add(noButton);
}
use of org.apache.wicket.model.StringResourceModel in project midpoint by Evolveum.
the class PageSelfRegistration method createPasswordPanel.
private void createPasswordPanel(WebMarkupContainer staticRegistrationForm) {
// ProtectedStringType initialPassword = null;
PasswordPanel password = new PasswordPanel(ID_PASSWORD, new PropertyModel<ProtectedStringType>(userModel, "credentials.password.value"), false, true);
password.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
password.getBaseFormComponent().setRequired(true);
staticRegistrationForm.add(password);
Label help = new Label(ID_TOOLTIP);
final StringResourceModel tooltipText = createStringResource("PageSelfRegistration.password.policy");
help.add(AttributeModifier.replace("title", tooltipText));
help.add(new InfoTooltipBehavior());
help.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return StringUtils.isNotEmpty(tooltipText.getObject());
}
});
staticRegistrationForm.add(help);
}
use of org.apache.wicket.model.StringResourceModel in project midpoint by Evolveum.
the class GuiComponents method createTriStateCombo.
public static <T> DropDownChoice createTriStateCombo(String id, IModel<Boolean> model) {
final IChoiceRenderer<T> renderer = new IChoiceRenderer<T>() {
@Override
public T getObject(String id, IModel<? extends List<? extends T>> choices) {
return id != null ? choices.getObject().get(Integer.parseInt(id)) : null;
}
@Override
public String getDisplayValue(T object) {
String key;
if (object == null) {
key = KEY_BOOLEAN_NULL;
} else {
Boolean b = (Boolean) object;
key = b ? KEY_BOOLEAN_TRUE : KEY_BOOLEAN_FALSE;
}
StringResourceModel model = PageBase.createStringResourceStatic(null, key);
//
return model.getString();
}
@Override
public String getIdValue(T object, int index) {
return Integer.toString(index);
}
};
DropDownChoice dropDown = new DropDownChoice(id, model, createChoices(), renderer) {
@Override
protected CharSequence getDefaultChoice(String selectedValue) {
StringResourceModel model = PageBase.createStringResourceStatic(null, KEY_BOOLEAN_NULL);
return model.getString();
}
};
dropDown.setNullValid(true);
return dropDown;
}
Aggregations