com.moximedia.aims
Class AimsFolder

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

public class AimsFolder
extends java.lang.Object
implements AimsObject, 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.

Author:
Doug Cates
See Also:
Serialized Form

Field Summary
protected static int NEXT_FOLDER_ID
           
 
Fields inherited from interface com.moximedia.aims.AimsObject
OBJECT_TYPE_ACETATE_LAYER, OBJECT_TYPE_FEATURE_LAYER, OBJECT_TYPE_FOLDER, OBJECT_TYPE_FOLDERS, OBJECT_TYPE_GROUP, OBJECT_TYPE_GROUPS, OBJECT_TYPE_IMAGE_LAYER, OBJECT_TYPE_WMS_LAYER
 
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 getGroupByName(java.lang.String name)
          Searches for a group in this folder or its subfolders with the specified name.
 AimsLayerGroup getGroupByObjectId(int objectId)
          Searches for a group in this folder or its subfolders with the specified object id.
 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.
 int getObjectType()
          Gets the type of object this is.
 boolean hasGroups()
          Returns an indicator of whether this folder or any of its sub-folders contain layer groups.
 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 hasLayers()
          Returns an indicator of whether this folder or any of its sub-folders contain layers.
 boolean hasLayersOrGroups()
          Returns an indicator of whether this folder or any of its sub-folders contain layers or groups.
 boolean isClosed()
          Returns the current open/closed state of the folder.
 boolean isEmpty()
          Returns an indicatior of whether there are any sub-folders, layers or groups in this 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 removeEmptyFolders()
          Removes empty folders from this folder.
 void removeEmptyFoldersRecursive()
          Removes empty folders from this folder and its sub-folders.
 void removeEmptyGroups()
          Removes empty groups from this folder
 void removeEmptyGroupsRecursive()
          Removes empty groups from this folder and its sub-folders.
 void removeGroup(int objectId)
          Removes the group with the specified object ID from this folder.
 void removeGroupRecursive(int objectId)
          Removes the group with the specified object ID from this folder or subfolders.
 void removeLayer(int objectId)
          Removes the layer with the specified object ID from this folder.
 void removeLayer(java.lang.String layerNameOrId)
          Removes the layer with the specified name or ID.
 void removeLayerRecursive(int objectId)
          Removes the layer with the specified object ID from this folder or subfolders.
 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.

Parameters:
isVisible - The new visibility setting for the folder contents.

getFolderByName

public AimsFolder getFolderByName(java.lang.String name)

getFolderByObjectId

public AimsFolder getFolderByObjectId(int objectId)

getGroupByObjectId

public AimsLayerGroup getGroupByObjectId(int objectId)
Searches for a group in this folder or its subfolders with the specified object id.

Parameters:
objectId - The object id of the group.
Returns:
The group, or null if not found.

getGroupByName

public AimsLayerGroup getGroupByName(java.lang.String name)
Searches for a group in this folder or its subfolders with the specified name.

Parameters:
name - The name of the group.
Returns:
The group, or null if not found.

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.

removeGroup

public void removeGroup(int objectId)
Removes the group with the specified object ID from this folder. Does not remove the group from sub-folders.

Parameters:
objectId - The group's objectId.

removeGroupRecursive

public void removeGroupRecursive(int objectId)
Removes the group with the specified object ID from this folder or subfolders.

Parameters:
objectId - The group's objectId.

removeLayer

public void removeLayer(int objectId)
Removes the layer with the specified object ID from this folder. Does not remove the layer from sub-folders.

Parameters:
objectId - The layer's objectId.

removeLayerRecursive

public void removeLayerRecursive(int objectId)
Removes the layer with the specified object ID from this folder or subfolders.

Parameters:
objectId - The layer's objectId.

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.

isEmpty

public boolean isEmpty()
Returns an indicatior of whether there are any sub-folders, layers or groups in this folder.

Returns:
True if there are no sub-folders, layers or groups in this folder.

removeEmptyGroups

public void removeEmptyGroups()
Removes empty groups from this folder


removeEmptyGroupsRecursive

public void removeEmptyGroupsRecursive()
Removes empty groups from this folder and its sub-folders.


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.

hasLayers

public boolean hasLayers()
Returns an indicator of whether this folder or any of its sub-folders contain layers. Note: does not consider groups.

Returns:
True if this folder or any of it's sub-folders contain layers, otherwise false.

hasGroups

public boolean hasGroups()
Returns an indicator of whether this folder or any of its sub-folders contain layer groups. Note: does not consider layers.

Returns:
True if this folder or any of it's sub-folders contain groups, otherwise false.

hasLayersOrGroups

public boolean hasLayersOrGroups()
Returns an indicator of whether this folder or any of its sub-folders contain layers or groups.

Returns:
True if this folder or any of it's sub-folders contain layers or groups, otherwise false.

removeEmptyFolders

public void removeEmptyFolders()
Removes empty folders from this folder.


removeEmptyFoldersRecursive

public void removeEmptyFoldersRecursive()
Removes empty folders from this folder and its sub-folders.


getObjectType

public int getObjectType()
Gets the type of object this is.

Specified by:
getObjectType in interface AimsObject
Returns:
The enumerated value.


Internet Mapping Framework for ArcIMS Java Object Model API (v5.0.004)
Copyright © 2005 Moxi Media Inc. and Province of British Columbia. All Rights Reserved.