Hi @ll !
I am a newbie to Vaadin so please excuse any stupid questions
I went through the Vaadin tutorial with Vaadin 6.4.4, Gwt 2.0. In chapter ‘6.1. Turning email addresses into links’ (
Link
) I have implemented a different solution. Instead of a link, I decided to have a label and a button, that would open the email address when pressed:
table.addGeneratedColumn("email", new Table.ColumnGenerator() {
@Override
public Component generateCell(Table source, Object itemId, Object columnId) {
final Person person = (Person) itemId;
Button button = new Button("Open");
button.addListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
getMainWindow().open(new ExternalResource("mailto:" + person.getEmail()));
}
});
HorizontalLayout component = new HorizontalLayout();
Label label = new Label(person.getEmail());
label.setEnabled(false);
component.addComponent(label);
component.addComponent(button);
component.setComponentAlignment(button, Alignment.TOP_RIGHT);
component.setSpacing(true);
return component;
}
});
This solution works fine except that the table selection does not change, if you click on the labels’ text. If you click in any other cell of the other columns, the selection is changed. Does anybody know what is wrong with my code? Found out, that the selection works, if i am using the label or button only.
Is it wrong to use containers inside table cells?
Is there a different way how to implement this? (Havent tried yet to implement it as a custom component but I asume the selection wount work either).
Thanks in advanced,
partyON.