Search in sources :

Example 6 with StringResourceModel

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);
    }
}
Also used : TooltipBehavior(de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipBehavior) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Example 7 with StringResourceModel

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);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) Label(org.apache.wicket.markup.html.basic.Label) StringResourceModel(org.apache.wicket.model.StringResourceModel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 8 with StringResourceModel

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);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) CheckBox(org.apache.wicket.markup.html.form.CheckBox) Label(org.apache.wicket.markup.html.basic.Label) StringResourceModel(org.apache.wicket.model.StringResourceModel) OnChangeAjaxBehavior(org.apache.wicket.ajax.form.OnChangeAjaxBehavior)

Example 9 with StringResourceModel

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);
}
Also used : InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) PasswordPanel(com.evolveum.midpoint.gui.api.component.password.PasswordPanel) EmptyOnBlurAjaxFormUpdatingBehaviour(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour) Label(org.apache.wicket.markup.html.basic.Label) MultiLineLabel(org.apache.wicket.markup.html.basic.MultiLineLabel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ProtectedStringType(com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Example 10 with StringResourceModel

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;
}
Also used : IChoiceRenderer(org.apache.wicket.markup.html.form.IChoiceRenderer) IModel(org.apache.wicket.model.IModel) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) ArrayList(java.util.ArrayList) List(java.util.List) 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