2013-11-21 71 views
0

我一直在開發一個Java + GAE(1.8.6)+ GWT(2.5.1)的應用程序,現在,根據我的客戶的需求,我需要創建一個屏幕布局劃分分爲兩部分(25%,75%),左側是選項,另外75%是點擊選項的結果(如屏幕設置爲iFrame)。創建GWT iFrame,如屏幕

我試圖使用一個DockLayoutPanel與西方和中心面板添加到他們,但我無法管理加載中央面板上西面板中放置的每個鏈接的內容。

我一直在Google的解決方案或一些代碼,以適應我的需求,但到目前爲止我還沒有取得太大的成功。

¿你能幫我嗎?我還購買了由Manning編輯的GWT in Action。但沒有發現很多有關這件事。

與此同時,我將繼續尋找/試圖自己找到解決方案。

謝謝你在前進,

親切的問候,

+0

水平面板已經符合要求。在左邊你建立你的菜單,在右邊你放下一個你用作新的「rootpanel」的面板。不需要iframe。 你可以發佈你的代碼如何創建用戶界面? – deterministicFail

+0

除了你的答案,我認爲它是完全有效的,我想我可以使用一個HTMLLayoutContainer,其中我會寫一個表,其中包含另外兩個表。一方面,將菜單選項的大小顯示爲列表,另一方面顯示單擊特定選項時顯示的小部件的內容。 – Catersa

+0

我打算用我找到的解決方案回答我的問題,但是:「聲譽低於10的用戶在詢問後8小時內無法回答自己的問題,您可以回答11/21/2013 5:16:04 PM。在此之前請使用評論,或者編輯您的問題。「所以我會在8小時內發佈答案,因爲我本來打算放在第一位。感謝您的回覆和時間。 – Catersa

回答

0

我找到的解決方案是:

//define framedPanel for later use 
private FramedPanel fupanel; 

//Instantiate the widget i want to add when the option is clicked 
final FileUp fileUp = new FileUp(); 

//Create the HtmlLayoutContainer in which add the widget later on 

HtmlLayoutContainer conEnlaces = new HtmlLayoutContainer(getTablaEnlaces()); 

public Widget asWidget() { 
    if (fupanel == null) { 
     fupanel = new FramedPanel(); 
     fupanel.setHeadingText("Administración"); 
     (some other code here) 

     VerticalLayoutContainer p = new VerticalLayoutContainer();  

     conEnlaces.setWidth(Window.getClientWidth()); 

     fupanel.add(p); 

     p.add(conEnlaces); 

     Hyperlink fileUph = new Hyperlink(); 
     fileUph.setText("- Importación de CSV"); 
     conEnlaces.add(fileUph, new HtmlData(".fileUph")); 

     filexh.addClickHandler(new ClickHandler() { 

     @Override 
     public void onClick(ClickEvent event) { 
      conEnlaces.add(filex, new HtmlData(".resultado")); 

     } 
    }); 

     fupanel.add(conEnlaces); 
    } 
    return fupanel; 
    } 

private native String getTablaEnlaces() /*-{ 
    return [ '<table border="0" cellspacing="0" cellpadding="0">', 
     '<tr><td>', 
     '<table border="0" width="75%">', 
     '<tr><td class=fileUph></td></tr>',  
     '</table></td>', 
     '<td><table border="0" style="margin-left: 25px;">', 
     '<tr><td class=resultado></td></tr>', 
     '</table>', 
     '</td></tr></table>' 
    ].join(""); 
}-*/;    

public void onModuleLoad() { 
    RootPanel.get().add(asWidget()); 
    } 

而且像這樣我的問題已經解決了。我向你展示了我的代碼,因爲我在使用stackoverflow論壇時生氣,人們說已經達到了解決方案,但不解釋如何。

感謝您的回覆和時間,