Edit cell value in vaadin table - java

I am new to Vaadin 7. I am facing a problem with vaadin table. Currently my data is displaying in vaadin table, in that table each row got one button. When I click that button, I want to change particular cell value in the same row.
table.setEditable(true)
Ex: In a row I have two columns "name" and "button". when I click button I want change name value in same row.
Suppose in first row column name value is "ABC" , when I click button, I want to change to value "ABC" to "XYZ".

Related

SWT Table Viewer add checkbox on row selection

In my table viewer, I want to add a checkbox to the last column when the user selects a row. How can I do this ?
Afaik tables only have checkbox icon in the first column.
Additional icons/checkboxes would have to be drawn manually.
Another option is to insert controls manually into table items. E.g insert a composite with checkbox + text. An example of how to insert a control into a table can be found in:
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet126.java

access database table row by row sequentially by click on button

How can I get row by row data sequentially on "label" by clicking button again and again until all row's data access? This problem is come when I want access row from a database table by click on next button to see first row and again click to see second row and so on.

Select table values to text field using SWT?

I have Table (TableViewer) containing TableItems with values. I have another class TextField mapped according to table column name.
Now my question is: When I select any row in table, the values in that row should get reflected in Text field. In Text field I can edit these vales and save to to table. Please let me know how I can achieve this?
What ever "Baz" has said is the right thing to do. If editing is table data is requirement, then make the table columns as editable. But if you want to specifically edit table row separately in a control (like Text field), then get IStructuredSelection from TableViewer and get the data in control to edit. Then after you edit, get the data back from control and set it back to table. Hope it helps.

How can I get table cell value as "xyz" WITHOUT hit the Enter or Tab key?

I found out if you editing a TableViewer cell without hit the Enter or Tab key. Then the new cell value won't take effect. For example, a table cell value is "abc" and you change it to "xyz". Then when you read that table cell value, it still "abc". You MUST hit the Enter or
Tab key, then you will get that table cell value as "xyz".
How can I force that table cell value as "xyz" WITHOUT hit the Enter or Tab key?
Thanks very much in advance!
i suggest you check the tableviewer api.
if it was a standard JTable you simply use this:
JTable table = new JTable(...);
table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
Temporally, i make a losing focus by set focus from current view to another view in RCP :). It's not official solution but effect.

How to make a JTable row to an "unselected" state after selected any row in that table?

I'm developing a Java Swing application which contains a JTable. By default, while launching the application for the first time, the call to the method jtable.getSelectedRow() or jtable.getSelectedColumn() returns -1, which means that no row selected at that moment. After user clicked any row or column, the call to the method jtable.getSelectedRow() or jtable.getSelectedColumn() returns the appropriate values of selected rows & columns. What I actually need is that I want to set the selected row or column to -1 i.e. "no row or column selected state". How can I do this?
The JTable method clearSelection will do what you want -- clear the selection of all the table's selected rows and columns. The JTable API is the place to look for methods such as these.

Categories