ix.iview
Class DomainEditor

java.lang.Object
  extended by ix.iview.DomainEditor
All Implemented Interfaces:
DomainListener, PropertiesApplication, IDESymbols, InternalDomainEditor, java.beans.PropertyChangeListener, java.util.EventListener

public class DomainEditor
extends java.lang.Object
implements DomainListener, java.beans.PropertyChangeListener, InternalDomainEditor, IDESymbols, PropertiesApplication

An editor/viewer frame for domain details. The editor can be created with a mandatory mode (true for simple, false for advanced) and an optional domain or an optional title. Most of the window buidling goes on in the ConstructFramePanels and their ConstructEditorPanels, except for the menubar and the toolbar.

Super-class JFrameMT defines useful menu/toolbar making things. Most of the action processing goes on in the ConstructFramePanels, except for domain specific things (read...) and window things (toggles).

Example for using DomainEditor:


   ...
   File modelDirectory = DomainParser.getLibraryDirectory();
   boolean isSimple = false;
   DomainEditor frame = new DomainEditor(isSimple);
   frame.setModelDirectory(modelDirectory);
   frame.setVisible(true);
   ...
 


Field Summary
protected  IXAgent agent
           
 DomainEditorFrame deFrame
           
 java.io.File directory
           
protected  JPropertiesManager propMan
           
 UIDomain uiDomain
          The current domain in the editor.
 
Fields inherited from interface ix.iview.IDESymbols
C_ALL, C_CONDITIONS_ONLY, C_CONDITIONS_OTHER, C_NONE, C_ORDER_CONDITIONS, C_ORDER_ONLY, C_ORDER_OTHER, C_OTHER_ONLY, MODE_ADVANCED, MODE_SIMPLE, VIEW_COMPREHENSIVE, VIEW_GRAPHICAL, VIEW_MINIMAL, VIEWS
 
Constructor Summary
DomainEditor()
          Makes the editor with the default (simple) mode.
DomainEditor(boolean standAlone)
          Makes the editor with the given stand alone mode.
DomainEditor(boolean isSimple, boolean standAlone)
          Makes the editor with the given mode and the given stand-alone or not.
DomainEditor(Domain domain)
          Makes the editor with the given domain - simple, stand-alone by default.
DomainEditor(Domain domain, boolean standAlone)
          Makes the editor with the given mode and load the given domain.
DomainEditor(IXAgent theAgent, Domain domain)
          Makes the editor with the given domain in not-stand-alone mode.
 
Method Summary
protected  JPropertiesManager ensureProperties()
           
protected  JPropertiesManager ensurePropertiesManager()
           
 Domain getDomain()
           
 javax.swing.JFrame getFrame()
           
 java.io.File getModelDirectory()
           
 java.lang.String getName()
          Needed for PropertiesApplication
 java.lang.String getProperty(java.lang.String which)
          Gets the current setting of the given property from the application.
 UIDomain getUIDomain()
           
static void main(java.lang.String[] args)
           
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
protected static void readDomain(Domain domain)
           
static void readDomain(Domain domain, java.lang.String resourceName)
          Adds definitions from a given resource to a given domain.
 void refinementAdded(RefinementEvent e)
           
static java.net.URL resolveDomainFile(java.lang.String resourceName)
           
 void saveExpansion(Refinement data)
          The name of this is a hangover from something Jeff did.
 void setConstruct(IXObject construct)
          Sets the given construct as the current one and displays it for editing.
 void setDomain(Domain domain)
          Sets the given domain as current in te uiDomain.
 void setEditable(boolean editable)
          Changes the flat that toggles I-DE viewer-only/viewer-editor mode.
 void setModelDirectory(java.io.File directory)
          Sets the directory used to load/save models.
 void setProperty(java.lang.String key, java.lang.String newValue)
          Sets the given property to the given value within the application
 void setUIConstruct(UIObject construct)
          Sets the given UIObject as the current one and displays it for editing.
 void setUIDomain(UIDomain uiDomain)
          Sets the given UIDomain as current both in this frame and the domain editor panel.
 void setVisible(boolean visible)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

agent

protected IXAgent agent

deFrame

public DomainEditorFrame deFrame

propMan

protected JPropertiesManager propMan

directory

public java.io.File directory

uiDomain

public UIDomain uiDomain
The current domain in the editor. May be null

Constructor Detail

DomainEditor

public DomainEditor()
Makes the editor with the default (simple) mode. Subsequently, the domain can be set with the setDomain method or it can be loaded via the menu. The default window title is "IX - Domain Editor".


DomainEditor

public DomainEditor(boolean isSimple,
                    boolean standAlone)
Makes the editor with the given mode and the given stand-alone or not. The given mode will override any defaults or preferences loaded from file.

Parameters:
isSimple - mode: true for simple, false for advanced
standAlone - mode: true for standAlone, false for part of other application

DomainEditor

public DomainEditor(boolean standAlone)
Makes the editor with the given stand alone mode. Subsequently, the domain can be set with the setDomain method or it can be loaded via the menu. The default window title is "IX - Domain Editor".

Parameters:
standAlone - mode: true for standAlone, false for part of other application

DomainEditor

public DomainEditor(Domain domain)
Makes the editor with the given domain - simple, stand-alone by default. The default window title is "IX - Domain Editor".

Parameters:
domain - the domain to use in the editor

DomainEditor

public DomainEditor(Domain domain,
                    boolean standAlone)
Makes the editor with the given mode and load the given domain. The default window title is "IX - Domain Editor".

Parameters:
domain - the domain to use in the editor
standAlone - mode: true for standAlone, false for part of other application

DomainEditor

public DomainEditor(IXAgent theAgent,
                    Domain domain)
Makes the editor with the given domain in not-stand-alone mode.

Parameters:
theAgent - the IXAgent that wants the editor to start
domain - the domain to use in the editor
Method Detail

getName

public java.lang.String getName()
Needed for PropertiesApplication

Specified by:
getName in interface PropertiesApplication
Returns:
the name of the application. Used to get default properties file name.

getFrame

public javax.swing.JFrame getFrame()
Specified by:
getFrame in interface PropertiesApplication
Returns:
the frame of the application. Used to link the dialogue to the frame

getProperty

public java.lang.String getProperty(java.lang.String which)
Description copied from interface: PropertiesApplication
Gets the current setting of the given property from the application.

Specified by:
getProperty in interface PropertiesApplication
Returns:
the current value within the application for the given property

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String newValue)
Sets the given property to the given value within the application

Specified by:
setProperty in interface PropertiesApplication

setEditable

public void setEditable(boolean editable)
Changes the flat that toggles I-DE viewer-only/viewer-editor mode.


setModelDirectory

public void setModelDirectory(java.io.File directory)
Sets the directory used to load/save models. This method just notes the given value which is used when needed for the file selectors for loading and saving models


getModelDirectory

public java.io.File getModelDirectory()
Returns:
the directory used to load/save models.

saveExpansion

public void saveExpansion(Refinement data)
The name of this is a hangover from something Jeff did. This is meant to set the given refinement into the editor ready to be changed.

Specified by:
saveExpansion in interface InternalDomainEditor

setConstruct

public void setConstruct(IXObject construct)
Sets the given construct as the current one and displays it for editing. All work is done in the current panel.

Parameters:
construct - the original domain object to be viewed/edited

setUIConstruct

public void setUIConstruct(UIObject construct)
Sets the given UIObject as the current one and displays it for editing. All work is done in the current panel.

Parameters:
construct - the UI object to be viewed/edited

setDomain

public void setDomain(Domain domain)
Sets the given domain as current in te uiDomain. Interested parties should be listening to uiDomain.

Parameters:
domain - the domain to use

setUIDomain

public void setUIDomain(UIDomain uiDomain)
Sets the given UIDomain as current both in this frame and the domain editor panel.

Parameters:
uiDomain - the UIDomain to use

getUIDomain

public UIDomain getUIDomain()

getDomain

public Domain getDomain()

refinementAdded

public void refinementAdded(RefinementEvent e)
Specified by:
refinementAdded in interface DomainListener

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

ensurePropertiesManager

protected JPropertiesManager ensurePropertiesManager()

ensureProperties

protected JPropertiesManager ensureProperties()

setVisible

public void setVisible(boolean visible)
Specified by:
setVisible in interface InternalDomainEditor

main

public static void main(java.lang.String[] args)

readDomain

protected static void readDomain(Domain domain)

readDomain

public static void readDomain(Domain domain,
                              java.lang.String resourceName)
Adds definitions from a given resource to a given domain. Does *not* perform consistency checks on the way.


resolveDomainFile

public static java.net.URL resolveDomainFile(java.lang.String resourceName)