2013-07-12 37 views
1

有一个小部件,是与“<对象>”标签的代名词或者我可以只使用一个HTML标签对象:GXT/GWT部件的“对象”标签

我想这一点,但它是不是地道:

import com.google.gwt.user.client.ui.HTML; 
final HTML h = new HTML("<object width='100%' height='100%' data='/media/invoice1.pdf'></object>"); 
     container.setCenterWidget(h); 


<object width='100%' height='100%' data='/media/invoice1.pdf'></object> 

这是GXT 3.0.1

回答

1

没有任何GWT部件包裹object标签,但你有ObjectElement,你可以用它来创建元素并将其附加到文件:

// Create an element and programatically set its attributes 
    ObjectElement o = Document.get().createObjectElement(); 
    o.setWidth("100%"); 
    o.setHeight("100%"); 
    o.setData("/media/invoice1.pdf"); 

    // Attach the element to the document 
    Document.get().getBody().appendChild(o); 

    // Optionally you could wrap your element into a widget. 
    Widget w = HTMLPanel.wrap(o);