diff --git a/enough-polish-j2me/source/src/de/enough/polish/ui/ItemSource.java b/enough-polish-j2me/source/src/de/enough/polish/ui/ItemSource.java index 955704c..5c35951 100644 --- a/enough-polish-j2me/source/src/de/enough/polish/ui/ItemSource.java +++ b/enough-polish-j2me/source/src/de/enough/polish/ui/ItemSource.java @@ -6,6 +6,9 @@ * * @author Robert Virkus, j2mepolish@enough.de * @see UniformItemSource + * @see UniformContainer + * @see SourcedContainer + * @see SourcedLazyContainer */ public interface ItemSource { diff --git a/enough-polish-sample-messaging/resources/base/style/polish.css b/enough-polish-sample-messaging/resources/base/style/polish.css index 71625d6..ac64682 100644 --- a/enough-polish-sample-messaging/resources/base/style/polish.css +++ b/enough-polish-sample-messaging/resources/base/style/polish.css @@ -178,10 +178,21 @@ info { layout: vertical-center; } +.messageFromMe:hover +{ + background-color: #fcc; +} + .messageFromUser extends messageFromMe { background-color: red; } +.messageFromUser:hover +{ + background-color: #fcc; +} + + .simpleMessage { text-effect: smiley-extended; label-style: nameLabel; @@ -198,12 +209,22 @@ info { background-color: silver; } +.simpleMessageFromMe:hover +{ + background-color: #cfc; +} + .simpleMessageFromYou extends simpleMessage { layout: right; background-color: #faa; } +.simpleMessageFromYou:hover +{ + background-color: #cfc; +} + /********************* CONTACT FORM ******************************************************************************************************/ .contactList { diff --git a/enough-polish-sample-messaging/source/src/de/enough/polish/app/view/SimpleMessageForm.java b/enough-polish-sample-messaging/source/src/de/enough/polish/app/view/SimpleMessageForm.java index 377092f..50c4e84 100644 --- a/enough-polish-sample-messaging/source/src/de/enough/polish/app/view/SimpleMessageForm.java +++ b/enough-polish-sample-messaging/source/src/de/enough/polish/app/view/SimpleMessageForm.java @@ -47,7 +47,6 @@ public class SimpleMessageForm extends FramedForm { TextField inputField; - private ArrayList messageList = new ArrayList(); private MessageItemSource itemSource; /** @@ -118,6 +117,7 @@ public Item createItem(int index) { //#style simpleMessageFromYou item = new StringItem(message.getSender() + ":", text); }; + //item.setDefaultCommand( new Command("Resend", Command.ITEM, 2)); return item; } diff --git a/enough-polish-website/site/source/docs/gui-item-container.html b/enough-polish-website/site/source/docs/gui-item-container.html new file mode 100644 index 0000000..b5e0ad9 --- /dev/null +++ b/enough-polish-website/site/source/docs/gui-item-container.html @@ -0,0 +1,97 @@ +<%define inDocumentationSection %> +<%define inDocumentationSection.gui %> +<%set title = J2ME Polish: Item %> +<%set basedir = ../ %> +<%include start_syntax.txt %> + +
+
+
+ Container contain different items. They are the basis for all J2ME Polish screens like
+ Form, FramedForm
+ or List.
+
+ You can create arbitrary complex items by nesting containers into each other.
+
+ You can also use columns and rows for containers or use any of the view-types
+ available for Containers.
+
+ The following containers require an item source. An de.enough.polish.ui.ItemSource + is responsible for translating underlying data into UI items. When an ItemSource is used, an + de.enough.polish.ui.ItemConsumer will register + with the source, so that the ItemSource can inform the ItemConsumer when the underlying data has been updated. +
+ +
+ If you want to use a different container you can either use one of the provided convenience forms
+ such as UniformForm
+ or SourcedForm
+ or you register the container as a root container using Screen.setRootContainer(Container)
:
+
+public class MyFramedForm extends FramedForm +{ + public MyFramedForm() + { + super("title"); + ItemSource mySource = new MyItemSource(); + SourcedLazyContainer container = new SourcedLazyContainer(mySource, 5, 15); + setRootContainer(container); + } +} ++ +
+ A de.enough.polish.ui.SourcedContainer + is a normal container that uses an ItemSource. +
+ +
+ The de.enough.polish.ui.SourcedLazyContainer
+ only loads items when they are required. In contrast to the UniformContainer those Items can vary in height,
+ a typical example include messages or news entries.
+
+ In combination with data storage like de.enough.polish.io.ChunkedStorageCollection,
+ de.enough.polish.io.ChunkedStorageRmsSystem
+ and the like you can create endless scrolling screens.
+
+ The de.enough.polish.ui.UniformContainer
+ along with the convenience de.enough.polish.ui.UniformForm
+ allow you to show vast numbers of entries without using too much memory.
+
+ For best memory efficiency the UniformContainer reuses items - for doing that you need to supply a
+ de.enough.polish.ui.UniformItemSource
+ instead of an ItemSource. The UniformItemSource additionally defines a void populateItem(int itemIndex, Item item )
+ method for reusing items.
+
+ A UniformContainer only supports items that have the same height.
+
+ Please compare the 'messaging' sample application for using ItemSource, UniformContainer and SourcedLazyContainer. +
+ +
- You can apply the following view-type
s for all Container based UI components - basically these are all
- components that can contain a number of items. Examples include ChoiceGroup,
+ You can apply the following view-type
s for all Container
+ based UI components - basically these are all components that can contain a number of items.
+ Examples include ChoiceGroup,
List, Form, HtmlBrowser
and commands menu.
+ | Different container implementations allow you to show an insane amount of data in one screen. | +
@@ -419,5 +425,7 @@ | Interact with hierarchical data with the TreeItem. |