GWT でタイトル付きのボーダー フレームを作成しようとしていますが、その結果、次のようになります。
これは、次のような HTML フィールドセットと凡例タグを使用して実行できます。
<fieldset>
<legend>Connection parameters</legend>
... the rest ...
</fieldset>
それを実装するカスタム ウィジェットを GWT で作成したいと考えています。なんとかできたのですが、ハンドラーを追加したのに、ウィジェット内で発生するイベント(ボタンクリックなど)が発生しないという問題があります。
私のウィジェットの実装は次のとおりです。
public class TitledPanel extends Widget {
private Element legend;
private Widget content = null;
public TitledPanel() {
Element fieldset = DOM.createFieldSet();
legend = DOM.createLegend();
DOM.appendChild(fieldset, legend);
setElement(fieldset);
}
public TitledPanel(String title) {
this();
setTitle(title);
}
@Override
public String getTitle() {
return DOM.getInnerHTML(legend);
}
@Override
public void setTitle(String html) {
DOM.setInnerHTML(legend, html);
}
public Widget getContent() {
return content;
}
public void setContent(Widget content) {
if (this.content != null) {
DOM.removeChild(getElement(), this.content.getElement());
}
this.content = content;
DOM.appendChild(getElement(), content.getElement());
}
}
Composite を拡張する必要がありますか、またはイベントを手動で再ルーティングする必要がありますか? または他の方法はありますか?