summaryrefslogtreecommitdiff
path: root/src/main/java/org/cristalise/gui/tabs/collection/CollectionView.java
blob: 06b11ab1be5205b9ecd70d464d47f56d3d4955c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package org.cristalise.gui.tabs.collection;

import javax.swing.JPanel;

import org.cristalise.gui.MainFrame;
import org.cristalise.kernel.collection.Collection;
import org.cristalise.kernel.collection.CollectionMember;
import org.cristalise.kernel.entity.proxy.ItemProxy;
import org.cristalise.kernel.process.Gateway;
import org.cristalise.kernel.utils.Logger;


/**************************************************************************
 *
 * $Revision: 1.1 $
 * $Date: 2004/08/10 07:56:08 $
 *
 * Copyright (C) 2003 CERN - European Organization for Nuclear Research
 * All rights reserved.
 **************************************************************************/


public abstract class CollectionView<M extends CollectionMember> extends JPanel {

	protected Collection<M> thisColl;
    protected ItemProxy item;

    public CollectionView() {
        super();
    }

    public void setItem(ItemProxy item) {
        this.item = item;
    }

    public abstract void setCollection(Collection<M> coll);

    protected void saveCollection()
    {
        try
        {
            String[] params = new String[1];
            params[0] = Gateway.getMarshaller().marshall(thisColl);
            MainFrame.userAgent.execute(item, "AddC2KObject", params);
        }
        catch (Exception e)
        {
            Logger.error(e);
        }
    }
}