Search in sources :

Example 1 with AjaxSelfUpdatingTimerBehavior

use of org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior in project midpoint by Evolveum.

the class ProgressReporter method startRefreshingProgressPanel.

private void startRefreshingProgressPanel(AjaxRequestTarget target) {
    if (refreshingBehavior == null) {
        // i.e. refreshing behavior has not been set yet
        refreshingBehavior = new AjaxSelfUpdatingTimerBehavior(Duration.milliseconds(refreshInterval)) {

            @Override
            protected void onPostProcessTarget(AjaxRequestTarget target) {
                super.onPostProcessTarget(target);
                if (progressPanel != null) {
                    progressPanel.invalidateCache();
                }
                if (asyncOperationResult != null) {
                    // by checking this we know that async operation has been finished
                    // because we set it to in-progress
                    asyncOperationResult.recomputeStatus();
                    stopRefreshingProgressPanel(target);
                    parentPage.finishProcessing(target, asyncOperationResult, true);
                    asyncOperationResult = null;
                }
            }

            @Override
            public boolean isEnabled(Component component) {
                return component != null;
            }
        };
        progressPanel.add(refreshingBehavior);
        target.add(progressPanel);
    }
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Component(org.apache.wicket.Component) AjaxSelfUpdatingTimerBehavior(org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior)

Example 2 with AjaxSelfUpdatingTimerBehavior

use of org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior in project midpoint by Evolveum.

the class SystemInfoPanel method initLayout.

@Override
protected void initLayout() {
    final WebMarkupContainer table = new WebMarkupContainer(ID_TABLE);
    table.setOutputMarkupId(true);
    add(table);
    table.add(new AjaxSelfUpdatingTimerBehavior(Duration.milliseconds(1500)));
    Label cpuUsage = new Label(ID_CPU_USAGE, new PropertyModel<>(getModel(), SystemInfoDto.F_CPU_USAGE));
    table.add(cpuUsage);
    Label heapMemory = new Label(ID_HEAP_MEMORY, createMemoryModel(true));
    table.add(heapMemory);
    Label nonHeapMemory = new Label(ID_NON_HEAP_MEMORY, createMemoryModel(false));
    table.add(nonHeapMemory);
    Label threads = new Label(ID_THREADS, createThreadModel());
    table.add(threads);
    DateLabelComponent startTime = new DateLabelComponent(ID_START_TIME, createStartTimeModel(), DateLabelComponent.MEDIUM_MEDIUM_STYLE);
    table.add(startTime);
    Label uptime = new Label(ID_UPTIME, createUptimeModel());
    table.add(uptime);
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) DateLabelComponent(com.evolveum.midpoint.web.component.DateLabelComponent) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxSelfUpdatingTimerBehavior(org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior)

Example 3 with AjaxSelfUpdatingTimerBehavior

use of org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior in project ocvn by devgateway.

the class LogLabel method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    add(indicatorAppender);
    setOutputMarkupId(true);
    setOutputMarkupPlaceholderTag(true);
    setEscapeModelStrings(false);
    selfUpdatingBehavior = new AjaxSelfUpdatingTimerBehavior(refreshInterval) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onPostProcessTarget(final AjaxRequestTarget target) {
            LogLabel.this.onPostProcessTarget(target);
        }
    };
    add(selfUpdatingBehavior);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSelfUpdatingTimerBehavior(org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior)

Aggregations

AjaxSelfUpdatingTimerBehavior (org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 DateLabelComponent (com.evolveum.midpoint.web.component.DateLabelComponent)1 Component (org.apache.wicket.Component)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1 Label (org.apache.wicket.markup.html.basic.Label)1