Examples of ConfigRegistry


Examples of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry

     */
    public Control createExampleControl(Composite parent) {
        eventList = GlazedLists.eventList(RowDataListFixture
                .getList(defaultDatasetSize));

        ConfigRegistry configRegistry = new ConfigRegistry();
        GlazedListsGridLayer<RowDataFixture> glazedListsGridLayer = new GlazedListsGridLayer<RowDataFixture>(
                eventList, RowDataListFixture.getPropertyNames(),
                RowDataListFixture.getPropertyToLabelMap(), configRegistry);

        nattable = new NatTable(parent, glazedListsGridLayer, false);
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry

        Composite buttonPanel = new Composite(panel, SWT.NONE);
        buttonPanel.setLayout(new GridLayout());
        GridDataFactory.fillDefaults().grab(true, true).applyTo(buttonPanel);

        ConfigRegistry configRegistry = new ConfigRegistry();

        // create the body layer stack
        IDataProvider bodyDataProvider = new ListDataProvider<Map<String, String>>(
                values, new MyColumnPropertyAccessor());
        final DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry

        propertyToLabelMap.put("columnFiveNumber", "Percentage");

        valuesToShow.add(createNumberValues());
        valuesToShow.add(createNumberValues());

        ConfigRegistry configRegistry = new ConfigRegistry();

        CalculatingGridLayer gridLayer = new CalculatingGridLayer(valuesToShow,
                configRegistry, propertyNames, propertyToLabelMap);
        DataLayer bodyDataLayer = gridLayer.getBodyDataLayer();
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry

        // stack does not
        // contain the necessary labels at the time the comparator is searched
        columnHeaderDataLayer
                .setConfigLabelAccumulator(new ColumnLabelAccumulator());

        ConfigRegistry configRegistry = new ConfigRegistry();

        // add the SortHeaderLayer to the column header layer stack
        // as we use GlazedLists, we use the GlazedListsSortModel which
        // delegates
        // the sorting to the SortedList
        final SortHeaderLayer<Person> sortHeaderLayer = new SortHeaderLayer<Person>(
                columnHeaderLayer, new GlazedListsSortModel<Person>(sortedList,
                        accessor, configRegistry, columnHeaderDataLayer));

        // build the row header layer
        IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
                bodyDataProvider);
        DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
                rowHeaderDataProvider);
        ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
                viewportLayer, selectionLayer);

        // build the corner layer
        IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
                columnHeaderDataProvider, rowHeaderDataProvider);
        DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
        ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
                sortHeaderLayer);

        // build the grid layer
        GridLayer gridLayer = new GridLayer(viewportLayer, sortHeaderLayer,
                rowHeaderLayer, cornerLayer);

        // turn the auto configuration off as we want to add our header menu
        // configuration
        NatTable natTable = new NatTable(parent, gridLayer, false);

        natTable.setConfigRegistry(configRegistry);

        // as the autoconfiguration of the NatTable is turned off, we have to
        // add the
        // DefaultNatTableStyleConfiguration manually
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
        // override the default sort configuration and change the mouse bindings
        // to sort on a single click
        natTable.addConfiguration(new SingleClickSortConfiguration());
        natTable.addConfiguration(new DebugMenuConfiguration(natTable));

        // add some custom sort configurations regarding comparators
        natTable.addConfiguration(new AbstractRegistryConfiguration() {

            @Override
            public void configureRegistry(IConfigRegistry configRegistry) {
                // Register custom comparator for last name column
                // when sorting via last name, Simpson will always win
                configRegistry.registerConfigAttribute(
                        SortConfigAttributes.SORT_COMPARATOR,
                        new Comparator<String>() {
                            @Override
                            public int compare(String o1, String o2) {

                                // check the sort order
                                boolean sortDesc = sortHeaderLayer
                                        .getSortModel().getSortDirection(1)
                                        .equals(SortDirectionEnum.DESC);
                                if ("Simpson".equals(o1)
                                        && !"Simpson".equals(o2)) {
                                    return sortDesc ? 1 : -1;
                                } else if (!"Simpson".equals(o1)
                                        && "Simpson".equals(o2)) {
                                    return sortDesc ? -1 : 1;
                                }
                                return o1.compareToIgnoreCase(o2);
                            }
                        }, DisplayMode.NORMAL,
                        ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 1);

                // Register null comparator to disable sorting for gender column
                configRegistry.registerConfigAttribute(
                        SortConfigAttributes.SORT_COMPARATOR,
                        new NullComparator(), DisplayMode.NORMAL,
                        ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 2);
            }
        });
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry

        DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
                columnHeaderDataProvider);
        ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
                viewportLayer, selectionLayer);

        ConfigRegistry configRegistry = new ConfigRegistry();
        SortHeaderLayer<Person> sortHeaderLayer = new SortHeaderLayer<Person>(
                columnHeaderLayer, new GlazedListsSortModel<Person>(sortedList,
                        accessor, configRegistry, columnHeaderDataLayer));

        ColumnGroupHeaderLayer columnGroupHeaderLayer = new ColumnGroupHeaderLayer(
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry

        DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
                columnHeaderDataProvider);
        ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
                viewportLayer, selectionLayer);

        ConfigRegistry configRegistry = new ConfigRegistry();
        SortHeaderLayer<PersonWithAddress> sortHeaderLayer = new SortHeaderLayer<PersonWithAddress>(
                columnHeaderLayer, new PersonWithAddressSortModel(data));

        // build the row header layer
        IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry

    @Before
    public void setup() {
        columnHeaderLayer = new DataLayerFixture(10, 2, 100, 50);

        configRegistry = new ConfigRegistry();
        new DefaultNatTableStyleConfiguration()
                .configureRegistry(configRegistry);
        new DefaultFilterRowConfiguration().configureRegistry(configRegistry);

        filterList = new FilterList<RowDataFixture>(
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry

     * @return {@link IConfigRegistry} used to hold the configuration bindings
     *         by Layer, DisplayMode and Config labels.
     */
    public IConfigRegistry getConfigRegistry() {
        if (this.configRegistry == null) {
            this.configRegistry = new ConfigRegistry();
            this.themeManager = new ThemeManager(this.configRegistry);
        }
        return this.configRegistry;
    }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry

    @Override
    public Control createExampleControl(Composite parent) {
        // create a new ConfigRegistry which will be needed for GlazedLists
        // handling
        ConfigRegistry configRegistry = new ConfigRegistry();

        // property names of the Person class
        String[] propertyNames = { "firstName", "lastName", "gender",
                "married", "birthday", "address.street", "address.housenumber",
                "address.postalCode", "address.city" };
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry

    @Override
    public Control createExampleControl(Composite parent) {
        // create a new ConfigRegistry which will be needed for GlazedLists
        // handling
        ConfigRegistry configRegistry = new ConfigRegistry();

        // property names of the Person class
        String[] propertyNames = { "firstName", "lastName", "gender",
                "married", "birthday", "address.street", "address.housenumber",
                "address.postalCode", "address.city" };
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.