public class IlpDefaultBackgroundSupport extends Object implements IlpBackgroundSupport
IlpBackgroundSupport
.Modifier and Type | Field and Description |
---|---|
protected Map |
backgroundFactories
Contains a mapping of extensions (xml, png) to instances of
IlpBackgroundFactory.
|
protected PropertyChangeListener |
backgroundPropertyListener
Listener that handles the property changes in the IlpBackground instances.
|
protected List |
backgrounds
A List with IlpBackground instances.
|
protected List |
backgroundURLs
A List with URL instances.
|
protected ilog.cpl.graph.background.internal.IlpBackgroundBatchingSupport |
batchingSupport
Used to provide batching of background properties.
|
protected List |
readOnlyBackgrounds
A read-only version of the IlpBackground instances List.
|
protected List |
readOnlyBackgroundURLs
A read-only version of the URL instances List.
|
protected IlpViewsView |
view
The view currently attached to this background support.
|
Constructor and Description |
---|
IlpDefaultBackgroundSupport()
Initializes the needed structures.
|
Modifier and Type | Method and Description |
---|---|
void |
addBackground(URL backgroundURL)
IlpBackgroundSupport implementation.
|
void |
addBackground(URL backgroundURL,
IlpBackground background)
Adds the background specified in the
URL using the the provided
IlpBackground as the last background. |
void |
addBackground(URL backgroundURL,
IlpBackground background,
int index)
IlpBackgroundSupport implementation.
|
void |
addBackground(URL backgroundURL,
int index)
IlpBackgroundSupport implementation.
|
void |
addBackgroundListener(IlpBackgroundListener listener)
IlpBackgroundSupport implementation.
|
void |
addBackgrounds(List backgroundURLs)
IlpBackgroundSupport implementation.
|
IlpBackground |
createBackground(URL backgroundURL)
It uses the registered
IlpBackgroundFactory s to create
the IlpBackground instance. |
IlpBackgroundFactory |
getBackgroundFactory(String extension)
Returns the background factory that is registered for the given extension.
|
IlpBackground |
getBackgroundInstance(URL backgroundURL)
IlpBackgroundSupport implementation.
|
List |
getBackgroundInstances()
Returns a read-only List of
IlpBackground instances in the same order as
they were indexed. |
List |
getBackgrounds()
IlpBackgroundSupport implementation.
|
protected int |
getLargestLayerIndex(List layers)
Returns the largest layer index within the given List of
IlvManagerLayers.
|
IlvManager |
getManager()
Returns the
IlvManager of the attached view. |
protected int |
getManagerLayerIndex(IlpBackground background,
int backgroundIndex)
Returns the IlvManagerLayer index that should be used by provided
IlpBackground as its insertion index.
|
IlvManagerView |
getManagerView()
Returns the
IlvManagerView of the attached view. |
protected int |
getNextAvailableIndex()
Returns the index that is after the index of the last IlvManagerLayer that
is used to represent a background.
|
protected int |
getSmallestLayerIndex(List layers)
Returns the smallest layer index within the given List of
IlvManagerLayers.
|
IlpViewsView |
getView()
IlpBackgroundSupport implementation.
|
protected void |
handleBackgroundCreation(IlpBackground background,
URL backgroundURL,
int backgroundIndex,
int backgroundManagerLayerIndex)
Should handle the creation the internal structures of the
IlpBackground.
|
protected void |
handleBackgroundDisposal(IlpBackground background)
Should handle the act of disposing the IlpBackground internal structures.
|
boolean |
isVisible(URL backgroundURL)
Returns if the background identified by the provided
URL is
visible or not. |
void |
moveBackground(URL backgroundURL,
int index)
IlpBackgroundSupport implementation.
|
protected void |
registerBackgroundFactories()
Registers all known background types.
|
void |
registerBackgroundFactory(String extension,
IlpBackgroundFactory factory)
IlpBackgroundSupport implementation.
|
void |
reloadBackground(URL backgroundURL)
IlpBackgroundSupport implementation.
|
void |
reloadBackgrounds()
IlpBackgroundSupport implementation.
|
void |
removeBackground(URL backgroundURL)
IlpBackgroundSupport implementation.
|
void |
removeBackgroundListener(IlpBackgroundListener listener)
IlpBackgroundSupport implementation.
|
void |
removeBackgrounds()
IlpBackgroundSupport implementation.
|
void |
setBackgrounds(List backgroundURLs)
Replaces the current backgrounds with the ones provided in the List
URL instances. |
void |
setView(IlpViewsView view)
IlpBackgroundSupport implementation.
|
void |
setVisible(URL backgroundURL,
boolean visible)
Sets if the background identified by the provided
URL is
visible or not. |
protected IlpViewsView view
protected ilog.cpl.graph.background.internal.IlpBackgroundBatchingSupport batchingSupport
protected Map backgroundFactories
protected List backgroundURLs
protected List readOnlyBackgroundURLs
protected List backgrounds
protected List readOnlyBackgrounds
protected PropertyChangeListener backgroundPropertyListener
public IlpDefaultBackgroundSupport()
public void addBackground(URL backgroundURL, int index) throws IlpBackgroundHandlingException
addBackground
in interface IlpBackgroundSupport
backgroundURL
- the URL
of the background to be addedindex
- the index where to add the backgroundIlpBackgroundHandlingException
- in case a problem occurs when adding
background for the provided URL
at the given index.IlpBackgroundSupport.addBackground(java.net.URL, int)
public void addBackground(URL backgroundURL) throws IlpBackgroundHandlingException
addBackground
in interface IlpBackgroundSupport
backgroundURL
- the URL
of the background to be addedIlpBackgroundHandlingException
- in case a problem occurs when adding
background for the provided URL
.IlpBackgroundSupport.addBackground(java.net.URL)
public void addBackground(URL backgroundURL, IlpBackground background, int index) throws IlpBackgroundHandlingException
addBackground
in interface IlpBackgroundSupport
backgroundURL
- the URL
of the background to be addedbackground
- the IlpBackground instance to be usedindex
- the index where to add the backgroundIlpBackgroundHandlingException
- in case a problem occurs when adding
background for the provided URL
and IlpBackground
.IlpBackgroundSupport.addBackground(java.net.URL, ilog.cpl.graph.background.IlpBackground, int)
public void addBackgrounds(List backgroundURLs) throws IlpBackgroundHandlingException
addBackgrounds
in interface IlpBackgroundSupport
backgroundURLs
- a List of URL
instancesIlpBackgroundHandlingException
- in case a problem occurs when
adding all the backgrounds.IlpBackgroundSupport.addBackgrounds(java.util.List)
public void removeBackground(URL backgroundURL) throws IlpBackgroundHandlingException
removeBackground
in interface IlpBackgroundSupport
backgroundURL
- the URL of the background of interestIlpBackgroundHandlingException
- in case a problem occurs when
removing the IlpBackground
associated with the provide
URL
.IlpBackgroundSupport.removeBackground(java.net.URL)
public void reloadBackground(URL backgroundURL) throws IlpBackgroundHandlingException
reloadBackground
in interface IlpBackgroundSupport
backgroundURL
- the URL that points to a given background.IlpBackgroundHandlingException
- in case a problem occurs when
reloading the provided URL
.IlpBackgroundSupport.reloadBackground(java.net.URL)
public List getBackgrounds()
getBackgrounds
in interface IlpBackgroundSupport
URL
instances in the same order as they
were indexedIlpBackgroundSupport.getBackgrounds()
public void removeBackgrounds() throws IlpBackgroundHandlingException
removeBackgrounds
in interface IlpBackgroundSupport
IlpBackgroundHandlingException
- in case a problem occurs when
removing all the backgrounds.IlpBackgroundSupport.removeBackgrounds()
public IlpBackgroundFactory getBackgroundFactory(String extension)
getBackgroundFactory
in interface IlpBackgroundSupport
extension
- File extension, for instance, gif
or svg
.public void registerBackgroundFactory(String extension, IlpBackgroundFactory factory) throws IlpBackgroundHandlingException
registerBackgroundFactory
in interface IlpBackgroundSupport
extension
- the extension that should specified in the form: "gif", "png"...factory
- the IlpBackgroundFactory
to be used for the given
extension or nullIlpBackgroundHandlingException
- in case a problem occurs when
registering the IlpBackgroundFactory
for the given extension.IlpBackgroundSupport.registerBackgroundFactory(java.lang.String, ilog.cpl.graph.background.IlpBackgroundFactory)
public void setView(IlpViewsView view) throws IlpBackgroundHandlingException
setView
in interface IlpBackgroundSupport
view
- the IlpViewsView of interest.IlpBackgroundHandlingException
- in case a problem occurs when
setting IlpViewsView
.IlpBackgroundSupport.setView(ilog.cpl.graphic.views.IlpViewsView)
public IlpBackground getBackgroundInstance(URL backgroundURL) throws IlpBackgroundHandlingException
It throws an IllegalArgumentException if the URL provided is not known.
getBackgroundInstance
in interface IlpBackgroundSupport
backgroundURL
- the URL of the background of interestIlpBackgroundHandlingException
- in case a problem occurs when
obtaining the IlpBackground
instance for the provide
URL
.public void reloadBackgrounds() throws IlpBackgroundHandlingException
reloadBackgrounds
in interface IlpBackgroundSupport
IlpBackgroundHandlingException
- in case a problem occurs when
reloading all the backgrounds.IlpBackgroundSupport.reloadBackgrounds()
public void moveBackground(URL backgroundURL, int index) throws IlpBackgroundHandlingException
Indices larger than the current background size will be adjusted to reflect the last position in backgrounds list.
This method does not remove nor re-add the background in question. Instead it
re-arrange the IlvManagerLayer
s appropriately.
moveBackground
in interface IlpBackgroundSupport
backgroundURL
- the URL
of the background of interest.index
- the index where the background should now be located.IlpBackgroundHandlingException
- in case a problem occurs when moving
the background.IlpBackgroundSupport.moveBackground(java.net.URL, int)
public IlpViewsView getView()
getView
in interface IlpBackgroundSupport
IlpViewsView
that this background support is
associated with.IlpBackgroundSupport.getView()
public void addBackgroundListener(IlpBackgroundListener listener)
addBackgroundListener
in interface IlpBackgroundSupport
listener
- IlpBackgroundListener
to be notified of changes.IlpBackgroundSupport.addBackgroundListener(ilog.cpl.graph.background.event.IlpBackgroundListener)
public void removeBackgroundListener(IlpBackgroundListener listener)
removeBackgroundListener
in interface IlpBackgroundSupport
listener
- IlpBackgroundListener
to be removed.IlpBackgroundSupport.removeBackgroundListener(ilog.cpl.graph.background.event.IlpBackgroundListener)
public void addBackground(URL backgroundURL, IlpBackground background) throws IlpBackgroundHandlingException
URL
using the the provided
IlpBackground
as the last background.public void setBackgrounds(List backgroundURLs) throws IlpBackgroundHandlingException
URL
instances.backgroundURLs
- a List of URL
sIlpBackgroundHandlingException
public List getBackgroundInstances()
IlpBackground
instances in the same order as
they were indexed.IlpBackground
instances in the same order as they
were indexed.public IlpBackground createBackground(URL backgroundURL) throws IlpBackgroundHandlingException
IlpBackgroundFactory
s to create
the IlpBackground
instance.
Note that the created IlpBackground
is not attached
to this IlpBackgroundSupport
.
backgroundURL
- the URL
of interest.IlpBackground
that represents the
provided URL
.IlpBackgroundHandlingException
- if a problem occurs.public boolean isVisible(URL backgroundURL) throws IlpBackgroundHandlingException
URL
is
visible or not.backgroundURL
- the URL of interestIlpBackgroundHandlingException
public void setVisible(URL backgroundURL, boolean visible) throws IlpBackgroundHandlingException
URL
is
visible or not.backgroundURL
- the URL of interestvisible
- true if visible and false otherwiseIlpBackgroundHandlingException
protected int getManagerLayerIndex(IlpBackground background, int backgroundIndex) throws IlpBackgroundHandlingException
The provided index is the index of the background within this background support.
IlpBackgroundHandlingException
protected int getNextAvailableIndex()
protected int getLargestLayerIndex(List layers)
protected int getSmallestLayerIndex(List layers)
public IlvManager getManager()
IlvManager
of the attached view.public IlvManagerView getManagerView()
IlvManagerView
of the attached view.protected void registerBackgroundFactories() throws IlpBackgroundHandlingException
IlpBackgroundHandlingException
protected void handleBackgroundDisposal(IlpBackground background) throws IlpBackgroundHandlingException
Handles:
background
- the IlpBackground to be handled.IlpBackgroundHandlingException
protected void handleBackgroundCreation(IlpBackground background, URL backgroundURL, int backgroundIndex, int backgroundManagerLayerIndex) throws IlpBackgroundHandlingException
Handles:
background
- the IlpBackground to be handled.backgroundURL
- the URL to be handled.backgroundIndex
- the index of this background within its peers.backgroundManagerLayerIndex
- the IlvManagerLayer index where to insert the given background.IlpBackgroundHandlingException
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.