Java 类javax.swing.event.TableColumnModelEvent 实例源码

项目:jmt    文件:GraphPanel.java   
@Override
public void columnAdded(TableColumnModelEvent e) {
    LinesTableColumn type = getColumnType(e.getToIndex());
    TableColumn column = getColumnModel().getColumn(e.getToIndex());
    switch (type) {
        case COLOR:
            column.setMaxWidth(25);
            break;
        case CLASS:
            column.setPreferredWidth(90);
            break;
        case STATION:
            column.setPreferredWidth(90);
            break;
        case ALGORITHM:
            column.setPreferredWidth(100);
            break;
    }
    super.columnAdded(e);
}
项目:taxonaut    文件:TableColumnModelSynchronizer.java   
public void columnMoved(TableColumnModelEvent event)
   {
if(isEmpty() || getEventSource() != null) {
    return;
}

setEventSource(event.getSource());

int columnIndex = event.getFromIndex();
int newIndex = event.getToIndex();

Collection<TableColumnModel> models = values();
for (TableColumnModel model : models) {
    if(model == getEventSource())
    continue;
    model.moveColumn(columnIndex, newIndex);
}

if(columnIndex != newIndex) {
    TableColumnSynchronizer column = columns.get(columnIndex);
    columns.remove(columnIndex);
    columns.add(newIndex, column);
}

setEventSource(null);
   }
项目:taxonaut    文件:NameTreeTable.java   
public void columnAdded(TableColumnModelEvent event)
   {
super.columnAdded(event);
TableColumn column = getColumnModel().getColumn(event.getToIndex());
column.setCellRenderer(cellRenderer);
AlignerTree aligner = getAlignerTree();
if(synchronizer != null &&
   aligner != null) {
    synchronizer.add(aligner);
    synchronizer = null;
}

TableCellRenderer r = column.getHeaderRenderer();
if(r instanceof TreeHeaderRenderer) {
    JTree tree = ((TreeHeaderRenderer)r).getTree();
    if(!(tree instanceof AlignerTree) &&
       aligner != null)
    aligner.addTree((NameTree)tree);
    resizeAndRepaint();
}
   }
项目:taxonaut    文件:NameTreeTable.java   
public void columnRemoved(TableColumnModelEvent event)
   {
AlignerTree atree = getAlignerTree();
if(atree != null) {
    List<JTree> renderers = atree.getTrees();

    Enumeration<TableColumn> e =
    getColumnModel().getColumns();

    while(e.hasMoreElements()) {
    TableCellRenderer r =
        e.nextElement().getHeaderRenderer();
    if(renderers.contains(r))
        renderers.remove(r);
    }

    for(JTree tree: renderers) {
    atree.removeTree((NameTree)tree);
    }

    renderers.clear();
}

super.columnRemoved(event);
   }
项目:cn1    文件:DefaultTableColumnModel.java   
public void moveColumn(final int columnIndex, final int newIndex) {
    if (columnIndex < 0 || columnIndex >= getColumnCount()
        || newIndex < 0 || newIndex > getColumnCount()) {

        throw new IllegalArgumentException(Messages.getString("swing.79")); //$NON-NLS-1$
    }

    if (columnIndex != newIndex) {
        TableColumn firstColumn = getColumn(columnIndex);
        tableColumns.remove(columnIndex);
        tableColumns.add(newIndex, firstColumn);

        boolean oldIsSelected = selectionModel.isSelectedIndex(columnIndex);
        selectionModel.removeIndexInterval(columnIndex, columnIndex);
        selectionModel.insertIndexInterval(newIndex, 1, true);
        if (oldIsSelected) {
            selectionModel.addSelectionInterval(newIndex, newIndex);
        } else {
            selectionModel.removeSelectionInterval(newIndex, newIndex);
        }
    }

    fireColumnMoved(new TableColumnModelEvent(this, columnIndex, newIndex));
}
项目:BurpSuiteLoggerPlusPlus    文件:LogTableColumnModel.java   
@Override
    public void moveColumn(int viewFrom, int viewTo) {
//      viewToModelMap
        columnMap.get(viewToModelMap.get(viewFrom)).setOrder(viewTo);
        if(viewFrom < viewTo) {
            for (int i = viewFrom + 1; i <= viewTo; i++) {
                columnMap.get(viewToModelMap.get(i)).setOrder(i-1);
            }
            reorderViewColumns(true);
        }else if(viewFrom > viewTo){
            for (int i = viewFrom-1; i >= viewTo; i--) {
                columnMap.get(viewToModelMap.get(i)).setOrder(i+1);
            }
            reorderViewColumns(true);
        }else{
            //no change
        }
        this.fireColumnMoved(new TableColumnModelEvent(this, viewFrom, viewTo));
    }
