Protege 2.1.1

edu.stanford.smi.protege.model
Class Project

java.lang.Object
  extended byedu.stanford.smi.protege.model.Project
Direct Known Subclasses:
RemoteClientProject

public class Project
extends Object

The aggregation of a domain knowledge base with its user interface. Methods on this class that take an "errors" collection may insert any object into this collection These objects can be strings or exceptions. All that is guaranteed is that the toString() method on each object will produce a usable error message. If the method call succeeds then no error objects will have been added to the collection. Eventually this hack will be replaced with some more reasonable interface for collecting errors. Note that we do not want to throw an exception because we would like to accumulate errors (e.g. parse errors) and let the user know about them all at once rather than one at a time. One downside of the current approach is that it leads to cascading errors.

Author:
Ray Fergerson

Constructor Summary
  Project(String projectString, Collection errors)
           
protected Project(URI uri, KnowledgeBaseFactory factory, Collection errors, boolean createDomainKB)
           
protected Project(URI uri, KnowledgeBaseFactory factory, Collection errors, boolean createDomainKB, boolean isMultiUserServer)
           
 
Method Summary
 Slot _getDirectBrowserSlot(Cls cls)
           
 void addJavaPackageName(String packageName)
           
 void addProjectListener(ProjectListener listener)
           
 void clearCachedWidgets()
           
 void clearIsDirty()
           
static Project createBuildProject(KnowledgeBase kb, Collection errors)
           
static Project createBuildProject(KnowledgeBaseFactory factory, Collection errors)
           
 void createDomainKnowledgeBase(KnowledgeBaseFactory factory, Collection errors, boolean load)
           
protected  JFrame createFrame(Cls cls, Slot slot)
           
protected  JFrame createFrame(Instance instance)
           
protected  JFrame createFrame(InstanceDisplay display, Object o)
           
static Project createNewProject(KnowledgeBaseFactory factory, Collection errors)
           
 ClsWidget createRuntimeClsWidget(Instance instance)
           
 ClsWidget createRuntimeClsWidget(Instance instance, Cls associatedCls)
           
 Widget createRuntimeWidget(Instance instance)
          Deprecated. use createRuntimeClsWidget
 WidgetDescriptor createWidgetDescriptor()
           
 WidgetDescriptor createWidgetDescriptor(Cls cls, Slot slot, Facet facet)
           
 void dispose()
           
