BlueSpray - Help
© SchoonerTurtles, Inc. 2012-2015

Introduction
Contents
Getting Started
Download
Navigating
Tutorials
Scripting
Advanced
About

Class STBase

This is the base class for all SchoonerTurtle classes and provides functionality to:


  • Saving and loading of object contents to and from XML files ("stx" files)



And defines:


  • Getting the object's name

  • Having a parent

  • Get and set settings (typically as part of loading and saving xml files)



* The base class does not have a constructor and does not have any member variables
making it's creation very fast. This allows it to be used to classes such as
STEdge which must be created and destroyed very quickly.


Copyright, SchoonerTurtles LLP, 2009
@author Jim Graham

ReturnsDefaultFunctionThrows
  Deallocate() Exception
String   GetContainedObjectsProperties(int TheLevel) Exception
String ShortClassName GetName()  
  GetProperties(STProperties TheSettings) Exception;
int   SetContainedObjectProperties(String ContainedObjectClassName,String ContainerClassName,String ObjectName,String TheString,int StartIndex) Exception
  SetProperties(STProperties TheProperties) Exception;

Object Functions


Deallocate() Exception

Deallocates any resources used by the class. This function must be overriden
and implemented for classes that contain pointers to other classes. This is because
Java will not clean up objects unless their pointers are first freed up. Subclasses
also need to class their aggregated objects to Deallocate() themselves.


String GetContainedObjectsProperties(int TheLevel) Exception

Return any content within the object that is not set in GetSettings() to
the string (including children) as an XML string

Parameters:
    TheLevel
Returns: '' if no content


String GetName()  

Returns the current name of the object. Needs to be overridden by subclasses
that allow the name to be set.

Returns: the current name of the object


GetProperties(STProperties TheSettings) Exception;

Sets the objects settings into the specified STProperties object.
The Format should be:
if ((Name!=null)&&(Name.equals("Untitled")==false)) TheSettings.Add(STBase.class,"Name",Name);

Parameters:
    TheSettings


int SetContainedObjectProperties(String ContainedObjectClassName,String ContainerClassName,String ObjectName,String TheString,int StartIndex) Exception

Override to obtain the settings for any children within an object.
Classes that override this function should make sure ContainerClassName
and the ObjectName are what is expected. ContainerClassName identifies
the class that wrote the object to the stream so that multiple classes in the
same hierarchy can use the same name for objects (i.e. we don't have to keep track).
The ObjectName allows the same class to use multiple objects of the same type within
one object. The ContainedObjectClassName identifies the type of class that should be
created for the object to ingest the properties. It is not required to check
this name but the other two are required. If the name of a class changes,
it should support the old names for backward compatibility.

Parameters:
    ContainedObjectClassName - the class name of the subclass at the bottom of the hierarchy (i.e. the one to instantiate)
    ContainerClassName - name of the class that contains the content tag (i.e. A scene contains layers)
    ObjectName - Value of the "Name" property for the object that was created.
    TheString - The string with the XML file contents
    StartIndex - An offset into the string to start parsing the attributes and content for the object.
Returns: New offset into the string


SetProperties(STProperties TheProperties) Exception;

The object should override this function to obtain it's settings values.
The format should be:

Name=TheProperties.Get("Name",Name);

Parameters:
    TheProperties