天道酬勤,学无止境

tableviewer

SWT - Table vs. TableViewer

I am creating a new project using SWT. I will have 3 or 4 different tables in the project. I am fairly new to SWT and I find myself asking should I be using just the Table or should it be a TableViewer. I am wanting to learn some good guidelines on when to use just the Table and when a TableViewer is the best route. What is the benefit of using a TableViewer instead of a Table? Should all the tables have a TableViewer? If I am working with data from the table, is just the Table the best way? Just really wanting some clarity so as I create the project I do it the right way. EDIT I have created

2021-07-12 15:47:55    分类:问答    java   swt   jface   tableviewer

JFace ColumnWeigthData 导致父级增长(JFace ColumnWeigthData causes parent to grow)

问题 我有一个 Eclipse RCP 应用程序,想在TableViewer使用ColumnWeigthData作为ColumnLayoutData使用动态列大小。 问题是,每当我布局表格时,父表单(示例代码中的ScrolledForm )都会增长几个像素。 要重现,您可以运行该示例并多次打开/关闭该部分。 每次关闭时,该部分都会变宽。 为什么它会这样做,我怎样才能让它停止? package com.test; import org.eclipse.jface.layout.TableColumnLayout; import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite

2021-07-11 16:29:02    分类:技术分享    java   swt   eclipse-rcp   jface   tableviewer

SWT - 表查看器 - 隐藏列并从列中获取值(SWT - Table Viewer - hiding columns and getting values from columns)

问题 我正在尝试从我的表中的数据创建一个数组列表。 我需要从可见列中获取值,但我还需要从表中不可见的列中获取值。 将 SWT 与表查看器一起使用,我不知道如何不在我的表中显示列。 我也不知道如何通过指定列名从表中提取数据。 我一直使用 Swing,所以我一直使用 Table Model Class。 在 Swing 中,创建列、隐藏它们并从中获取数据非常简单。 这就是我在以前的 Swing 项目中所做的。 在我的表模型类中: public String getColumnName(int column) { String s = null; switch (column) { case ITEMID_COL: { s = "ItemId"; break; } 然后getValueAt() public Object getValueAt(int row, int column) { Object o = null; try { switch (column) { case ITEMID_COL: { o = rds.get(row).rev.getItem().getStringProperty("item_id"); break; } 所以当我需要任何其他班级的表中的数据时,我所要做的就是 Object item_id = SingletonSelectTable

2021-07-10 09:24:45    分类:技术分享    java   swt   tableviewer

ColumnViewerTooltipSupport in SWT

What is the exact use of ColumnViewerTooltipSupport? I know that it provides tooltip support for ColumnViewers but does it mean that it provides tooltip for treeViewers? How can I use this feature to provide tooltip support individually different tooltips for my each tree item when the mouse hovers over each item? Do I require a MouseListener for this or does the ColumnViewerTooltipSupport class provide it by default? Can someone please help me out here as I'm relatively new to SWT concepts. My tooltip has multiple lines, How can I wrap the text and display it neatly? It seems like

2021-06-26 11:57:32    分类:问答    java   swt   jface   tableviewer

How to navigate down with enter key in SWT TableViewer

I have a TableViewer and want the selection to go down one cell when I press the enter key, much like in MS Excel. I implemented my own CellNavigationStrategy with the following findSelectedCell. public ViewerCell findSelectedCell(ColumnViewer viewer, ViewerCell currentSelectedCell, Event event) { if (event.type == ColumnViewerEditorActivationEvent.KEY_PRESSED) { if (event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR) { ViewerCell nextCell = currentSelectedCell .getNeighbor(ViewerCell.BELOW, false); return nextCell; } } return null; } This works pretty well as long as I have ViewerCell

2021-06-26 09:07:06    分类:问答    java   swt   tableviewer

SWT - Table Viewer - hiding columns and getting values from columns

I am trying to create an arraylist from the data in my table. I need to get the values from the visible columns, but I also need to get values from columns that are not visible in the table. Using SWT with a Table Viewer, I have no idea on how to not display columns in my table. I also have no idea on how to pull the data from the table by specifying column names. I have always used Swing, so I have always used a Table Model Class. In swing it is pretty simple to create the columns, hide them and get data from them. This is how I have done it in previous Swing projects. In my table model class

2021-06-24 08:07:53    分类:问答    java   swt   tableviewer

JFace ColumnWeigthData causes parent to grow

I got an Eclipse RCP app and want to use dynamic column size in a TableViewer using ColumnWeigthData as ColumnLayoutData. Problem is that the parent form (ScrolledForm in example code) grows a few pixels whenever I layout the table. To reproduce you can run the example and open/close the Section a few times. On every close the section gets wider. Why does it do this and how can I make it stop? package com.test; import org.eclipse.jface.layout.TableColumnLayout; import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers

2021-06-23 21:54:37    分类:问答    java   swt   eclipse-rcp   jface   tableviewer

What does JFace add to SWT?

What is the difference betweem the following: TreeViewer & Tree TableViewer & Table TreeViewerColumn & TreeColumn TableViewerColumn & TableColumn When to use viewer & regular widget? PS: It would a great help if you can help me find a good resource for understanding them.Thanks in advance!

2021-05-17 19:26:27    分类:问答    java   eclipse   swt   jface   tableviewer

将删除按钮添加到表中的列(Adding a remove button to a column in a table)

问题 是否可以向表中的单元格添加“删除”按钮? 我有一个包含5列的表格,我想添加一个第6列。 我希望第六列的每一行都有一个删除按钮。 示例行: | 10002 | 部分金属| 001 | 是的删除| 这样,用户只需单击按钮即可删除所有不需要的行。 我在表中有一个标记列,它是ComboBox 。 我创建了一个扩展EditingSupport的类。 我是否需要制作另一个扩展EditingSupport类,但要创建一个按钮而不是ComboBox ? 编辑 public class AplotDataTableViewer extends TableViewer { public AplotDataTableViewer(Composite parent, int style) { super(parent, style); Table table = getTable(); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); table.setLayoutData(gridData); createColumns(); table.setHeaderVisible(true); table.setLinesVisible(true); setContentProvider(new

2021-04-22 09:37:44    分类:技术分享    java   button   swt   jface   tableviewer

Adding a remove button to a column in a table

Is it possible to add a Remove button to a cell in a table? I have a table with 5 columns, I would like to add a 6th column. I want the 6th column to have a remove button in each row. Example Row: | 10002 | part | Metal | 001 | Yes | Remove | That way the user can remove any unwanted rows by just clicking the button. I have a markup column in the table and it is ComboBox. I created a class that extends EditingSupport. Would I need to make a another class extending EditingSupport, but creating a button instead of ComboBox? EDIT public class AplotDataTableViewer extends TableViewer { public

2021-04-04 21:51:51    分类:问答    java   button   swt   jface   tableviewer