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);
}
}
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);
}
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);
}
Aggregations