List of usage examples for com.vaadin.ui Upload setStyleName
@Override public void setStyleName(String style)
From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.InitialScreenViewImpl.java
License:Open Source License
public void createImportButton() { importButton = new VerticalLayout(); importButton.setWidth(150, com.vaadin.terminal.Sizeable.UNITS_PIXELS); importButton.setHeight(80, com.vaadin.terminal.Sizeable.UNITS_PIXELS); importButton.setStyleName("topBarButtonContainer"); UploadReceiver receiver = new UploadReceiver(eventBus); Upload upload = new Upload(null, receiver); upload.setButtonCaption(""); upload.setImmediate(true);/*from www . j a va2s . co m*/ upload.addListener(receiver); upload.setStyleName("importButton"); upload.setWidth(30, com.vaadin.terminal.Sizeable.UNITS_PIXELS); upload.setHeight(30, com.vaadin.terminal.Sizeable.UNITS_PIXELS); Label gap = new Label(); gap.setHeight("5px"); Label label = new Label("Projekte"); label.setStyleName("topBarButtonLabel"); label.setSizeUndefined(); Label label2 = new Label("importieren"); label2.setStyleName("topBarButtonLabel"); label2.setSizeUndefined(); VerticalLayout labelLayout = new VerticalLayout(); labelLayout.setHeight(45, com.vaadin.terminal.Sizeable.UNITS_PIXELS); labelLayout.setWidth(100, UNITS_PERCENTAGE); importButton.addComponent(upload); labelLayout.addComponent(label); labelLayout.addComponent(label2); importButton.addComponent(gap); importButton.addComponent(labelLayout); importButton.setComponentAlignment(upload, Alignment.TOP_CENTER); labelLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); labelLayout.setComponentAlignment(label2, Alignment.MIDDLE_CENTER); }
From source file:org.hip.vif.web.util.UploadComponent.java
License:Open Source License
private Upload createUpload(final IBibliographyTask inTask) { final Upload outUpload = new Upload(); outUpload.setWidthUndefined();//from ww w . j a va 2 s. c o m outUpload.setReceiver(new Upload.Receiver() { @Override public OutputStream receiveUpload(final String inFilename, // NOPMD final String inMimeType) { return createStream(inFilename); } }); final String lCaption = Activator.getMessages().getMessage("ui.upload.button.lbl"); //$NON-NLS-1$ outUpload.setButtonCaption(lCaption); outUpload.setImmediate(true); outUpload.setStyleName("vif-upload"); //$NON-NLS-1$ outUpload.addStartedListener(new Upload.StartedListener() { @Override public void uploadStarted(final StartedEvent inEvent) { // NOPMD fileInfo = new FileInfo(inEvent.getFilename(), inEvent.getMIMEType()); tempUpload = null; // NOPMD uploadFinished = false; outUpload.setVisible(false); if (hasDownloads) { dialog.setVisible(true); // FF } } }); outUpload.addFinishedListener(new Upload.FinishedListener() { @Override public void uploadFinished(final FinishedEvent inEvent) { // NOPMD uploadFinished = true; outUpload.setVisible(true); } }); outUpload.addSucceededListener(new Upload.SucceededListener() { @Override public void uploadSucceeded(final SucceededEvent inEvent) { // NOPMD if (!hasDownloads) { handleUpload(inTask, false); } } }); outUpload.addFailedListener(new Upload.FailedListener() { @Override public void uploadFailed(final FailedEvent inEvent) { // NOPMD handleDeleteTemp(); } }); return outUpload; }