项目:findbugs-all-the-bugs    文件:SorterTableColumnModel.java   
public void moveColumn(int fromIndex, int toIndex) {

        if (!MainFrame.getInstance().canNavigateAway())
            return;
        MainFrame.getInstance().updateDesignationDisplay();
        TableColumn from = columnList.get(fromIndex);
        TableColumn to = columnList.get(toIndex);

        columnList.set(fromIndex, to);
        to.setModelIndex(fromIndex);

        columnList.set(toIndex, from);
        from.setModelIndex(toIndex);

        orderUpdate();

        for (TableColumnModelListener w : new ArrayList<TableColumnModelListener>(watchers)) {
            w.columnMoved(new TableColumnModelEvent(this, fromIndex, toIndex));
        }
    }
项目:snap-desktop    文件:PlacemarkManagerTopComponent.java   
@Override
public void columnAdded(TableColumnModelEvent e) {
    int minWidth;
    final int index = e.getToIndex();
    switch (index) {
        case 0:
        case 1:
            minWidth = 60;
            break;
        default:
            minWidth = 80;
    }
    TableColumnModel columnModel = (TableColumnModel) e.getSource();
    columnModel.getColumn(index).setPreferredWidth(minWidth);
    columnModel.getColumn(index).setCellRenderer(new RightAlignmentTableCellRenderer());
}
项目:freeVM    文件:DefaultTableColumnModel.java   
public void moveColumn(final int columnIndex, final int newIndex) {
    if (columnIndex < 0 || columnIndex >= getColumnCount()
        || newIndex < 0 || newIndex > getColumnCount()) {

        throw new IllegalArgumentException(Messages.getString("swing.79")); //$NON-NLS-1$
    }

    if (columnIndex != newIndex) {
        TableColumn firstColumn = getColumn(columnIndex);
        tableColumns.remove(columnIndex);
        tableColumns.add(newIndex, firstColumn);

        boolean oldIsSelected = selectionModel.isSelectedIndex(columnIndex);
        selectionModel.removeIndexInterval(columnIndex, columnIndex);
        selectionModel.insertIndexInterval(newIndex, 1, true);
        if (oldIsSelected) {
            selectionModel.addSelectionInterval(newIndex, newIndex);
        } else {
            selectionModel.removeSelectionInterval(newIndex, newIndex);
        }
    }

    fireColumnMoved(new TableColumnModelEvent(this, columnIndex, newIndex));
}
项目:freeVM    文件:DefaultTableColumnModel.java   
public void moveColumn(final int columnIndex, final int newIndex) {
    if (columnIndex < 0 || columnIndex >= getColumnCount()
        || newIndex < 0 || newIndex > getColumnCount()) {

        throw new IllegalArgumentException(Messages.getString("swing.79")); //$NON-NLS-1$
    }

    if (columnIndex != newIndex) {
        TableColumn firstColumn = getColumn(columnIndex);
        tableColumns.remove(columnIndex);
        tableColumns.add(newIndex, firstColumn);

        boolean oldIsSelected = selectionModel.isSelectedIndex(columnIndex);
        selectionModel.removeIndexInterval(columnIndex, columnIndex);
        selectionModel.insertIndexInterval(newIndex, 1, true);
        if (oldIsSelected) {
            selectionModel.addSelectionInterval(newIndex, newIndex);
        } else {
            selectionModel.removeSelectionInterval(newIndex, newIndex);
        }
    }

    fireColumnMoved(new TableColumnModelEvent(this, columnIndex, newIndex));
}
项目:incubator-netbeans    文件:ETableColumnModel.java   
/** Copy of addColumn(TableColumn) with an index specifying where to add the new column */
   private void addColumn(TableColumn aColumn, int index) {
if (aColumn == null) {
    throw new IllegalArgumentException("Object is null");
}

tableColumns.insertElementAt(aColumn, index);
aColumn.addPropertyChangeListener(this);
//invalidateWidthCache();
       totalColumnWidth = -1;

// Post columnAdded event notification
fireColumnAdded(new TableColumnModelEvent(this, 0, index));
   }
