Using SmartGWT 4.0 and GWT 2.5 we see an issue with tooltips not appearing on toolbar buttons that are enabled when a ListGrid cell editor has focus. Interestingly, we do get the tooltips for the disabled toolbar buttons, just not the enabled buttons. Is this a known issue? Below is an example slice of code.
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridEditEvent;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import com.smartgwt.client.widgets.toolbar.ToolStripButton;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class TooltipExample implements EntryPoint {
protected ListGrid exampleGrid;
protected ListGridField groupField;
protected ListGridField propertyField;
protected ListGridField valueField;
protected ToolStrip toolStrip;
protected ToolStripButton saveButton, closeButton;
/**
* This is the entry point method.
*/
public void onModuleLoad() {
RootPanel.get().add(getViewPanel());
}
public VLayout getViewPanel() {
VLayout layout = new VLayout();
groupField = new ListGridField("group", "Group");
groupField.setCanEdit(false);
propertyField = new ListGridField("property", "Property");
propertyField.setCanEdit(false);
valueField = new ListGridField("value", "Value");
valueField.setCanEdit(true);
exampleGrid = new ListGrid();
exampleGrid.setFields(groupField, propertyField, valueField);
exampleGrid.setWidth(500);
exampleGrid.setHeight(250);
exampleGrid.setEditByCell(true);
exampleGrid.setEditEvent(ListGridEditEvent.CLICK);
exampleGrid.setData(new AttributesData().getRecords());
toolStrip = new ToolStrip();
toolStrip.setWidth(500);
toolStrip.setHeight(30);
toolStrip.setAlign(Alignment.RIGHT);
saveButton = new ToolStripButton();
saveButton.setPrompt( "Save" );
saveButton.setTitle("Save");
saveButton.setPadding(5);
saveButton.setDisabled(true);
closeButton = new ToolStripButton();
closeButton.setPrompt( "Close" );
closeButton.setTitle( "Close" );
closeButton.setPadding(5);
toolStrip.addMember(saveButton);
toolStrip.addMember(closeButton);
layout.addMember(toolStrip);
layout.addMember(exampleGrid);
return layout;
}
class Attributes extends ListGridRecord {
public Attributes() {
}
public Attributes(String group, String property, String value) {
setGroup(group);
setProperty(property);
setValue(value);
}
public void setGroup(String group) {
setAttribute("group", group);
}
public String getGroup() {
return getAttributeAsString("group");
}
public void setProperty(String property) {
setAttribute("property", property);
}
public String getProperty() {
return getAttributeAsString("property");
}
public void setValue(String value) {
setAttribute("value", value);
}
public String getValue() {
return getAttributeAsString("value");
}
}
public class AttributesData {
private Attributes[] records;
public Attributes[] getRecords() {
if (records == null) {
records = getNewRecords();
}
return records;
}
private Attributes[] getNewRecords() {
return new Attributes[] {
new Attributes("Primary", "Name", "Name1"),
new Attributes("Primary", "Type", "Type1") };
}
}
}
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ListGridEditEvent;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import com.smartgwt.client.widgets.toolbar.ToolStripButton;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class TooltipExample implements EntryPoint {
protected ListGrid exampleGrid;
protected ListGridField groupField;
protected ListGridField propertyField;
protected ListGridField valueField;
protected ToolStrip toolStrip;
protected ToolStripButton saveButton, closeButton;
/**
* This is the entry point method.
*/
public void onModuleLoad() {
RootPanel.get().add(getViewPanel());
}
public VLayout getViewPanel() {
VLayout layout = new VLayout();
groupField = new ListGridField("group", "Group");
groupField.setCanEdit(false);
propertyField = new ListGridField("property", "Property");
propertyField.setCanEdit(false);
valueField = new ListGridField("value", "Value");
valueField.setCanEdit(true);
exampleGrid = new ListGrid();
exampleGrid.setFields(groupField, propertyField, valueField);
exampleGrid.setWidth(500);
exampleGrid.setHeight(250);
exampleGrid.setEditByCell(true);
exampleGrid.setEditEvent(ListGridEditEvent.CLICK);
exampleGrid.setData(new AttributesData().getRecords());
toolStrip = new ToolStrip();
toolStrip.setWidth(500);
toolStrip.setHeight(30);
toolStrip.setAlign(Alignment.RIGHT);
saveButton = new ToolStripButton();
saveButton.setPrompt( "Save" );
saveButton.setTitle("Save");
saveButton.setPadding(5);
saveButton.setDisabled(true);
closeButton = new ToolStripButton();
closeButton.setPrompt( "Close" );
closeButton.setTitle( "Close" );
closeButton.setPadding(5);
toolStrip.addMember(saveButton);
toolStrip.addMember(closeButton);
layout.addMember(toolStrip);
layout.addMember(exampleGrid);
return layout;
}
class Attributes extends ListGridRecord {
public Attributes() {
}
public Attributes(String group, String property, String value) {
setGroup(group);
setProperty(property);
setValue(value);
}
public void setGroup(String group) {
setAttribute("group", group);
}
public String getGroup() {
return getAttributeAsString("group");
}
public void setProperty(String property) {
setAttribute("property", property);
}
public String getProperty() {
return getAttributeAsString("property");
}
public void setValue(String value) {
setAttribute("value", value);
}
public String getValue() {
return getAttributeAsString("value");
}
}
public class AttributesData {
private Attributes[] records;
public Attributes[] getRecords() {
if (records == null) {
records = getNewRecords();
}
return records;
}
private Attributes[] getNewRecords() {
return new Attributes[] {
new Attributes("Primary", "Name", "Name1"),
new Attributes("Primary", "Type", "Type1") };
}
}
}