Hi,
currently I am writing a grid which should display an object which contains nested objects of which I want to display its name.
Currently I have the following code:
public class SwitchGrid extends Grid<IpSwitch> implements AutoRefresherComponent {
/**
*
*/
private static final long serialVersionUID = -6611331292773081623L;
//
// UI controller
//
private SwitchGridUiControllerInterface uicontroller;
public SwitchGrid(SwitchGridUiControllerInterface uicontroller) {
super(IpSwitch.class);
this.setLocale(UI.getCurrent().getLocale());
this.setSizeFull();
this.uicontroller = uicontroller;
this.setColumns("switchState", "enabled", "switchable", "name", "ipControlDevice.name", "switchGroup.name");
As you can see I am using the setcolumns() methods cisplay the columns I want, which works quit well. There is only one problem: The switchGroup object can be null, and in this case I get a null pointer exception. How can I define, that only if the nested object is not null, its name should be displayed, if it is null I want to display an empty string?
Thanks,
Florian