// Path: src/main/java/ru/taximaxim/pgsqlblocks/utils/Columns.java
// public enum Columns {
// 
//     PID("pid"),
//     BACKEND_TYPE("backend_type"),
//     BLOCK_CREATE_DATE("block_start_date"),
//     BLOCK_END_DATE("block_end_date"),
//     BLOCKED_COUNT("num_of_blocked_processes"),
//     APPLICATION_NAME("application"),
//     DATABASE_NAME("db_name"),
//     USER_NAME("user_name"),
//     CLIENT("client"),
//     BACKEND_START("backend_start"),
//     QUERY_START("query_start"),
//     XACT_START("xact_start"),
//     DURATION("duration"),
//     STATE("state"),
//     STATE_CHANGE("state_change"),
//     BLOCKED("blocked_by"),
//     LOCK_TYPE("lock_type"),
//     RELATION("relation"),
//     SLOW_QUERY("slow_query"),
//     QUERY("query");
// 
//     private final String columnName;
// 
//     Columns(String columnName) {
//         this.columnName = columnName;
//     }
// 
//     public String getColumnName() {
//         return columnName;
//     }
// }
// 
// Path: src/main/java/ru/taximaxim/treeviewer/models/DataSource.java
// public abstract class DataSource<T extends IObject> implements ITableLabelProvider, ITreeContentProvider {
// 
//     protected List<ILabelProviderListener> listeners = new ArrayList<>();
// 
//     public abstract List<Columns> getColumns();
// 
//     public abstract Set<Columns> getColumnsToFilter();
// 
//     public abstract ResourceBundle getResourceBundle();
// 
//     public abstract String getRowText(Object element, Columns column);
// 
//     public abstract int compare(Object e1, Object e2, Columns column);
// 
//     public String getLocalizeString(String name) {
//         if (getResourceBundle() == null || !getResourceBundle().containsKey(name)) {
//             return name;
//         }
// 
//         return getResourceBundle().getString(name);
//     }
// 
//     @Override
//     public String getColumnText(Object element, int columnIndex) {
//         return getRowText(element, getColumns().get(columnIndex));
//     }
// 
//     @Override
//     public void dispose() {
// 
//     }
// 
//     @Override
//     public boolean isLabelProperty(Object element, String property) {
//         return false;
//     }
// 
//     @Override
//     public void addListener(ILabelProviderListener listener) {
//         listeners.add(listener);
//     }
// 
//     @Override
//     public void removeListener(ILabelProviderListener listener) {
//         listeners.remove(listener);
//     }
// }


import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import ru.taximaxim.pgsqlblocks.utils.Columns;
import ru.taximaxim.treeviewer.models.DataSource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ResourceBundle;
import java.util.Set;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
/*-
 * ========================LICENSE_START=================================
 * pgSqlBlocks
 * %
 * Copyright (C) 2017 - 2018 "Technology" LLC
 * %
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =========================LICENSE_END==================================
 */
package ru.taximaxim.treeviewer.filter;




/**
 * GUI of Filters
 */
public class FilterComposite extends Composite {

    private final Set<Columns> filterList;
    private final ResourceBundle innerResourceBundle;
    private final DataSource<?> dataSource;
    private final int numberOfColumns;
    private final FilterChangeHandler filterChangeHandler;
    private final List<Text> filterTextList = new ArrayList<>();

    public FilterComposite(Composite parent, int style, ResourceBundle innerResourceBundle,
// Path: src/main/java/ru/taximaxim/pgsqlblocks/utils/Columns.java
// public enum Columns {
// 
//     PID("pid"),
//     BACKEND_TYPE("backend_type"),
//     BLOCK_CREATE_DATE("block_start_date"),
//     BLOCK_END_DATE("block_end_date"),
//     BLOCKED_COUNT("num_of_blocked_processes"),
//     APPLICATION_NAME("application"),
//     DATABASE_NAME("db_name"),
//     USER_NAME("user_name"),
//     CLIENT("client"),
//     BACKEND_START("backend_start"),
//     QUERY_START("query_start"),
//     XACT_START("xact_start"),
//     DURATION("duration"),
//     STATE("state"),
//     STATE_CHANGE("state_change"),
//     BLOCKED("blocked_by"),
//     LOCK_TYPE("lock_type"),
//     RELATION("relation"),
//     SLOW_QUERY("slow_query"),
//     QUERY("query");
// 
//     private final String columnName;
// 
//     Columns(String columnName) {
//         this.columnName = columnName;
//     }
// 
//     public String getColumnName() {
//         return columnName;
//     }
// }
// 
// Path: src/main/java/ru/taximaxim/treeviewer/models/DataSource.java
// public abstract class DataSource<T extends IObject> implements ITableLabelProvider, ITreeContentProvider {
// 
//     protected List<ILabelProviderListener> listeners = new ArrayList<>();
// 
//     public abstract List<Columns> getColumns();
// 
//     public abstract Set<Columns> getColumnsToFilter();
// 
//     public abstract ResourceBundle getResourceBundle();
// 
//     public abstract String getRowText(Object element, Columns column);
// 
//     public abstract int compare(Object e1, Object e2, Columns column);
// 
//     public String getLocalizeString(String name) {
//         if (getResourceBundle() == null || !getResourceBundle().containsKey(name)) {
//             return name;
//         }
// 
//         return getResourceBundle().getString(name);
//     }
// 
//     @Override
//     public String getColumnText(Object element, int columnIndex) {
//         return getRowText(element, getColumns().get(columnIndex));
//     }
// 
//     @Override
//     public void dispose() {
// 
//     }
// 
//     @Override
//     public boolean isLabelProperty(Object element, String property) {
//         return false;
//     }
// 
//     @Override
//     public void addListener(ILabelProviderListener listener) {
//         listeners.add(listener);
//     }
// 
//     @Override
//     public void removeListener(ILabelProviderListener listener) {
//         listeners.remove(listener);
//     }
// }


// Path: src/main/java/ru/taximaxim/treeviewer/filter/FilterComposite.java
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import ru.taximaxim.pgsqlblocks.utils.Columns;
import ru.taximaxim.treeviewer.models.DataSource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ResourceBundle;
import java.util.Set;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;

/*-
 * ========================LICENSE_START=================================
 * pgSqlBlocks
 * %
 * Copyright (C) 2017 - 2018 "Technology" LLC
 * %
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =========================LICENSE_END==================================
 */
package ru.taximaxim.treeviewer.filter;




/**
 * GUI of Filters
 */
public class FilterComposite extends Composite {

    private final Set<Columns> filterList;
    private final ResourceBundle innerResourceBundle;
    private final DataSource<?> dataSource;
    private final int numberOfColumns;
    private final FilterChangeHandler filterChangeHandler;
    private final List<Text> filterTextList = new ArrayList<>();

    public FilterComposite(Composite parent, int style, ResourceBundle innerResourceBundle,
            DataSource<?> dataSource, FilterChangeHandler filterChangeHandler) {