public abstract class IlvTileLockFilter extends Object implements IlvPersistentObject, Serializable
isLockAllowed function of the
the filter that will potentially veto the lock of a tile
that was triggered by an event in a view (unzooming, scrolling,
resizing ...). This class can be used to prevent the loading
of too many tiles at the same time.
The following example prevents a view which is extremely zoomed out to load more than 10 tiles at once.
class MyLockFilter
extends IlvTileLockFilter {
public boolean isLockAllowed(IlvTileController tileController,
IlvManagerView view)
{
// get the size of the view
Dimension size = view.getSize();
// compute the corners of the view in the manager coordinate system
IlvTransformer t = view.getTransformer();
if (t == null)
return true;
IlvRect rect = new IlvRect(0, 0, size.width, size.height);
t.inverse(rect);
// compute the number of visible tiles
int indexes[] = tileController.getTileIndexes(rect);
int horizontalTiles =
indexes[IlvTileController.RIGHT_COLUMN_INDEX] -
indexes[IlvTileController.LEFT_COLUMN_INDEX] + 1;
int verticalTiles =
indexes[IlvTileController.LOWER_ROW_INDEX] -
indexes[IlvTileController.UPPER_ROW_INDEX] + 1;
if ((horizontalTiles * verticalTiles) > 10)
return false;
else
return true;
}
public boolean isPersistent()
{
return false;
}
}
To implement persistence, see the documentation of the
IlvPersistentObject interface.IlvTileController.setLockFilter(ilog.views.tiling.IlvTileLockFilter),
Serialized Form| Modifier | Constructor and Description |
|---|---|
protected |
IlvTileLockFilter()
Initializes an instance of
IlvTileLockFilter |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
isLockAllowed(IlvTileController tileController,
IlvManagerView view)
Returns true if an event in view can lock a tile in the
specified tile controller (If the tile controller is attached
to a layer, this function is called only if the layer is visible
in the view).
|
abstract boolean |
isPersistent()
Tells if the filter must be saved to an IVL file.
|
void |
write(IlvOutputStream stream)
Writes the filter to an
IlvOutputStream. |
protected IlvTileLockFilter()
IlvTileLockFilter public abstract boolean isLockAllowed(IlvTileController tileController, IlvManagerView view)
tileController - the controller of the tilesview - the view that requested the lock (after a zoom operation
or a resize operation for instance)public abstract boolean isPersistent()
true, the filter
is saved; otherwise it is not saved.public void write(IlvOutputStream stream) throws IOException
IlvOutputStream.write in interface IlvPersistentObjectstream - the output stream. You must override this method
if specific data is to be stored. Note that the first instruction
in your implementation of the method must be
super.write(stream).IOException - standard IO error.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.