static boolean equals(Object o1, Object o2)
           
 Collection getAllKnowledgeBaseFactories()
           
 Slot getBrowserSlot(Cls cls)
          Deprecated.  
 BrowserSlotPattern getBrowserSlotPattern(Cls cls)
           
 Collection getBrowserSlots(Cls cls)
           
 Object getClientInformation(Object key)
          Returns previously stored "arbitrary" client information.
 PropertyList getClsWidgetPropertyList(Cls cls)
           
 Collection getCurrentUsers()
           
 String getDefaultWidgetClassName(Cls cls, Slot slot, Facet facet)
           
 ClsWidget getDesignTimeClsWidget(Cls cls)
           
 Slot getDirectBrowserSlot(Cls cls)
          Deprecated.  
 BrowserSlotPattern getDirectBrowserSlotPattern(Cls cls)
           
 Collection getDirectIncludedProjects()
          Deprecated. Use #getDirectIncludedProjectURIs()
 Collection getDirectIncludedProjectURIs()
           
 boolean getDisplayAbstractClassIcon()
           
 boolean getDisplayConfirmationOnRemove()
           
 boolean getDisplayHiddenClasses()
           
 boolean getDisplayHiddenFrames()
           
 boolean getDisplayMultiParentClassIcon()
           
 FrameCounts getFrameCounts()
           
 Collection getIncludedProjects()
           
 Slot getInheritedBrowserSlot(Cls cls)
          Deprecated.  
 BrowserSlotPattern getInheritedBrowserSlotPattern(Cls cls)
           
 KnowledgeBase getInternalProjectKnowledgeBase()
           
 URI getJournalURI()
           
 KnowledgeBase getKnowledgeBase()
           
 KnowledgeBaseFactory getKnowledgeBaseFactory()
           
 URI getLoadingURI()
           
 String getLocalUser()
           
 String getName()
          same as #getProjectName()
 Collection getOpenWindows()
           
 File getProjectDirectoryFile()
          Deprecated. Use #getProjectDirectoryURI()
 URI getProjectDirectoryURI()
           
 File getProjectFile()
          Deprecated. Use #getProjectURI()
 String getProjectFilePath()
          Deprecated. Use #getProjectURI()
 String getProjectName()
           
 URI getProjectURI()
           
 PropertyList getSources()
           
 Collection getSuitableWidgetClassNames(Cls cls, Slot slot, Facet facet)
           
 WidgetDescriptor getTabWidgetDescriptor(String widgetName)
           
 Collection getTabWidgetDescriptors()
           
 boolean getUpdateModificationSlots()
           
 String getUserName()
           
 WidgetMapper getWidgetMapper()
           
 boolean hasCompleteSources()
           
 boolean hasCustomizedDescriptor(Cls cls)
           
 boolean hasIncludedProjects()
           
 void includeProject(String path, Collection errors)
           
 void includeProject(URI uri, boolean doLoad, Collection errors)
           
 void includeProject(URI uri, Collection errors)
           
 boolean isDirty()
           
 boolean isHidden(Frame frame)
           
 boolean isJournalingEnabled()
           
 boolean isMultiUserClient()
           
 boolean isMultiUserServer()
           
 boolean isReadonly()
           
 boolean isSuitableWidget(Cls cls, Slot slot, Facet facet, WidgetDescriptor d)
           
 void loadBrowserSlots(Instance projectInstance)
           
 void loadIncludedProjects(Instance projectInstance, Collection errors)
           
static Project loadProjectFromFile(String fileName, Collection errors)
           
static Project loadProjectFromURI(URI uri, Collection errors)
           
static Project loadProjectFromURI(URI uri, Collection errors, boolean isMultiUserServer)
           
 void mergeIncludedProjects()
           
 void postFormChangeEvent(Cls cls)
           
 void postFormChangeEvent(WidgetDescriptor d)
           
 void postProjectEvent(int type)
           
 void postProjectEvent(int type, ClsWidget widget)
           
 void removeIncludedProjectReferences()
           
 void removeJavaPackageName(String packageName)
           
 void removeProjectListener(ProjectListener listener)
           
 void save(Collection errors)
           
 void setClientInformation(Object key, Object value)
          Set persistent client information.
 void setDefaultClsWidgetClassName(String s)
           
 void setDirectIncludedProjectURIs(Collection projectURIs)
           
 void setDisplayAbstractClassIcon(boolean b)
           
 void setDisplayConfirmationOnRemove(boolean b)
           
 void setDisplayHiddenClasses(boolean b)
           
 void setDisplayHiddenFrames(boolean b)
           
 void setDisplayMultiParentClassIcon(boolean b)
           
 void setHidden(Frame frame, boolean hidden)
           
 void setIsReadonly(boolean b)
           
 void setJournalingEnabled(boolean enable)
           
 void setKnowledgeBaseFactory(KnowledgeBaseFactory factory)
           
protected  void setKnowledgeBases(KnowledgeBase domainKb, KnowledgeBase projectKb)
           
 void setProjectFilePath(String s)
           
 void setProjectURI(URI uri)
           
 void setTabWidgetDescriptorOrder(Collection c)
           
 void setUpdateModificationSlots(boolean b)
           
 void setUserName(String s)
           
 void setWidgetMapper(WidgetMapper mapper)
           
 JFrame show(Cls cls, Slot slot)
           
 JFrame show(Instance instance)
           
 JFrame show(String instanceName)
           
 JInternalFrame showInInternalFrame(Instance instance)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Project

