Package com.vaadin.server

Examples of com.vaadin.server.VaadinSession


     *
     * @throws Exception
     *             if thrown
     */
    public void testWithDefaultClassLoader() throws Exception {
        VaadinSession application = createStubApplication();
        application.setConfiguration(createConfigurationMock());

        DefaultUIProvider uiProvider = new DefaultUIProvider();
        Class<? extends UI> uiClass = uiProvider
                .getUIClass(new UIClassSelectionEvent(
                        createRequestMock(getClass().getClassLoader())));
View Full Code Here


                "dummyInt");
        serializeAndDeserialize(mp);
    }

    public void testVaadinSession() throws Exception {
        VaadinSession session = new VaadinSession(null);

        session = serializeAndDeserialize(session);

        assertNotNull(
                "Pending access queue was not recreated after deserialization",
                session.getPendingAccessQueue());
    }
View Full Code Here

        sizeLabel.setValue("Container size: " + currentSize);
    }

    public void triggerItemSetChange() {
        log("*** triggerItemSetChange(): scheduling item set change event");
        final VaadinSession session = VaadinSession.getCurrent();
        new Thread() {
            @Override
            public void run() {
                ExpandingContainer.this.invoke(session, new Runnable() {
                    @Override
View Full Code Here

        }.start();
    }

    private void invoke(VaadinSession session, Runnable action) {
        session.lock();
        VaadinSession previousSession = VaadinSession.getCurrent();
        VaadinSession.setCurrent(session);
        try {
            action.run();
        } finally {
            session.unlock();
View Full Code Here

import com.vaadin.ui.VerticalLayout;

public class TestRemoveFromParentLocking {

    private static VerticalLayout createTestComponent() {
        VaadinSession session = new VaadinSession(null) {
            private final ReentrantLock lock = new ReentrantLock();

            @Override
            public Lock getLockInstance() {
                return lock;
            }
        };

        session.getLockInstance().lock();

        UI ui = new UI() {
            @Override
            protected void init(VaadinRequest request) {
            }
        };
        ui.setSession(session);

        VerticalLayout layout = new VerticalLayout();
        ui.setContent(layout);

        session.getLockInstance().unlock();
        return layout;
    }
View Full Code Here

        rent = rent.scaleByPowerOfTen(-2);
        paulaBean.setRent(rent);
    }

    public void testFloatConversion() {
        VaadinSession sess = new AlwaysLockedVaadinSession(null);
        VaadinSession.setCurrent(sess);

        TextField tf = new TextField();
        tf.setLocale(new Locale("en", "US"));
        tf.setPropertyDataSource(new MethodProperty<Integer>(new FloatBean(12f,
View Full Code Here

        assertEquals(24f, tf.getConvertedValue());
        assertEquals(24f, tf.getPropertyDataSource().getValue());
    }

    public void testLongConversion() {
        VaadinSession sess = new AlwaysLockedVaadinSession(null);
        VaadinSession.setCurrent(sess);

        TextField tf = new TextField();
        tf.setLocale(new Locale("en", "US"));
        tf.setPropertyDataSource(new MethodProperty<Integer>(new LongBean(12,
View Full Code Here

        assertEquals(1982739187239L, tf.getConvertedValue());
        assertEquals(1982739187239L, tf.getPropertyDataSource().getValue());
    }

    public void testDefaultNumberConversion() {
        VaadinSession app = new AlwaysLockedVaadinSession(null);
        VaadinSession.setCurrent(app);
        TextField tf = new TextField();
        tf.setLocale(new Locale("en", "US"));
        tf.setPropertyDataSource(new MethodProperty<Integer>(paulaBean,
                "salary"));
View Full Code Here

        }

    }

    public void testNumberDoubleConverterChange() {
        final VaadinSession a = new AlwaysLockedVaadinSession(null);
        VaadinSession.setCurrent(a);
        TextField tf = new TextField() {
            @Override
            public VaadinSession getSession() {
                return a;
View Full Code Here

                        if (getPushConfiguration().getPushMode() != PushMode.AUTOMATIC) {
                            log("Can only test with automatic push enabled");
                            return;
                        }

                        final VaadinSession session = getSession();
                        new Thread() {
                            @Override
                            public void run() {
                                // Pretend this isn't a Vaadin thread
                                CurrentInstance.clearAll();

                                /*
                                 * Get explicit lock to ensure the (implicit)
                                 * push does not happen during normal request
                                 * handling.
                                 */
                                session.lock();
                                try {
                                    access(new Runnable() {
                                        @Override
                                        public void run() {
                                            checkCurrentInstancesBeforeResponse = true;
                                            // Trigger beforeClientResponse
                                            markAsDirty();
                                        }
                                    });
                                } finally {
                                    session.unlock();
                                }
                            }
                        }.start();
                    }
                }));
View Full Code Here

TOP

Related Classes of com.vaadin.server.VaadinSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.