Skip to content

Commit

Permalink
Added getter/setter methods for CascadedTable row filter and column p…
Browse files Browse the repository at this point in the history
…rojection
  • Loading branch information
jheer committed Jul 15, 2006
1 parent ecfb098 commit 3e03f4c
Showing 1 changed file with 52 additions and 8 deletions.
60 changes: 52 additions & 8 deletions src/prefuse/data/CascadedTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,11 @@ protected CascadedTable(Table parent, Predicate rowFilter,
m_parent = parent;
m_pnames = new ArrayList();
m_rows = new CascadedRowManager(this);
m_rowFilter = rowFilter==null ? BooleanLiteral.TRUE : rowFilter;
m_colFilter = colFilter==null ? new AcceptAllColumnProjection() : colFilter;
filterColumns();
filterRows();

m_listener = new Listener();

setColumnProjection(colFilter);
setRowFilter(rowFilter);
m_parent.addTableListener(m_listener);
if ( m_rowFilter != BooleanLiteral.TRUE )
m_rowFilter.addExpressionListener(m_listener);
m_colFilter.addProjectionListener(m_listener);
}

// -- non-cascading version -----------------------------------------------
Expand Down Expand Up @@ -240,6 +235,55 @@ public void filterRows() {
}
}

/**
* Get the ColumnProjection determining which columns of the
* parent table are included in this one.
* @return the ColumnProjection of this CascadedTable
*/
public ColumnProjection getColumnProjection() {
return m_colFilter;
}

/**
* Sets the ColumnProjection determining which columns of the
* parent table are included in this one.
* @param colFilter a ColumnProjection determining which columns of the
* parent table to include in this one.
*/
public void setColumnProjection(ColumnProjection colFilter) {
if ( m_colFilter != null ) {
m_colFilter.removeProjectionListener(m_listener);
}
m_colFilter = colFilter==null ? new AcceptAllColumnProjection() : colFilter;
m_colFilter.addProjectionListener(m_listener);
filterColumns();
}

/**
* Gets ths Predicate determining which rows of the parent
* table are included in this one.
* @return the row filtering Predicate of this CascadedTable
*/
public Predicate getRowFilter() {
return m_rowFilter;
}

/**
* Sets the Predicate determining which rows of the parent
* table are included in this one.
* @param rowFilter a Predicate determining which rows of the parent
* table to include in this one.
*/
public void setRowFilter(Predicate rowFilter) {
if ( m_rowFilter != null ) {
m_rowFilter.removeExpressionListener(m_listener);
}
m_rowFilter = rowFilter==null ? BooleanLiteral.TRUE : rowFilter;
if ( m_rowFilter != BooleanLiteral.TRUE )
m_rowFilter.addExpressionListener(m_listener);
filterRows();
}

// ------------------------------------------------------------------------
// Table Metadata

Expand Down

0 comments on commit 3e03f4c

Please sign in to comment.