/** {@inheritDoc} */ public void listChanged(ListEvent listChanges) { // KTable has no fine-grained event notification, // so each time the data changes we'll probably break // selection. Hopefully we can resolve this problem // in the future by saving selection and adjusting it // as the model changes table.redraw(); }
private static void createIssuesTable(Shell shell) { BasicEventList issuesEventList = new BasicEventList(); Composite comp1 = new Composite(shell, SWT.NONE); comp1.setLayout(new FillLayout()); final KTable table = new KTable(comp1, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWTX.FILL_WITH_LASTCOL | SWTX.EDIT_ON_KEY); DefaultEventKTableModel tableModel = GlazedListsKTable.eventKTableModelWithThreadProxyList(table, issuesEventList, new IssuesTableFormat()); table.setModel(tableModel); // loads issues final IssueLoader issueLoader = new IssueLoader(issuesEventList, new SimpleThrobber()); issueLoader.start(); issueLoader.setProject(Project.getProjects().get(0)); }
/** * 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 table the KTable the model is created for * @param source the {@link EventList} * @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) { super(table, createProxyList(source, table.getDisplay()), tableFormat); disposeSource = (this.source != source); }
private static void createIssuesTable(Shell shell) { BasicEventList issuesEventList = new BasicEventList(); Composite comp1 = new Composite(shell, SWT.NONE); comp1.setLayout(new FillLayout()); final KTable table = new KTable(comp1, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWTX.FILL_WITH_LASTCOL | SWTX.EDIT_ON_KEY); DefaultEventKTableModel tableModel = GlazedListsKTable.eventKTableModelWithThreadProxyList(table, issuesEventList, new IssuesTableFormat()); table.setModel(tableModel); // loads issues final IssueLoader issueLoader = new IssueLoader(issuesEventList, new SimpleThrobber()); issueLoader.start(); issueLoader.setProject(Project.getProjects().get(0)); }
/** * 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 table the KTable the model is created for * @param source the {@link EventList} * @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) { super(table, createProxyList(source, table.getDisplay()), tableFormat); disposeSource = (this.source != source); }
private static void createIssuesTable(Shell shell) { BasicEventList issuesEventList = new BasicEventList(); Composite comp1 = new Composite(shell, SWT.NONE); comp1.setLayout(new FillLayout()); final KTable table = new KTable(comp1, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWTX.FILL_WITH_LASTCOL | SWTX.EDIT_ON_KEY); EventKTableModel tableModel = new EventKTableModel(table, issuesEventList, new IssuesTableFormat()); table.setModel(tableModel); // loads issues final IssueLoader issueLoader = new IssueLoader(issuesEventList, new SimpleThrobber()); issueLoader.start(); issueLoader.setProject(Project.getProjects().get(0)); }
/** * Create a new {@link DefaultEventKTableModel} that uses elements from the * specified {@link EventList} as rows, and the specified {@link TableFormat} * to divide row objects across columns. * * <p>The returned model is <strong>not thread-safe</strong>. Unless otherwise * noted, all methods are only safe to be called from the SWT event handler thread. * </p> * * @param table the KTable the model is created for * @param source the {@link EventList} * @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 static DefaultEventKTableModel eventKTableModelWithThreadProxyList(KTable table, EventList source, TableFormat tableFormat) { final EventList proxySource = GlazedListsSWT.createSwtThreadProxyListWithLock(source, table.getDisplay()); return new DefaultEventKTableModel(table, proxySource, tableFormat, true); } }
/** {@inheritDoc} */ @Override public void listChanged(ListEvent listChanges) { // KTable has no fine-grained event notification, // so each time the data changes we'll probably break // selection. Hopefully we can resolve this problem // in the future by saving selection and adjusting it // as the model changes table.redraw(); }
/** * Create a new {@link DefaultEventKTableModel} that uses elements from the * specified {@link EventList} as rows, and the specified {@link TableFormat} * to divide row objects across columns. * * <p>The returned model is <strong>not thread-safe</strong>. Unless otherwise * noted, all methods are only safe to be called from the SWT event handler thread. * </p> * * @param table the KTable the model is created for * @param source the {@link EventList} * @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 static DefaultEventKTableModel eventKTableModelWithThreadProxyList(KTable table, EventList source, TableFormat tableFormat) { final EventList proxySource = GlazedListsSWT.createSwtThreadProxyListWithLock(source, table.getDisplay()); return new DefaultEventKTableModel(table, proxySource, tableFormat, true); } }
/** {@inheritDoc} */ public void listChanged(ListEvent listChanges) { // KTable has no fine-grained event notification, // so each time the data changes we'll probably break // selection. Hopefully we can resolve this problem // in the future by saving selection and adjusting it // as the model changes table.redraw(); }
/** * 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); }