I'm trying extend GWT's MenuItem, in GWT you can only place text there, what i want is place any widget like a button near the text. So I start making a sub class from MenuItem and i get many problem. Many properties are private, I cannot override them, or I must override all function which use these properties as well. And there are many stuff are only in package visiable, so my implementation must follow the original GWT Widget, use the gwt's package structure.
So I think it's not quite easy to extend the GWT Widget, I know there is a Composite class which can pack different Widg开发者_如何转开发et together, but that cannot solve all problem. And I don't want to use other 3rd GWT libray like smartGWT or GWTExt, they change alot and are very diffrenet from GWT.
So my question is, is there any good way to extend GWT's widgets?
Something like this?
MenuBar menu = new MenuBar();
Command cmd = new Command() {
@Override
public void execute() {
Window.alert("you clicked me");
}
};
MenuItem item = new MenuItem("click me", cmd);
item.setHTML("<input type=\"button\" value=\"click\" />What the hell");
menu.addItem(item);
精彩评论