Wednesday, July 6, 2011

SingleSelectionModel not firing for root node (CellTree)

Hi there.
I'm trying to implement the treeCell Widget in my project, but i'm
having an issue since days now...
The SElectionModel is not firing for my root nodes for some reason. It
get fired thougth for leaf nodes.

Here is my node info code.


@Override
public <T> NodeInfo<?> getNodeInfo(T value) {
if (value == null) {
// LEVEL 0.
// We passed null as the root value. Return the composers.

// Create a data provider that contains the list of composers.
rootDataProvider = new ListDataProvider<PartnerDTO>(partners);

// Create a cell to display a composer.
Cell<PartnerDTO> cell = new AbstractCell<PartnerDTO>() {
@Override
public void render(Context context, PartnerDTO value,
SafeHtmlBuilder sb) {
if (value != null) {
sb.appendEscaped(value.getCompanyName());
}
}
};

IconCellDecorator<PartnerDTO> decorator = new
IconCellDecorator<PartnerDTO>(
ICONS.partner_icon(), cell);

// Return a node info that pairs the data provider and the cell.
return new DefaultNodeInfo<PartnerDTO>(rootDataProvider,
decorator, selectionModelLeaf, null, null);
} else if (value instanceof PartnerDTO) {
PartnerDTO dto = (PartnerDTO) value;
// LEVEL 2 - LEAF.
// We want the children of the playlist. Return the songs.
ListDataProvider<ClientDetailsDTO> dataProvider =
providerForPartners
.get(dto.getPartnerID());

if (dataProvider == null) {
dataProvider = new ListDataProvider<ClientDetailsDTO>();
providerForPartners.put(dto.getPartnerID(), dataProvider);

fetchClients(dto.getPartnerID());
}

// Create a cell to display a composer.
Cell<ClientDetailsDTO> cell = new AbstractCell<ClientDetailsDTO>()
{
@Override
public void render(Context context, ClientDetailsDTO value,
SafeHtmlBuilder sb) {
if (value != null) {
sb.appendEscaped(value.getDisplayName() + " ("
+ value.getNumberOfApp() + ")");
}
}
};

IconCellDecorator<ClientDetailsDTO> decorator = new
IconCellDecorator<ClientDetailsDTO>(
ICONS.client_icon(), cell);

// Use the shared selection model.
DefaultNodeInfo<ClientDetailsDTO> info = new
DefaultNodeInfo<ClientDetailsDTO>(
dataProvider, decorator, selectionModelLeaf, null);
return info;
}

return null;
}

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate