|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--elge.engine.Engine
Engine is a class which is responsible for running the environment. It starts the GUI mode (batch mode is not yet done), and handles all important things, like projects, helps, main configuration.
This is also the class, which should be run as main class when starting up the environment:
cmdline>java elge.engine.Engine
Field Summary | |
String |
configPath
The standart config path for the engine. |
protected EngineConfiguration |
econf
The engine configuration |
protected static ResourceBundle |
elgeBundle
|
protected static Locale |
elgeLocale
|
static String |
ENGINE_CONFIG_FILE
a file name of the angine configuration (elge.xml) |
protected ElgeGUI |
gui
The gui interface. |
protected static javax.help.HelpSet |
mainHS
The main help set. |
static String |
PROJECT_CONFIG
standart file name of the project configuration (config.xml) |
static String |
PROJECT_EXT
The standart file extension of the project files (.elp) |
static String |
PROP_RECENTS
Identification of the property RecentProjects. |
protected static Engine |
singleton
The singleton of the engine. |
Method Summary | |
void |
addPropertyChangeListener(PropertyChangeListener l)
Adds a property change listener |
void |
addRecentProject(Project pt)
Adds a recent project to the vector. |
void |
closeProject(Project pt)
Close the porject and remove from list.. |
Project |
createProject(String name,
World w)
Creates a project in the project dir under the name "name" with a world - w. |
void |
exceptionThrown(Exception e)
This method is called when a recoverable exception has been caught. |
EngineConfiguration |
getConf()
returns the EngineConfiguration for this instance |
String |
getConfigPath()
returns the config path of the engine. |
static Engine |
getEngine()
Gets the singleton that is the engine using. |
ElgeGUI |
getGUI()
get the running gui, if available. |
javax.help.HelpSet |
getHelpSet()
Returns the main helpset for the engine. |
Vector |
getOpenedProjects()
|
String |
getProjectPath()
The project dir is a directory, where the projects are saved. |
static Object |
getRandomElement(List list)
Choose a random element from the list and return it. |
static int |
getRandomNumber(int from,
int to)
Returns a random number in range of from to to included. |
static Engine |
getSingleton()
like getEngine() |
static String |
getString(String key)
Gets a string from the bundle resource. |
boolean |
checkProjectName(String name)
Checks the project name, if it can be used for new project. |
boolean |
isGUI()
True if the guis is running false otherwise. |
void |
loadConfiguration()
Loads the engine configuration. |
protected void |
loadEngine()
Loads the engine xonfiguration (elge.xml) |
Project |
loadProject(File file)
Tries to load project. |
static void |
main(String[] args)
Runs the engine. |
void |
removePropertyChangeListener(PropertyChangeListener l)
Removes a property change listener |
void |
removeRecentProject(String path)
Removes a recent project from the vecot |
void |
run(String[] args)
this run is like main method. |
void |
saveConfiguration()
Save configuration for the engine. |
protected void |
saveEngine()
saves only the egnine configuration (elge.xml) |
boolean |
saveProject(Project pt)
Saves the state of the project. |
boolean |
saveProjectAs(Project pt,
String pname)
Saves project under other name. |
boolean |
saveProjects()
Saves all opened projects |
void |
setConfiPath(String configPath)
Sets the config path for the engine. |
void |
setProjectPath(String configPath)
Sets the directory where the projects should be saved. |
void |
stop()
Stops and closes the engine. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String PROP_RECENTS
public static final String PROJECT_EXT
public static final String PROJECT_CONFIG
public static final String ENGINE_CONFIG_FILE
public String configPath
protected ElgeGUI gui
protected EngineConfiguration econf
protected static javax.help.HelpSet mainHS
protected static Engine singleton
protected static Locale elgeLocale
protected static ResourceBundle elgeBundle
Method Detail |
public void addPropertyChangeListener(PropertyChangeListener l)
l
- the listenerpublic void removePropertyChangeListener(PropertyChangeListener l)
l
- the listenerpublic Project createProject(String name, World w)
name
- project namew
- project world. Main AgentContainer.
public Project loadProject(File file)
file
- the directory of the project
public boolean saveProject(Project pt)
pt
- proejct to save
public boolean saveProjectAs(Project pt, String pname)
pt
- project to savepname
- alternative project name
public boolean saveProjects()
public void closeProject(Project pt)
pt
- project to closepublic String getConfigPath()
public void setConfiPath(String configPath)
configPath
- path to config dir for the enginepublic String getProjectPath()
public void setProjectPath(String configPath)
configPath
- path to dir for saving the projects.public void loadConfiguration()
public void saveConfiguration()
protected void saveEngine()
protected void loadEngine()
public void run(String[] args)
args
- cmd line arguments.public void stop()
public EngineConfiguration getConf()
public void addRecentProject(Project pt)
pt
- project to be added.public void removeRecentProject(String path)
path
- project path to be removed.public ElgeGUI getGUI()
public boolean isGUI()
public boolean checkProjectName(String name)
name
- name of future project
public Vector getOpenedProjects()
public void exceptionThrown(Exception e)
exceptionThrown
in interface ExceptionListener
e
- The exception that was caught.public static void main(String[] args)
args
- cmd line arguments.public static Engine getEngine()
public static Engine getSingleton()
getEngine()
public static String getString(String key)
key
- the key in the bundle resource
public javax.help.HelpSet getHelpSet()
public static int getRandomNumber(int from, int to)
from
to to
included.
from
- begin of intervalto
- end of interval
public static Object getRandomElement(List list)
list
- list to choose from
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |