Package com.redspr.redquerybuilder.core.client.expression

Examples of com.redspr.redquerybuilder.core.client.expression.Comparison


        cb.getSelect().updateTable(
                s.getDatabase().getMainSchema().findTableOrView("Log"));
        s.getMsgBus().fireEvent(new TableEvent()); // XXX encapsulation
        cb.fireDirty();

        Comparison c = new Comparison(s);
        cb.getSelect().addCondition(c);
        cb.fireDirty();

        ExpressionColumn left = (ExpressionColumn) c.getLeft();

        TableFilter log = cb.getSelect().getFilters().get(0);
        assertEquals("Log", log.getTable().getName());
        assertEquals("x0", log.getAlias());
        for (int i = 0; i < 2; i++) {
View Full Code Here


        cb.getSelect().updateTable(
                s.getDatabase().getMainSchema().findTableOrView("Log"));
        cb.fireDirty();

        Comparison c = new Comparison(s);

        cb.getSelect().addCondition(c);
        cb.fireDirty();

        ExpressionColumn left = (ExpressionColumn) c.getLeft();

        TableFilter log = cb.getSelect().getFilters().get(0);
        left.selectConstraintRef((ConstraintReferential) log.getTable()
                .getConstraints().get(0));
View Full Code Here

                .getConstraintByName("Rev parentfk");

        cb.getSelect().updateTable(log);
        cb.fireDirty();

        Comparison c = new Comparison(s);

        cb.getSelect().addCondition(c);
        cb.fireDirty();

        ExpressionColumn left = (ExpressionColumn) c.getLeft();

        left.selectConstraintRef(logToPerson);
        cb.fireDirty();

        assertEquals(
View Full Code Here

            + "LEFT OUTER JOIN PERSON X0 ON X0.ID = X.ID\n"
            + "LEFT OUTER JOIN Log X1 ON X1.PARENT = X0.ID\n"
            + "WHERE (X1.ID = ?)";
        assertEquals(sql1, s.getSQL(new ArrayList()));

        Comparison c = (Comparison) s.getCondition();
        s.remove(c);
        s.garbageCollectFilters();

        String sql2 = "SELECT X.ID\nFROM PERSON X";
        assertEquals(sql2, s.getSQL(new ArrayList()));
View Full Code Here

        Select s = cb.getSelect();

        cb.fireDirty();

        {
            Comparison comp = (Comparison) s.getCondition();
            Parameter right = (Parameter) comp.getRight();
            Element selectElmt = right.getElement();

            String html = "<select class='gwt-ListBox' multiple='multiple' size='2'>"
                    + "<option value='A'>A</option>"
                    + "<option value='B'>B</option>"
                    + "<option value='C'>C</option>" + "</select>";
            assertEquals(html, selectElmt);

            assertEquals("SELECT X.ID\nFROM PERSON X\nWHERE (X.CATEGORY IN (?, ?))", s.getSQL(args()));


            // change to sex
            ExpressionColumn left2 = (ExpressionColumn) comp.getLeft();
            left2.updateColumn("X", sess.getDatabase().getMainSchema()
                    .findTableOrView("PERSON").getColumn("category2"));
            cb.fireDirty();
        }

        {
            Comparison comp = (Comparison) s.getCondition();
            Parameter right = (Parameter) comp.getRight();
            Element selectElmt = right.getElement();

            String html = "<select class='gwt-ListBox' multiple='multiple' size='2'>"
                    + "<option value='X'>X</option>"
                    + "<option value='Y'>Y</option>"
                    + "<option value='Z'>Z</option>" + "</select>";
            assertEquals(html, selectElmt);

            assertEquals("SELECT X.ID\nFROM PERSON X\nWHERE (X.category2 IN ?)", s.getSQL(args()));

            // change to sex
            ExpressionColumn left2 = (ExpressionColumn) comp.getLeft();
            left2.updateColumn("X", sess.getDatabase().getMainSchema()
                    .findTableOrView("PERSON").getColumn("sex"));
            cb.fireDirty();
        }

        {
            Comparison comp = (Comparison) s.getCondition();
            Parameter right = (Parameter) comp.getRight();

            Element selectElmt = right.getElement();

            String html = "<select class='gwt-ListBox'>"
                    + "<option value='Please select...'>Please select...</option>"
View Full Code Here

        Select s = cb.getSelect();

        cb.fireDirty();

        {
            Comparison comp = (Comparison) s.getCondition();

            // change to sex
            ExpressionColumn left2 = (ExpressionColumn) comp.getLeft();
            left2.updateColumn("X", sess.getDatabase().getMainSchema()
                    .findTableOrView("LOG").getColumn("date"));


            final List<Object> args = new ArrayList<Object>();
View Full Code Here

        CommandBuilder cb = new CommandBuilder(sess, "SELECT x.id FROM Person x", null);
        RootPanel.get().add(cb);
        Select s = cb.getSelect();

        Comparison c = s.addFirstCondition();
        s.fireDirty();
        ExpressionColumn left2 = (ExpressionColumn) c.getLeft();
        left2.updateColumn("X", sess.getDatabase().getMainSchema()
                .findTableOrView("PERSON").getColumn("owner"));
        c.fireDirty();


        assertEquals("<select class='gwt-ListBox'>"
                + "<option value='Please select...'>Please select...</option>"
                + "<option value='M'>M</option>"
                + "<option value='F'>F</option>"
                + "</select>", c.getRight());
    }
View Full Code Here

        args.add("M");
        CommandBuilder cb = new CommandBuilder(sess, "SELECT x.id FROM Person x WHERE sex = ?", args);
        RootPanel.get().add(cb);
        Select s = cb.getSelect();

        Comparison c = (Comparison) s.getCondition();
        Parameter p = (Parameter) c.getRight();
        SelectEditorWidget sew = (SelectEditorWidget) p.getEditorWidget();
        assertEquals("M", sew.getValue());
    }
View Full Code Here

        s2.add(new MultiWordSuggestion("M", "M"));
        s2.add(new MultiWordSuggestion("F", "F"));

        config.getEnumerateCallback().onSuccess(new Response(s2));

        Comparison c = (Comparison) s.getCondition();
        Parameter p = (Parameter) c.getRight();
        SelectEditorWidget sew = (SelectEditorWidget) p.getEditorWidget();
        assertEquals("M", sew.getValue());
    }
View Full Code Here

        Select s = cb.getSelect();

       // cb.fireDirty();

        ConditionAndOr andOr = (ConditionAndOr) s.getCondition();
        Comparison comp = (Comparison) andOr.getLeft();
        Parameter right = (Parameter) comp.getRight();
        Element selectElmt = right.getElement();

        String html = "<input type='text' class='gwt-TextBox' value='13'>";
        assertEquals(html, selectElmt);
    }
View Full Code Here

TOP

Related Classes of com.redspr.redquerybuilder.core.client.expression.Comparison

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.