Class LayoutLoader
java.lang.Object
cl.obcom.desktopfx.layout.LayoutLoader
Collection of reusable
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.netswitch.cl/layouts/*.jsp file:///C:/netswitch/layouts/*.asp
-
Constructor Summary
ConstructorsConstructorDescriptionLayoutLoader(Desktop desktop, URI layoutURI) Creates a newLayoutLoaderinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears (removes) all layouts from the cache.Downloads the specification of theLayoutwith the givenname.Returns theLayoutwith the specifiedname.booleanReturnstrueif the signatures of downloaded layouts are verified.layouts()Returns an unmodifiable collection with the layouts contained in thisLayoutLoader.voidAdds a layout to the collection of layouts of thisLayoutLoader.voidsetVerifyLayoutSignatures(boolean value) Changes whether the signatures of downloaded layouts are verified.
-
Constructor Details
-
LayoutLoader
Creates a newLayoutLoaderinstance.- Parameters:
desktop- the Desktop application instance.layoutURI- the URI used to download layouts.- Throws:
NullPointerException- if an argument isnull.IllegalArgumentException- iflayoutURIis invalid.
-
-
Method Details
-
layouts
Returns an unmodifiable collection with the layouts contained in thisLayoutLoader.- Returns:
- an unmodifiable collection with the layouts contained in this
LayoutLoader.
-
clear
public void clear()Clears (removes) all layouts from the cache. -
getVerifyLayoutSignatures
public boolean getVerifyLayoutSignatures()Returnstrueif the signatures of downloaded layouts are verified.- Returns:
trueif the signatures of downloaded layouts are verified.
-
setVerifyLayoutSignatures
public void setVerifyLayoutSignatures(boolean value) Changes whether the signatures of downloaded layouts are verified.- Parameters:
value- iftruethe signatures of downloaded layouts will be verified. Otherwise the signatures will be assigned to layouts without verification.
-
getLayout
Returns theLayoutwith the specifiedname. 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 ifgetVerifyLayoutSignatures()returnstrue, otherwise the signature will be assigned to the layout without verification.- Parameters:
name- name of the requiredLayout.- Returns:
- the
Layoutwith the specifiedname. - Throws:
NullPointerException- ifnameisnull.Exception- if an error occurs while loading the layout.
-
putLayout
Adds a layout to the collection of layouts of thisLayoutLoader. Thelayoutmust be non-null and complete as defined by theLayout.isComplete()method.- Parameters:
layout- the layout to add to thisLayoutLoader.- Throws:
NullPointerException- iflayoutis null.IllegalArgumentException- iflayoutis not complete.
-
download
Downloads the specification of theLayoutwith the givenname. The layout spacification will be downloaded from the location specified by the specifiedlayoutURI.- Parameters:
name- the name of the requiredLayout.- Returns:
- a string with the specification of the
Layout. - Throws:
NullPointerException- ifnameisnull.Exception- if an error occurs while loading the layout.
-