@Override public void addListEventListener(ListEventListener<? super E> listChangeListener) { super.addListEventListener(listChangeListener); // also adjust the table's checked rows if(listChangeListener instanceof DefaultEventTableViewer) { tableChecker = new TableChecker(); super.addListEventListener(tableChecker); } }
@Override public void addListEventListener(ListEventListener<? super E> listChangeListener) { super.addListEventListener(listChangeListener); // also adjust the table's checked rows if(listChangeListener instanceof DefaultEventTableViewer) { tableChecker = new TableChecker(); super.addListEventListener(tableChecker); } }
@Override public void addListEventListener(ListEventListener<? super E> listChangeListener) { super.addListEventListener(listChangeListener); // also adjust the table's checked rows if(listChangeListener instanceof EventTableViewer) { tableChecker = new TableChecker(); super.addListEventListener(tableChecker); } }
/** * Create a new {@link EventKTableModel} that uses elements from the * specified {@link EventList} as rows, and the specified {@link TableFormat} * to divide row objects across columns. * * @param tableFormat provides logic to divide row objects across columns. * If the value implements the {@link KTableFormat} interface, those * methods will be used to provide further details such as cell renderers, * cell editors and row heights. */ public EventKTableModel(KTable table, EventList source, TableFormat tableFormat) { this.table = table; this.swtThreadSource = GlazedListsSWT.swtThreadProxyList(source, table.getDisplay()); // this TableFormat supports KTable directly if(tableFormat instanceof KTableFormat) { this.kTableFormat = (KTableFormat)tableFormat; // adapt a regular TableFormat for use with KTable } else { this.kTableFormat = new TableFormatKTableFormat(tableFormat); } // listen for events on the SWT display thread swtThreadSource.addListEventListener(this); }
/** * Creates a new {@link JEventListPanel} hosting the * {@link JComponent}s from the specified source {@link EventList}. */ public JEventListPanel(EventList<E> source, Format<E> format) { this.swingSource = GlazedListsSwing.swingThreadProxyList(source); this.listLayout = new ListLayout(this, format); this.format = format; this.setLayout(listLayout); // populate the initial elements for(int i = 0; i < swingSource.size(); i++) { sourceChangeHandler.insert(i); } // listen for changes to the source swingSource.addListEventListener(sourceChangeHandler); }
/** * Creates a new {@link JEventListPanel} hosting the * {@link JComponent}s from the specified source {@link EventList}. */ public JEventListPanel(EventList<E> source, Format<E> format) { this.swingSource = GlazedListsSwing.swingThreadProxyList(source); this.listLayout = new ListLayout(this, format); this.format = format; this.setLayout(listLayout); // populate the initial elements for(int i = 0; i < swingSource.size(); i++) { sourceChangeHandler.insert(i); } // listen for changes to the source swingSource.addListEventListener(sourceChangeHandler); }
/** * Creates a new {@link JEventListPanel} hosting the * {@link JComponent}s from the specified source {@link EventList}. */ public JEventListPanel(EventList<E> source, Format<E> format) { this.swingSource = GlazedListsSwing.swingThreadProxyList(source); this.listLayout = new ListLayout(this, format); this.format = format; this.setLayout(listLayout); // populate the initial elements for(int i = 0; i < swingSource.size(); i++) { sourceChangeHandler.insert(i); } // listen for changes to the source swingSource.addListEventListener(sourceChangeHandler); }
/** * Creates a new tree model that extracts the tree data from the given * <code>source</code>. * * @param source a {@link TreeList} that provides the tree data */ public EventTreeModel(TreeList<E> source) { // lock the source list for reading since we want to prevent writes // from occurring until we fully initialize this EventTableModel source.getReadWriteLock().readLock().lock(); try { disposeSwingThreadSource = !GlazedListsSwing.isSwingThreadProxyList(source); swingThreadSource = disposeSwingThreadSource ? GlazedListsSwing.swingThreadProxyList(source) : (TransformedList) source; // prepare listeners swingThreadSource.addListEventListener(this); } finally { source.getReadWriteLock().readLock().unlock(); } this.treeList = source; }
/** * Creates a new tree model that extracts the tree data from the given * <code>source</code>. * * @param source a {@link TreeList} that provides the tree data */ public EventTreeModel(TreeList<E> source) { // lock the source list for reading since we want to prevent writes // from occurring until we fully initialize this EventTableModel source.getReadWriteLock().readLock().lock(); try { disposeSwingThreadSource = !GlazedListsSwing.isSwingThreadProxyList(source); swingThreadSource = disposeSwingThreadSource ? GlazedListsSwing.swingThreadProxyList(source) : (TransformedList) source; // prepare listeners swingThreadSource.addListEventListener(this); } finally { source.getReadWriteLock().readLock().unlock(); } this.treeList = source; }
/** * Creates a new tree model that extracts the tree data from the given * <code>source</code>. * * @param source a {@link TreeList} that provides the tree data */ public EventTreeModel(TreeList<E> source) { // lock the source list for reading since we want to prevent writes // from occurring until we fully initialize this EventTableModel source.getReadWriteLock().readLock().lock(); try { disposeSwingThreadSource = !GlazedListsSwing.isSwingThreadProxyList(source); swingThreadSource = disposeSwingThreadSource ? GlazedListsSwing.swingThreadProxyList(source) : (TransformedList) source; // prepare listeners swingThreadSource.addListEventListener(this); } finally { source.getReadWriteLock().readLock().unlock(); } this.treeList = source; }
/** * Binds the contents of a {@link Combo} component to an {@link EventList} * source. This allows the selection choices in a {@link Combo} to change * dynamically to reflect chances to the source {@link EventList}. The * {@link String} values displayed in the {@link Combo} compoment will be * formatted using the provided {@link ILabelProvider}. * * @see ILabelProvider * @see GlazedListsSWT#beanLabelProvider(String) */ public EventComboViewer(EventList<E> source, Combo combo, ILabelProvider labelProvider) { // lock the source list for reading since we want to prevent writes // from occurring until we fully initialize this EventComboViewer source.getReadWriteLock().readLock().lock(); try { this.swtSource = GlazedListsSWT.swtThreadProxyList(source, combo.getDisplay()); this.combo = combo; this.labelProvider = labelProvider; // set the initial data for(int i = 0, n = source.size(); i < n; i++) { addRow(i, source.get(i)); } // listen for changes swtSource.addListEventListener(this); } finally { source.getReadWriteLock().readLock().unlock(); } }
/** * Creates a new model that contains the {@link TableColumn} objects from * the given <code>source</code>. Changes to the <code>source</code> are * reflected in this model. */ public EventTableColumnModel(EventList<T> source) { setSelectionModel(createSelectionModel()); setColumnMargin(1); invalidateWidthCache(); setColumnSelectionAllowed(false); // lock the source list for reading since we want to prevent writes // from occurring until we fully initialize this EventTableColumnModel source.getReadWriteLock().readLock().lock(); try { // ensure all of the TableColumns are non-null for (int i = 0, n = source.size(); i < n; i++) { if (source.get(i) == null) throw new IllegalStateException("null TableColumn objects are not allowed in EventTableColumnModel"); } // start listening to each of the TableColumns for property changes that may resize the table header for (int i = 0, n = source.size(); i < n; i++) source.get(i).addPropertyChangeListener(this); disposeSwingThreadSource = !GlazedListsSwing.isSwingThreadProxyList(source); swingThreadSource = disposeSwingThreadSource ? GlazedListsSwing.swingThreadProxyList(source) : (TransformedList<T, T>) source; swingThreadSource.addListEventListener(this); } finally { source.getReadWriteLock().readLock().unlock(); } }
/** * Creates a new List that displays and responds to changes in source. * List elements are formatted using the provided {@link ILabelProvider}. */ public EventListViewer(EventList<E> source, List list, ILabelProvider labelProvider) { // lock the source list for reading since we want to prevent writes // from occurring until we fully initialize this EventListViewer source.getReadWriteLock().readLock().lock(); try { swtThreadSource = GlazedListsSWT.swtThreadProxyList(source, list.getDisplay()); this.list = list; this.labelProvider = labelProvider; // Enable the selection lists selection = new SelectionManager<E>(swtThreadSource, new SelectableList()); // setup initial values for(int i = 0, n = swtThreadSource.size(); i < n; i++) { addRow(i, swtThreadSource.get(i)); } // listen for changes swtThreadSource.addListEventListener(this); } finally { source.getReadWriteLock().readLock().unlock(); } }
/** * Creates a new model that contains the {@link TableColumn} objects from * the given <code>source</code>. Changes to the <code>source</code> are * reflected in this model. */ public EventTableColumnModel(EventList<T> source) { setSelectionModel(createSelectionModel()); setColumnMargin(1); invalidateWidthCache(); setColumnSelectionAllowed(false); // lock the source list for reading since we want to prevent writes // from occurring until we fully initialize this EventTableColumnModel source.getReadWriteLock().readLock().lock(); try { // ensure all of the TableColumns are non-null for (int i = 0, n = source.size(); i < n; i++) { if (source.get(i) == null) throw new IllegalStateException("null TableColumn objects are not allowed in EventTableColumnModel"); } // start listening to each of the TableColumns for property changes that may resize the table header for (int i = 0, n = source.size(); i < n; i++) source.get(i).addPropertyChangeListener(this); disposeSwingThreadSource = !GlazedListsSwing.isSwingThreadProxyList(source); swingThreadSource = disposeSwingThreadSource ? GlazedListsSwing.swingThreadProxyList(source) : (TransformedList<T, T>) source; swingThreadSource.addListEventListener(this); } finally { source.getReadWriteLock().readLock().unlock(); } }
/** * Creates a new model that contains the {@link TableColumn} objects from * the given <code>source</code>. Changes to the <code>source</code> are * reflected in this model. */ public EventTableColumnModel(EventList<T> source) { setSelectionModel(createSelectionModel()); setColumnMargin(1); invalidateWidthCache(); setColumnSelectionAllowed(false); // lock the source list for reading since we want to prevent writes // from occurring until we fully initialize this EventTableColumnModel source.getReadWriteLock().readLock().lock(); try { // ensure all of the TableColumns are non-null for (int i = 0, n = source.size(); i < n; i++) { if (source.get(i) == null) throw new IllegalStateException("null TableColumn objects are not allowed in EventTableColumnModel"); } // start listening to each of the TableColumns for property changes that may resize the table header for (int i = 0, n = source.size(); i < n; i++) source.get(i).addPropertyChangeListener(this); disposeSwingThreadSource = !GlazedListsSwing.isSwingThreadProxyList(source); swingThreadSource = disposeSwingThreadSource ? GlazedListsSwing.swingThreadProxyList(source) : (TransformedList<T, T>) source; swingThreadSource.addListEventListener(this); } finally { source.getReadWriteLock().readLock().unlock(); } }