private final ProgressIndicator pi = new ProgressIndicator();
private final Label memoryStatus;
public TestForStyledUpload() {
main.addComponent(new Label(
"Clicking on button b updates information about upload components status or same with garbage collector."));
up = new Upload(null, buffer);
up.setButtonCaption("Select file");
up.setImmediate(true);
up.addListener((FinishedListener) this);
up.addListener((FailedListener) this);
up.addListener((SucceededListener) this);
up.addListener((StartedListener) this);
up.addListener(new Upload.ProgressListener() {
@Override
public void updateProgress(long readBytes, long contentLenght) {
pi.setValue(new Float(readBytes / (float) contentLenght));
refreshMemUsage();
transferred.setValue("Transferred " + readBytes + " of "
+ contentLenght);
}
});
final Button b = new Button("Update status",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
readState();
}
});
final Button c = new Button("Update status with gc",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
gc();
}
});
main.addComponent(up);
l = new Label("Idle");
main.addComponent(l);
pi.setVisible(false);
pi.setPollingInterval(300);
main.addComponent(pi);
main.addComponent(transferred);
memoryStatus = new Label();
main.addComponent(memoryStatus);
statusLayout.setMargin(true);
status.setVisible(false);
main.addComponent(status);