use of de.jaret.util.ui.table.filter.IAutoFilter in project translationstudio8 by heartsome.
the class JaretTable method setUpAutoFilter.
/**
* Setup the autofilter components.
*
* @param gc GC
*/
private void setUpAutoFilter(GC gc) {
if (_autoFilterEnabled) {
for (IColumn column : _cols) {
IAutoFilter af = _autoFilterMap.get(column);
ColInfo cInfo = getColInfo(column);
if (af != null && cInfo == null) {
af.getControl().setVisible(false);
} else {
if (af != null) {
af.getControl().setVisible(true);
af.getControl().setBounds(cInfo.x, _autoFilterRect.y, cInfo.width, _autoFilterRect.height);
}
}
}
} else {
for (IColumn column : _cols) {
IAutoFilter af = _autoFilterMap.get(column);
if (af != null) {
af.getControl().setVisible(false);
}
}
}
}
use of de.jaret.util.ui.table.filter.IAutoFilter in project translationstudio8 by heartsome.
the class JaretTable method updateAutoFilter.
/**
* Create and/or update autofilters.
*
*/
private void updateAutoFilter() {
if (_autoFilterEnabled) {
// check combining autofilter
if (_autoFilter == null) {
_autoFilter = new AutoFilter(this);
}
// create autofilter instances and controls if necessary
for (IColumn column : _cols) {
if (_autoFilterMap.get(column) == null) {
IAutoFilter af = createAutoFilter(column);
if (af != null) {
af.addPropertyChangeListener(_autoFilter);
_autoFilterMap.put(column, af);
}
}
}
// update the filters and register them with the combining internal autofilter row filter
for (IColumn column : _cols) {
IAutoFilter af = _autoFilterMap.get(column);
if (af != null) {
// might be null in case of errors
af.update();
}
}
}
}
use of de.jaret.util.ui.table.filter.IAutoFilter in project translationstudio8 by heartsome.
the class JaretTable method createAutoFilter.
/**
* Instantiate an autofilter instance for the given column.
*
* @param column column
* @return instantiated autofilter or <code>null</code> if any error occurs during instantiation
*/
private IAutoFilter createAutoFilter(IColumn column) {
Class<? extends IAutoFilter> clazz = getAutoFilterClass(column);
if (clazz == null) {
return null;
}
IAutoFilter result = null;
try {
Constructor<? extends IAutoFilter> constructor = clazz.getConstructor();
result = constructor.newInstance();
} catch (Exception e) {
// TODO
e.printStackTrace();
return null;
}
result.setTable(this);
result.setColumn(column);
return result;
}
Aggregations