Skip to content

Commit

Permalink
improved documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Virkus committed Aug 27, 2013
1 parent 0839435 commit 25e7969
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*
* @author Robert Virkus, j2mepolish@enough.de
* @see UniformItemSource
* @see UniformContainer
* @see SourcedContainer
* @see SourcedLazyContainer
*/
public interface ItemSource
{
Expand Down
21 changes: 21 additions & 0 deletions enough-polish-sample-messaging/resources/base/style/polish.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
public class SimpleMessageForm extends FramedForm {

TextField inputField;
private ArrayList messageList = new ArrayList();
private MessageItemSource itemSource;

/**
Expand Down Expand Up @@ -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;
}

Expand Down
97 changes: 97 additions & 0 deletions enough-polish-website/site/source/docs/gui-item-container.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<%define inDocumentationSection %>
<%define inDocumentationSection.gui %>
<%set title = J2ME Polish: Item %>
<%set basedir = ../ %>
<%include start_syntax.txt %>

<h1 id="top">Container</h1>
<ul class="relatedtechnologies">
<li class="relatedtechnologiesheader">Related Topics:</li>
<li><a href="gui-item-tableitem.html">TableItem</a></li>
<li><a href="gui-item-treeitem.html">TreeItem</a></li>
</ul>
<%index %>

<p>
<img src="<%= basedir%>images/gui-item-container.png" width="175" height="220" alt="Container can hold many items" />

Container contain different items. They are the basis for all J2ME Polish screens like
<a href="gui-screen-form.html">Form</a>, <a href="gui-screen-framedform.html">FramedForm</a>
or <a href="gui-screen-list.html">List</a>.
<br/>
You can create arbitrary complex items by nesting containers into each other.
<br />
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
available for Containers.
</p>

<h2 id="Container-ItemSource">ItemSource</h2>
<p>
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>
is responsible for translating underlying data into UI items. When an ItemSource is used, an
<a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/ItemConsumer.html">de.enough.polish.ui.ItemConsumer</a> will register
with the source, so that the ItemSource can inform the ItemConsumer when the underlying data has been updated.
</p>

<h2 id="Container-UsingADifferentContainer">Using a Different Container</h2>
<p>
If you want to use a different container you can either use one of the provided convenience forms
such as <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/UniformForm.html">UniformForm</a>
or <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/SourcedForm.html">SourcedForm</a>
or you register the container as a root container using <code>Screen.setRootContainer(Container)</code>:
</p>
<pre class="brush: java">
public class MyFramedForm extends FramedForm
{
public MyFramedForm()
{
super("title");
ItemSource mySource = new MyItemSource();
SourcedLazyContainer container = new SourcedLazyContainer(mySource, 5, 15);
setRootContainer(container);
}
}
</pre>

<h2 id="Container-SourcedContainer">SourcedContainer</h2>
<p>
A <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/SourcedContainer.html">de.enough.polish.ui.SourcedContainer</a>
is a normal container that uses an ItemSource.
</p>

<h2 id="Container-SourcedLazyContainer">SourcedLazyContainer</h2>
<p>
The <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/SourcedLazyContainer.html">de.enough.polish.ui.SourcedLazyContainer</a>
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.
<br/>
In combination with data storage like <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/io/ChunkedStorageCollection.html">de.enough.polish.io.ChunkedStorageCollection</a>,
<a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/io/ChunkedStorageRmsSystem.html">de.enough.polish.io.ChunkedStorageRmsSystem</a>
and the like you can create endless scrolling screens.
</p>

<h2 id="Container-UniformContainer">UniformContainer</h2>
<p>
The <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/UniformContainer.html">de.enough.polish.ui.UniformContainer</a>
along with the convenience <a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/UniformForm.html">de.enough.polish.ui.UniformForm</a>
allow you to show vast numbers of entries without using too much memory.
<br/>
For best memory efficiency the UniformContainer reuses items - for doing that you need to supply a
<a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/UniformItemSource.html">de.enough.polish.ui.UniformItemSource</a>
instead of an ItemSource. The UniformItemSource additionally defines a <code>void populateItem(int itemIndex, Item item )</code>
method for reusing items.
<br/>
A UniformContainer only supports items that have the same height.
</p>

<h2 id="Item-SampleApp">Sample App</h2>
<p>
Please compare the 'messaging' sample application for using ItemSource, UniformContainer and SourcedLazyContainer.
</p>

<h2 id="Item-JavaDoc">JavaDoc</h2>
<ul>
<li><a href="<%= javadocdir %>/javadoc/j2me/de/enough/polish/ui/Container.html">de.enough.polish.ui.Container</a></li>
</ul>

<%include end.txt %>
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ <h3 id="gui-viewtypes-item-size-increase">size-increase view-type</h3>

<h2 id="gui-viewtypes-container">View Types for Container based UI Components</h2>
<p>
You can apply the following <code>view-type</code>s for all Container based UI components - basically these are all
components that can contain a number of items. Examples include <a href="gui-item-choicegroup.html">ChoiceGroup</a>,
You can apply the following <code>view-type</code>s for all <a href="gui-item-container.html">Container</a>
based UI components - basically these are all components that can contain a number of items.
Examples include <a href="gui-item-choicegroup.html">ChoiceGroup</a>,
<a href="gui-screen-list.html">List</a>, <a href="gui-screen-form.html">Form</a>, <a href="gui-item-htmlbrowser.html">HtmlBrowser</a>
and <a href="gui-screenelement-menubar.html">commands menu</a>.
</p>
Expand Down
8 changes: 8 additions & 0 deletions enough-polish-website/site/source/docs/gui-visualguide.html
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ <h3 id="gui-item-clockitem">ClockItem</h3>
<td valign="center">The <a href="gui-item-clockitem.html">ClockItem</a> displays the time.</td>
</tr></table>

<h3 id="gui-item-container">Container</h3>
<table><tr>
<td><a href="gui-item-container.html"><img src="<%= basedir%>images/gui-item-container.png" width="175" height="220" alt="Container can hold many items" /></a></td>
<td valign="center">Different <a href="gui-item-container.html">container</a> implementations allow you to show an insane amount of data in one screen.</td>
</tr></table>

<h3 id="gui-item-custom">CustomItem</h3>
<table><tr>
<td><a href="gui-item-customitem.html"><img src="<%= basedir%>images/extend.png" width="76" height="68" alt="Create Your Own CustomItem" /></a></td>
Expand Down Expand Up @@ -419,5 +425,7 @@ <h3 id="gui-item-treeitem">TreeItem</h3>
</a></td>
<td valign="center">Interact with hierarchical data with the <a href="gui-item-treeitem.html">TreeItem</a>.</td>
</tr></table>



<%include end.txt %>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,11 @@ private void appendKeywordEntries(Keyword[] myKeywords, HashMap entriesByKeyword
int idStartPos = currentLine.indexOf(" id=\"");
if (idStartPos != -1) {
int idEndPos = currentLine.indexOf( '"', idStartPos + 6 );
if (idEndPos == -1)
{
String message = "Unable to process line " + currentLine + " in " + path + ": id is not closed";
throw new BuildException(message);
}
String id = currentLine.substring( idStartPos + 5, idEndPos );
int headingStartPos = currentLine.indexOf( '>', idEndPos );
int headingEndPos = currentLine.indexOf('<', headingStartPos );
Expand Down

0 comments on commit 25e7969

Please sign in to comment.