google-code-export / gwt-ext

Automatically exported from code.google.com/p/gwt-ext
0 stars 0 forks source link

ToolbarTextItem (and others) should implement HasText #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The com.gwtext.client.widgets.ToolbarTextItem (and for instance,
com.gwtext.client.widgets.menu.TextItem) should implement the
com.google.gwt.user.client.ui.HasText interface, allowing the
implementation to read and, most importantly, set the text value of the
toolbar / menu item at a later stage using normal GWT code.

Example implementation for a fictive MyToolbarTextItem adding HasText to
ToolbarTextItem that works:

class MyToolbarTextItem extends ToolbarTextItem implements HasText
{
  public MyToolbarTextItem(String text){
    super(text);
  }

  public native String getText()/*-{
    var tbi = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
    return tbi.el.innerHTML;
  }-*/

  public native void setText(String text)/*-{
    var tbi = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
    tbi.el.innerHTML = text;
  }-*/ 
}

Original issue reported on code.google.com by intern...@gmail.com on 10 Sep 2007 at 12:13

GoogleCodeExporter commented 9 years ago
I have added getText / setText to ToolbarTextItem  and TextItem. But I don't 
see an
advantage to having them implmement an com.google.gwt.user.client.ui.HasText
interface. Can you give me a usecase where you would like to work with widgets 
at a
HasText level?

Original comment by sanjiv.j...@gmail.com on 25 Sep 2007 at 2:51

GoogleCodeExporter commented 9 years ago
See note above.

Original comment by sanjiv.j...@gmail.com on 1 Oct 2007 at 5:05