setup
the roject is mavenized; libs are RAP, eclipselink,slf4j,mysql-connector,junit
the following is used for rap:
<dependency>
<groupId>org.eclipse.rap</groupId>
<artifactId>org.eclipse.rap.rwt</artifactId>
<version>2.1.0-M2</version>
</dependency>
Problem:
I am using a Table. This table should only display 24 Items in 4 Columns.
I cant delete the Buttons in the Table!
public Table table;
private TableColumn tblclmnStellplatz;
private TableColumn tblclmnReserviert;
private TableColumn tblclmnVonWem;
private TableColumn tblclmnWofr;
i try to update the view by deleting all elements in that table.
private void updateTableView() {
// TODO remove bug
table.clearAll();
table.removeAll();
table.update();
table.redraw();
logge("number of items in table : " + table.getItemCount());
StoringPosition storingposition;
for (int position = testlab.getNumberOfStoringPositions(); position >= 1; position--) {
table.update();
storingposition = testlab.getStoringPosition(position);
TableItem tableitem = new TableItem(table, 0, 0);
tableitem.setText(0,
Integer.toString(storingposition.getPosition()));
if (storingposition.isReserved()) {
tableitem.setText(1, "yes");
String reservist = storingposition.getReservist();
tableitem.setText(2, reservist);
tableitem.setText(3, storingposition.getEndDate());
TableEditor te = new TableEditor(table);
te.minimumWidth = 50;
tableitem.setData(te);
Button b = new Button(table, 0);
b.addSelectionListener(deletebuttonlistener);
logge(" int to string sp.getPosition : "
+ Integer.toString(storingposition.getPosition()));
b.setData(position + "");
b.setText("del");
te.setEditor(b, tableitem, 4);
te.layout();
} else {
tableitem.setText(1, "no");
tableitem.setText(2, "");
tableitem.setText(3, "");
tableitem.setText(4, "");
}
table.update();
}
}
the Listener:
DeleteButtonListener implements SelectionListener
public void widgetSelected(SelectionEvent arg0) {
Button button;
button = (Button) arg0.getSource();
int position = Integer.parseInt((String) button
.getData());
button.setEnabled(false);
button.setVisible(false);
button.dispose();
mainComposite.table.remove(position);
mainComposite.deleteReservation(position);
mainComposite.redraw();
// Now a little chaos after trying all ideas :(
}
as you can see my idea is to remove all elements from the table and fill it with all 24 elements.
I tried clearAll and removeAll and i tried also removing by index. (remove(int index)
I also tried dispose for the Buttons ...
Thought after all Buttons are dereferenced they should vanish...
Am i misunderstanding Table and TableEditor or is this a bug in the Webclient?