Listing of Source ../source/GOF/GofHostAreaIdentifierAdapter.javapackage se.entra.phantom.server;
import java.util.Vector;
/**
* This is an adapter class that must be used as a base class for classes implementing
* the GofHostAreaIdentifier interface.
* <p>
* Extending from this class, instead of directly implementing the interface, makes
* it possible to extend the interface with new methods in the future, without forcing
* a re-compilation of user written GofHostAreaIdentifier classes. Default versions of
* these new methods can instead be implemented in this adapter class.
* @author J. Bergström
*/
public abstract class GofHostAreaIdentifierAdapter implements GofHostAreaIdentifier
{
// ------------------
// INSTANCE VARIABLES
// ------------------
/**
* All the GofHostFields that belongs to this area.
*/
protected Vector<GofHostField> areaGofHostFields = new Vector<GofHostField>();
/**
* All the controls that have been added to this area.
*/
protected Vector<PhantomControl> phantomControls = new Vector<PhantomControl>();
// -----------
// CONSTRUCTOR
// -----------
/**
* The constructor is a default constructor without any parameters. This makes it possible to
* load this class dynamically. The constructor doesn't do anything more than create the
* instance.
*/
public GofHostAreaIdentifierAdapter( )
{
}
// ----------------
// INSTANCE METHODS
// ----------------
/**
* This method should get all the settings from the configuration file needed for this class.
* <p>
* Classes extending from this class that needs to read in their own settings from the configuration
* file, <b>must</b> implement this method, since this default implementation don't do anything.
* @param confFile A reference to the IniFile instance that holds the current server configuration file's settings.
* @param subsection The name of the subsection used for the current Gui-on-the-Fly settings.
*/
@Override
public void getAreaSettings( IniFile confFile, String subsection )
{
}
/**
* This method must implement the code for identifying the area the class is supposed to identify.
* It should also store the GofHostFields that belong to this area in the areaGofHostFields Vector.
* <p>
* This adapter class only implements an empty method. Classes extending this class <b>must</b>
* extend this method.
* @param gofHostFields A <code>Vector</code> containing all the GofHostFields in the part of the
* screen area to be analyzed.
* @param x The start column of the area to be analyzed.
* @param y The start line of the area to be analyzed.
* @param w The width of the area to be analyzed.
* @param h The height of the area to be analyzed.
* @return The adapters default method just returns <code>null</code>.
* @see #areaGofHostFields
*/
@Override
public Vector<GofHostField> identifyArea( Vector<GofHostField> gofHostFields, int x, int y, int w, int h )
{
return null;
}
/**
* This method gets all the GofHostFields belonging to this area.
* @return This area's GofHostFields.
*/
@Override
public Vector<GofHostField> getAreasGofHostFields( )
{
return areaGofHostFields;
}
/**
* Adds a new PhantomControl to the area. The method stores the control internally
* in a <code>Vector</code> in the class. This makes it possible for class extending
* this class to implement the laying out of the components.
* @param phantomControl The control to add to this area.
*/
@Override
public void addControl( PhantomControl phantomControl )
{
phantomControls.addElement( phantomControl );
}
/**
* This method should layout the controls belonging to this area according to the layout rule
* specified by the parameter.
* <p>
* This adapter class only implements an empty method. Classes extending this class <b>must</b>
* extend this method.
*/
@Override
public void layout( )
{
}
}