Search in sources :

Example 11 with AbstractTableModel

use of javax.swing.table.AbstractTableModel in project intellij-community by JetBrains.

the class CodeStyleImportsPanelBase method refreshTable.

private void refreshTable(final JBTable table, final PackageEntryTable packageTable) {
    AbstractTableModel model = (AbstractTableModel) table.getModel();
    table.createDefaultColumnsFromModel();
    model.fireTableDataChanged();
    ImportLayoutPanel.resizeColumns(packageTable, table, myImportLayoutPanel.areStaticImportsEnabled());
}
Also used : AbstractTableModel(javax.swing.table.AbstractTableModel)

Example 12 with AbstractTableModel

use of javax.swing.table.AbstractTableModel in project intellij-community by JetBrains.

the class AddEditRemovePanel method initTable.

private void initTable() {
    myTableModel = new AbstractTableModel() {

        public int getColumnCount() {
            return myModel.getColumnCount();
        }

        public int getRowCount() {
            return myData != null ? myData.size() : 0;
        }

        public Class getColumnClass(int columnIndex) {
            return myModel.getColumnClass(columnIndex);
        }

        public String getColumnName(int column) {
            return myModel.getColumnName(column);
        }

        public Object getValueAt(int rowIndex, int columnIndex) {
            return myModel.getField(myData.get(rowIndex), columnIndex);
        }

        @Override
        public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
            myModel.setValue(aValue, myData.get(rowIndex), columnIndex);
            fireTableRowsUpdated(rowIndex, rowIndex);
        }

        @Override
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return myModel.isEditable(columnIndex);
        }
    };
    myTable = createTable();
    myTable.setModel(myTableModel);
    myTable.setShowColumns(false);
    myTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    myTable.setStriped(true);
    new DoubleClickListener() {

        @Override
        protected boolean onDoubleClick(MouseEvent event) {
            doEdit();
            return true;
        }
    }.installOn(myTable);
}
Also used : MouseEvent(java.awt.event.MouseEvent) AbstractTableModel(javax.swing.table.AbstractTableModel)

Example 13 with AbstractTableModel

use of javax.swing.table.AbstractTableModel in project processdash by dtuma.

the class TaskScheduleDialog method evRecalculated.

public void evRecalculated(EventObject e) {
    recalcActiveMilestoneDateRow();
    // We have to manually generate events for the JTreeTable,
    // since it has installed some wrapper object to convert the
    // TreeTableModel into a TableModel.
    AbstractTableModel model = (AbstractTableModel) treeTable.getModel();
    model.fireTableChanged(new TableModelEvent(model, 0, treeTable.getRowCount() - 1));
    // Calculating the schedule may mean that direct time columns now
    // need to be displayed or hidden
    showHideColumns();
    // Since rows may have been added or deleted to the schedule, and
    // rows may have changed to or from automatic rows, update the
    // buttons appropriately.
    enableScheduleButtons();
    // Display the error button if necessary.
    maybeDisplayErrorButton();
    // highlight any errors in the EVModel if they exist.
    highlightErrors(getErrors());
}
Also used : TableModelEvent(javax.swing.event.TableModelEvent) AbstractTableModel(javax.swing.table.AbstractTableModel)

Example 14 with AbstractTableModel

use of javax.swing.table.AbstractTableModel in project cayenne by apache.

the class TemplatePreferences method addTemplateAction.

public void addTemplateAction() {
    FSPath path = new TemplateCreator(this).startupAction();
    if (path != null) {
        int len = templateEntries.size();
        templateEntries.add(path);
        ((AbstractTableModel) view.getTable().getModel()).fireTableRowsInserted(len, len);
    }
}
Also used : FSPath(org.apache.cayenne.modeler.pref.FSPath) AbstractTableModel(javax.swing.table.AbstractTableModel)

Example 15 with AbstractTableModel

use of javax.swing.table.AbstractTableModel in project cayenne by apache.

the class MergerTokenSelectorController method reverseAllAction.

public void reverseAllAction() {
    isReverse = !isReverse;
    for (int i = 0; i < selectableTokensList.size(); i++) {
        MergerToken token = selectableTokensList.get(i);
        MergerToken reverse = token.createReverse(mergerTokenFactory);
        selectableTokensList.set(i, reverse);
        if (excludedTokens.remove(token)) {
            excludedTokens.add(reverse);
        }
    }
    Collections.sort(selectableTokensList);
    AbstractTableModel model = (AbstractTableModel) view.getTokens().getModel();
    model.fireTableDataChanged();
}
Also used : MergerToken(org.apache.cayenne.dbsync.merge.token.MergerToken) AbstractTableModel(javax.swing.table.AbstractTableModel)

Aggregations

AbstractTableModel (javax.swing.table.AbstractTableModel)31 TableModel (javax.swing.table.TableModel)8 PackageEntry (com.intellij.psi.codeStyle.PackageEntry)4 JTable (javax.swing.JTable)4 JBTable (com.intellij.ui.table.JBTable)3 JFrame (javax.swing.JFrame)3 JScrollPane (javax.swing.JScrollPane)3 JButton (javax.swing.JButton)2 JPanel (javax.swing.JPanel)2 TableModelEvent (javax.swing.event.TableModelEvent)2 TableRowSorter (javax.swing.table.TableRowSorter)2 FormBuilder (com.jgoodies.forms.builder.FormBuilder)1 FormLayout (com.jgoodies.forms.layout.FormLayout)1 Dimension (java.awt.Dimension)1 Font (java.awt.Font)1 Point (java.awt.Point)1 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1 MouseEvent (java.awt.event.MouseEvent)1 MalformedURLException (java.net.MalformedURLException)1 ArrayList (java.util.ArrayList)1