protected Project(URI uri,
                  KnowledgeBaseFactory factory,
                  Collection errors,
                  boolean createDomainKB)

Project

protected Project(URI uri,
                  KnowledgeBaseFactory factory,
                  Collection errors,
                  boolean createDomainKB,
                  boolean isMultiUserServer)

Project

public Project(String projectString,
               Collection errors)
Method Detail

equals

public static boolean equals(Object o1,
                             Object o2)

addJavaPackageName

public void addJavaPackageName(String packageName)

addProjectListener

public void addProjectListener(ProjectListener listener)

clearCachedWidgets

public void clearCachedWidgets()

createBuildProject

public static Project createBuildProject(KnowledgeBaseFactory factory,
                                         Collection errors)
Parameters:
errors - See class note for information about this argument.

createBuildProject

public static Project createBuildProject(KnowledgeBase kb,
                                         Collection errors)

createDomainKnowledgeBase

public void createDomainKnowledgeBase(KnowledgeBaseFactory factory,
                                      Collection errors,
                                      boolean load)
Parameters:
errors - See class note for information about this argument.

createFrame

protected JFrame createFrame(Cls cls,
                             Slot slot)

createFrame

protected JFrame createFrame(Instance instance)

createFrame

protected JFrame createFrame(InstanceDisplay display,
                             Object o)

createNewProject

public static Project createNewProject(KnowledgeBaseFactory factory,
                                       Collection errors)
Parameters:
errors - See class note for information about this argument.

createRuntimeClsWidget

public ClsWidget createRuntimeClsWidget(Instance instance)

createRuntimeClsWidget

public ClsWidget createRuntimeClsWidget(Instance instance,
                                        Cls associatedCls)

createRuntimeWidget

public Widget createRuntimeWidget(Instance instance)
Deprecated. use createRuntimeClsWidget


createWidgetDescriptor

public WidgetDescriptor createWidgetDescriptor()

createWidgetDescriptor

public WidgetDescriptor createWidgetDescriptor(Cls cls,
                                               Slot slot,
                                               Facet facet)

dispose

public void dispose()

getAllKnowledgeBaseFactories

public Collection getAllKnowledgeBaseFactories()

getBrowserSlot

public Slot getBrowserSlot(Cls cls)
Deprecated.  


getBrowserSlots

public Collection getBrowserSlots(Cls cls)

getBrowserSlotPattern

public BrowserSlotPattern getBrowserSlotPattern(Cls cls)

getInheritedBrowserSlot

public Slot getInheritedBrowserSlot(Cls cls)
Deprecated.  


getInheritedBrowserSlotPattern

public BrowserSlotPattern getInheritedBrowserSlotPattern(Cls cls)

getClsWidgetPropertyList

public PropertyList getClsWidgetPropertyList(Cls cls)

getDefaultWidgetClassName

public String getDefaultWidgetClassName(Cls cls,
                                        Slot slot,
                                        Facet facet)

getDesignTimeClsWidget

public ClsWidget getDesignTimeClsWidget(Cls cls)

_getDirectBrowserSlot

public Slot _getDirectBrowserSlot(Cls cls)

getDirectBrowserSlot

public Slot getDirectBrowserSlot(Cls cls)
Deprecated.  


getDirectBrowserSlotPattern

public BrowserSlotPattern getDirectBrowserSlotPattern(Cls cls)

getDisplayAbstractClassIcon

public boolean getDisplayAbstractClassIcon()

getDisplayConfirmationOnRemove

public boolean getDisplayConfirmationOnRemove()

getDisplayHiddenClasses

public boolean getDisplayHiddenClasses()

getDisplayHiddenFrames

public boolean getDisplayHiddenFrames()

getDisplayMultiParentClassIcon

public boolean getDisplayMultiParentClassIcon()

getIncludedProjects

public Collection getIncludedProjects()
Returns:
the URIs of all included projects, including indirectly included ones

setDirectIncludedProjectURIs

public void setDirectIncludedProjectURIs(Collection projectURIs)

getDirectIncludedProjects

