次の行を含む次のテーブルを SWT でレンダリングしようとしています。
名前1 | anotherProperty |BUTTON1(EDIT) BUTTON2(REMOVE) BUTTON3(DEACTIVATE)
SWT - Tableviewer を使用してテーブルの列に削除ボタンを追加すると、列ごとにボタンを1 つだけレンダリングできました。
これを行う方法はありますか?
次の行を含む次のテーブルを SWT でレンダリングしようとしています。
名前1 | anotherProperty |BUTTON1(EDIT) BUTTON2(REMOVE) BUTTON3(DEACTIVATE)
SWT - Tableviewer を使用してテーブルの列に削除ボタンを追加すると、列ごとにボタンを1 つだけレンダリングできました。
これを行う方法はありますか?
単一のボタンを追加するのと同じ方法で、複数のボタンを追加することもできますが、それらのボタンには追加のコンテナーが必要になります。以下のようなものを試すことができます:
col.setLabelProvider(new ColumnLabelProvider() {
@Override
public void update(ViewerCell cell) {
TableItem item = (TableItem) cell.getItem();
Composite buttonPane = new Composite(getTable(), SWT.NONE);
buttonPane.setLayout(new FillLayout());
Button button = new Button(buttonPane,SWT.NONE);
button.setText("Edit");
button = new Button(buttonPane,SWT.NONE);
button.setText("Remove");
button = new Button(buttonPane,SWT.NONE);
button.setText("Deactivate");
TableEditor editor = new TableEditor(getTable());
editor.grabHorizontal = true;
editor.grabVertical = true;
editor.setEditor(buttonPane, item, columnIndex);
editor.layout();
}
});