public final class LayoutLoader extends Object
Layout
instances. If a required Layout
is not in the collection, it is loaded from the specified layoutURI
and added to the collection.
The layoutURI
must contain at least one occurrence of the marker
"*
". Before each download, all occurrences of this marker are
replaced with the name of the layout. In this way, the resulting URL
gets targeted specifically to the required layout. Examples of valid URLs:
http://www.netserver.cl/layouts/*.jsp file:///C:/netserver/layouts/*.asp
Constructor and Description |
---|
LayoutLoader(Desktop desktop,
URI layoutURI)
Creates a new
LayoutLoader instance. |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears (removes) all layouts from the cache.
|
String |
download(String name)
Downloads the specification of the
Layout with the given name . |
Layout |
getLayout(String name)
Returns the
Layout with the specified name . |
boolean |
getVerifyLayoutSignatures()
Returns
true if the signatures of downloaded layouts are verified. |
Collection<Layout> |
layouts()
Returns an unmodifiable collection with the layouts contained in this
LayoutLoader . |
void |
putLayout(Layout layout)
Adds a layout to the collection of layouts of this
LayoutLoader . |
void |
setVerifyLayoutSignatures(boolean value)
Changes whether the signatures of downloaded layouts are verified.
|
public LayoutLoader(Desktop desktop, URI layoutURI)
LayoutLoader
instance.desktop
- the Desktop application instance.layoutURI
- the URI used to download layouts.NullPointerException
- if an argument is null
.IllegalArgumentException
- if layoutURI
is invalid.public Collection<Layout> layouts()
LayoutLoader
.LayoutLoader
.public void clear()
public boolean getVerifyLayoutSignatures()
true
if the signatures of downloaded layouts are verified.true
if the signatures of downloaded layouts are verified.public void setVerifyLayoutSignatures(boolean value)
value
- if true
the signatures of downloaded layouts will
be verified. Otherwise the signatures will be assigned to layouts
without verification.public Layout getLayout(String name) throws Exception
Layout
with the specified name
. If the layout
is not available in the cache, it is downloaded, compiled, stored in the
cache and returned to the caller of this method. The signature of the
downloaded layout will be verified if getVerifyLayoutSignatures()
returns true
, otherwise the signature will be assigned to the
layout without verification.name
- name of the required Layout
.Layout
with the specified name
.NullPointerException
- if name
is null
.Exception
- if an error occurs while loading the layout.public void putLayout(Layout layout)
LayoutLoader
.
The layout
must be non-null and complete as defined by the Layout.isComplete()
method.layout
- the layout to add to this LayoutLoader
.NullPointerException
- if layout
is null.IllegalArgumentException
- if layout
is not complete.public String download(String name) throws Exception
Layout
with the given name
. The layout spacification will be downloaded from the location
specified by the specified layoutURI
.name
- the name of the required Layout
.Layout
.NullPointerException
- if name
is null
.Exception
- if an error occurs while loading the layout.Copyright © OBCOM INGENIERIA S.A. (Chile). All Rights Reserved.