|
| 1 | +<%define inDocumentationSection %> |
| 2 | +<%define inDocumentationSection.gui %> |
| 3 | +<%set title = J2ME Polish: Item %> |
| 4 | +<%set basedir = ../ %> |
| 5 | +<%include start_syntax.txt %> |
| 6 | + |
| 7 | + <h1 id="top">Container</h1> |
| 8 | + <ul class="relatedtechnologies"> |
| 9 | + <li class="relatedtechnologiesheader">Related Topics:</li> |
| 10 | + <li><a href="gui-item-tableitem.html">TableItem</a></li> |
| 11 | + <li><a href="gui-item-treeitem.html">TreeItem</a></li> |
| 12 | + </ul> |
| 13 | + <%index %> |
| 14 | + |
| 15 | + <p> |
| 16 | + <img src="<%= basedir%>images/gui-item-container.png" width="175" height="220" alt="Container can hold many items" /> |
| 17 | + |
| 18 | + Container contain different items. They are the basis for all J2ME Polish screens like |
| 19 | + <a href="gui-screen-form.html">Form</a>, <a href="gui-screen-framedform.html">FramedForm</a> |
| 20 | + or <a href="gui-screen-list.html">List</a>. |
| 21 | + <br/> |
| 22 | + You can create arbitrary complex items by nesting containers into each other. |
| 23 | + <br /> |
| 24 | + You can also use columns and rows for containers or use any of the <a href="gui-visualguide-viewtypes.html#gui-viewtypes-container">view-type</a>s |
| 25 | + available for Containers. |
| 26 | + </p> |
| 27 | + |
| 28 | + <h2 id="Container-ItemSource">ItemSource</h2> |
| 29 | + <p> |
| 30 | + The following containers require an item source. An <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/ItemSource.html">de.enough.polish.ui.ItemSource</a> |
| 31 | + is responsible for translating underlying data into UI items. When an ItemSource is used, an |
| 32 | + <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/ItemConsumer.html">de.enough.polish.ui.ItemConsumer</a> will register |
| 33 | + with the source, so that the ItemSource can inform the ItemConsumer when the underlying data has been updated. |
| 34 | + </p> |
| 35 | + |
| 36 | + <h2 id="Container-UsingADifferentContainer">Using a Different Container</h2> |
| 37 | + <p> |
| 38 | + If you want to use a different container you can either use one of the provided convenience forms |
| 39 | + such as <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/UniformForm.html">UniformForm</a> |
| 40 | + or <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/SourcedForm.html">SourcedForm</a> |
| 41 | + or you register the container as a root container using <code>Screen.setRootContainer(Container)</code>: |
| 42 | + </p> |
| 43 | +<pre class="brush: java"> |
| 44 | +public class MyFramedForm extends FramedForm |
| 45 | +{ |
| 46 | + public MyFramedForm() |
| 47 | + { |
| 48 | + super("title"); |
| 49 | + ItemSource mySource = new MyItemSource(); |
| 50 | + SourcedLazyContainer container = new SourcedLazyContainer(mySource, 5, 15); |
| 51 | + setRootContainer(container); |
| 52 | + } |
| 53 | +} |
| 54 | +</pre> |
| 55 | + |
| 56 | + <h2 id="Container-SourcedContainer">SourcedContainer</h2> |
| 57 | + <p> |
| 58 | + A <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/SourcedContainer.html">de.enough.polish.ui.SourcedContainer</a> |
| 59 | + is a normal container that uses an ItemSource. |
| 60 | + </p> |
| 61 | + |
| 62 | + <h2 id="Container-SourcedLazyContainer">SourcedLazyContainer</h2> |
| 63 | + <p> |
| 64 | + The <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/SourcedLazyContainer.html">de.enough.polish.ui.SourcedLazyContainer</a> |
| 65 | + only loads items when they are required. In contrast to the UniformContainer those Items can vary in height, |
| 66 | + a typical example include messages or news entries. |
| 67 | + <br/> |
| 68 | + In combination with data storage like <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/io/ChunkedStorageCollection.html">de.enough.polish.io.ChunkedStorageCollection</a>, |
| 69 | + <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/io/ChunkedStorageRmsSystem.html">de.enough.polish.io.ChunkedStorageRmsSystem</a> |
| 70 | + and the like you can create endless scrolling screens. |
| 71 | + </p> |
| 72 | + |
| 73 | + <h2 id="Container-UniformContainer">UniformContainer</h2> |
| 74 | + <p> |
| 75 | + The <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/UniformContainer.html">de.enough.polish.ui.UniformContainer</a> |
| 76 | + along with the convenience <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/UniformForm.html">de.enough.polish.ui.UniformForm</a> |
| 77 | + allow you to show vast numbers of entries without using too much memory. |
| 78 | + <br/> |
| 79 | + For best memory efficiency the UniformContainer reuses items - for doing that you need to supply a |
| 80 | + <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/UniformItemSource.html">de.enough.polish.ui.UniformItemSource</a> |
| 81 | + instead of an ItemSource. The UniformItemSource additionally defines a <code>void populateItem(int itemIndex, Item item )</code> |
| 82 | + method for reusing items. |
| 83 | + <br/> |
| 84 | + A UniformContainer only supports items that have the same height. |
| 85 | + </p> |
| 86 | + |
| 87 | + <h2 id="Item-SampleApp">Sample App</h2> |
| 88 | + <p> |
| 89 | + Please compare the 'messaging' sample application for using ItemSource, UniformContainer and SourcedLazyContainer. |
| 90 | + </p> |
| 91 | + |
| 92 | + <h2 id="Item-JavaDoc">JavaDoc</h2> |
| 93 | + <ul> |
| 94 | + <li><a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/Container.html">de.enough.polish.ui.Container</a></li> |
| 95 | + </ul> |
| 96 | + |
| 97 | +<%include end.txt %> |
0 commit comments