javax.swing.table.TableColumnModel.addColumnModelListener()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中javax.swing.table.TableColumnModel.addColumnModelListener()方法的一些代码示例,展示了TableColumnModel.addColumnModelListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableColumnModel.addColumnModelListener()方法的具体详情如下:
包路径:javax.swing.table.TableColumnModel
类名称:TableColumnModel
方法名:addColumnModelListener

TableColumnModel.addColumnModelListener介绍

暂无

代码示例

代码示例来源:origin: de.sciss/jtreetable

@Override
public void addColumnModelListener(TableColumnModelListener x) {
  delegate.addColumnModelListener(x);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui

private void hookColumns() {
    table.getColumnModel().addColumnModelListener(new TableColumnModelListener() {
      public void columnAdded(TableColumnModelEvent e) { repaint(); }
      public void columnRemoved(TableColumnModelEvent e) { repaint(); }
      public void columnMoved(TableColumnModelEvent e) { repaint(); }
      public void columnMarginChanged(ChangeEvent e) { repaint(); }
      public void columnSelectionChanged(ListSelectionEvent e) { repaint(); }
    });
    listening = true;
  }
};

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-bugtracking-commons

@Override
public void mousePressed(MouseEvent e) {
  table.getColumnModel().addColumnModelListener(tcml);
}
@Override

代码示例来源:origin: com.github.haifengl/smile-plot

/**
 * Apply this column settings to given table. This object will also listen
 * to table column model events.
 * @param table A JTable to apply column settings.
 */
public void apply(JTable table) {
  this.table = table;
  restoreSettings();
  table.getColumnModel().addColumnModelListener(this);
}

代码示例来源:origin: org.geotools/gt2-widgets-swing

/**
 * Construct a new cell renderer.
 */
public CellRenderer() {
  foreground = super.getForeground();
  background = super.getBackground();
  table.getColumnModel().addColumnModelListener(this);
}

代码示例来源:origin: org.zaproxy/zap

/**
 * Reset the TableColumnManager to only manage the TableColumns that are
 * currently visible in the table.
 * 
 * Generally this method should only be invoked by the TableColumnManager
 * when the TableModel of the table is changed.
 */
public void reset() {
  table.getColumnModel().removeColumnModelListener(this);
  columnModel = table.getColumnModel();
  columnModel.addColumnModelListener(this);
  // Keep a duplicate TableColumns for managing hidden TableColumns
  int count = columnModel.getColumnCount();
  allColumns = new ArrayList<>(count);
  for (int i = 0; i < count; i++) {
    allColumns.add(columnModel.getColumn(i));
  }
}

代码示例来源:origin: net.sf.sfac/sfac-core

/**
 * Register all necassary listener to the table objects, so this model can react to click on column headers and display arrows
 * for sort direction in column headers.
 * <p>
 * More than one table can be registerd to this model.
 * 
 * @param table
 *            the table using this model.
 */
