Search in sources :

Example 21 with Component

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

the class UploadDownloadPanel method removeFilePerformed.

public void removeFilePerformed(AjaxRequestTarget target) {
    Component input = get(ID_INPUT_FILE);
    try {
        updateValue(null);
        LOGGER.trace("Remove file success.");
        input.success(getString("UploadPanel.message.removeSuccess"));
    } catch (Exception e) {
        LOGGER.trace("Remove file error.", e);
        input.error(getString("UploadPanel.message.removeError") + " " + e.getMessage());
    }
}
Also used : Component(org.apache.wicket.Component) FormComponent(org.apache.wicket.markup.html.form.FormComponent)

Example 22 with Component

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

the class DropDownFormGroup method initLayout.

private void initLayout(IModel<List<T>> choices, IChoiceRenderer<T> renderer, IModel<String> label, final String tooltipKey, boolean isTooltipInModal, String labelSize, String textSize, final boolean required) {
    WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
    add(labelContainer);
    Label l = new Label(ID_LABEL, label);
    if (StringUtils.isNotEmpty(labelSize)) {
        labelContainer.add(AttributeAppender.prepend("class", labelSize));
    }
    labelContainer.add(l);
    Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
    tooltipLabel.add(new AttributeAppender("data-original-title", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return getString(tooltipKey);
        }
    }));
    tooltipLabel.add(new InfoTooltipBehavior(isTooltipInModal));
    tooltipLabel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return tooltipKey != null;
        }
    });
    tooltipLabel.setOutputMarkupId(true);
    tooltipLabel.setOutputMarkupPlaceholderTag(true);
    labelContainer.add(tooltipLabel);
    WebMarkupContainer requiredContainer = new WebMarkupContainer(ID_REQUIRED);
    requiredContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return required;
        }
    });
    labelContainer.add(requiredContainer);
    WebMarkupContainer selectWrapper = new WebMarkupContainer(ID_SELECT_WRAPPER);
    if (StringUtils.isNotEmpty(textSize)) {
        selectWrapper.add(AttributeAppender.prepend("class", textSize));
    }
    add(selectWrapper);
    DropDownChoice select = createDropDown(ID_SELECT, choices, renderer, required);
    select.setLabel(label);
    selectWrapper.add(select);
    FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(select));
    feedback.setOutputMarkupId(true);
    selectWrapper.add(feedback);
    Component additionalInfo = createAdditionalInfoComponent(ID_ADDITIONAL_INFO);
    if (additionalInfo == null) {
        additionalInfo = new Label(ID_ADDITIONAL_INFO, "");
    }
    selectWrapper.add(additionalInfo);
}
Also used : InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) Label(org.apache.wicket.markup.html.basic.Label) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) Component(org.apache.wicket.Component) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 23 with Component

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

the class TestConnectionResultPanel method initLayout.

private void initLayout(Page parentPage) {
    WebMarkupContainer contentPanel = new WebMarkupContainer(ID_CONTENT_PANEL);
    contentPanel.setOutputMarkupId(true);
    add(contentPanel);
    Label messageLabel = new Label(ID_MESSAGE, ((PageBase) parentPage).createStringResource("TestConnectionResultPanel.message"));
    messageLabel.setOutputMarkupId(true);
    contentPanel.add(messageLabel);
    messageLabel.add(new VisibleEnableBehaviour() {

        public boolean isVisible() {
            return !isLoaded;
        }
    });
    AjaxLazyLoadPanel resultsPanel = new AjaxLazyLoadPanel(ID_RESULT) {

        @Override
        public Component getLazyLoadComponent(String id) {
            return new TestConnectionMessagesPanel(id, resourceOid, (PageBase) parentPage);
        }

        @Override
        protected void onComponentLoaded(Component component, AjaxRequestTarget target) {
            isLoaded = true;
            target.add(component);
            target.add(messageLabel);
        }
    };
    contentPanel.add(resultsPanel);
    AjaxButton ok = new AjaxButton(ID_OK) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            getPageBase().hideMainPopup(target);
            okPerformed(target);
        }
    };
    contentPanel.add(ok);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) Label(org.apache.wicket.markup.html.basic.Label) AjaxLazyLoadPanel(org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) Component(org.apache.wicket.Component) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 24 with Component

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

the class WebComponentUtil method debugDumpComponentTree.

private static void debugDumpComponentTree(StringBuilder sb, Component c, int level) {
    DebugUtil.indentDebugDump(sb, level);
    sb.append(c).append("\n");
    if (c instanceof MarkupContainer) {
        for (Component sub : (MarkupContainer) c) {
            debugDumpComponentTree(sb, sub, level + 1);
        }
    }
}
Also used : MarkupContainer(org.apache.wicket.MarkupContainer) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) Component(org.apache.wicket.Component)

Example 25 with Component

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

the class InfoTooltipBehavior method getModalContainer.

@Override
public String getModalContainer(Component component) {
    String id = component.getMarkupId();
    if (component.getParent() != null) {
        Component parent = component.getParent();
        id = parent.getParent() != null ? parent.getParent().getMarkupId() : parent.getMarkupId();
    }
    return id;
}
Also used : Component(org.apache.wicket.Component)

Aggregations

Component (org.apache.wicket.Component)47 Label (org.apache.wicket.markup.html.basic.Label)16 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)13 FormComponent (org.apache.wicket.markup.html.form.FormComponent)12 ArrayList (java.util.ArrayList)10 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)9 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)7 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)5 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)4 Behavior (org.apache.wicket.behavior.Behavior)4 SimpleAttributeModifier (org.apache.wicket.behavior.SimpleAttributeModifier)4 ListView (org.apache.wicket.markup.html.list.ListView)4 Fragment (org.apache.wicket.markup.html.panel.Fragment)4 Item (org.apache.wicket.markup.repeater.Item)4 PropertyModel (org.apache.wicket.model.PropertyModel)4 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)3 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)3 DropDownChoicePanel (com.evolveum.midpoint.web.component.input.DropDownChoicePanel)3 RepositoryModel (com.gitblit.models.RepositoryModel)3 TextField (org.apache.wicket.markup.html.form.TextField)3