Gwt 是否将元素强制转换为FlowPanel?
我正在尝试创建自己的复合按钮,使用div作为外部父级:Gwt 是否将元素强制转换为FlowPanel?,gwt,Gwt,我正在尝试创建自己的复合按钮,使用div作为外部父级: public class CompoundButton extends ButtonBase { public CompoundButton() { super(DOM.createDiv()); } } ButtonBase的构造函数需要一个元素实例,所以我使用DOM.createDiv()调用。但是现在我如何添加子窗口小部件呢 public CompoundButton() { super(DO
public class CompoundButton extends ButtonBase {
public CompoundButton() {
super(DOM.createDiv());
}
}
ButtonBase的构造函数需要一个元素实例,所以我使用DOM.createDiv()调用。但是现在我如何添加子窗口小部件呢
public CompoundButton() {
super(DOM.createDiv()); <-- we're just a div.
// ButtonBase has no "add()" method - but this class is really
// just a div instance, so shouldn't I be able to convert it to
// a FlowPanel for example to be able to add elements to it here?
this.add(new FlowPanel()); <-- not possible, "add()" not available here.
公共复合按钮(){
super(DOM.createDiv());Button base接受一个单元格,flowpanel不是一个单元格,您的复合按钮代码是错误的,因为它没有将单元格发送给其父级
正确的代码是
public class CompoundButton<C> extends ButtonBase<C>
{
protected CompoundButton( ButtonCellBase<C> cell )
{
super( cell );
}
}
公共类CompoundButton扩展了ButtonBase
{
受保护的复合按钮(ButtonCellBase单元)
{
超级电池;
}
}
您可以简单地使用标签或流程面板,并将其样式设置为按钮。您需要从ButtonBase中获得什么?我需要为移动设备添加事件处理程序。由于内置300毫秒的点击延迟,正常的addClickHandler实现在移动浏览器上无法正常工作。哪些处理程序?标签的处理程序与ButtonBase,包括HasAllTouchHandlers和HasAllGestureHandlers。