GWT是否有LazyPanel。我無法看到它。請讓我知道。如果它得到lazyPanel,請讓我再知道版本GWT懶加載
Q
GWT懶加載
1
A
回答
2
我同意rustyshelf在谷歌搜索的原理,但由於StackOverflow的是這也是一個參考本身,這裏有一個更詳細的答案:
默認情況下,不顯示LazyPanel。只有在LazyPanel上調用setVisible(true)時纔會創建底層窗口小部件。
當子面板包含相對較重的內容時,該類主要應與StackPanel,DisclosurePanel和TabPanel一起使用。
使用來包裝這些內容的創建可以顯着提高用戶體驗。
Using the LazyPanel is simple。所有你需要做的就是添加你想懶惰地加載到懶惰面板的小部件,然後在懶惰面板上調用setVisible(true)以實際上按需加載小部件。值得一提的是,LazyPanel主要用於像TabPanel和StackPanel這樣的小部件,在所有情況下都不是很理想。
0
這是來自「候選版本」GWT的LazyPanel.java 1.6.2 所以是的,簡單的,以及上述答案的確認。
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.user.client.ui;
/**
* Convenience class to help lazy loading. The bulk of a LazyPanel is not
* instantiated until {@link #setVisible}(true) or {@link #ensureWidget} is
* called.
* <p>
* <h3>Example</h3> {@example com.google.gwt.examples.LazyPanelExample}
*/
public abstract class LazyPanel extends SimplePanel {
public LazyPanel() {
}
/**
* Create the widget contained within the {@link LazyPanel}.
*
* @return the lazy widget
*/
protected abstract Widget createWidget();
/**
* Ensures that the widget has been created by calling {@link #createWidget}
* if {@link #getWidget} returns <code>null</code>. Typically it is not
* necessary to call this directly, as it is called as a side effect of a
* <code>setVisible(true)</code> call.
*/
public void ensureWidget() {
Widget widget = getWidget();
if (widget == null) {
widget = createWidget();
setWidget(widget);
}
}
@Override
/*
* Sets whether this object is visible. If <code>visible</code> is
* <code>true</code>, creates the sole child widget if necessary by calling
* {@link #ensureWidget}.
*
* @param visible <code>true</code> to show the object, <code>false</code> to
* hide it
*/
public void setVisible(boolean visible) {
if (visible) {
ensureWidget();
}
super.setVisible(visible);
}
}
+0
LazyPanel包含在1.6版本,其中1.6.4是第一個「官方」版本版。 – 2009-06-22 17:37:23
相關問題
- 1. GWT懶惰加載
- 2. 如何「懶惰」加載小部件,使GWT加載更快
- 3. 懶加載javascript
- 4. 懶惰加載不加載
- 5. Autofac懶惰加載
- 6. SWT TabFolder懶加載
- 7. iOS UIScrollView懶加載
- 8. Android懶惰加載
- 9. ASP.NET HoverMenuExtender懶加載
- 10. 懶加載表格
- 11. 懶惰加載Ninject
- 12. Angular 4懶加載
- 13. Vaadin格 - 懶加載
- 14. Eclipselink懶惰加載
- 15. 懶加載不@PostConstruct
- 16. Neo4j懶加載c#
- 17. Lucene.NET和懶加載
- 18. AngularJS懶渲染(不懶加載意見)
- 19. 加載Resty-GWT
- 20. Flex 4樹懶加載
- 21. Singleton懶加載模式
- 22. 實體框架懶加載
- 23. JSF懶加載組件值
- 24. JHipster組合框懶加載
- 25. 懶惰加載CSS與js
- 26. Django的懶加載分頁
- 27. 學說懶惰加載
- 28. NHibernate:懶加載屬性
- 29. 動畫懶惰加載ArrayAdapter
- 30. AngularJS懶加載不工作
不能與一個有着高達你的等級爭論,我小費我的帽子給你先生。) – rustyshelf 2008-12-22 00:23:23