comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java @ 4658:bea519b46919

Don't create Collection when a CollectionView for a new project is created This is the first step to not show collections which haven't got an artifact yet in the project list.
author Björn Ricks <bjoern.ricks@intevation.de>
date Tue, 11 Dec 2012 16:11:20 +0100
parents 4c2005e6ac65
children 518d60dfe6bf
comparison
equal deleted inserted replaced
4657:65eadfe33466 4658:bea519b46919
132 /** 132 /**
133 * This constructor creates a new CollectionView that is used to display the 133 * This constructor creates a new CollectionView that is used to display the
134 * <i>collection</i>. 134 * <i>collection</i>.
135 */ 135 */
136 public CollectionView(FLYS flys) { 136 public CollectionView(FLYS flys) {
137 // do this first because it takes longer than the other stuff in here.
138 User user = flys.getCurrentUser();
139 createNewCollection(user.identifier());
140
141 this.flys = flys; 137 this.flys = flys;
142 this.tabs = new TabSet(); 138 this.tabs = new TabSet();
143 this.outputTabs = new HashMap<String, OutputTab>(); 139 this.outputTabs = new HashMap<String, OutputTab>();
144 this.handlers = new ArrayList<CollectionChangeHandler>(); 140 this.handlers = new ArrayList<CollectionChangeHandler>();
145 this.outHandlers = new ArrayList<OutputModesChangeHandler>(); 141 this.outHandlers = new ArrayList<OutputModesChangeHandler>();
240 addItem(layout); 236 addItem(layout);
241 237
242 layout.addMember(tabs); 238 layout.addMember(tabs);
243 tabs.addTab(parameterList); 239 tabs.addTab(parameterList);
244 } 240 }
245
246
247 /**
248 * This method triggers the CreateCollectionService to create a new
249 * collection in the artifact server.
250 *
251 * @param ownerId The uuid of the user that should own the new collection.
252 */
253 protected void createNewCollection(String ownerId) {
254 GWT.log("CollectionView.createNewCollection");
255
256 Config config = Config.getInstance();
257 final String locale = config.getLocale();
258
259 createCollectionService.create(
260 locale,
261 ownerId,
262 new AsyncCallback<Collection>() {
263 @Override
264 public void onFailure(Throwable caught) {
265 GWT.log("Could not create the new collection.");
266 SC.warn(FLYS.getExceptionString(messages, caught));
267 }
268
269 @Override
270 public void onSuccess(Collection collection) {
271 GWT.log("Successfully created a new collection.");
272 setCollection(collection);
273 }
274 });
275 }
276
277 241
278 protected FLYS getFlys() { 242 protected FLYS getFlys() {
279 return flys; 243 return flys;
280 } 244 }
281 245

http://dive4elements.wald.intevation.org