@Override
protected VaadinServiceSession createVaadinSession(VaadinRequest request)
throws ServiceException {
- return new VaadinPortletSession();
+ return new VaadinPortletSession(this);
}
@Override
private final Map<String, String> sharedParameterActionNameMap = new HashMap<String, String>();
private final Map<String, String> sharedParameterActionValueMap = new HashMap<String, String>();
+ /**
+ * Create a portlet service session for the given portlet service
+ *
+ * @param service
+ * the portlet service to which the new session belongs
+ */
+ public VaadinPortletSession(VaadinPortletService service) {
+ super(service);
+ }
+
public PortletSession getPortletSession() {
WrappedSession wrappedSession = getSession();
PortletSession session = ((WrappedPortletSession) wrappedSession)
private VaadinService service;
+ /**
+ * Create a new service session tied to a Vaadin service
+ *
+ * @param service
+ * the Vaadin service for the new session
+ */
+ public VaadinServiceSession(VaadinService service) {
+ this.service = service;
+ }
+
/**
* @see javax.servlet.http.HttpSessionBindingListener#valueBound(HttpSessionBindingEvent)
*/
return Collections.unmodifiableList(uiProviders);
}
+ public VaadinService getService() {
+ return service;
+ }
+
}
@Override
protected VaadinServiceSession createVaadinSession(VaadinRequest request)
throws ServiceException {
- return new VaadinServletSession();
+ return new VaadinServletSession(this);
}
@Override
private transient boolean reinitializingSession = false;
+ /**
+ * Create a servlet service session for the given servlet service
+ *
+ * @param service
+ * the servlet service to which the new session belongs
+ */
+ public VaadinServletSession(VaadinServletService service) {
+ super(service);
+ }
+
@Override
public void valueUnbound(HttpSessionBindingEvent event) {
if (!reinitializingSession) {
public void testApplicationConverterFactoryInBackgroundThread() {
VaadinServiceSession.setCurrent(null);
- final VaadinServiceSession appWithCustomIntegerConverter = new VaadinServiceSession();
+ final VaadinServiceSession appWithCustomIntegerConverter = new VaadinServiceSession(
+ null);
appWithCustomIntegerConverter
.setConverterFactory(new ConverterFactory42());
}
public void testApplicationConverterFactoryForDetachedComponent() {
- final VaadinServiceSession appWithCustomIntegerConverter = new VaadinServiceSession();
+ final VaadinServiceSession appWithCustomIntegerConverter = new VaadinServiceSession(
+ null);
appWithCustomIntegerConverter
.setConverterFactory(new ConverterFactory42());
VaadinServiceSession.setCurrent(appWithCustomIntegerConverter);
}
public void testApplicationConverterFactoryForDifferentThanCurrentApplication() {
- final VaadinServiceSession fieldAppWithCustomIntegerConverter = new VaadinServiceSession();
+ final VaadinServiceSession fieldAppWithCustomIntegerConverter = new VaadinServiceSession(
+ null);
fieldAppWithCustomIntegerConverter
.setConverterFactory(new ConverterFactory42());
- VaadinServiceSession.setCurrent(new VaadinServiceSession());
+ VaadinServiceSession.setCurrent(new VaadinServiceSession(null));
TextField tf = new TextField("", "123") {
@Override
@Override
protected void setUp() throws Exception {
- final VaadinServiceSession application = new VaadinServiceSession();
+ final VaadinServiceSession application = new VaadinServiceSession(null);
final UI uI = new UI() {
@Override
protected void init(VaadinRequest request) {
}
private CommunicationManager createCommunicationManager() {
- return new CommunicationManager(new VaadinServiceSession());
+ return new CommunicationManager(new VaadinServiceSession(null));
}
}
}
public void testNumberDoubleConverterChange() {
- final VaadinServiceSession a = new VaadinServiceSession();
+ final VaadinServiceSession a = new VaadinServiceSession(null);
VaadinServiceSession.setCurrent(a);
TextField tf = new TextField() {
@Override
}
public void testDefaultNumberConversion() {
- VaadinServiceSession app = new VaadinServiceSession();
+ VaadinServiceSession app = new VaadinServiceSession(null);
VaadinServiceSession.setCurrent(app);
TextField tf = new TextField();
tf.setLocale(new Locale("en", "US"));
int numReadOnlyChanges = 0;
AbstractField field = new AbstractField() {
- final private VaadinServiceSession application = new VaadinServiceSession() {
-
- };
+ final private VaadinServiceSession application = new VaadinServiceSession(
+ null);
private UI uI = new UI() {
@Override
}
public void testIntegerDataSource() {
- VaadinServiceSession.setCurrent(new VaadinServiceSession());
+ VaadinServiceSession.setCurrent(new VaadinServiceSession(null));
Label l = new Label("Foo");
Property ds = new MethodProperty<Integer>(Person.createTestPerson1(),
"age");
}
private VaadinServiceSession createStubApplication() {
- return new VaadinServiceSession() {
+ return new VaadinServiceSession(null) {
@Override
public DeploymentConfiguration getConfiguration() {
return createConfigurationMock();
@Test
public void addSubWindow() {
- VaadinServiceSession.setCurrent(new VaadinServiceSession());
+ VaadinServiceSession.setCurrent(new VaadinServiceSession(null));
TestApp app = new TestApp();
app.init();
Window subWindow = new Window("Sub window");
public class AttachDetachWindow {
- private VaadinServiceSession testApp = new VaadinServiceSession();
+ private VaadinServiceSession testApp = new VaadinServiceSession(null);
private interface TestContainer {
public boolean attachCalled();
@Before
public void setup() {
- vaadinSession = new VaadinServiceSession();
+ vaadinSession = new VaadinServiceSession(null);
VaadinServiceSession.setCurrent(vaadinSession);
label = new Label();