Package org.eclipse.nebula.widgets.nattable.filterrow

Examples of org.eclipse.nebula.widgets.nattable.filterrow.ParseResult


        return parseResults;
    }

    private static void parse(String string, TextMatchingMode textMatchingMode,
            List<ParseResult> parseResults) {
        ParseResult parseResult;

        switch (textMatchingMode) {
            case REGULAR_EXPRESSION:
                parseResult = parseExpression(string);
                break;
View Full Code Here


     * @param string
     *            entered by the user in the filter row text box
     */
    public static ParseResult parseExpression(String string) {
        Scanner scanner = new Scanner(string.trim());
        ParseResult parseResult = new ParseResult();

        Pattern p = Pattern.compile("<>|([>|<]?=?)"); //$NON-NLS-1$
        String opToken = scanner.findWithinHorizon(p, 2);
        if (isNotEmpty(opToken)) {
            parseResult.setMatchType(MatchType.parse(opToken));
            while (scanner.hasNext()) {
                parseResult.setValueToMatch(scanner.next());
            }
        } else {
            parseResult.setValueToMatch(string);
        }
        scanner.close();
        return parseResult;
    }
View Full Code Here

        scanner.close();
        return parseResult;
    }

    public static ParseResult parseLiteral(String string) {
        ParseResult parseResult = new ParseResult();
        parseResult.setMatchType(MatchType.NONE);
        parseResult.setValueToMatch(string);
        return parseResult;
    }
View Full Code Here

        assertEquals("100", result.getValueToMatch());
    }

    @Test
    public void parseEqualSymbolWithSpace() throws Exception {
        ParseResult result = FilterRowUtils.parse("= 100", NULL_DELIMITER,
                TextMatchingMode.REGULAR_EXPRESSION).get(0);

        assertEquals(MatchType.EQUAL, result.getMatchOperation());
        assertEquals("100", result.getValueToMatch());
    }
View Full Code Here

        assertEquals("100", result.getValueToMatch());
    }

    @Test
    public void parseNotEqualSymbol() throws Exception {
        ParseResult result = FilterRowUtils.parse("<>100", NULL_DELIMITER,
                TextMatchingMode.REGULAR_EXPRESSION).get(0);

        assertEquals(MatchType.NOT_EQUAL, result.getMatchOperation());
        assertEquals("100", result.getValueToMatch());
    }
View Full Code Here

        assertEquals("100", result.getValueToMatch());
    }

    @Test
    public void parseNotEqualSymbolWithSpace() throws Exception {
        ParseResult result = FilterRowUtils.parse(" <> 100", NULL_DELIMITER,
                TextMatchingMode.REGULAR_EXPRESSION).get(0);

        assertEquals(MatchType.NOT_EQUAL, result.getMatchOperation());
        assertEquals("100", result.getValueToMatch());
    }
View Full Code Here

        assertEquals("100", result.getValueToMatch());
    }

    @Test
    public void parseGreaterThanOrEqualSymbol() throws Exception {
        ParseResult result = FilterRowUtils.parse(">= 100", NULL_DELIMITER,
                TextMatchingMode.REGULAR_EXPRESSION).get(0);

        assertEquals(MatchType.GREATER_THAN_OR_EQUAL,
                result.getMatchOperation());
        assertEquals("100", result.getValueToMatch());
    }
View Full Code Here

        assertEquals("100", result.getValueToMatch());
    }

    @Test
    public void parseGreaterThanOrEqualSymbolWithSpace() throws Exception {
        ParseResult result = FilterRowUtils.parse(" >=  100", NULL_DELIMITER,
                TextMatchingMode.REGULAR_EXPRESSION).get(0);

        assertEquals(MatchType.GREATER_THAN_OR_EQUAL,
                result.getMatchOperation());
        assertEquals("100", result.getValueToMatch());
    }
View Full Code Here

        assertEquals("100", result.getValueToMatch());
    }

    @Test
    public void parseLessThanOrEqualSymbol() throws Exception {
        ParseResult result = FilterRowUtils.parse("<=100", NULL_DELIMITER,
                TextMatchingMode.REGULAR_EXPRESSION).get(0);

        assertEquals(MatchType.LESS_THAN_OR_EQUAL, result.getMatchOperation());
        assertEquals("100", result.getValueToMatch());
    }
View Full Code Here

        assertEquals("100", result.getValueToMatch());
    }

    @Test
    public void parseLessThanOrEqualSymbolWithSpace() throws Exception {
        ParseResult result = FilterRowUtils.parse("<= 100", NULL_DELIMITER,
                TextMatchingMode.REGULAR_EXPRESSION).get(0);

        assertEquals(MatchType.LESS_THAN_OR_EQUAL, result.getMatchOperation());
        assertEquals("100", result.getValueToMatch());
    }
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.filterrow.ParseResult

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.