Ignore:
Timestamp:
2013-01-09T23:34:21+13:00 (11 years ago)
Author:
davidb
Message:

Adding in error message if a collection space can't be generated for a collection.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/GlamED/trunk/src/org/honours/agents/CollectionSpaceAgent.java

    r26609 r26636  
    44import org.expeditee.gui.Frame;
    55import org.expeditee.gui.FrameIO;
     6import org.expeditee.gui.MessageBay;
    67import org.honours.Main;
    78import org.honours.collection.Collection;
     
    1718       
    1819        _collection = Collection.findCollection(frame);
     20        System.err.println(frame.getName());
     21        System.err.println(_collection);
    1922       
    20         if(_collection.getCollectionSpace() == null){
    21             //create a new collection space.
    22             _collectionSpace = new CollectionSpace(_collection);
    23             _collection.setCollectionSpace(_collectionSpace);
    24             _collectionSpace.generate();
     23        if(_collection != null){
     24            if(_collection.getCollectionSpace() == null){
     25                //create a new collection space.
     26                _collectionSpace = new CollectionSpace(_collection);
     27                _collection.setCollectionSpace(_collectionSpace);
     28                _collectionSpace.generate();
    2529           
    26             int index = Collection.getCollectionPosition(_collection);
    27             Main._collections.remove(index);
    28             Main._collections.add(index, _collection);
     30                int index = Collection.getCollectionPosition(_collection);
     31                Main._collections.remove(index);
     32                Main._collections.add(index, _collection);
    2933           
    30             return FrameIO.LoadFrame(_collectionSpace.getName() + "1");
     34                return FrameIO.LoadFrame(_collectionSpace.getName() + "1");
     35            }
     36        }else{
     37            MessageBay.errorMessage("ERROR: Cannot generate a collection space as collection cannot be found.");
    3138        }
    32        
    3339       
    3440        return null;
Note: See TracChangeset for help on using the changeset viewer.