Search this API

y.module
Class YPackage

java.lang.Object
  extended by y.module.YPackage

public class YPackage
extends java.lang.Object

Represents a collection of YModule objects. Additionally a YPackage can contain YPackage objects itself.

This class provides a JMenu that holds entries for each YModule in the package.

 
Your browser does not support SVG content.

Field Summary
protected  YList moduleNames
          The name of the modules in the order as they was inserted, important for menu creation
protected  java.util.Hashtable modules
          mapping of module-names to modules
protected  java.lang.String name
          name of the package
protected  YList packages
          The sub packages of this package
protected  java.beans.PropertyChangeSupport propertyChangeSupport
          the support which is used to notify listeners about changes in the module list and sub package list
 
Constructor Summary
YPackage(java.io.InputStream is)
          Read Package description from an InputStream.
YPackage(java.lang.String name)
          Creates a new Package
YPackage(java.net.URL url)
          Initializes a YPackage from a resource located at the given url.
 
Method Summary
 void addModule(java.lang.String className)
          Adds a module by its class name.
 void addModule(java.lang.String moduleName, java.lang.String className)
          Adds a module by its class name.
 void addModule(java.lang.String modName, YModule module)
          Adds a module to this package.
 void addModule(YModule module)
          Adds a module to this package.
 void addPackage(YPackage pack)
          Adds a sub package to the package This only affects menu handling This method will fire a PropertyChangeEvent for "packageList"
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Registers PropertyChangeListener to receive events.
 void addToMenu(javax.swing.JMenu menu, YPackageMenuListener listener)
          Deprecated. yEd does not use this method any longer, just add and remove modules and sub packages, yEd will take care of the menus.
 javax.swing.JMenu createMenu(YPackageMenuListener listener)
          Deprecated. yEd does not use this method any longer, just add and remove modules and sub packages, yEd will take care of the menus.
static YPackage createPackage(java.lang.String resourcePath)
           
 YModule getModule(java.lang.String name)
          Get a registered module by name.
 YCursor getModuleNames()
          Get all module names
 java.util.Hashtable getModules()
          Get all Modules
 java.lang.String getName()
          Get the name of the package
 YCursor getPackages()
          Get all sub packages
 void initPackage(java.io.InputStream is)
          Initializes a YPackage from a Input stream
 void listModules()
          Convenience method to print out the names of all modules in the package
 void removeModule(java.lang.String moduleName)
          Removes a module by its name.
 void removePackage(YPackage pack)
          Removes a sub package from the package This method will fire a PropertyChangeEvent for "packageList"
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes PropertyChangeListener from the list of listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
name of the package


modules

protected java.util.Hashtable modules
mapping of module-names to modules


moduleNames

protected YList moduleNames
The name of the modules in the order as they was inserted, important for menu creation


packages

protected YList packages
The sub packages of this package


propertyChangeSupport

protected java.beans.PropertyChangeSupport propertyChangeSupport
the support which is used to notify listeners about changes in the module list and sub package list

Constructor Detail

YPackage

public YPackage(java.lang.String name)
Creates a new Package

Parameters:
name - The name of the package

YPackage

public YPackage(java.io.InputStream is)
Read Package description from an InputStream. The InputStream is scanned until the first <PACKAGE ..> tag is found.


YPackage

public YPackage(java.net.URL url)
Initializes a YPackage from a resource located at the given url.

Method Detail

initPackage

public void initPackage(java.io.InputStream is)
Initializes a YPackage from a Input stream


createPackage

public static YPackage createPackage(java.lang.String resourcePath)

getName

public java.lang.String getName()
Get the name of the package

Returns:
the name of the package

getModule

public YModule getModule(java.lang.String name)
Get a registered module by name.


getModuleNames

public YCursor getModuleNames()
Get all module names

Returns:
An enumeration of all module names registered in the package

getPackages

public YCursor getPackages()
Get all sub packages


getModules

public java.util.Hashtable getModules()
Get all Modules

Returns:
A hash table containing all modules

addModule

public void addModule(YModule module)
Adds a module to this package. The module's getModuleName() method be used to to give the module a name.


addModule

public void addModule(java.lang.String modName,
                      YModule module)
Adds a module to this package. The module's getModuleName() method be used to to give the module a name.


addModule

public void addModule(java.lang.String className)
Adds a module by its class name. The class file is loaded on demand. The name of the base class is used as module name.

Parameters:
className - The complete name of the class of the module

addModule

public void addModule(java.lang.String moduleName,
                      java.lang.String className)
Adds a module by its class name. The class file is loaded on demand. This method will fire a PropertyChangeEvent for "moduleList"

Parameters:
className - The complete name of the class of the module
moduleName - The name of the module

removeModule

public void removeModule(java.lang.String moduleName)
Removes a module by its name. This method will fire a PropertyChangeEvent for "moduleList"

Parameters:
moduleName - The name of the module

addPackage

public void addPackage(YPackage pack)
Adds a sub package to the package This only affects menu handling This method will fire a PropertyChangeEvent for "packageList"

Parameters:
pack - A YPackage

removePackage

public void removePackage(YPackage pack)
Removes a sub package from the package This method will fire a PropertyChangeEvent for "packageList"

Parameters:
pack - A YPackage

createMenu

public javax.swing.JMenu createMenu(YPackageMenuListener listener)
Deprecated. yEd does not use this method any longer, just add and remove modules and sub packages, yEd will take care of the menus.

Creates a complete menu. This method can be used to place the menu of the package into an application.

Parameters:
listener - Specifies what to do is a module is selected
Returns:
A menu containing all modules in the package

addToMenu

public void addToMenu(javax.swing.JMenu menu,
                      YPackageMenuListener listener)
Deprecated. yEd does not use this method any longer, just add and remove modules and sub packages, yEd will take care of the menus.

Adds content of this package to a menu. This method can be used to place the menu of the package into an application.

Parameters:
listener - Specifies what to do is a module is selected

listModules

public void listModules()
Convenience method to print out the names of all modules in the package


addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Registers PropertyChangeListener to receive events.

Parameters:
listener - The listener to register.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes PropertyChangeListener from the list of listeners.

Parameters:
listener - The listener to remove.

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.