package com.onaro.sanscreen.client.view.tabular; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.onaro.client.swing.table.functional.AbstractFunctionalColumn; import com.onaro.util.jfc.tables.filter.Filter; /** * Base class for TableColumn extensions used for columns used in {@link AbstractTabularTableModel}. This class * provides extensions for managing the association with a table column filter, a flag for whether the column * should be visible by default, whether the column is considered a system column (for hidden columns of data in the * table), and associations with column groups. * * @param the object type for the rows the column can operate on. * @see AbstractTabularTableModel */ public abstract class AbstractTabularColumn extends AbstractFunctionalColumn implements ITabularColumn { static final Logger logger = LogManager.getLogger(AbstractTabularColumn.class); private static final long serialVersionUID = 1L; /** * Filter for use with this column. May be null if no filter is applicable. */ private Filter filter; /** * Tells if this column should be visible by default. */ private boolean visibleByDefault = true; /** * Is this column a system (i.e. NOT user viewable column). */ private boolean system = false; /** * The display name of this column's group. */ private String groupName = null; public AbstractTabularColumn(String id, Class valueType, String name, Boolean editable) { super(id, valueType, name, editable); } public AbstractTabularColumn(String id, Class valueType, String name) { super(id, valueType, name); } public AbstractTabularColumn(String id, Class valueType) { super(id, valueType); } public final Filter getFilter() { return filter; } public final void setFilter(Filter filter) { this.filter = filter; } public final String getGroupName() { return groupName; } public final void setGroupName(String groupName) { this.groupName = groupName; } public final boolean isSystem() { return system; } public final void setSystem(boolean system) { this.system = system; if (logger.isDebugEnabled()) { logger.debug("setSystem: this=" + hashCode() //$NON-NLS-1$ + ", isSystem=" + system); //$NON-NLS-1$ } } public boolean isVisibleByDefault() { return visibleByDefault; } public void setVisibleByDefault(boolean visibleByDefault) { this.visibleByDefault = visibleByDefault; if (logger.isDebugEnabled()) { logger.debug("setVisibleByDefault: this=" + hashCode() //$NON-NLS-1$ + ", isVisibleByDefault=" + visibleByDefault); //$NON-NLS-1$ } } /** * Override shouldPrefetch() to ensure system columns are prefetched. */ @Override public boolean shouldPrefetch() { return isSystem() || super.shouldPrefetch(); } }