用Eclipse开发iPhone Web 应用程序
清单 2. 定制 textRow CSS 扩展以正确显示静态文本
/* Adding a new row CSS style to iUi for displaying blocks of text */
position: relative;
border-bottom: 1px solid #999999;
-webkit-border-radius: 0;
text-align: right;
}
text-align: left;
margin: 5px 8px 5px 10px;
padding: 0px 0px 0px 0px;
}
fieldset > .textRow:last-child {
border-bottom: none !important;
}
清单 3 显示了 java.math.BigDecimal 的一种构造方法的详细信息页面。
清单 3. 使用 textRow 元素的 HTML 详细信息页面
<div id="java.math.BigDecimal(long,java.math.MathContext)" title="BigDecimal"
class="panel">
<div class="textRow"><p><b>
public BigDecimal(long, MathContext)</b></p></div>
<div class="textRow"><p>Translates a
<code>long</code> into a
<code>BigDecimal</code>, with rounding according to the context settings.
The scale of the <code>BigDecimal</code>, before any rounding, is zero.
<h2>Parameters</h2>
<div class="textRow"><p><b>long val
</b>: <code>long</code> value to be converted
to <code>BigDecimal</code>.</p></div>
<div class="textRow"><p><b>MathContext mc
</b>: the context to use.</p></div>
<h2>Throws</h2>
<div class="textRow"><p><b>ArithmeticException
</b>: if the result is inexact but
the rounding mode is <code>UNNECESSARY</code>.</p></div>
</div>
<fieldset> 标记内的所有内容都位于圆角矩形内,textRow <div> 用于分隔行。带有 <h2> 标记的标题显示为列表上方的组标签。图 10 显示了最终页面。
图 10. java.math.BigDecimal 中的构造函数的详细视图
拥有三个导航级别和目标详细信息页面后,UI 就完成了。iDoc 使用户可以专注于具体任务。借助 iUi 框架和一些定制的 CSS,它看上去很像本机 iPhone 应用程序。
开发 iDoc
现在已经设计了 UI,接下来需要编写代码来生成 HTML 文件。创建一个插入到 Sun 的 javadoc 命令中的简单 doclet。我们的示例将使用标准 java.* 包,但是 iDoc 可以从任何源代码生成 Javadoc。使用 OpenJDK 源代码,因为它可以公开获得并且 GNU Public License (GPL) V2 许可证允许我们生成和发布其 Javadoc。
使用 iDoc,只需迭代包和类并调用方法打印上述格式的静态 HTML 页面。清单 4 显示打印目标详细信息页面的方法。
评论