use of org.apache.wicket.model.StringResourceModel in project midpoint by Evolveum.
the class SearchItem method getName.
public String getName() {
String key = definition.getDisplayName();
if (StringUtils.isEmpty(key)) {
StringBuilder sb = new StringBuilder();
sb.append(search.getType().getSimpleName()).append('.').append(definition.getName().getLocalPart());
key = sb.toString();
}
StringResourceModel nameModel = PageBase.createStringResourceStatic(null, key);
if (nameModel != null) {
if (StringUtils.isNotEmpty(nameModel.getString())) {
return nameModel.getString();
}
}
String name = definition.getDisplayName();
if (StringUtils.isNotEmpty(name)) {
return name;
}
return definition.getName().getLocalPart();
}
use of org.apache.wicket.model.StringResourceModel 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.StringResourceModel in project ocvn by devgateway.
the class EarlierThanDateFieldValidator method validate.
@Override
public void validate(final IValidatable<Date> validatable) {
highDate.getField().validate();
if (!highDate.getField().isValid()) {
return;
}
Date endDate = (Date) highDate.getField().getConvertedInput();
if (endDate != null && validatable.getValue() != null && endDate.before(validatable.getValue())) {
ValidationError error = new ValidationError(this);
error.setVariable("highDateName", new StringResourceModel(highDate.getLabelKey(), highDate.getParent(), null).getString());
validatable.error(error);
}
}
use of org.apache.wicket.model.StringResourceModel in project ocvn by devgateway.
the class BasePage method newAdminMenu.
protected NavbarDropDownButton newAdminMenu() {
// admin menu
NavbarDropDownButton adminMenu = new NavbarDropDownButton(new StringResourceModel("navbar.admin", this, null)) {
private static final long serialVersionUID = 1L;
@Override
protected List<AbstractLink> newSubMenuButtons(final String arg0) {
List<AbstractLink> list = new ArrayList<>();
list.add(new MenuBookmarkablePageLink<ListGroupPage>(ListGroupPage.class, null, new StringResourceModel("navbar.groups", this, null)).setIconType(FontAwesomeIconType.tags));
// list.add(new
// MenuBookmarkablePageLink<ListTestFormPage>(ListTestFormPage.class,
// null,
// new StringResourceModel("navbar.testcomponents", this, null))
// .setIconType(FontAwesomeIconType.android));
list.add(new MenuBookmarkablePageLink<ListVietnamImportSourceFiles>(ListVietnamImportSourceFiles.class, null, new StringResourceModel("navbar.importfiles", this, null)).setIconType(FontAwesomeIconType.file_archive_o));
list.add(new MenuBookmarkablePageLink<VietnamImportPage>(VietnamImportPage.class, null, new StringResourceModel("navbar.import", this, null)).setIconType(FontAwesomeIconType.cloud_upload));
list.add(new MenuBookmarkablePageLink<ListUserPage>(ListUserPage.class, null, new StringResourceModel("navbar.users", this, null)).setIconType(FontAwesomeIconType.users));
list.add(new MenuBookmarkablePageLink<SpringEndpointsPage>(SpringEndpointsPage.class, null, new StringResourceModel("navbar.springendpoints", this, null)).setIconType(FontAwesomeIconType.anchor));
list.add(new MenuBookmarkablePageLink<JminixRedirectPage>(JminixRedirectPage.class, null, new StringResourceModel("navbar.jminix", this, null)).setIconType(FontAwesomeIconType.bug));
// MenuBookmarkablePageLink<HALRedirectPage> halBrowserLink =
// new MenuBookmarkablePageLink<HALRedirectPage>(
// HALRedirectPage.class, null, new StringResourceModel(
// "navbar.halbrowser", this, null)) {
// private static final long serialVersionUID = 1L;
//
// @Override
// protected void onComponentTag(ComponentTag tag) {
// super.onComponentTag(tag);
// tag.put("target", "_blank");
// }
// };
// halBrowserLink.setIconType(FontAwesomeIconType.rss).setEnabled(true);
// list.add(halBrowserLink);
MenuBookmarkablePageLink<UIRedirectPage> uiBrowserLink = new MenuBookmarkablePageLink<UIRedirectPage>(UIRedirectPage.class, null, new StringResourceModel("navbar.ui", this, null)) {
private static final long serialVersionUID = 1L;
@Override
protected void onComponentTag(final ComponentTag tag) {
super.onComponentTag(tag);
tag.put("target", "_blank");
}
};
uiBrowserLink.setIconType(FontAwesomeIconType.dashboard).setEnabled(true);
list.add(new MenuBookmarkablePageLink<Void>(EditAdminSettingsPage.class, new StringResourceModel("navbar.adminSettings", BasePage.this, null)).setIconType(FontAwesomeIconType.briefcase));
list.add(new MenuBookmarkablePageLink<Void>(ListAllDashboardsPage.class, new StringResourceModel("navbar.allDashboard", BasePage.this, null)).setIconType(FontAwesomeIconType.filter));
list.add(uiBrowserLink);
return list;
}
};
adminMenu.setIconType(GlyphIconType.cog);
MetaDataRoleAuthorizationStrategy.authorize(adminMenu, Component.RENDER, SecurityConstants.Roles.ROLE_ADMIN);
return adminMenu;
}
use of org.apache.wicket.model.StringResourceModel in project ocvn by devgateway.
the class BasePage method newLanguageMenu.
public NavbarDropDownButton newLanguageMenu() {
final NavbarDropDownButton languageDropDown = new NavbarDropDownButton(new StringResourceModel("navbar.lang", this, null)) {
private static final long serialVersionUID = 319842753824102674L;
@Override
protected List<AbstractLink> newSubMenuButtons(final String buttonMarkupId) {
final List<AbstractLink> list = new ArrayList<>();
for (final Locale l : WebConstants.AVAILABLE_LOCALES) {
final PageParameters params = new PageParameters(BasePage.this.getPageParameters());
params.set(WebConstants.LANGUAGE_PARAM, l.getLanguage());
list.add(new MenuBookmarkablePageLink<Page>(BasePage.this.getPageClass(), params, Model.of(l.getDisplayName())));
}
return list;
}
};
languageDropDown.setIconType(GlyphIconType.flag);
return languageDropDown;
}
Aggregations