public void registerToTableColumns(JTable table) {
  TableColumnModel cm = table.getColumnModel();
  cm.addColumnModelListener(columnModelListener);
  setTableColumnHeaderRenderers(cm, 0, cm.getColumnCount() - 1);
  JTableHeader tableHeader = table.getTableHeader();
  tableHeader.addMouseListener(tableHeaderListener);
  tableHeaders.add(tableHeader);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui

private void hookHeaderColumnResize() {
  treeTable.getTableHeader().getColumnModel().addColumnModelListener(new TableColumnModelListener() {
    public void columnAdded(TableColumnModelEvent e) {
      treeTableViewport.repaint();
    }
    public void columnMoved(TableColumnModelEvent e) {
      treeTableViewport.repaint();
    }
    public void columnRemoved(TableColumnModelEvent e) {
      treeTableViewport.repaint();
    }
    public void columnMarginChanged(ChangeEvent e) {
      treeTableViewport.repaint();
      updateScrollBar(true);
    }
    public void columnSelectionChanged(ListSelectionEvent e) {}
  });
}

代码示例来源:origin: org.zaproxy/zap

/**
 * Hide a column from view in the table.
 * 
 * @param column
 *            the TableColumn to be removed from the TableColumnModel of the
 *            table
 */
public void hideColumn(TableColumn column) {
  if (columnModel.getColumnCount() == 1) {
    return;
  }
  // Ignore changes to the TableColumnModel made by the TableColumnManager
  columnModel.removeColumnModelListener(this);
  columnModel.removeColumn(column);
  columnModel.addColumnModelListener(this);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui

private void hookHeaderColumnResize() {
  if (extendedTable.getTableHeader() != null) {
    extendedTable.getTableHeader().getColumnModel().addColumnModelListener(new TableColumnModelListener() {
        public void columnAdded(TableColumnModelEvent e) {
          extendedTableViewport.repaint();
        }
        public void columnMoved(TableColumnModelEvent e) {
          extendedTableViewport.repaint();
        }
        public void columnRemoved(TableColumnModelEvent e) {
          extendedTableViewport.repaint();
        }
        public void columnMarginChanged(ChangeEvent e) {
          extendedTableViewport.repaint();
        }
        public void columnSelectionChanged(ListSelectionEvent e) {
        } // Ignored
      });
  }
}

代码示例来源:origin: mucommander/mucommander

public SortByAction(MainFrame mainFrame, Map<String,Object> properties, Column column) {
  super(mainFrame, properties);
  this.column = column;
  mainFrame.addActivePanelListener(this);
  mainFrame.getLeftPanel().getFileTable().getColumnModel().addColumnModelListener(this);
  mainFrame.getRightPanel().getFileTable().getColumnModel().addColumnModelListener(this);
  updateState(mainFrame.getActiveTable());
}

代码示例来源:origin: com.google.code.validationframework/validationframework-swing

/**
 * @see AbstractIconFeedback#detach()
 */
@Override
public void attach(JComponent decoratedComponent, AnchorLink anchorLinkWithOwner) {
  super.attach(decoratedComponent, anchorLinkWithOwner);
  if (decoratedComponent instanceof JTable) {
    table = (JTable) decoratedComponent;
    table.addComponentListener(cellTracker);
    table.addPropertyChangeListener("columnModel", cellTracker);
    if (table.getColumnModel() != null) {
      table.getColumnModel().addColumnModelListener(cellTracker);
    }
    table.addPropertyChangeListener("sorter", cellTracker);
    table.addPropertyChangeListener("rowSorter", cellTracker);
    if (table.getRowSorter() != null) {
      table.getRowSorter().addRowSorterListener(cellTracker);
    }
  }
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

/**
 * Adjusts internal state after table's column model property has changed.
 * Handles cleanup of listeners to the old/new columnModel (Note, that
 * it listens to the column model only if it can control column visibility).
 * Updates content of popup.
 * 
 * @param oldModel the old <code>TableColumnModel</code> we had been listening to.
 */
protected void updateFromColumnModelChange(TableColumnModel oldModel) {
  if (oldModel != null) {
    oldModel.removeColumnModelListener(columnModelListener);
  }
  populatePopup();
  if (canControl()) {
    table.getColumnModel().addColumnModelListener(getColumnModelListener());
  }
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

/**
 * Adjusts internal state after table's column model property has changed.
 * Handles cleanup of listeners to the old/new columnModel (Note, that
 * it listens to the column model only if it can control column visibility).
 * Updates content of popup.
 * 
 * @param oldModel the old <code>TableColumnModel</code> we had been listening to.
 */
protected void updateFromColumnModelChange(TableColumnModel oldModel) {
  if (oldModel != null) {
    oldModel.removeColumnModelListener(columnModelListener);
  }
  populatePopup();
  if (canControl()) {
    table.getColumnModel().addColumnModelListener(getColumnModelListener());
  }
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

/**
 * Adjusts internal state after table's column model property has changed.
 * Handles cleanup of listeners to the old/new columnModel (Note, that
 * it listens to the column model only if it can control column visibility).
 * Updates content of popup.
 * 
 * @param oldModel the old <code>TableColumnModel</code> we had been listening to.
 */
protected void updateFromColumnModelChange(TableColumnModel oldModel) {
  if (oldModel != null) {
    oldModel.removeColumnModelListener(columnModelListener);
  }
  populatePopup();
  if (canControl()) {
    table.getColumnModel().addColumnModelListener(getColumnModelListener());
  }
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

/**
 * Adjusts internal state after table's column model property has changed.
 * Handles cleanup of listeners to the old/new columnModel (Note, that
 * it listens to the column model only if it can control column visibility).
 * Updates content of popup.
 * 
 * @param oldModel the old <code>TableColumnModel</code> we had been listening to.
 */
protected void updateFromColumnModelChange(TableColumnModel oldModel) {
  if (oldModel != null) {
    oldModel.removeColumnModelListener(columnModelListener);
  }
  populatePopup();
  if (canControl()) {
    table.getColumnModel().addColumnModelListener(getColumnModelListener());
  }
}

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

/**
 * Adjusts internal state after table's column model property has changed.
 * Handles cleanup of listeners to the old/new columnModel (Note, that
 * it listens to the column model only if it can control column visibility).
 * Updates content of popup.
 * 
 * @param oldModel the old <code>TableColumnModel</code> we had been listening to.
 */
protected void updateFromColumnModelChange(TableColumnModel oldModel) {
  if (oldModel != null) {
    oldModel.removeColumnModelListener(columnModelListener);
  }
  populatePopup();
  if (canControl()) {
    table.getColumnModel().addColumnModelListener(getColumnModelListener());
  }
}

代码示例来源:origin: com.eas.platypus/platypus-js-grid

/**
 * ConstrainedColumnModel constructor.
 *
 * @param aDelegate A <code>TableColumnModel</code> instance all significant
 * work is delegated to.
 * @param aConstraint A <code>LinearConstraint</code> instacne defining the
 * constraint.
 * @see TableColumnModel
 */
public ConstrainedColumnModel(TableColumnModel aDelegate, LinearConstraint aConstraint) {
  super();
  delegate = aDelegate;
  constraint = aConstraint;
  columnSelectionAllowed = delegate.getColumnSelectionAllowed();
  columnMargin = delegate.getColumnMargin();
  delegate.addColumnModelListener(new DelegatedColumnModelListener());
  constraint.addConstraintChangeListener(new ConstraintListener());
}

代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit

VFSDirectoryEntryTable(BrowserView browserView)
{
  super(new VFSDirectoryEntryTableModel());
  this.browserView = browserView;
  setShowGrid(false);
  setIntercellSpacing(new Dimension(0,0));
  setDefaultRenderer(VFSDirectoryEntryTableModel.Entry.class,
    renderer = new FileCellRenderer());
  header = getTableHeader();
  header.setReorderingAllowed(false);
  addMouseListener(new MainMouseHandler());
  header.addMouseListener(new MouseHandler());
  header.setDefaultRenderer(new HeaderRenderer(
    (DefaultTableCellRenderer)header.getDefaultRenderer()));
  setRowSelectionAllowed(true);
  getColumnModel().addColumnModelListener(new ColumnHandler());
  setAutoResizeMode(AUTO_RESIZE_OFF);
} //}}}

代码示例来源:origin: cytoscape.coreplugins/attribute-browser

private void initialize() {
  this.setSize(400, 300);
  this.setCellSelectionEnabled(true);
  this.getPopupMenu();
  this.getHeaderPopupMenu();
  
  setKeyStroke();
  Cytoscape.getSwingPropertyChangeSupport().addPropertyChangeListener(this);
  setSelectedColor(SELECTED_NODE);
  setSelectedColor(REV_SELECTED_NODE);
  setSelectedColor(SELECTED_EDGE);
  setSelectedColor(REV_SELECTED_EDGE);
  this.setDefaultRenderer(Object.class, new BrowserTableCellRenderer(false, objectType));
  this.getColumnModel().addColumnModelListener(this);
  this.setDefaultEditor(Object.class, new MultiLineTableCellEditor() );
  
  this.getTableHeader().addMouseMotionListener(this);
}

相关文章