Package org.eclipse.nebula.widgets.nattable.data.convert

Examples of org.eclipse.nebula.widgets.nattable.data.convert.DefaultDateDisplayConverter


                EditConfigAttributes.CELL_EDITABLE_RULE,
                IEditableRule.ALWAYS_EDITABLE);

        configRegistry.registerConfigAttribute(
                CellConfigAttributes.DISPLAY_CONVERTER,
                new DefaultDateDisplayConverter(), DisplayMode.NORMAL,
                CrossValidationGridExample.DATE_LABEL);
        configRegistry.registerConfigAttribute(
                CellConfigAttributes.DISPLAY_CONVERTER,
                new DefaultDateDisplayConverter(), DisplayMode.EDIT,
                CrossValidationGridExample.DATE_LABEL);

        // configure the validation error style
        IStyle validationErrorStyle = new Style();
        validationErrorStyle.setAttributeValue(
View Full Code Here


                EditConfigAttributes.CELL_EDITABLE_RULE,
                IEditableRule.ALWAYS_EDITABLE);

        configRegistry.registerConfigAttribute(
                CellConfigAttributes.DISPLAY_CONVERTER,
                new DefaultDateDisplayConverter(), DisplayMode.NORMAL,
                _4451_CrossValidationGridExample.DATE_LABEL);
        configRegistry.registerConfigAttribute(
                CellConfigAttributes.DISPLAY_CONVERTER,
                new DefaultDateDisplayConverter(), DisplayMode.EDIT,
                _4451_CrossValidationGridExample.DATE_LABEL);

        // configure the validation error style
        IStyle validationErrorStyle = new Style();
        validationErrorStyle.setAttributeValue(
View Full Code Here

    private static final TimeZone utc = TimeZone.getTimeZone("UTC");
    private static final Date FROZEN_DATE = new Date(0);

    @Test
    public void happyPath() throws Exception {
        final DefaultDateDisplayConverter converter = new DefaultDateDisplayConverter(
                "yyyy.MM.dd HH:mm:ss", utc);
        assertEquals("1970.01.01 00:00:00",
                converter.canonicalToDisplayValue(FROZEN_DATE));
        assertEquals(FROZEN_DATE,
                converter.displayToCanonicalValue("1970.01.01 00:00:00"));
    }
View Full Code Here

    @Test
    public void defaultDisplayFormat() throws Exception {
        final SimpleDateFormat sdf = new SimpleDateFormat();
        sdf.setTimeZone(utc);

        final DefaultDateDisplayConverter converter = new DefaultDateDisplayConverter(
                utc);
        assertEquals(sdf.format(FROZEN_DATE),
                converter.canonicalToDisplayValue(FROZEN_DATE));
        assertEquals(FROZEN_DATE,
                converter.displayToCanonicalValue(sdf.format(FROZEN_DATE)));
    }
View Full Code Here

                converter.displayToCanonicalValue(sdf.format(FROZEN_DATE)));
    }

    @Test
    public void invalidDataType() throws Exception {
        final DefaultDateDisplayConverter converter = new DefaultDateDisplayConverter();

        System.err.println("** THE FOLLOWING STACK TRACE IS EXPECTED **");
        assertEquals("XXX", converter.canonicalToDisplayValue("XXX"));

        try {
            converter.displayToCanonicalValue("AAA");
            fail("ConversionFailedException should have been throwed");
        } catch (ConversionFailedException e) {}

    }
View Full Code Here

            // using a DateCellEditor also needs a Date conversion to work
            // correctly
            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.DISPLAY_CONVERTER,
                    new DefaultDateDisplayConverter(pattern),
                    DisplayMode.NORMAL, _447_EditorExample.COLUMN_NINE_LABEL);
        }
View Full Code Here

            // using a DateCellEditor also needs a Date conversion to work
            // correctly
            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.DISPLAY_CONVERTER,
                    new DefaultDateDisplayConverter(pattern),
                    DisplayMode.NORMAL,
                    _4471_EditorTraversalExample.COLUMN_THREE_LABEL);
        }
View Full Code Here

                        new CheckBoxPainter(), DisplayMode.NORMAL,
                        MARRIED_LABEL);

                configRegistry.registerConfigAttribute(
                        CellConfigAttributes.DISPLAY_CONVERTER,
                        new DefaultDateDisplayConverter("MM/dd/yyyy"),
                        DisplayMode.NORMAL, DATE_LABEL);

                // exchange the painter that is used to render the tree
                // structure
                // the following will use triangles instead of plus/minus icons
View Full Code Here

                        new CheckBoxPainter(), DisplayMode.NORMAL,
                        ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 3);

                configRegistry.registerConfigAttribute(
                        CellConfigAttributes.DISPLAY_CONVERTER,
                        new DefaultDateDisplayConverter("MM/dd/yyyy"),
                        DisplayMode.NORMAL,
                        ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 4);

            }
        });
View Full Code Here

            // using a DateCellEditor also needs a Date conversion to work
            // correctly
            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.DISPLAY_CONVERTER,
                    new DefaultDateDisplayConverter(pattern),
                    DisplayMode.NORMAL,
                    COLUMN_FIVE_LABEL);
        }
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.data.convert.DefaultDateDisplayConverter

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.