Example usage for org.apache.wicket.markup.html.panel FeedbackPanel setFilter

List of usage examples for org.apache.wicket.markup.html.panel FeedbackPanel setFilter

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.panel FeedbackPanel setFilter.

Prototype

public final FeedbackPanel setFilter(IFeedbackMessageFilter filter) 

Source Link

Document

Sets a filter to use on the feedback messages model

Usage

From source file:abid.password.wicket.components.ErrorInfoFeedbackPanel.java

License:Apache License

private FeedbackPanel createFeedBackFilter(String id, final int filterLevel) {
    FeedbackPanel feedbackPanel = new FeedbackPanel(id) {
        private static final long serialVersionUID = 1L;

        @Override/*w w w  . j av  a2s.co  m*/
        public boolean isVisible() {
            return anyMessage(filterLevel);

        }
    };
    feedbackPanel.setFilter(new IFeedbackMessageFilter() {
        private static final long serialVersionUID = 1L;

        public boolean accept(FeedbackMessage message) {
            return message.getLevel() == filterLevel;
        }
    });
    feedbackPanel.setEscapeModelStrings(false);
    return feedbackPanel;
}

From source file:com.evolveum.midpoint.web.component.prism.PrismValuePanel.java

License:Apache License

private void initLayout(IModel<String> label, Form form) {
    //feedback/*from  www .j a  va2  s  . c  o m*/
    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK);
    feedback.setOutputMarkupId(true);
    add(feedback);

    //input
    InputPanel input = createInputComponent("input", label, form);
    initAccessBehaviour(input);
    add(input);

    feedback.setFilter(new ComponentFeedbackMessageFilter(input.getBaseFormComponent()));

    //buttons
    AjaxLink addButton = new AjaxLink("addButton") {

        @Override
        public void onClick(AjaxRequestTarget target) {
            addValue(target);
        }
    };
    addButton.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isAddButtonVisible();
        }
    });
    add(addButton);

    AjaxLink removeButton = new AjaxLink("removeButton") {

        @Override
        public void onClick(AjaxRequestTarget target) {
            removeValue(target);
        }
    };
    removeButton.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isRemoveButtonVisible();
        }
    });
    add(removeButton);
}

From source file:com.evolveum.midpoint.web.page.admin.home.PageMyPasswords.java

License:Apache License

private void initLayout() {
    Form mainForm = new Form(ID_MAIN_FORM);
    add(mainForm);/*  w ww .j a  v a2 s .com*/

    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, provider, columns);
    accounts.setItemsPerPage(30);
    accounts.setShowPaging(false);
    mainForm.add(accounts);

    PasswordPanel passwordPanel = new PasswordPanel(ID_PASSWORD_PANEL,
            new PropertyModel<String>(model, MyPasswordsDto.F_PASSWORD));
    mainForm.add(passwordPanel);

    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK);
    feedback.setFilter(new ComponentFeedbackMessageFilter(passwordPanel.getBaseFormComponent()));
    feedback.setOutputMarkupId(true);
    mainForm.add(feedback);

    initButtons(mainForm);
}

From source file:com.evolveum.midpoint.web.page.admin.users.component.AssociationValueChoicePanel.java

License:Apache License

private void initLayout(final IModel<PrismContainerValue<ShadowAssociationType>> value,
        final List<PrismPropertyValue> values, final boolean required, Class<C> type) {

    WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);

    textWrapper.setOutputMarkupId(true);

    TextField<String> text = new TextField<>(ID_TEXT, createTextModel(value));
    text.add(new AjaxFormComponentUpdatingBehavior("blur") {
        private static final long serialVersionUID = 1L;

        @Override//  w  w w .  j  av a 2  s .co m
        protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
        }
    });
    text.setRequired(required);
    text.setEnabled(false);
    textWrapper.add(text);

    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text));
    feedback.setFilter(new ComponentFeedbackMessageFilter(text));
    textWrapper.add(feedback);

    AjaxLink edit = new AjaxLink(ID_EDIT) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            editValuePerformed(target);
        }
    };
    edit.add(new VisibleEnableBehaviour() {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return model.getObject().isEmpty();
        }
    });
    textWrapper.add(edit);
    add(textWrapper);

    initDialog(type, values);

}

From source file:com.evolveum.midpoint.web.page.login.PageSelfRegistration.java

License:Apache License

private void initInputProperties(FeedbackPanel feedback, TextPanel<String> input) {
    input.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    input.getBaseFormComponent().setRequired(true);
    feedback.setFilter(new ContainerFeedbackMessageFilter(input.getBaseFormComponent()));

    input.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override//from   w ww  .  j a  v  a2 s .c o  m
        public boolean isEnabled() {
            return getOidFromParams(getPageParameters()) == null;
        }

    });

}

From source file:gr.abiss.calipso.wicket.BasePanel.java

License:Open Source License

protected FeedbackPanel getFeedbackPanel(String id) {
    FeedbackPanel feedback = new FeedbackPanel(id);
    feedback.setOutputMarkupId(true);/*from w  ww .  j av  a2  s  .  c o m*/
    IFeedbackMessageFilter filter = new CalipsoFeedbackMessageFilter();
    feedback.setFilter(filter);
    return feedback;
}

