public final class LayoutManager extends Object
Implements a collection (cache) of reusable Layout
instances. If a
requiered Layout
is not in this collection, then its specification is
downloaded, compiled, verified and added to the collection. Layouts are
downloaded using the URI (Uniform Resource Identifier) supplied to the
LayoutManager(String)
constructor. This URI must contain at least
one occurrence of the special placeholder character "*
". Before each
download, all occurrences of this placeholder are replaced with the
name of the requiered Layout
. In this way the resulting URI
gets targeted specifically to the required Layout
. Examples of valid
URIs:
http://www.obcom.cl/desktop/recs/*.asp file:/C:/websphere/dsn/web/recs/*.jsp ecuser://JSERVER?FormName=*
The last example shows a URI defined with the protocol ecuser
.
This non-standard protocol is used to download layout specifications from a
server called ECUSER
. This server is reached by sending transactions
via a ClientChannel
whose name matches the name of the host of
the URI. In the previous example, the required ClientChannel
is
called JSERVER
. This ClientChannel
must be created
before this LayoutManager
can be
used.
Constructor and Description |
---|
LayoutManager(String uri)
Creates a new
LayoutManager for the specified Uniform Resource
Identifier (URI). |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears (removes) all layouts from the cache.
|
Layout |
getLayout(String name)
Returns a
Layout with the specified name . |
String |
getURI()
Returns the Uniform Resource Identifier (URI) of this
LayoutManager . |
Iterator<Layout> |
iterator()
Returns a "read-only" iterator over the collection of layouts in this
LayoutManager . |
Layout |
putLayout(Layout layout)
Adds a layout to the collection of layouts of this
LayoutManager . |
public LayoutManager(String uri)
LayoutManager
for the specified Uniform Resource
Identifier (URI). This URI must contain at least one occurrence of
the special placeholder "*
". Before a Layout
is
downloaded, all occurrences of this placeholder are replaced with the
name of this Layout
. In this way the resulting URI gets
targeted specifically to the required Layout
.uri
- the Uniform Resource Identifier (URI) of layouts.NullPointerException
- if the supplied uri
is null
.public String getURI()
LayoutManager
.LayoutManager
.LayoutManager(String)
public Iterator<Layout> iterator()
LayoutManager
. Each object returned by the Iterator.next()
method corresponds to a Layout
object.LayoutManager
.Iterator.next()
,
Iterator.hasNext()
public void clear()
public Layout putLayout(Layout layout)
LayoutManager
.
The layout
must be non-null and complete as defined by the Layout.isComplete()
method. This method returns the previous layout with
the same name as the supplied layout
, or null
if it did
not have one.layout
- the layout to add to this LayoutManager
.layout
, or null
if it did not have one.NullPointerException
- if layout
is null.IllegalArgumentException
- if layout
is not complete.Layout.isComplete()
public Layout getLayout(String name)
Layout
with the specified name
. If the Layout
is not in the cache, it downloads its specification, compiles it,
verifies its MD5 signature (or checksum), and then stores the resulting
Layout
in the cache. If any step in this process fails, it throws
an exception.name
- name of the required Layout
.NullPointerException
- if name
is null or empty.Copyright © OBCOM INGENIERIA S.A. (Chile). All Rights Reserved.