com.moximedia.aims
Class AimsFolder

java.lang.Object
  extended bycom.moximedia.aims.AimsFolder
All Implemented Interfaces:
java.io.Serializable

public class AimsFolder
extends java.lang.Object
implements java.io.Serializable

Folders are used to organize layers in the IMF. A folder can contain layers, be set to be opened or closed, and has a name. The AimsFolder object is one of a group of folders that can be added to an AimsFolders object.

See Also:
Serialized Form

Field Summary
protected static int NEXT_FOLDER_ID
           
 
Constructor Summary
AimsFolder()
          Creates new Folder
AimsFolder(java.lang.String folderName)
          Creates new Folder with a name
AimsFolder(java.lang.String folderName, boolean isOpen)
          Creates new Folder with a name and initial state
 
Method Summary
 void addFolder(AimsFolder folder)
          Adds a folder to the folder.
 void addLayer(int index, java.lang.Object layer)
          Inserts a layer to the folder at the specified index.
 void addLayer(java.lang.Object layer)
          Adds a layer to the folder.
 boolean canSetVisibilityOff()
           
 boolean canSetVisibilityOn()
           
 boolean controlsSubfolderVisibility()
           
 AimsFolder getFolderByName(java.lang.String name)
           
 AimsFolder getFolderByObjectId(int objectId)
           
 AimsFolders getFolders()
          Gets the folders that are subfolders of this folder
 AimsLayerGroup getGroupByObjectId(int objectId)
           
 AimsLayers getLayers()
          Returns the layers contained in the folder in an AimsLayers object.
 int getLevel()
           
 java.lang.String getName()
          Returns a String containing the folder name.
 int getObjectId()
          Returns the IMF internal id for this folder.
 java.util.Vector getObjects()
          Returns the layers and groups contained in the folder in a Vector object.
 boolean hasLayer(int layerObjectId)
          Returns an indicator of whether a layer with the specified object id is in this folder or subfolder.
 boolean hasLayerListLegends()
           
 boolean isClosed()
          Returns the current open/closed state of the folder.
 boolean isOpen()
          Returns the current open/closed state of the folder.
 boolean isRadio()
          Returns whether the folder is a radio folder where only one layer or group can be turned on at a time.
 void removeLayer(java.lang.String layerNameOrId)
          Removes the layer with the specified name or ID.
 void setAxlAttribute(java.lang.String tag, java.lang.String name, java.lang.String value)
          Sets one of the attributes of this object using a string value.
 void setClosed()
          Sets the open/closed state of the folder to open.
 void setLevel(int level)
           
 void setOpen()
          Sets the open/closed state of the folder to open.
 void setOpen(boolean isOpen)
          Sets the open/closed state of the folder.
 void setVisible(boolean isVisible)
          Sets the visibility of all the layers or layer groups in the folder, respecting the canSetVisibility and controlSubfolderVisibility settings of this folder and subfolders.
 void toggle()
          Toggles the open/closed state of the folder.
 java.lang.String toString()
          Returns a text representation of of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NEXT_FOLDER_ID

protected static int NEXT_FOLDER_ID
Constructor Detail

AimsFolder

public AimsFolder()
Creates new Folder


AimsFolder

public AimsFolder(java.lang.String folderName)
Creates new Folder with a name

Parameters:
folderName - The name of the folder

AimsFolder

public AimsFolder(java.lang.String folderName,
                  boolean isOpen)
Creates new Folder with a name and initial state

Parameters:
folderName - The name of the folder
isOpen - True if the folder should be open, otherwise false
Method Detail

canSetVisibilityOn

public boolean canSetVisibilityOn()

canSetVisibilityOff

public boolean canSetVisibilityOff()

controlsSubfolderVisibility

public boolean controlsSubfolderVisibility()

setVisible

public void setVisible(boolean isVisible)
Sets the visibility of all the layers or layer groups in the folder, respecting the canSetVisibility and controlSubfolderVisibility settings of this folder and subfolders.


getFolderByName

public AimsFolder getFolderByName(java.lang.String name)

getFolderByObjectId

public AimsFolder getFolderByObjectId(int objectId)

getGroupByObjectId

public AimsLayerGroup getGroupByObjectId(int objectId)

getObjectId

public int getObjectId()
Returns the IMF internal id for this folder.

Returns:
The internal id for the folder.

setLevel

public void setLevel(int level)

getLevel

public int getLevel()

addLayer

public void addLayer(int index,
                     java.lang.Object layer)
Inserts a layer to the folder at the specified index. If the index is out of bounds, the layer will be added to the end of the list.

Parameters:
index - The position of the layer in the folder.
layer - A layer to add to the folder.

addLayer

public void addLayer(java.lang.Object layer)
Adds a layer to the folder.

Parameters:
layer - A layer to add to the folder.

addFolder

public void addFolder(AimsFolder folder)
Adds a folder to the folder.

Parameters:
folder - A folder to add to the folder.

getFolders

public AimsFolders getFolders()
Gets the folders that are subfolders of this folder

Returns:
The folders, or null if there are no subfolders.

getLayers

public AimsLayers getLayers()
Returns the layers contained in the folder in an AimsLayers object.

Returns:
An AimsLayers object containing the layers in the folder.

removeLayer

public void removeLayer(java.lang.String layerNameOrId)
Removes the layer with the specified name or ID.

Parameters:
layerNameOrId - The layer name or ID.

getObjects

public java.util.Vector getObjects()
Returns the layers and groups contained in the folder in a Vector object.

Returns:
A Vector object containing the layers and groups in the folder.

getName

public java.lang.String getName()
Returns a String containing the folder name.

Returns:
The name of the folder.

isOpen

public boolean isOpen()
Returns the current open/closed state of the folder.

Returns:
True if open, false if closed.

isRadio

public boolean isRadio()
Returns whether the folder is a radio folder where only one layer or group can be turned on at a time.

Returns:
True if it is a radio folder, false if not.

isClosed

public boolean isClosed()
Returns the current open/closed state of the folder.

Returns:
True if closed, false if open.

setOpen

public void setOpen(boolean isOpen)
Sets the open/closed state of the folder.

Parameters:
isOpen - True to open the folder, false to close.

setOpen

public void setOpen()
Sets the open/closed state of the folder to open.


setClosed

public void setClosed()
Sets the open/closed state of the folder to open.


toggle

public void toggle()
Toggles the open/closed state of the folder.


toString

public java.lang.String toString()
Returns a text representation of of this class.

Returns:
A string describing the class

setAxlAttribute

public void setAxlAttribute(java.lang.String tag,
                            java.lang.String name,
                            java.lang.String value)
Sets one of the attributes of this object using a string value. This method should only be called from the SAX event handler.

Parameters:
tag - The AXL element tag containing this attribute (not used).
name - The AXL attribute name.
value - The AXL attribute value.

hasLayerListLegends

public boolean hasLayerListLegends()

hasLayer

public boolean hasLayer(int layerObjectId)
Returns an indicator of whether a layer with the specified object id is in this folder or subfolder.

Parameters:
layerObjectId - The object id of the target layer.
Returns:
True if found, otherwise false.