From source file:gr.abiss.calipso.wicket.ItemViewFormPanel.java

License:Open Source License

/**
 * /* w ww.j a v a  2s  .c  o m*/
 * @param id
 * @param breadCrumbModel
 * @param item
 * @param itemSearch
 * @param previewHistory
 */
public ItemViewFormPanel(String id, IBreadCrumbModel breadCrumbModel, Item item, ItemSearch itemSearch,
        History previewHistory) {
    super(id, breadCrumbModel);
    this.itemSearch = itemSearch;
    FeedbackPanel feedback = new FeedbackPanel("feedback");
    filter = new CalipsoFeedbackMessageFilter();
    feedback.setFilter(filter);

    User currentUser = getPrincipal();
    Space currentSpace = getCurrentSpace();
    boolean userCanSeeComments = currentUser.hasRegularRoleForSpace(currentSpace)
            || (currentSpace.getItemVisibility().equals(Space.ITEMS_VISIBLE_TO_LOGGEDIN_REPORTERS)
                    && currentUser.isGuestForSpace(currentSpace));

    itemViewForm = new ItemViewForm("form", item, previewHistory);
    itemViewForm.add(feedback);
    WebMarkupContainer formContainer = new WebMarkupContainer("formContainer");
    formContainer.add(itemViewForm);
    add(formContainer.setVisible(userCanSeeComments));
    // TODO: add expired clean up for files uploaded by UploadPanel as well
    // getJtrac().removeExpiredTemporaryAttachments();
}

From source file:info.jtrac.wicket.ItemViewFormPanel.java

License:Apache License

public ItemViewFormPanel(String id, Item item) {
    super(id);//w w  w  .j  a  v  a 2 s.c  o  m
    FeedbackPanel feedback = new FeedbackPanel("feedback");
    filter = new JtracFeedbackMessageFilter();
    feedback.setFilter(filter);
    add(feedback);
    add(new ItemViewForm("form", item));
}

From source file:main.java.info.jtrac.wicket.ItemViewFormPanel.java

License:Apache License

public ItemViewFormPanel(String id, Item item, ItemSearch itemSearch) {
    super(id);//w ww .ja v a2 s. c  o m
    this.itemSearch = itemSearch;
    FeedbackPanel feedback = new FeedbackPanel("feedback");
    filter = new JtracFeedbackMessageFilter();
    feedback.setFilter(filter);
    add(feedback);
    add(new ItemViewForm("form", item));
}

From source file:org.hippoecm.frontend.plugins.cms.admin.updater.UpdaterPanel.java

License:Apache License

public UpdaterPanel(final String componentId, final IBreadCrumbModel breadCrumbModel,
        final IPluginContext context) {
    super(componentId, breadCrumbModel);

    this.context = context;

    form = new HippoForm("new-form");
    final AjaxButton newButton = new AjaxButton("new-button") {
        @Override/*from   ww  w  .  j  av a 2s  .  com*/
        protected void onSubmit(AjaxRequestTarget target, Form<?> currentForm) {
            newUpdater();
        }
    };

    // customize feedbackpanel to display only messages from hippoform
    FeedbackPanel feedbackPanel = getFeedbackPanel();
    if (feedbackPanel != null) {
        feedbackPanel.setFilter(message -> {
            final Component reporter = message.getReporter();
            return reporter == UpdaterPanel.this.form;
        });
    }

    form.add(newButton);

    add(form);

    treeModel = new JcrTreeModel(new JcrTreeNode(new JcrNodeModel(UPDATE_PATH), null)) {
        @Override
        protected TreeModelEvent newTreeModelEvent(final Event event) throws RepositoryException {
            if (StringUtils.equals(event.getPath(), getNodePath())) {
                updateUI();
            }
            return super.newTreeModelEvent(event);
        }
    };
    context.registerService(treeModel, IObserver.class.getName());

    breadCrumbModel.addListener(new IBreadCrumbModelListener() {
        @Override
        public void breadCrumbActivated(final IBreadCrumbParticipant previousParticipant,
                final IBreadCrumbParticipant breadCrumbParticipant) {
        }

        @Override
        public void breadCrumbAdded(final IBreadCrumbParticipant breadCrumbParticipant) {
        }

        @Override
        public void breadCrumbRemoved(final IBreadCrumbParticipant breadCrumbParticipant) {
            if (breadCrumbParticipant == UpdaterPanel.this) {
                breadCrumbModel.removeListener(this);
                context.unregisterService(treeModel, IObserver.class.getName());
            }
        }
    });

    tree = new UpdaterTree("updater-tree", treeModel, newTreeNodeTranslator(), newTreeNodeIconProvider());
    tree.setRootLess(true);
    tree.setOutputMarkupId(true);
    add(tree);

    tree.expandChildrenOfRoot();

    editor = EMPTY_EDITOR;
    editor.setOutputMarkupId(true);
    add(editor);

    title = new Label("updater-title", new AbstractReadOnlyModel<String>() {
        @Override
        public String getObject() {
            return getUpdaterTitle();
        }
    });
    title.setOutputMarkupId(true);
    add(title);

    setOutputMarkupId(true);
}