Search in sources :

Example 1 with ProgressbarPanel

use of com.evolveum.midpoint.gui.api.component.progressbar.ProgressbarPanel in project midpoint by Evolveum.

the class InfoBoxPanel method initLayout.

private void initLayout(final IModel<InfoBoxType> model, final Class<? extends IRequestablePage> linkPage) {
    WebMarkupContainer infoBox = new WebMarkupContainer(ID_INFO_BOX);
    add(infoBox);
    infoBox.add(AttributeModifier.append("class", new PropertyModel<String>(model, InfoBoxType.BOX_BACKGROUND_COLOR)));
    WebMarkupContainer infoBoxIcon = new WebMarkupContainer(ID_INFO_BOX_ICON);
    infoBox.add(infoBoxIcon);
    infoBoxIcon.add(AttributeModifier.append("class", new PropertyModel<String>(model, InfoBoxType.ICON_BACKGROUND_COLOR)));
    WebMarkupContainer image = new WebMarkupContainer(ID_IMAGE_ID);
    image.add(AttributeModifier.append("class", new PropertyModel<String>(model, InfoBoxType.IMAGE_ID)));
    infoBoxIcon.add(image);
    Label message = new Label(ID_MESSAGE, new PropertyModel<String>(model, InfoBoxType.MESSAGE));
    infoBox.add(message);
    Label number = new Label(ID_NUMBER, new PropertyModel<String>(model, InfoBoxType.NUMBER));
    infoBox.add(number);
    WebMarkupContainer progress = new WebMarkupContainer(ID_PROGRESS);
    infoBox.add(progress);
    progress.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return model.getObject().getProgress() != null;
        }
    });
    ProgressbarPanel progressBar = new ProgressbarPanel(ID_PROGRESS_BAR, new PropertyModel<Integer>(model, InfoBoxType.PROGRESS));
    progress.add(progressBar);
    Label description = new Label(ID_DESCRIPTION, new PropertyModel<String>(model, InfoBoxType.DESCRIPTION));
    infoBox.add(description);
    if (linkPage != null) {
        add(new AjaxEventBehavior("click") {

            private static final long serialVersionUID = 1L;

            @Override
            protected void onEvent(AjaxRequestTarget target) {
                setResponsePage(linkPage);
            }
        });
    }
}
Also used : AjaxEventBehavior(org.apache.wicket.ajax.AjaxEventBehavior) PropertyModel(org.apache.wicket.model.PropertyModel) Label(org.apache.wicket.markup.html.basic.Label) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ProgressbarPanel(com.evolveum.midpoint.gui.api.component.progressbar.ProgressbarPanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 2 with ProgressbarPanel

use of com.evolveum.midpoint.gui.api.component.progressbar.ProgressbarPanel in project midpoint by Evolveum.

the class BasicInfoBoxPanel method customInitLayout.

@Override
protected void customInitLayout(WebMarkupContainer parentInfoBox, IModel<InfoBoxType> model, Class<? extends IRequestablePage> linkPage) {
    WebMarkupContainer progress = new WebMarkupContainer(ID_PROGRESS);
    parentInfoBox.add(progress);
    progress.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return model.getObject() != null && model.getObject().getProgress() != null;
        }
    });
    ProgressbarPanel progressBar = new ProgressbarPanel(ID_PROGRESS_BAR, new PropertyModel<>(model, InfoBoxType.PROGRESS));
    progress.add(progressBar);
    Label description = new Label(ID_DESCRIPTION, new PropertyModel<String>(model, InfoBoxType.DESCRIPTION));
    parentInfoBox.add(description);
    if (linkPage != null) {
        add(new AjaxEventBehavior("click") {

            private static final long serialVersionUID = 1L;

            @Override
            protected void onEvent(AjaxRequestTarget target) {
                setResponsePage(linkPage);
            }
        });
    }
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxEventBehavior(org.apache.wicket.ajax.AjaxEventBehavior) ProgressbarPanel(com.evolveum.midpoint.gui.api.component.progressbar.ProgressbarPanel) Label(org.apache.wicket.markup.html.basic.Label) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Aggregations

ProgressbarPanel (com.evolveum.midpoint.gui.api.component.progressbar.ProgressbarPanel)2 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)2 AjaxEventBehavior (org.apache.wicket.ajax.AjaxEventBehavior)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 Label (org.apache.wicket.markup.html.basic.Label)2 PropertyModel (org.apache.wicket.model.PropertyModel)1