use of org.polymap.core.data.feature.storecache.StoreCacheProcessor.AtomicLong2 in project polymap4-core by Polymap4.
the class StatisticsSupplier method updateUI.
protected void updateUI() {
AtomicLong2 timestamp = StoreCacheProcessor.lastUpdated.get(layerId);
if (timestamp != null && timestamp.get() > 0) {
long ago = System.currentTimeMillis() - timestamp.get();
l.setText("Last update: " + df.format(new Date(timestamp.get())) + " (" + ddf.format(Duration.ofMillis(ago)) + ")");
} else {
l.setText("Cache is empty or update forced ");
}
l.getParent().layout(true);
}
use of org.polymap.core.data.feature.storecache.StoreCacheProcessor.AtomicLong2 in project polymap4-core by Polymap4.
the class StatisticsSupplier method createContents.
@Override
public Control createContents(Composite parent, Param<Object> param, PipelineProcessorSite site) {
this.layerId = site.layerId.get();
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(FormLayoutFactory.defaults().spacing(3).margins(0, 0, 3, 0).create());
// Label
l = new Label(container, SWT.NONE);
l.setFont(UIUtils.italic(l.getFont()));
updateUI();
//
Button btn = new Button(container, SWT.PUSH);
btn.setText("FLUSH CACHE");
btn.setToolTipText("Reset timestamp so that next access will re-fetch contents from backend store");
btn.addSelectionListener(UIUtils.selectionListener(ev -> {
StoreCacheProcessor.lastUpdated.put(layerId, new AtomicLong2());
updateUI();
}));
// layout
FormDataFactory.on(l).fill().noBottom();
FormDataFactory.on(btn).top(l).left(30).right(70).bottom(100);
return container;
}
Aggregations