Search in sources :

Example 21 with AttributeModifier

use of org.apache.wicket.AttributeModifier in project midpoint by Evolveum.

the class ChangePasswordPanel method initLayout.

private void initLayout(final boolean oldPasswordVisible) {
    model = (LoadableModel<MyPasswordsDto>) getModel();
    Label oldPasswordLabel = new Label(ID_OLD_PASSWORD_LABEL, createStringResource("PageSelfCredentials.oldPasswordLabel"));
    add(oldPasswordLabel);
    oldPasswordLabel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return oldPasswordVisible;
        }
    });
    Label passwordLabel = new Label(ID_PASSWORD_LABEL, createStringResource("PageSelfCredentials.passwordLabel1"));
    add(passwordLabel);
    PasswordTextField oldPasswordField = new PasswordTextField(ID_OLD_PASSWORD_FIELD, new PropertyModel<String>(model, MyPasswordsDto.F_OLD_PASSWORD));
    oldPasswordField.setRequired(false);
    oldPasswordField.setResetPassword(false);
    add(oldPasswordField);
    oldPasswordField.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        public boolean isVisible() {
            return oldPasswordVisible;
        }

        ;
    });
    PasswordPanel passwordPanel = new PasswordPanel(ID_PASSWORD_PANEL, new PropertyModel<ProtectedStringType>(model, MyPasswordsDto.F_PASSWORD));
    passwordPanel.getBaseFormComponent().add(new AttributeModifier("autofocus", ""));
    add(passwordPanel);
    WebMarkupContainer accountContainer = new WebMarkupContainer(ID_ACCOUNTS_CONTAINER);
    List<IColumn<PasswordAccountDto, String>> columns = initColumns();
    ListDataProvider<PasswordAccountDto> provider = new ListDataProvider<PasswordAccountDto>(this, new PropertyModel<List<PasswordAccountDto>>(model, MyPasswordsDto.F_ACCOUNTS));
    TablePanel accounts = new TablePanel(ID_ACCOUNTS_TABLE, provider, columns);
    accounts.setItemsPerPage(30);
    accounts.setShowPaging(false);
    if (model.getObject().getPropagation() != null && model.getObject().getPropagation().equals(CredentialsPropagationUserControlType.MAPPING)) {
        accountContainer.setVisible(false);
    }
    accountContainer.add(accounts);
    AjaxLink help = new AjaxLink(ID_BUTTON_HELP) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            showHelpPerformed(target);
        }
    };
    accountContainer.add(help);
    add(accountContainer);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) PasswordPanel(com.evolveum.midpoint.gui.api.component.password.PasswordPanel) Label(org.apache.wicket.markup.html.basic.Label) PasswordTextField(org.apache.wicket.markup.html.form.PasswordTextField) AttributeModifier(org.apache.wicket.AttributeModifier) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PasswordAccountDto(com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto) MyPasswordsDto(com.evolveum.midpoint.web.page.admin.home.dto.MyPasswordsDto) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) ProtectedStringType(com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 22 with AttributeModifier

use of org.apache.wicket.AttributeModifier in project midpoint by Evolveum.

the class TooltipBehavior method onConfigure.

@Override
public void onConfigure(final Component component) {
    component.setOutputMarkupId(true);
    component.add(AttributeModifier.replace("data-toggle", "tooltip"));
    component.add(new AttributeModifier("data-placement", getDataPlacement()) {

        @Override
        protected String newValue(String currentValue, String replacementValue) {
            if (StringUtils.isEmpty(currentValue)) {
                return replacementValue;
            }
            return currentValue;
        }
    });
}
Also used : AttributeModifier(org.apache.wicket.AttributeModifier)

Example 23 with AttributeModifier

use of org.apache.wicket.AttributeModifier in project ocvn by devgateway.

the class BootstrapPagingNavigation method populateItem.

@Override
protected void populateItem(final LoopItem loopItem) {
    super.populateItem(loopItem);
    final long pageIndex = getStartIndex() + loopItem.getIndex();
    // Add disabled class to enclosing list item.
    loopItem.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {

        private static final long serialVersionUID = 1L;

        @Override
        public String getObject() {
            if (pageable.getCurrentPage() == pageIndex) {
                return "active";
            } else {
                return "";
            }
        }
    }));
// Do not mask disabled link by em tag.
// ((AbstractLink)
// loopItem.get("pageLink")).setBeforeDisabledLink("").setAfterDisabledLink("");
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) AttributeModifier(org.apache.wicket.AttributeModifier)

Example 24 with AttributeModifier

use of org.apache.wicket.AttributeModifier in project gitblit by gitblit.

the class TicketPage method addDateAttributions.

protected void addDateAttributions(MarkupContainer container, Change entry) {
    container.add(WicketUtils.createDateLabel("changeDate", entry.date, GitBlitWebSession.get().getTimezone(), getTimeUtils(), false));
    // set the id attribute
    if (entry.hasComment()) {
        container.setOutputMarkupId(true);
        container.add(new AttributeModifier("id", Model.of(entry.getId())));
        ExternalLink link = new ExternalLink("changeLink", "#" + entry.getId());
        container.add(link);
    } else {
        container.add(new Label("changeLink").setVisible(false));
    }
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) TicketLabel(com.gitblit.tickets.TicketLabel) AttributeModifier(org.apache.wicket.AttributeModifier) SimpleAttributeModifier(org.apache.wicket.behavior.SimpleAttributeModifier) ExternalLink(org.apache.wicket.markup.html.link.ExternalLink)

Example 25 with AttributeModifier

use of org.apache.wicket.AttributeModifier in project midpoint by Evolveum.

the class TablePanel method setStyle.

public void setStyle(String value) {
    Validate.notEmpty(value, "Value must not be null or empty.");
    DataTable table = getDataTable();
    table.add(new AttributeModifier("style", new Model(value)));
}
Also used : DataTable(org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) IModel(org.apache.wicket.model.IModel) AttributeModifier(org.apache.wicket.AttributeModifier)

Aggregations

AttributeModifier (org.apache.wicket.AttributeModifier)37 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)23 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)23 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)21 Label (org.apache.wicket.markup.html.basic.Label)19 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)18 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)12 IModel (org.apache.wicket.model.IModel)9 PropertyModel (org.apache.wicket.model.PropertyModel)9 ListItem (org.apache.wicket.markup.html.list.ListItem)8 ListView (org.apache.wicket.markup.html.list.ListView)8 Model (org.apache.wicket.model.Model)7 ArrayList (java.util.ArrayList)6 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)5 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)5 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)4 PasswordPanel (com.evolveum.midpoint.gui.api.component.password.PasswordPanel)3 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)3 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)3 EmptyOnBlurAjaxFormUpdatingBehaviour (com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour)3