项目:incubator-netbeans    文件:IssueTable.java   
@Override
public void columnMoved(TableColumnModelEvent e) {
    int from = e.getFromIndex();
    int to = e.getToIndex();
    if(from == to) {
        return;
    }
    table.getTableHeader().getColumnModel().getColumn(from).setModelIndex(from);
    table.getTableHeader().getColumnModel().getColumn(to).setModelIndex(to);
    tableModel.moveColumn(from, to);
}
项目:rapidminer    文件:AttributeEditor.java   
@Override
public void columnAdded(TableColumnModelEvent e) {
    super.columnAdded(e);
    // bigger default size
    TableColumn column = getColumnModel().getColumn(getColumnModel().getColumnCount() - 1);
    column.setPreferredWidth(COLUMN_WIDTH);
}
项目:rapidminer    文件:ExtendedJTable.java   
/** Necessary to properly stopping the editing when a column is moved (dragged). */
@Override
public void columnMoved(final TableColumnModelEvent e) {
    if (isEditing()) {
        cellEditor.stopCellEditing();
    }
    super.columnMoved(e);
}
项目:gate-core    文件:XJTable.java   
/**
 * Overridden to fix 
 * //http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4330950:
 */ 
@Override
public void columnMoved(TableColumnModelEvent e) {
  if (isEditing()) {
      cellEditor.stopCellEditing();
  }
  super.columnMoved(e);
}
项目:openjdk-jdk10    文件:JTableOperator.java   
/**
 * Maps {@code JTable.columnAdded(TableColumnModelEvent)} through queue
 */
public void columnAdded(final TableColumnModelEvent tableColumnModelEvent) {
    runMapping(new MapVoidAction("columnAdded") {
        @Override
        public void map() {
            ((JTable) getSource()).columnAdded(tableColumnModelEvent);
        }
    });
}
项目:openjdk-jdk10    文件:JTableOperator.java   
/**
 * Maps {@code JTable.columnMoved(TableColumnModelEvent)} through queue
 */
public void columnMoved(final TableColumnModelEvent tableColumnModelEvent) {
    runMapping(new MapVoidAction("columnMoved") {
        @Override
        public void map() {
            ((JTable) getSource()).columnMoved(tableColumnModelEvent);
        }
    });
}
项目:openjdk-jdk10    文件:JTableOperator.java   
/**
 * Maps {@code JTable.columnRemoved(TableColumnModelEvent)} through queue
 */
public void columnRemoved(final TableColumnModelEvent tableColumnModelEvent) {
    runMapping(new MapVoidAction("columnRemoved") {
        @Override
        public void map() {
            ((JTable) getSource()).columnRemoved(tableColumnModelEvent);
        }
    });
}
项目:openjdk-jdk10    文件:JTableHeaderOperator.java   
/**
 * Maps {@code JTableHeader.columnAdded(TableColumnModelEvent)} through queue
 */
public void columnAdded(final TableColumnModelEvent tableColumnModelEvent) {
    runMapping(new MapVoidAction("columnAdded") {
        @Override
        public void map() {
            ((JTableHeader) getSource()).columnAdded(tableColumnModelEvent);
        }
    });
}
项目:openjdk-jdk10    文件:JTableHeaderOperator.java   
/**
 * Maps {@code JTableHeader.columnRemoved(TableColumnModelEvent)}
 * through queue
 */
public void columnRemoved(final TableColumnModelEvent tableColumnModelEvent) {
    runMapping(new MapVoidAction("columnRemoved") {
        @Override
        public void map() {
            ((JTableHeader) getSource()).columnRemoved(tableColumnModelEvent);
        }
    });
}
项目:openjdk-jdk10    文件:JTableHeaderOperator.java   
/**
 * Maps {@code JTableHeader.columnMoved(TableColumnModelEvent)} through queue
 */
