Search in sources :

Example 11 with StringResourceModel

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();
}
Also used : ToStringBuilder(org.apache.commons.lang.builder.ToStringBuilder) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Example 12 with StringResourceModel

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;
}
Also used : JasperReportValueDto(com.evolveum.midpoint.web.page.admin.reports.dto.JasperReportValueDto) ListView(org.apache.wicket.markup.html.list.ListView) Label(org.apache.wicket.markup.html.basic.Label) LookupPropertyModel(com.evolveum.midpoint.web.model.LookupPropertyModel) PropertyModel(org.apache.wicket.model.PropertyModel) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) ListItem(org.apache.wicket.markup.html.list.ListItem) StringResourceModel(org.apache.wicket.model.StringResourceModel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 13 with StringResourceModel

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);
    }
}
Also used : ValidationError(org.apache.wicket.validation.ValidationError) StringResourceModel(org.apache.wicket.model.StringResourceModel) Date(java.util.Date)

Example 14 with StringResourceModel

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;
}
Also used : NavbarDropDownButton(de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarDropDownButton) ComponentTag(org.apache.wicket.markup.ComponentTag) ArrayList(java.util.ArrayList) MenuBookmarkablePageLink(de.agilecoders.wicket.core.markup.html.bootstrap.button.dropdown.MenuBookmarkablePageLink) AbstractLink(org.apache.wicket.markup.html.link.AbstractLink) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Example 15 with StringResourceModel

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;
}
Also used : NavbarDropDownButton(de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarDropDownButton) Locale(java.util.Locale) ArrayList(java.util.ArrayList) Page(org.apache.wicket.Page) EditUserPage(org.devgateway.toolkit.forms.wicket.page.user.EditUserPage) VietnamImportPage(org.devgateway.ocvn.forms.wicket.page.VietnamImportPage) ListGroupPage(org.devgateway.toolkit.forms.wicket.page.lists.ListGroupPage) RedirectPage(org.apache.wicket.markup.html.pages.RedirectPage) GenericWebPage(org.apache.wicket.markup.html.GenericWebPage) ListAllDashboardsPage(org.devgateway.ocds.forms.wicket.page.list.ListAllDashboardsPage) LogoutPage(org.devgateway.toolkit.forms.wicket.page.user.LogoutPage) ListMyDashboardsPage(org.devgateway.ocds.forms.wicket.page.list.ListMyDashboardsPage) ListUserPage(org.devgateway.toolkit.forms.wicket.page.lists.ListUserPage) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) AbstractLink(org.apache.wicket.markup.html.link.AbstractLink) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Aggregations

StringResourceModel (org.apache.wicket.model.StringResourceModel)19 Label (org.apache.wicket.markup.html.basic.Label)8 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)7 ArrayList (java.util.ArrayList)6 List (java.util.List)4 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)4 TooltipBehavior (de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipBehavior)3 ListItem (org.apache.wicket.markup.html.list.ListItem)3 ListView (org.apache.wicket.markup.html.list.ListView)3 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)2 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)2 IconBehavior (de.agilecoders.wicket.core.markup.html.bootstrap.image.IconBehavior)2 NavbarDropDownButton (de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarDropDownButton)2 IndicatingAjaxLink (org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink)2 Form (org.apache.wicket.markup.html.form.Form)2 AbstractLink (org.apache.wicket.markup.html.link.AbstractLink)2 LogoutPage (org.devgateway.toolkit.forms.wicket.page.user.LogoutPage)2 FileMetadata (org.devgateway.toolkit.persistence.dao.FileMetadata)2 PasswordPanel (com.evolveum.midpoint.gui.api.component.password.PasswordPanel)1 ModelState (com.evolveum.midpoint.model.api.context.ModelState)1