GWT 프레임 (IFrameElement)에로드 된 이미지 및 URL의 지연로드. 이미지/URL이 LoadHandler 이벤트를 사용하여로드되었다고 말하면 이벤트를 잡을 수 있습니다.
private void loadLoginPage() {
final Frame frame = new Frame(url_base + url_login); // set the frames url
frame.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
// Get the document from the loaded frame (similar to RootPanel on main page)
Document doc = IFrameElement.as(frame.getElement()).getContentDocument();
// From here you can wrap widgets in the frame like this
final TextBox username = TextBox.wrap(doc.getElementById("username")); // from the html doc using id="username"
// grab a div element
DivElement div = DivElement.as(doc.getElementById("mydiv"));
// Create content to be added to the doc
ButtonElement button_elem = doc.createPushButtonElement();
Button button = Button.wrap(button_elem);
// attach to the document
div.appendChild(button.getElement());
}
});
// Attach to DOM
RootPanel.get("mything").add(frame);
}
이미지 로딩에 대해서도 비슷합니다. 이 도움이
Image image = new Image(image_url);
image.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
// image is ready to be used.
}
});
// attach to DOM to initiate loading of the image
희망 ...
예, 게으른 로딩이 가능하다. 예를 들어 IFrameElement에는 LoadHandler 이벤트가 있습니다. 다른 위젯에는 태그를 지정할 수있는 이벤트가 있습니다. – WLGfx
좀 더 자세히 설명해 주시겠습니까? – NuCradle