好,我知道它的工作(見年長以前嘗試的這個答案的版本;))。
我的解決方案基於Mail example。 工作代碼:
public class SplitTest implements EntryPoint {
private static TestUiBinder uiBinder = GWT.create(TestUiBinder.class);
interface TestUiBinder extends UiBinder<SplitLayoutPanel, SplitTest> {
}
/**
* This is the entry point method.
*/
public void onModuleLoad() {
SplitLayoutPanel outer = uiBinder.createAndBindUi(this);
RootLayoutPanel.get().add(outer);
}
}
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">
<ui:style>
.conversationPanelContainer, .conversationPanel, .messageTextAndSendPanel, .messageText {
font-weight: bold;
}
</ui:style>
<g:SplitLayoutPanel>
<g:north size="700">
<g:VerticalPanel>
<g:ScrollPanel styleName="{style.conversationPanelContainer}">
<g:FlexTable ui:field="conversationPanel" styleName="{style.conversationPanel}"></g:FlexTable>
</g:ScrollPanel>
<g:HorizontalPanel styleName="{style.messageTextAndSendPanel}">
<g:TextBox ui:field="messageText" styleName="{style.messageText}"></g:TextBox><g:Button ui:field="sendButton">Send</g:Button>
</g:HorizontalPanel>
</g:VerticalPanel>
</g:north>
<g:south size="300">
<g:Button>TestButton</g:Button>
</g:south>
</g:SplitLayoutPanel>
</ui:UiBinder>
注意一些事情:
- 首先:你在UiBinder的XML有一個錯誤模板:這是
<g:Button>
,不是<g:button>
(區分大小寫)
- 使用
RootLayoutPanel
代替我們UAL RootPanel
- 我還是有點困惑整個
LayoutPanel
小號啄 - 在Mail example他們使用嵌套在一個DockLayoutPanel
SplitLayoutPanel
,但只有DockLayoutPanel
被明確添加到RootLayoutPanel
- 我是明白,SplitLayoutPanel
自動地也被添加(以便它可以接收調整大小事件等)?那麼在主LayoutPanel中嵌套的其他Widget如何呢?是否必須將它們明確地添加到RootLayoutPanel
或者只有它們是該Widget/Composite的根部,或者甚至不可能?我真的沒有時間atm進一步追求 - 我會留下它作爲別人的功課;)
順便說一句:我檢查了這個代碼在怪癖模式和標準模式下 - 我不'看不到差別,都工作O_O(雖然,這是一個簡單的使用SplitLayoutPanel
- 更復雜的例子可能會導致怪癖模式和/或渲染錯誤一些怪異的行爲)
沒有例外? (無論是在DevMode的和螢火蟲/其他瀏覽器控制檯) – 2010-03-22 20:41:25
我從我目前的工作電腦了,所以我不能肯定地說,但我記得看到一些RPC調用在Firebug控制檯窗口分派(我儘管缺少UI,但每個x分鐘都會執行一次RPC調用)。如果有例外,什麼都不會運行,對吧? – 2010-03-22 21:18:01