public Collection getDirectIncludedProjects()
Deprecated. Use #getDirectIncludedProjectURIs()

Returns:
A collection of strings which are the absolute file paths directly included Projects that are files. If an directly included Project is not a file then IllegalArgumentException is thrown

getDirectIncludedProjectURIs

public Collection getDirectIncludedProjectURIs()
Returns:
the absolute URI's of all directly included projects

getInternalProjectKnowledgeBase

public KnowledgeBase getInternalProjectKnowledgeBase()

getJournalURI

public URI getJournalURI()

getKnowledgeBase

public KnowledgeBase getKnowledgeBase()

getKnowledgeBaseFactory

public KnowledgeBaseFactory getKnowledgeBaseFactory()

getName

public String getName()
same as #getProjectName()


getProjectName

public String getProjectName()
Returns:
the "base" project name (no path, no ".pprj" extension)

getOpenWindows

public Collection getOpenWindows()

getProjectURI

public URI getProjectURI()

getProjectDirectoryURI

public URI getProjectDirectoryURI()

getProjectDirectoryFile

public File getProjectDirectoryFile()
Deprecated. Use #getProjectDirectoryURI()


getProjectFile

public File getProjectFile()
Deprecated. Use #getProjectURI()


getProjectFilePath

public String getProjectFilePath()
Deprecated. Use #getProjectURI()


getSources

public PropertyList getSources()

getSuitableWidgetClassNames

public Collection getSuitableWidgetClassNames(Cls cls,
                                              Slot slot,
                                              Facet facet)

getTabWidgetDescriptor

public WidgetDescriptor getTabWidgetDescriptor(String widgetName)

getTabWidgetDescriptors

public Collection getTabWidgetDescriptors()

getUpdateModificationSlots

public boolean getUpdateModificationSlots()

hasCompleteSources

public boolean hasCompleteSources()

hasCustomizedDescriptor

public boolean hasCustomizedDescriptor(Cls cls)

hasIncludedProjects

public boolean hasIncludedProjects()

includeProject

public void includeProject(String path,
                           Collection errors)

includeProject

public void includeProject(URI uri,
                           Collection errors)
Parameters:
errors - See class note for information about this argument.

includeProject

public void includeProject(URI uri,
                           boolean doLoad,
                           Collection errors)
Parameters:
errors - See class note for information about this argument.

isDirty

public boolean isDirty()

isHidden

public boolean isHidden(Frame frame)

isJournalingEnabled

public boolean isJournalingEnabled()

isReadonly

public boolean isReadonly()

isSuitableWidget

public boolean isSuitableWidget(Cls cls,
                                Slot slot,
                                Facet facet,
                                WidgetDescriptor d)

loadBrowserSlots

public void loadBrowserSlots(Instance projectInstance)

setDefaultClsWidgetClassName

public void setDefaultClsWidgetClassName(String s)

getLoadingURI

public URI getLoadingURI()

loadIncludedProjects

public void loadIncludedProjects(Instance projectInstance,
                                 Collection errors)
Parameters:
errors - See class note for information about this argument.

loadProjectFromURI

public static Project loadProjectFromURI(URI uri,
                                         Collection errors)
Parameters:
errors - See class note for information about this argument.

loadProjectFromURI

public static Project loadProjectFromURI(URI uri,
                                         Collection errors,
                                         boolean isMultiUserServer)

loadProjectFromFile

public static Project loadProjectFromFile(String fileName,
                                          Collection errors)

setWidgetMapper

public void setWidgetMapper(WidgetMapper mapper)

getWidgetMapper

public WidgetMapper getWidgetMapper()

mergeIncludedProjects

public void mergeIncludedProjects()

postFormChangeEvent

public void postFormChangeEvent(Cls cls)

postFormChangeEvent

public void postFormChangeEvent(WidgetDescriptor d)

postProjectEvent

public void postProjectEvent(int type)

postProjectEvent

public void postProjectEvent(int type,
                             ClsWidget widget)

