NCSA Portfolio

ncsa.j3d.ui
Class PortfolioProperties

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--java.util.Properties
                    |
                    +--ncsa.j3d.ui.PortfolioProperties

public class PortfolioProperties
extends java.util.Properties

This object is derived from the properties object. It is custom tailored to load objects specified in these property files. And allows instantiating of a list of objects. Here a list of objects is defined by appending monotonically increasing numbers (starting at 0) to a string of characters.

e.g. InputSource0=ncsa.j3d.ui.events.KeyPress InputSource1=ncsa.j3d.ui.events.KeyRelease InputSource2=ncsa.j3d.ui.events.MouseDown InputSource3=ncsa.j3d.ui.events.MouseUp InputSource4=ncsa.j3d.ui.events.MouseDrag

See Also:
Serialized Form

Method Summary
 java.util.Enumeration getEnumeration(java.lang.String text)
          This is the same as getVector except that an Enumeration is returned.
 java.lang.Object getObject(java.lang.String text)
          This method searches through the portfolio.properties file and tries to instantiate the object that is identified by the supplied key.
 java.lang.Object[] getObjects(java.lang.String text)
          This is the same as getVector except that an Object[] is returned.
 java.util.Vector getVector(java.lang.String text)
          Allows a list of objects to be loaded.
static PortfolioProperties instance()
           
static void main(java.lang.String[] args)
          This is test of sorts.
static void makeDefault(java.util.Properties p)
          This adds/overwrites the following entries in the properties file.
static void reload()
           
static void save(java.util.Properties p)
          Saves the properties file to portfolio.properties in the current directory.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, propertyNames, save, setProperty, store
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

instance

public static PortfolioProperties instance()

reload

public static void reload()

getVector

public java.util.Vector getVector(java.lang.String text)
Allows a list of objects to be loaded. A list of objects is defined by the left part of the entry consisting of the same string of text with a monotonically increasing (starting at zero) integer appended to it.

e.g.

InputSource4=ncsa.j3d.ui.events.MouseDrag

InputSource3=ncsa.j3d.ui.events.MouseUp

InputSource2=ncsa.j3d.ui.events.MouseDown

InputSource1=ncsa.j3d.ui.events.KeyRelease

InputSource0=ncsa.j3d.ui.events.KeyPress

And supplying "InputSource" as the argument, would return a vector containing these objects with the InputSource0 object in the first entry of the Vector(etc..).

Parameters:
text - The text portion of the list to load.

getEnumeration

public java.util.Enumeration getEnumeration(java.lang.String text)
This is the same as getVector except that an Enumeration is returned.
Parameters:
text - The text portion of the list to load.

getObjects

public java.lang.Object[] getObjects(java.lang.String text)
This is the same as getVector except that an Object[] is returned.
Parameters:
text - The text portion of the list to load.

getObject

public java.lang.Object getObject(java.lang.String text)
This method searches through the portfolio.properties file and tries to instantiate the object that is identified by the supplied key. e.g. MyKey=ncsa.dodo.chris would try to instantiate the ncsa.dodo.chris object when text = "MyKey".
Parameters:
text - The key to search for.

main

public static void main(java.lang.String[] args)
This is test of sorts. It has a side effect that an blank property file is created. This is a minimal portfolio.properties file.

It contains.

InputSource0=ncsa.j3d.ui.events.KeyPress

InputSource1=ncsa.j3d.ui.events.KeyRelease

InputSource2=ncsa.j3d.ui.events.MouseDown

InputSource3=ncsa.j3d.ui.events.MouseUp

InputSource4=ncsa.j3d.ui.events.MouseDrag

ActiveTool=ncsa.j3d.ui.tools.PickTool

InactiveTool0=ncsa.j3d.ui.tools.ViewTool


makeDefault

public static void makeDefault(java.util.Properties p)
This adds/overwrites the following entries in the properties file.

InputSource0=ncsa.j3d.ui.events.KeyPress

InputSource1=ncsa.j3d.ui.events.KeyRelease

InputSource2=ncsa.j3d.ui.events.MouseDown

InputSource3=ncsa.j3d.ui.events.MouseUp

InputSource4=ncsa.j3d.ui.events.MouseDrag

ActiveTool=ncsa.j3d.ui.tools.PickTool

InactiveTool0=ncsa.j3d.ui.tools.ViewTool

Parameters:
p - The Properties object.

save

public static void save(java.util.Properties p)
Saves the properties file to portfolio.properties in the current directory.
Parameters:
p - The portfolio properties object or any properties object.

NCSA Portfolio

NCSA Portfolio, Copyright 1997-1999, National Center for Supercomputing Applications, University of Illinois Urbana-Champaign, All Rights Reserved