0

私はGWTプロジェクトを持っていますが、GWTがHTML5をどのように作成するのか疑問に思っています鬼ごっこ。

何時間も検索してここに来て尋ねた後、GWTでHTML5セクションタグを作成する方法はありますか?

4

3 に答える 3

1

はい、独自のウィジェットを作成できます。

public class SectionPanel extends ComplexPanel implements
    InsertPanel.ForIsWidget {
/**
 * Creates an empty section panel.
 */

public SectionPanel() {
 setElement(DOM.createElement("section"));
}

/**
 * Adds a new child widget to the panel.
 * 
 * @param w
 *            the widget to be added
 */
@Override
public void add(Widget w) {
    add(w, getElement());
}

... etc. ...

}

于 2013-01-30T09:10:31.893 に答える
1

新しいウィジェットタイプを作成する必要はありません。ジェネリックを使用して、使用するHTMLPanelタグを指定するだけです。

UiBinderオプション

を使用するUiBinderと、.ui.xmlファイルには次のようなものが含まれます。

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
             xmlns:g="urn:import:com.google.gwt.user.client.ui">
    ...
    <g:HTMLPanel tag="section">
        (your section content here)
    </g:HTMLPanel>
    ...
</ui:UiBinder>

手動オプション

プログラムでそれを行うことを好む場合:

HTMLPanel section = new HTMLPanel("section", "(your section content here)");

最初の引数は、使用するタグを指定します。最初の引数を指定しない場合のデフォルトはですdiv

どちらの場合も、HTML出力でこれを生成します。

<section>
    (your section content here)
</section>
于 2016-03-09T01:09:39.707 に答える
0

Ui:Binderで好きなHTMLを追加できます:

https://developers.google.com/web-toolkit/doc/latest/DevGuideUiBinder

于 2013-01-30T16:24:21.050 に答える