source: other-projects/GlamED/trunk/src/org/honours/agents/CollectionSpaceAgent.java@ 26636

Last change on this file since 26636 was 26636, checked in by davidb, 11 years ago

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

File size: 1.2 KB
Line 
1package org.honours.agents;
2
3import org.expeditee.agents.DefaultAgent;
4import org.expeditee.gui.Frame;
5import org.expeditee.gui.FrameIO;
6import org.expeditee.gui.MessageBay;
7import org.honours.Main;
8import org.honours.collection.Collection;
9import org.honours.CollectionSpace.CollectionSpace;
10
11public class CollectionSpaceAgent extends DefaultAgent {
12
13
14 private Collection _collection;
15 private CollectionSpace _collectionSpace;
16
17 public Frame process(Frame frame) {
18
19 _collection = Collection.findCollection(frame);
20 System.err.println(frame.getName());
21 System.err.println(_collection);
22
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();
29
30 int index = Collection.getCollectionPosition(_collection);
31 Main._collections.remove(index);
32 Main._collections.add(index, _collection);
33
34 return FrameIO.LoadFrame(_collectionSpace.getName() + "1");
35 }
36 }else{
37 MessageBay.errorMessage("ERROR: Cannot generate a collection space as collection cannot be found.");
38 }
39
40 return null;
41 }
42
43
44
45}
Note: See TracBrowser for help on using the repository browser.