Last active
March 1, 2017 10:51
-
-
Save johannest/293d13d37cdf1471fffb2d3a614c47ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io._ | |
import java.util | |
import javax.servlet.annotation.WebServlet | |
import com.vaadin.annotations.{Push, Theme, VaadinServletConfiguration} | |
import com.vaadin.server.StreamResource.StreamSource | |
import com.vaadin.server.{FileDownloader, StreamResource, VaadinRequest, VaadinServlet} | |
import com.vaadin.ui.Button.ClickEvent | |
import com.vaadin.ui.{Label, UI, TabSheet, Upload} | |
import com.vaadin.ui.Upload.{Receiver, SucceededEvent, FinishedEvent, SucceededListener} | |
@Theme("mytheme") object MyUI { | |
@WebServlet(urlPatterns = Array("/*"), name = "MyUIServlet", asyncSupported = true) | |
@VaadinServletConfiguration(ui = classOf[MyUI], productionMode = false) class MyUIServlet extends VaadinServlet { | |
override def servletInitialized() = { | |
} | |
} | |
} | |
@Push | |
@Theme("mytheme") | |
class MyUI extends UI { | |
protected def init(vaadinRequest: VaadinRequest) { | |
val t = new TabSheet | |
val os = new ByteArrayOutputStream() | |
val upload = new Upload | |
upload.setReceiver((s: String, s1: String) => { | |
os | |
}) | |
upload.addFinishedListener((event: FinishedEvent) => { | |
//t.setSelectedTab(1) | |
}) | |
upload.addSucceededListener((event: SucceededEvent) => { | |
t.setSelectedTab(1) | |
}) | |
t.addComponent(upload) | |
t.addComponent(new Label("Second tab")) | |
setContent(t) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment