gt: 		if (columnIndex == COLUMN_ATTRIBUTES_INDEX) {
context: /**
   * Copyright (C) 2001-2017 by RapidMiner and the contributors
   * 
   * Complete list of developers available at our web site:
   * 
   * http://rapidminer.com
   * 
   * This program is free software: you can redistribute it and/or modify it under the terms of the
   * GNU Affero General Public License as published by the Free Software Foundation, either version 3
   * of the License, or (at your option) any later version.
   * 
   * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
   * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Affero General Public License for more details.
   * 
   * You should have received a copy of the GNU Affero General Public License along with this program.
   * If not, see http://www.gnu.org/licenses/.
  */
  package com.rapidminer.gui.properties;
  
  import com.rapidminer.example.set.CustomFilter.CustomFilters;
  import com.rapidminer.gui.properties.tablepanel.TablePanel;
  import com.rapidminer.gui.properties.tablepanel.cells.interfaces.*;
  import com.rapidminer.gui.properties.tablepanel.model.TablePanelModel;
  import com.rapidminer.operator.ports.InputPort;
  import com.rapidminer.operator.ports.metadata.AttributeMetaData;
  import com.rapidminer.operator.ports.metadata.ExampleSetMetaData;
  import com.rapidminer.tools.I18N;
  import com.rapidminer.tools.Ontology;
  import com.rapidminer.tools.Tools;
  
  import javax.swing.event.TableModelEvent;
  import javax.swing.table.AbstractTableModel;
  import java.text.DateFormat;
  import java.text.SimpleDateFormat;
  import java.util.*;
  import java.util.concurrent.atomic.AtomicBoolean;
  
  
  /**
   * This is the backing model for the {@link TablePanel} used by the example set filters.
   *
   * @author Marco Boeck
   */
  public class FilterTableModel extends AbstractTableModel implements TablePanelModel {
  
  	private static final long serialVersionUID = 7919277746196444952L;
  
  	private static final int COLUMN_COUNT = 3;
  	private static final int COLUMN_ATTRIBUTES_INDEX = 0;
  	private static final int COLUMN_CUSTOM_FILTER_INDEX = 1;
  	private static final int COLUMN_FILTER_VALUE_INDEX = 2;
  
  	private static final String[] COLUMN_NAMES = new String[] {
  		I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.filter_table_model.column_name_attribute.title"),
  		I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.filter_table_model.column_name_compare.title"),
  		I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.filter_table_model.column_name_field.title") };
  
  	/** syntax help for date fields */
  	private static final String SYNTAX_DATE = "01/31/2014";
  
  	/** syntax help for date_time fields */
  	private static final String SYNTAX_DATE_TIME = "01/31/2014 9:00:00 AM";
  
  	/** syntax help for time fields */
  	private static final String SYNTAX_TIME = "9:00:00 AM";
  
  	/** the metadata for the example set at the input port */
  	private ExampleSetMetaData md;
  
  	/** flag which indicates if possible values for filter comparators should depend on meta data */
  	private boolean checkMetaDataForComparators;
  
  	/** the number of rows this table model currently has */
  	private int rowsCount;
  
  	/** the list of AttributeMetaData for this model */
  	private List<AttributeMetaData> listOfAttributeMetaData;
  
  	/** the list of selected values for the attribute column */
  	private List<String> rowListOfSelectedAttributes;
  
  	/** the list of selected values for the comparator column */
  	private List<String> rowListOfSelectedComparators;
  
  	/** the list of selected values for the value column */
  	private List<String> rowListOfSelectedValues;
  
  	/** used to prevent events while we are creating the model */
  	private AtomicBoolean creatingModel;
  
  	/** the format for date_time */
  	private final DateFormat FORMAT_DATE_TIME = new SimpleDateFormat(CustomFilters.DATE_TIME_FORMAT_STRING, Locale.ENGLISH);
  
  	/** the format for date */
  	private final DateFormat FORMAT_DATE = new SimpleDateFormat(CustomFilters.DATE_FORMAT_STRING, Locale.ENGLISH);
  
  	/** the format for time */
  	private final DateFormat FORMAT_TIME = new SimpleDateFormat(CustomFilters.TIME_FORMAT_STRING, Locale.ENGLISH);
  
      /**
       * Creates a new {@link FilterTableModel} instance.
       *
       * @param inputPort the input port
       * @throws IllegalArgumentException if the input port has no example set
       */
      public FilterTableModel(InputPort inputPort) throws IllegalArgumentException {
  		if (inputPort == null) {
  			throw new IllegalArgumentException("InputPort must not be null!");
  		}
  
  		this.listOfAttributeMetaData = new LinkedList<>();
  		if (inputPort.getMetaData() instanceof ExampleSetMetaData) {
  			this.md = (ExampleSetMetaData) inputPort.getMetaData();
  			for (AttributeMetaData metadata : md.getAllAttributes()) {
  				listOfAttributeMetaData.add(metadata);
  			}
  		}
  		this.rowsCount = 0;
  		this.rowListOfSelectedAttributes = new LinkedList<>();
  		this.rowListOfSelectedComparators = new LinkedList<>();
  		this.rowListOfSelectedValues = new LinkedList<>();
  		this.creatingModel = new AtomicBoolean(false);
  		this.checkMetaDataForComparators = true;
  	}
  
  	@Override
  	public int getRowCount() {
  		return rowsCount;
  	}
  
  	@Override
  	public int getColumnCount() {
  		return COLUMN_COUNT;
  	}
  
  	@Override
  	public String getColumnName(int columnIndex) {
  		if (columnIndex < 0 || columnIndex >= getColumnCount()) {
  			throw new IllegalArgumentException("Invalid columnIndex: " + columnIndex);
  		}
  		return COLUMN_NAMES[columnIndex];
  	}
  
  	@Override
  	public Class<?> getColumnClass(int columnIndex) {
  		return getColumnClass(-1, columnIndex);
  	}
  
  	@Override
  	public Class<? extends CellType> getColumnClass(int rowIndex, int columnIndex) {
  		switch (columnIndex) {
  			case COLUMN_ATTRIBUTES_INDEX:
  				return CellTypeComboBox.class;
  			case COLUMN_CUSTOM_FILTER_INDEX:
  				return CellTypeComboBox.class;
  			case COLUMN_FILTER_VALUE_INDEX:
  				if (rowIndex == -1) {
  					return CellTypeLabel.class;
  				}
  				CustomFilters filter = CustomFilters.getByLabel(String.valueOf(getValueAt(rowIndex,
  						COLUMN_CUSTOM_FILTER_INDEX)));
  				if (filter == CustomFilters.REGEX) {
  					return CellTypeRegex.class;
  				} else if (filter == CustomFilters.MISSING || filter == CustomFilters.NOT_MISSING) {
  					// missing/not missing filter -> no date cell type
  					return CellTypeTextFieldDefault.class;
  				} else if (filter == null || filter.isNominalFilter()) {
  					return CellTypeTextFieldDefault.class;
  				} else {
  					// distinguish between numerical and date attributes
  					String selectedAttributeName = String.valueOf(getValueAt(rowIndex, COLUMN_ATTRIBUTES_INDEX));
  					int valueType = Ontology.ATTRIBUTE_VALUE;
  					// see if the attribute has been set to an existing one so the value type can be
  					// obtained
  					for (AttributeMetaData md : listOfAttributeMetaData) {
  						if (md.getName().equals(selectedAttributeName)) {
  							valueType = md.getValueType();
  							break;
  						}
  					}
  					// this happens when the meta data is unknown - use String.class for generic
  					// textfield
  					if (valueType == Ontology.ATTRIBUTE_VALUE) {
  						return CellTypeTextFieldDefault.class;
  					}
  					if (Ontology.ATTRIBUTE_VALUE_TYPE.isA(valueType, Ontology.DATE)) {
  						return CellTypeDate.class;
  					} else if (Ontology.ATTRIBUTE_VALUE_TYPE.isA(valueType, Ontology.TIME)) {
  						return CellTypeTextFieldTime.class;
  					} else if (Ontology.ATTRIBUTE_VALUE_TYPE.isA(valueType, Ontology.DATE_TIME)) {
  						return CellTypeDateTime.class;
  					}
  
  					if (valueType == Ontology.INTEGER) {
  						return CellTypeTextFieldInteger.class;
  					}
  					return CellTypeTextFieldNumerical.class;
  				}
  			default:
  				throw new IllegalArgumentException("Invalid columnIndex: " + columnIndex);
  		}
  	}
  
  	@Override
  	public boolean isCellEditable(int rowIndex, int columnIndex) {
  		// only first and last column are editable
  