removeIncludedProjectReferences

public void removeIncludedProjectReferences()

removeJavaPackageName

public void removeJavaPackageName(String packageName)

removeProjectListener

public void removeProjectListener(ProjectListener listener)

save

public void save(Collection errors)

clearIsDirty

public void clearIsDirty()

setDisplayAbstractClassIcon

public void setDisplayAbstractClassIcon(boolean b)

setDisplayConfirmationOnRemove

public void setDisplayConfirmationOnRemove(boolean b)

setDisplayHiddenFrames

public void setDisplayHiddenFrames(boolean b)

setDisplayHiddenClasses

public void setDisplayHiddenClasses(boolean b)

setDisplayMultiParentClassIcon

public void setDisplayMultiParentClassIcon(boolean b)

setHidden

public void setHidden(Frame frame,
                      boolean hidden)

setIsReadonly

public void setIsReadonly(boolean b)

setJournalingEnabled

public void setJournalingEnabled(boolean enable)

setKnowledgeBaseFactory

public void setKnowledgeBaseFactory(KnowledgeBaseFactory factory)

setProjectFilePath

public void setProjectFilePath(String s)

setProjectURI

public void setProjectURI(URI uri)

setTabWidgetDescriptorOrder

public void setTabWidgetDescriptorOrder(Collection c)

setUpdateModificationSlots

public void setUpdateModificationSlots(boolean b)

show

public JFrame show(Cls cls,
                   Slot slot)

show

public JFrame show(Instance instance)

show

public JFrame show(String instanceName)

showInInternalFrame

public JInternalFrame showInInternalFrame(Instance instance)

toString

public String toString()

getClientInformation

public Object getClientInformation(Object key)
Returns previously stored "arbitrary" client information. This information is view specific and differs from the client information available on the KnowledgeBase class. Examples of this type of information is the positioning of a yellow sticky on a form, or the positioning of a node in the diagram widget.

The "client information" attached to a project is persistent. In order for the persistence mechanism to work correctly the keys and values stored as client information must either be a domain knowledge base frame or be serializable.

Typical values are things such as Strings, Rectangles, and Maps of other objects. The other objects included in a map must themselves be either Frames or must be convertable to and from a string. Being convertable to and from a String means:
(1) The object.toString() method must return the state of the object.
(2) There class must has a constructor that takes a single string argument.
It must be the case that for any instance "a" of "MyClass"

      a.equals(new MyClass(a.toString());
 


A typical use of "client information" is the following:

   final String KEY = "MyClass.frame_rectangles";
   Map frameRectangleMap = (Map) getClientInformation(KEY);
   if (frameRectangleMap == null) {
       frameRectangleMap = new HashMap();
       getProject().setClientInformation(KEY, frameRectangleMap);
   }
   // ...
   // save rectangles associated with frames into frameRectangleMap with code like
   frameRectangleMap.put(frameX, rectangleX);
   frameRectangleMap.put(frameY, rectangleY);
   // ..
   
   // elsewhere
   // retrieve positions
   Map map = (Map) getClientInformation(KEY);
   Rectangle x = (Rectangle) map.get(frameX);
   Rectangle y = (Rectangle) map.get(frameY);
 


setClientInformation

public void setClientInformation(Object key,
                                 Object value)
Set persistent client information. See getClientInformation(Object) for more information about "client information".


getCurrentUsers

public Collection getCurrentUsers()

getLocalUser

public String getLocalUser()

setKnowledgeBases

protected void setKnowledgeBases(KnowledgeBase domainKb,
                                 KnowledgeBase projectKb)

getFrameCounts

public FrameCounts getFrameCounts()

isMultiUserClient

public boolean isMultiUserClient()

isMultiUserServer

public boolean isMultiUserServer()

setUserName

public void setUserName(String s)

getUserName

public String getUserName()

Protege 2.1.1

Submit a bug report or feature request
Protégé is a trademark of Stanford University.
Copyright (c) 1998-2004 Stanford University.