Package com.log4jviewer.filters

Examples of com.log4jviewer.filters.FilterModel


        selectedFilter.addItem(filterItemModel);
        return filterItemModel;
    }

    public void removeFilterItem(final int filterItemIndex) {
        FilterModel selectedFilter = filters.get(selectedFilterIndex);
        selectedFilter.removeItem(filterItemIndex);
    }
View Full Code Here


            @Override
            public void handleEvent(final Event event) {
                if (!tableViewer.getSelection().isEmpty()) {
                    TableItem eventItem = (TableItem) event.item;

                    FilterModel filterModel = (FilterModel) eventItem.getData();
                    if (isFilterActive(filterModel)) {
                        event.detail |= SWT.SELECTED;
                    }
                }
            }
View Full Code Here

        TableViewerColumn nameColumn = createSingleColumn(tableViewer, nameColumnTitle,
                nameColumnWidth);
        nameColumn.setLabelProvider(new ColumnLabelProvider() {
            @Override
            public String getText(final Object element) {
                FilterModel filterModel = (FilterModel) element;
                String filterName = filterModel.getFilterName();
                logger.debug("New filter name: {}", filterName);
                return filterName;
            }
        });
        nameColumn.setEditingSupport(new FilterNameCellEditor(tableViewer));

        final String descriptionColumnTitle = "Description";
        final int descriptionColumnWidth = 300;
        TableViewerColumn desriptionColumn = createSingleColumn(tableViewer,
                descriptionColumnTitle,
                descriptionColumnWidth);
        desriptionColumn.setLabelProvider(new ColumnLabelProvider() {
            @Override
            public String getText(final Object element) {
                FilterModel filterModel = (FilterModel) element;
                String filterDescription = filterModel.getFilterDescr();
                logger.debug("Filter description: {}", filterDescription);
                return filterDescription;
            }
        });
        desriptionColumn.setEditingSupport(new FilterDescriptionCellEditor(tableViewer));
View Full Code Here

            filterTable.setSelection(activeFilterIndex);
        }
    }

    private void doAddNewFilterButtonAction() {
        FilterModel filterModel = filterContentProvider.createFilter();
        tableViewer.add(filterModel);
    }
View Full Code Here

        when(filterItemMock.getFieldType()).thenReturn(FilterItemModel.FieldType.LEVEL);
        when(filterItemMock.isInclude()).thenReturn(true);
        when(filterItemMock.getPattern()).thenReturn("INFO");
        when(filterItemMock.isEnabled()).thenReturn(true);

        FilterModel filterModel = new FilterModel();
        filterModel.addItem(filterItemMock);
        return filterModel;
    }
View Full Code Here

        Assert.assertEquals(logMocks.get(5), logList.getFilteredLog(5));
    }

    @Test
    public void addLogWithFilterTest() {
        FilterModel filterModel = createFilterMock();
        LogFilterEngine logFilterEngine = new LogFilterEngine();
        logFilterEngine.setFilter(filterModel);
        int logBufferSize = 6;
        LogList logList = new LogList(logFilterEngine, logBufferSize);
View Full Code Here

        Assert.assertEquals(logMocks.get(4), logList.getFilteredLog(1));
    }

    @Test
    public void logBufferValidatorTest() {
        FilterModel filterModel = createFilterMock();
        LogFilterEngine logFilterEngine = new LogFilterEngine();
        logFilterEngine.setFilter(filterModel);
        int logBufferSize = 1;
        LogList logList = new LogList(logFilterEngine, logBufferSize);
View Full Code Here

    private boolean saveFilterSettingsAndNotifyObservers() {
        boolean isSuccessfulySaved = true;

        try {
            FilterModel activeFilter = filterContentProvider.getActiveFilter();
            notifyListeners(this, getFilterCopy(activeFilter));

            String filtersConfigFilePath = filterContentProvider.getAbsoluteFiltersFilePath();
            List<FilterModel> filterModels = filterContentProvider.getFilters();
View Full Code Here

        ((FilterSettings) filterSettings).setActiveFilterSelection();
        filterSettings.getTableViewer().getTable().notifyListeners(SWT.Selection, new Event());
    }

    private FilterModel getFilterCopy(final FilterModel filter) {
        FilterModel filterCopy = new FilterModel();
        filterCopy.setFilterName(filter.getFilterName());
        filterCopy.setFilterDescr(filter.getFilterDescr());

        for (int i = 0; i < filter.getItemsCount(); i++) {
            if (filter.getItem(i).isEnabled()) {
                filterCopy.addItem(filter.getItem(i));
            }
        }
        return filterCopy;
    }
View Full Code Here

    public List<FilterModel> getFilters() {
        return filters;
    }

    public FilterModel getActiveFilter() {
        FilterModel filterModel;

        if ((filters.size() == 0) || (activeFilterIndex < 0)) {
            filterModel = new FilterModel();
        } else {
            filterModel = filters.get(activeFilterIndex);
        }
        return filterModel;
    }
View Full Code Here

TOP

Related Classes of com.log4jviewer.filters.FilterModel

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.