public void columnMoved(final TableColumnModelEvent tableColumnModelEvent) {
    runMapping(new MapVoidAction("columnMoved") {
        @Override
        public void map() {
            ((JTableHeader) getSource()).columnMoved(tableColumnModelEvent);
        }
    });
}
项目:scorekeeperfrontend    文件:DriverTable.java   
@Override
public void setColumnSizes(TableColumnModelEvent e)
{
    TableColumnModel tcm = (TableColumnModel)e.getSource();
    int cc = tcm.getColumnCount();
    if (cc <= 1) return;

    setColumnWidths(tcm.getColumn(0), 40, 60, 75);
    setColumnWidths(tcm.getColumn(1), 80, 250, 400);
    doLayout();
}
项目:scorekeeperfrontend    文件:RunsTable.java   
public void setColumnSizes(TableColumnModelEvent e)
{
    TableColumnModel tcm = (TableColumnModel)e.getSource();
    for (int ii = 0; ii < tcm.getColumnCount(); ii++)
    {
        setColumnWidths(tcm.getColumn(ii), 70, 95, 200);
    }
    doLayout();
}
项目:openjdk9    文件:JTableOperator.java   
/**
 * Maps {@code JTable.columnAdded(TableColumnModelEvent)} through queue
 */
public void columnAdded(final TableColumnModelEvent tableColumnModelEvent) {
    runMapping(new MapVoidAction("columnAdded") {
        @Override
        public void map() {
            ((JTable) getSource()).columnAdded(tableColumnModelEvent);
        }
    });
}
项目:openjdk9    文件:JTableOperator.java   
/**
 * Maps {@code JTable.columnMoved(TableColumnModelEvent)} through queue
 */
public void columnMoved(final TableColumnModelEvent tableColumnModelEvent) {
    runMapping(new MapVoidAction("columnMoved") {
        @Override
        public void map() {
            ((JTable) getSource()).columnMoved(tableColumnModelEvent);
        }
    });
}
项目:openjdk9    文件:JTableOperator.java   
/**
 * Maps {@code JTable.columnRemoved(TableColumnModelEvent)} through queue
 */
public void columnRemoved(final TableColumnModelEvent tableColumnModelEvent) {
    runMapping(new MapVoidAction("columnRemoved") {
        @Override
        public void map() {
            ((JTable) getSource()).columnRemoved(tableColumnModelEvent);
        }
    });
}
项目:openjdk9    文件:JTableHeaderOperator.java   
/**
 * Maps {@code JTableHeader.columnAdded(TableColumnModelEvent)} through queue
 */
public void columnAdded(final TableColumnModelEvent tableColumnModelEvent) {
    runMapping(new MapVoidAction("columnAdded") {
        @Override
        public void map() {
            ((JTableHeader) getSource()).columnAdded(tableColumnModelEvent);
        }
    });
}
项目:openjdk9    文件:JTableHeaderOperator.java   
/**
 * Maps {@code JTableHeader.columnRemoved(TableColumnModelEvent)}
 * through queue
 */
public void columnRemoved(final TableColumnModelEvent tableColumnModelEvent) {
    runMapping(new MapVoidAction("columnRemoved") {
        @Override
        public void map() {
            ((JTableHeader) getSource()).columnRemoved(tableColumnModelEvent);
        }
    });
}
项目:openjdk9    文件:JTableHeaderOperator.java   
/**
 * Maps {@code JTableHeader.columnMoved(TableColumnModelEvent)} through queue
 */
