Package com.vaadin.data.util.sqlcontainer

Examples of com.vaadin.data.util.sqlcontainer.SQLContainer


            generateTestData(connectionPool);

            TableQuery query = new TableQuery("people", connectionPool,
                    new DefaultSQLGenerator());

            SQLContainer container = new LimitedSQLContainer(query);

            final VerticalLayout rootLayout = new VerticalLayout();

            final Table table = new Table();
            table.setContainerDataSource(container);
View Full Code Here


    private void initContainers() {
        try {
            TableQuery q1 = new TableQuery(TABLENAME, connectionPool);
            q1.setVersionColumn("id");
            testContainer = new SQLContainer(q1);

            TableQuery q2 = new TableQuery(LARGE_TABLENAME, connectionPool);
            q2.setVersionColumn("id");
            largeContainer = new SQLContainer(q2);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

            createTestTable(connectionPool);
            insertTestData(connectionPool);

            TableQuery q = new TableQuery("MYTABLE2", connectionPool);
            q.setVersionColumn("VERSION");
            SQLContainer myContainer = new SQLContainer(q);
            // Uncommenting these works around the issue
            // myContainer.addOrderBy(new OrderBy("PFX", true));
            // myContainer.addOrderBy(new OrderBy("NUMERO", true));
            myContainer.removeAllContainerFilters();
            myContainer.addContainerFilter(new Equal("PFX", "C"));

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

            final ComboBox myCombo = new ComboBox("MyCaption");
View Full Code Here

                try {
                    int cents = 100;
                    for (int cent = 0; cent < cents; cent++) {
                        TableQuery q = new TableQuery("AUTHOR", pool);
                        q.setVersionColumn("ID");
                        SQLContainer c = new SQLContainer(q);
                        for (int i = 0; i < 100; i++) {
                            Object id = c.addItem();
                            c.getContainerProperty(id, "FIRST_NAMES").setValue(
                                    getRandonName());
                            c.getContainerProperty(id, "LAST_NAME").setValue(
                                    getRandonName());
                        }
                        c.commit();
                        getContext().lock();
                        try {
                            proggress
                                    .setValue(new Float((1.0f * cent) / cents));
                            proggress.setCaption("" + 100 * cent
 
View Full Code Here

    @Test(expected = IllegalStateException.class)
    public void storeRow_noDelegateNoTransactionActive_shouldFail()
            throws SQLException {
        FreeformQuery query = new FreeformQuery("SELECT * FROM people",
                Arrays.asList("ID"), connectionPool);
        query.storeRow(new RowItem(new SQLContainer(query), new RowId(
                new Object[] { 1 }), null));
    }
View Full Code Here

    @Test(expected = UnsupportedOperationException.class)
    public void storeRow_noDelegate_shouldFail() throws SQLException {
        FreeformQuery query = new FreeformQuery("SELECT * FROM people",
                Arrays.asList("ID"), connectionPool);
        SQLContainer container = EasyMock.createNiceMock(SQLContainer.class);
        EasyMock.replay(container);
        query.beginTransaction();
        query.storeRow(new RowItem(container, new RowId(new Object[] { 1 }),
                null));
        query.commit();
View Full Code Here

    @Test(expected = UnsupportedOperationException.class)
    public void removeRow_noDelegate_shouldFail() throws SQLException {
        FreeformQuery query = new FreeformQuery("SELECT * FROM people",
                Arrays.asList("ID"), connectionPool);
        SQLContainer container = EasyMock.createNiceMock(SQLContainer.class);
        EasyMock.replay(container);
        query.beginTransaction();
        query.removeRow(new RowItem(container, new RowId(new Object[] { 1 }),
                null));
        query.commit();
View Full Code Here

        FreeformQueryDelegate delegate = EasyMock
                .createMock(FreeformQueryDelegate.class);
        EasyMock.expect(
                delegate.storeRow(EasyMock.isA(Connection.class),
                        EasyMock.isA(RowItem.class))).andReturn(1);
        SQLContainer container = EasyMock.createNiceMock(SQLContainer.class);
        EasyMock.replay(delegate, container);
        query.setDelegate(delegate);

        query.beginTransaction();
        RowItem row = new RowItem(container, new RowId(new Object[] { 1 }),
View Full Code Here

                .createMock(FreeformQueryDelegate.class);
        EasyMock.expect(
                delegate.storeRow(EasyMock.isA(Connection.class),
                        EasyMock.isA(RowItem.class))).andThrow(
                new UnsupportedOperationException());
        SQLContainer container = EasyMock.createNiceMock(SQLContainer.class);
        EasyMock.replay(delegate, container);
        query.setDelegate(delegate);

        query.beginTransaction();
        RowItem row = new RowItem(container, new RowId(new Object[] { 1 }),
View Full Code Here

        FreeformQueryDelegate delegate = EasyMock
                .createMock(FreeformQueryDelegate.class);
        EasyMock.expect(
                delegate.removeRow(EasyMock.isA(Connection.class),
                        EasyMock.isA(RowItem.class))).andReturn(true);
        SQLContainer container = EasyMock.createNiceMock(SQLContainer.class);
        EasyMock.replay(delegate, container);
        query.setDelegate(delegate);

        query.beginTransaction();
        RowItem row = new RowItem(container, new RowId(new Object[] { 1 }),
View Full Code Here

TOP

Related Classes of com.vaadin.data.util.sqlcontainer.SQLContainer

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.