Package javax.swing.event

Examples of javax.swing.event.TableColumnModelEvent


                    for (int j = 0, n = previousEventObjects.size(); j < n; j++) {
                        EventObject previousEvent = previousEventObjects.get(j);
                        EventObject currentEvent = currentEventObjects.get(j);
                       
                        if (previousEvent instanceof TableColumnModelEvent) {
                            TableColumnModelEvent previous = (TableColumnModelEvent) previousEvent;
                            TableColumnModelEvent current = (TableColumnModelEvent) currentEvent;

                            assertEquals(previous.getFromIndex(), current.getFromIndex());
                            assertEquals(previous.getToIndex(), current.getToIndex());

                        } else if (previousEvent instanceof ChangeEvent) {
                            assertEquals(ChangeEvent.class, previousEvent.getClass());
                            assertEquals(ChangeEvent.class, currentEvent.getClass());

                        } else if (previousEvent instanceof ListSelectionEvent) {
                            ListSelectionEvent previous = (ListSelectionEvent) previousEvent;
                            ListSelectionEvent current = (ListSelectionEvent) currentEvent;

                            assertEquals(previous.getFirstIndex(), current.getFirstIndex());
                            assertEquals(previous.getLastIndex(), current.getLastIndex());
                            assertEquals(previous.getValueIsAdjusting(), current.getValueIsAdjusting());
                        }
                    }
                }

                previousEntry = currentEntry;
View Full Code Here


            return;
        }
        columnList.clear();
        for (int x = 0; x < order.size(); x++) {
            for (TableColumnModelListener l : watchers) {
                l.columnRemoved(new TableColumnModelEvent(this, x, x));
            }
        }

        // First, empty showOrder
        shown.clear();
        MainFrame mainFrame = MainFrame.getInstance();
        int x = 0;
        for (Sortables c : other.order) {
            if (!c.isAvailable(mainFrame)) {
                continue;
            }

            shown.add(c);
            TableColumn tc = makeTableColumn(x, c);
            columnList.add(tc);
            for (TableColumnModelListener l : watchers) {
                l.columnAdded(new TableColumnModelEvent(this, x, x));
            }
            x++;
        }
        dlsm = new DefaultListSelectionModel();
        dlsm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
View Full Code Here

            for (int x = 0; x < columnList.size(); x++) {
                columnList.get(x).setModelIndex(x);
            }
            orderUpdate();
            for (TableColumnModelListener l : watchers) {
                l.columnAdded(new TableColumnModelEvent(this, columnList.size() - 1, columnList.size() - 1));
            }
        } else if (!on) {
            shown.remove(s);
            for (int x = 0; x < columnList.size(); x++) {
                columnList.get(x).setModelIndex(x);
            }

            for (int counter = 0; counter < columnList.size(); counter++) {
                TableColumn tc = columnList.get(counter);
                if (tc.getIdentifier().equals(s)) {
                    columnList.remove(counter);
                    for (int x = counter; x < columnList.size(); x++) {
                        columnList.get(x).setModelIndex(x);
                    }

                    orderUpdate();
                    for (TableColumnModelListener l : watchers) {
                        l.columnRemoved(new TableColumnModelEvent(this, counter, counter));
                    }

                }
            }
        }
View Full Code Here

        from.setModelIndex(toIndex);

        orderUpdate();

        for (TableColumnModelListener w : new ArrayList<TableColumnModelListener>(watchers)) {
            w.columnMoved(new TableColumnModelEvent(this, fromIndex, toIndex));
        }
    }
View Full Code Here

        }
        tableColumns.add(column);
        totalColumnWidth = -1;
        column.addPropertyChangeListener(this);
        alignSelectionModelToColumns();
        fireColumnAdded(new TableColumnModelEvent(this, tableColumns.size() - 2 >= 0 ? tableColumns.size() - 2 : tableColumns.size() - 1, tableColumns.size() - 1));
    }
View Full Code Here

        if (tableColumns.remove(column)) {
            totalColumnWidth = -1;
            column.removePropertyChangeListener(this);
        }
        alignSelectionModelToColumns();
        fireColumnRemoved(new TableColumnModelEvent(this, index, index));
    }
View Full Code Here

            } else {
                selectionModel.removeSelectionInterval(newIndex, newIndex);
            }
        }

        fireColumnMoved(new TableColumnModelEvent(this, columnIndex, newIndex));
    }
View Full Code Here

     * @param to   where to move the column.
     */
    public synchronized void moveColumn(int from, int to) {
        // We need to trigger these for the file table to display the 'column dragging' animation.
        if(from == to) {
            triggerColumnMoved(new TableColumnModelEvent(this, from, to));
            return;
        }

        TableColumn column; // Buffer for the table to remove.
        int         index;  // Used to store the internal index of 'from' and 'to'.

        // Locates the internal index of the requested column
        // and removes that column
        index  = getInternalIndex(from);
        column = columns.get(index);
        columns.remove(index);

        // If the column needs to be moved at the end of the set,
        // no need to locate its correct index.
        if(to == countCache - 1)
            columns.add(column);

        // Otherwise, finds the column's internal index and inserts
        // it there.
        else {
            index  = getInternalIndex(to);
            columns.add(index, column);
        }

        // Notifies listeners and stores the new configuration.
        triggerColumnMoved(new TableColumnModelEvent(this, from, to));
    }
View Full Code Here

        }
        tableColumns.add(column);
        totalColumnWidth = -1;
        column.addPropertyChangeListener(this);
        alignSelectionModelToColumns();
        fireColumnAdded(new TableColumnModelEvent(this, tableColumns.size() - 2 >= 0 ? tableColumns.size() - 2 : tableColumns.size() - 1, tableColumns.size() - 1));
    }
View Full Code Here

        if (tableColumns.remove(column)) {
            totalColumnWidth = -1;
            column.removePropertyChangeListener(this);
        }
        alignSelectionModelToColumns();
        fireColumnRemoved(new TableColumnModelEvent(this, index, index));
    }
View Full Code Here

TOP

Related Classes of javax.swing.event.TableColumnModelEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.