CellTree, how can I hide blue background of cell and yellow background of head of cell after focus

38 views
Skip to first unread message

vkrejcirik

unread,
Dec 28, 2010, 3:44:53 AM12/28/10
to Google Web Toolkit
Hi, I use CellTree wieh TreeViewModel for creating applications menu.
When I select some cell, it changes background. (cells body is blue
and cells head is yellow)
Is it possible to remove this behavior?

I think, I must add something in this part of code:

/**
* The cell used to render categories.
*/
private static class CategoryCell extends AbstractCell<Category> {
@Override
public void render(Category value, Object key, SafeHtmlBuilder sb) {
if (value != null) {
sb.appendEscaped(value.getName());
}
}


}

/**
* The cell used to render content.
*/
private static class ContentWidgetCell extends
AbstractCell<ContentWidget> {

public ContentWidgetCell() {
// cell responds to change events.
super("change");
}

@Override
public void render(ContentWidget value, Object key, SafeHtmlBuilder
sb) {
if (value != null) {

if (value instanceof GenderWidget) {

GenderWidget tempValue = (GenderWidget) value;

sb.appendHtmlConstant("<table>");

for (Gender g : tempValue.getGenders()) {

sb.appendHtmlConstant("<tr><td valign=\"top\">");
sb.appendHtmlConstant("<input type=\"checkbox\" />");
sb.appendHtmlConstant("</td><td>");

// Display the name of gender
sb.appendHtmlConstant("<div style=\"padding-left:10px;\">");
sb.appendEscaped(g.getName());
sb.appendHtmlConstant("</div>");
sb.appendHtmlConstant("</td></tr>");
}

sb.appendHtmlConstant("</table>");

} else {
sb.appendEscaped(value.getName());
}
}
}

@Override
public void onBrowserEvent(com.google.gwt.dom.client.Element parent,
ContentWidget value, Object key, NativeEvent event,
ValueUpdater<ContentWidget> valueUpdater) {
// Check that the value is not null.
if (value == null) {
return;
}

// Call the super handler, which handlers the enter key.
super.onBrowserEvent(parent, value, key, event, valueUpdater);

// Handle click events.
if ("change".equals(event.getType())) {

// Toggle the checkbox.
List<CheckItem> inputs = value.getInputElements(parent);

for (CheckItem i : inputs) {
if (i.getElement().isChecked()) {
// System.out.println(i.getId() + " je");
value.getSearchParametersHolder().getSelectedGenders()
.add(i.getId());
} else {
// System.out.println(i.getId() + " ne");
if (value.getSearchParametersHolder()
.getSelectedGenders().contains(i.getId()))
value.getSearchParametersHolder()
.getSelectedGenders().remove(i.getId());
}
}
}
}
}

Thanks for reply.
Reply all
Reply to author
Forward
0 new messages