本文整理汇总了Java中prefuse.data.event.EventConstants类的典型用法代码示例。如果您正苦于以下问题:Java EventConstants类的具体用法?Java EventConstants怎么用?Java EventConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EventConstants类属于prefuse.data.event包,在下文中一共展示了EventConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearAggregateMappings
import prefuse.data.event.EventConstants; //导入依赖的package包/类
/**
* Clears all aggregates mappings for the aggregate at the given row,
* optionally issuing a table update.
* @param row the table row of the aggregate
* @param update indicates whether or not to fire a table update
*/
protected void clearAggregateMappings(int row, boolean update) {
Index index = m_aggregated.index(AGGREGATE);
boolean fire = false;
for ( IntIterator rows = index.rows(row); rows.hasNext(); ) {
int r = rows.nextInt();
// this removal maneuver is ok because we know we are
// pulling row values directly from an index
// with intervening iterators, remove might throw an exception
rows.remove();
m_aggregated.removeRow(r);
fire = true;
}
if ( update && fire )
fireTableEvent(row, row,
EventConstants.ALL_COLUMNS, EventConstants.UPDATE);
}
示例2: fireGraphEvent
import prefuse.data.event.EventConstants; //导入依赖的package包/类
/**
* Fire a graph event. Makes sure to invalidate all edges connected
* to a node that has been updated.
* @see prefuse.data.Graph#fireGraphEvent(prefuse.data.Table, int, int, int, int)
*/
protected void fireGraphEvent(Table t,
int first, int last, int col, int type)
{
// if a node is invalidated, invalidate the edges, too
if ( type==EventConstants.UPDATE &&
col==VisualItem.IDX_VALIDATED && t==getNodeTable() )
{
VisualTable nodes = (VisualTable)t;
VisualTable edges = (VisualTable)getEdgeTable();
for ( int i=first; i<=last; ++i ) {
if ( nodes.isValidated(i) )
continue; // look only for invalidations
IntIterator erows = edgeRows(i);
while ( erows.hasNext() ) {
int erow = erows.nextInt();
edges.setValidated(erow, false);
}
}
}
// fire the event off to listeners
super.fireGraphEvent(t, first, last, col, type);
}
示例3: fireGraphEvent
import prefuse.data.event.EventConstants; //导入依赖的package包/类
/**
* Fire a graph change event
* @param t the backing table where the change occurred (either a
* node table or an edge table)
* @param first the first modified table row
* @param last the last (inclusive) modified table row
* @param col the number of the column modified, or
* {@link prefuse.data.event.EventConstants#ALL_COLUMNS} for operations
* affecting all columns
* @param type the type of modification, one of
* {@link prefuse.data.event.EventConstants#INSERT},
* {@link prefuse.data.event.EventConstants#DELETE}, or
* {@link prefuse.data.event.EventConstants#UPDATE}.
*/
protected void fireGraphEvent(Table t,
int first, int last, int col, int type)
{
String table = (t==getNodeTable() ? NODES : EDGES);
if ( type != EventConstants.UPDATE ) {
// fire event to all tuple set listeners
fireTupleEvent(t, first, last, type);
}
if ( !m_listeners.isEmpty() ) {
// fire event to all listeners
Object[] lstnrs = m_listeners.getArray();
for ( int i=0; i<lstnrs.length; ++i ) {
((GraphListener)lstnrs[i]).graphChanged(
this, table, first, last, col, type);
}
}
}
示例4: fireTupleEvent
import prefuse.data.event.EventConstants; //导入依赖的package包/类
/**
* Fire a Tuple event.
* @param t the Table on which the event has occurred
* @param start the first row changed
* @param end the last row changed
* @param type the type of event, one of
* {@link prefuse.data.event.EventConstants#INSERT} or
* {@link prefuse.data.event.EventConstants#DELETE}.
*/
protected void fireTupleEvent(Table t, int start, int end, int type) {
if ( m_tupleListeners != null && m_tupleListeners.size() > 0 ) {
Object[] lstnrs = m_tupleListeners.getArray();
Tuple[] tuples = new Tuple[end-start+1];
for ( int i=0, r=start; r <= end; ++r, ++i ) {
tuples[i] = t.getTuple(r);
}
for ( int i=0; i<lstnrs.length; ++i ) {
TupleSetListener tsl = (TupleSetListener)lstnrs[i];
if ( type == EventConstants.INSERT ) {
tsl.tupleSetChanged(this, tuples, EMPTY_ARRAY);
} else {
tsl.tupleSetChanged(this, EMPTY_ARRAY, tuples);
}
}
}
}
示例5: removeRow
import prefuse.data.event.EventConstants; //导入依赖的package包/类
/**
* Removes a row from this table.
* @param row the row to delete
* @return true if the row was successfully deleted, false if the
* row was already invalid
*/
public boolean removeRow(int row) {
if ( m_rows.isValidRow(row) ) {
// the order of operations here is extremely important
// otherwise listeners may end up with corrupted state.
// fire update *BEFORE* clearing values
// allow listeners (e.g., indices) to perform clean-up
fireTableEvent(row, row, EventConstants.ALL_COLUMNS,
EventConstants.DELETE);
// invalidate the tuple
m_tuples.invalidate(row);
// release row with row manager
// do this before clearing column values, so that any
// listeners can determine that the row is invalid
m_rows.releaseRow(row);
// now clear column values
for ( Iterator<Column> cols = getColumns(); cols.hasNext(); ) {
Column c = cols.next();
c.revertToDefault(row);
}
return true;
}
return false;
}
示例6: removeColumn
import prefuse.data.event.EventConstants; //导入依赖的package包/类
/**
* Internal method for removing a column.
* @param idx the column number of the column to remove
* @return the removed Column instance
*/
protected Column removeColumn(int idx) {
// make sure index is legal
if ( idx < 0 || idx >= m_columns.size() ) {
throw new IllegalArgumentException("Column index is not legal.");
}
String name = m_names.get(idx);
(m_entries.get(name)).dispose();
Column col = m_columns.remove(idx);
m_entries.remove(name);
m_names.remove(idx);
renumberColumns();
m_lastCol = -1;
invalidateSchema();
// ignore what the old column has to say
col.removeColumnListener(this);
// fire notification
fireTableEvent(m_rows.getMinimumRow(), m_rows.getMaximumRow(),
idx, EventConstants.DELETE);
return col;
}
示例7: handleColumnChanged
import prefuse.data.event.EventConstants; //导入依赖的package包/类
/**
* Handle a column change event.
* @param c the modified column
* @param start the starting row of the modified range
* @param end the ending row (inclusive) of the modified range
*/
protected void handleColumnChanged(Column c, int start, int end) {
for ( ; !isValidRow(start) && start <= end; ++start );
if ( start > end ) return; // bail if no valid rows
// determine the index of the updated column
int idx;
if ( m_lastCol != -1 && c == getColumn(m_lastCol) ) {
// constant time
idx = m_lastCol;
} else {
// linear time
idx = getColumnNumber(c);
}
// if we have a valid index, fire a notification
if ( idx >= 0 ) {
fireTableEvent(start, end, idx, EventConstants.UPDATE);
}
}
示例8: fireTableEvent
import prefuse.data.event.EventConstants; //导入依赖的package包/类
/**
* Fire a table event to notify listeners.
* @param row0 the starting row of the modified range
* @param row1 the ending row (inclusive) of the modified range
* @param col the number of the column modified, or
* {@link prefuse.data.event.EventConstants#ALL_COLUMNS} for operations
* effecting all columns.
* @param type the table modification type, one of
* {@link prefuse.data.event.EventConstants#INSERT},
* {@link prefuse.data.event.EventConstants#DELETE}, or
* {@link prefuse.data.event.EventConstants#UPDATE}.
*/
protected void fireTableEvent(int row0, int row1, int col, int type) {
// increment the modification count
++m_modCount;
if ( type != EventConstants.UPDATE &&
col == EventConstants.ALL_COLUMNS )
{
// fire event to all tuple set listeners
fireTupleEvent(this, row0, row1, type);
}
if ( !m_listeners.isEmpty() ) {
// fire event to all table listeners
for (TableListener lstnr : m_listeners)
lstnr.tableChanged(this, row0, row1, col, type);
}
}
示例9: tableChanged
import prefuse.data.event.EventConstants; //导入依赖的package包/类
@Override
public void tableChanged(Table t, int start, int end, int col, int type) {
if(type == EventConstants.UPDATE && start == end) {
TemporalObject to = (TemporalObject)t.getTuple(start);
int treeLevel = to.getTreeLevel();
int[] dataColumnIndices = getDataColumnIndices();
for(int i=0; i<dataColumnIndices.length; i++) {
if(col == dataColumnIndices[i]) {
if (t.canGetDouble(col)) {
double d = t.getDouble(start, col);
if (!Double.isNaN(d)) {
minValues[i][treeLevel] = Math.min(minValues[i][treeLevel], d);
maxValues[i][treeLevel] = Math.max(maxValues[i][treeLevel], d);
}
}
}
break;
}
}
}
示例10: addToAggregate
import prefuse.data.event.EventConstants; //导入依赖的package包/类
/**
* Add an item to the aggregation at the given row.
* @param row the row index of the aggregate
* @param member the item to add to the aggregation
*/
public void addToAggregate(int row, VisualItem member) {
validRowCheck(row, true);
if ( !aggregateContains(row, member) ) {
int ar = m_aggregated.addRow();
m_aggregated.setInt(ar, AGGREGATE, row);
m_aggregated.setInt(ar, MEMBER_HASH, getHashCode(member));
m_aggregated.set(ar, MEMBER, member);
fireTableEvent(row, row,
EventConstants.ALL_COLUMNS, EventConstants.UPDATE);
}
}
示例11: removeFromAggregate
import prefuse.data.event.EventConstants; //导入依赖的package包/类
/**
* Remove an item from the aggregation at the given row
* @param row the row index of the aggregate
* @param member the item to remove from the aggregation
*/
public void removeFromAggregate(int row, VisualItem member) {
validRowCheck(row, true);
int ar = getAggregatedRow(row, member);
if ( ar >= 0 ) {
m_aggregated.removeRow(ar);
fireTableEvent(row, row,
EventConstants.ALL_COLUMNS, EventConstants.UPDATE);
}
}
示例12: fireTableEvent
import prefuse.data.event.EventConstants; //导入依赖的package包/类
/**
* Clear all aggregate mappings for a row when it is deleted.
*/
protected void fireTableEvent(int row0, int row1, int col, int type) {
if ( col==EventConstants.ALL_COLUMNS && type==EventConstants.DELETE ) {
for ( int r=row0; r<=row1; ++r )
clearAggregateMappings(r, false);
}
super.fireTableEvent(row0, row1, col, type);
}
示例13: fireTableEvent
import prefuse.data.event.EventConstants; //导入依赖的package包/类
/**
* Relay table events. Ensures that updated visual items are invalidated
* and that damage reports are issued for deleted items.
*/
protected void fireTableEvent(int row0, int row1, int col, int type) {
// table attributes changed, so we invalidate the bounds
if ( type==EventConstants.UPDATE )
{
if ( col != VisualItem.IDX_VALIDATED ) {
for ( int r=row0; r<=row1; ++r )
setValidated(r,false);
} else {
// change in validated status
for ( int r=row0; r<=row1; ++r ) {
if ( !isValidated(r) ) {
// retrieve the old bounds to report damage
m_vis.damageReport(getItem(r), getBounds(r));
}
}
}
}
else if ( type==EventConstants.DELETE && col==EventConstants.ALL_COLUMNS)
{
for ( int r=row0; r<=row1; ++r ) {
if ( isVisible(r) && isValidated(r) ) {
VisualItem item = (VisualItem)getTuple(r);
m_vis.damageReport(item, getBounds(r));
}
}
}
// now propagate the change event
super.fireTableEvent(row0, row1, col, type);
}
示例14: fireGraphEvent
import prefuse.data.event.EventConstants; //导入依赖的package包/类
/**
* Fire a graph event. Makes sure to invalidate all edges connected
* to a node that has been updated.
* @see prefuse.data.Graph#fireGraphEvent(prefuse.data.Table, int, int, int, int)
*/
protected void fireGraphEvent(Table t,
int first, int last, int col, int type)
{
// if a node is invalidated, invalidate the edges, too
if ( type==EventConstants.UPDATE &&
col==VisualItem.IDX_VALIDATED && t==getNodeTable() )
{
VisualTable nodes = (VisualTable)t;
VisualTable edges = (VisualTable)getEdgeTable();
for ( int i=first; i<=last; ++i ) {
if ( nodes.isValidated(i) )
continue; // look only for invalidations
if ( i < 0 ) {
System.err.println("catch me - VisualGraph fireGraphEvent");
}
// try {
IntIterator erows = edgeRows(i);
while ( erows.hasNext() ) {
int erow = erows.nextInt();
edges.setValidated(erow, false);
}
// } catch ( Exception ex ) {
// ex.printStackTrace();
// }
}
}
// fire the event off to listeners
super.fireGraphEvent(t, first, last, col, type);
}
示例15: addCascadedRow
import prefuse.data.event.EventConstants; //导入依赖的package包/类
/**
* Internal method for adding a new cascaded row backed by
* the given parent row.
* @param prow the parent row to inherit
* @return the row number ofr the newly added row in this table
*/
protected int addCascadedRow(int prow) {
int r = m_rows.addRow();
((CascadedRowManager)m_rows).put(r, prow);
updateRowCount();
fireTableEvent(r, r, EventConstants.ALL_COLUMNS, EventConstants.INSERT);
return r;
}