public void columnMoved(final TableColumnModelEvent tableColumnModelEvent) {
    runMapping(new MapVoidAction("columnMoved") {
        @Override
        public void map() {
            ((JTableHeader) getSource()).columnMoved(tableColumnModelEvent);
        }
    });
}
项目:j2se_for_android    文件:JTable.java   
public void columnMoved(TableColumnModelEvent e) {
    if (isEditing() && !getCellEditor().stopCellEditing()) {
        getCellEditor().cancelCellEditing();
    }
    isForceRefreshTable = true;
    repaint();
}
项目:j2se_for_android    文件:DefaultTableColumnModel.java   
public void addColumn(TableColumn aColumn) {
    if (aColumn == null) {
        throw new IllegalArgumentException("Object is null");
    }

    tableColumns.addElement(aColumn);
    invalidateWidthCache();
    fireColumnAdded(new TableColumnModelEvent(this, 0, getColumnCount() - 1));
}
项目:j2se_for_android    文件:DefaultTableColumnModel.java   
public void removeColumn(TableColumn column) {
    int columnIndex = tableColumns.indexOf(column);

    if (columnIndex != -1) {
        if (selectionModel != null) {
            selectionModel.removeIndexInterval(columnIndex, columnIndex);
        }

        column.removePropertyChangeListener(this);
        tableColumns.removeElementAt(columnIndex);
        invalidateWidthCache();

        fireColumnRemoved(new TableColumnModelEvent(this, columnIndex, 0));
    }
}
项目:j2se_for_android    文件:DefaultTableColumnModel.java   
public void moveColumn(int columnIndex, int newIndex) {
    if ((columnIndex < 0) || (columnIndex >= getColumnCount())
            || (newIndex < 0) || (newIndex >= getColumnCount()))
        throw new IllegalArgumentException(
                "moveColumn() - Index out of range");

    TableColumn aColumn;

    if (columnIndex == newIndex) {
        fireColumnMoved(new TableColumnModelEvent(this, columnIndex,
                newIndex));
        return;
    }
    aColumn = tableColumns.elementAt(columnIndex);

    tableColumns.removeElementAt(columnIndex);
    boolean selected = selectionModel.isSelectedIndex(columnIndex);
    selectionModel.removeIndexInterval(columnIndex, columnIndex);

    tableColumns.insertElementAt(aColumn, newIndex);
    selectionModel.insertIndexInterval(newIndex, 1, true);
    if (selected) {
        selectionModel.addSelectionInterval(newIndex, newIndex);
    } else {
        selectionModel.removeSelectionInterval(newIndex, newIndex);
    }

    fireColumnMoved(new TableColumnModelEvent(this, columnIndex, newIndex));
}
项目:j2se_for_android    文件:DefaultTableColumnModel.java   
protected void fireColumnAdded(TableColumnModelEvent e) {
    Object[] listeners = listenerList.getListenerList();
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
        if (listeners[i] == TableColumnModelListener.class) {
            ((TableColumnModelListener) listeners[i + 1]).columnAdded(e);
        }
    }
}
项目:j2se_for_android    文件:DefaultTableColumnModel.java   
protected void fireColumnRemoved(TableColumnModelEvent e) {
    Object[] listeners = listenerList.getListenerList();
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
        if (listeners[i] == TableColumnModelListener.class) {
            ((TableColumnModelListener) listeners[i + 1]).columnRemoved(e);
        }
    }
}
项目:j2se_for_android    文件:DefaultTableColumnModel.java   
protected void fireColumnMoved(TableColumnModelEvent e) {
    Object[] listeners = listenerList.getListenerList();
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
        if (listeners[i] == TableColumnModelListener.class) {
            ((TableColumnModelListener) listeners[i + 1]).columnMoved(e);
        }
    }
}
项目:javify    文件:JTable.java   
public void columnAdded(TableColumnModelEvent event)
{
  firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
                     null, null);
  handleColumnChange(AccessibleTableModelChange.INSERT,
                     event.getFromIndex(), event.getToIndex());
}
项目:javify    文件:JTable.java   
public void columnRemoved(TableColumnModelEvent event)
{
  firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
                     null, null);
  handleColumnChange(AccessibleTableModelChange.DELETE,
                     event.getFromIndex(), event.getToIndex());
}
项目:javify    文件:JTable.java   
public void columnMoved(TableColumnModelEvent event)
{
  firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
                     null, null);
  handleColumnChange(AccessibleTableModelChange.DELETE,
                     event.getFromIndex(), event.getFromIndex());
  handleColumnChange(AccessibleTableModelChange.INSERT,
                     event.getFromIndex(), event.getToIndex());
}
项目:javify    文件:JTable.java   
/**
 * Invoked when the column is moved. Revalidates and repains the table.
 */
public void columnMoved (TableColumnModelEvent event)
{
  if (isEditing())
    editingCanceled(null);
  revalidate();
  repaint();
}