summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/lifecycle/instance/gui/view/FindActDefPanel.java
blob: 5cb00bfea9147151538be70f92f55b6f2dc539be (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.c2kernel.lifecycle.instance.gui.view;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.graph.model.Vertex;
import com.c2kernel.graph.view.SelectedVertexPanel;
import com.c2kernel.gui.MainFrame;
import com.c2kernel.lifecycle.ActivitySlotDef;
import com.c2kernel.lookup.DomainPath;

/**************************************************************************
 *
 * $Revision: 1.3 $
 * $Date: 2005/12/01 14:23:15 $
 *
 * Copyright (C) 2003 CERN - European Organization for Nuclear Research
 * All rights reserved.
 **************************************************************************/

public class FindActDefPanel extends SelectedVertexPanel {

    JButton findButton;
    ActivitySlotDef currentAct;

    public FindActDefPanel() {
        super();
        findButton = new JButton("Open Definition");
        findButton.setEnabled(false);
        add(findButton);
        findButton.addActionListener(new ActionListener()
                {
            public void actionPerformed(ActionEvent e)
            {
				try {
					DomainPath actPath = (DomainPath)new DomainPath("/desc/ActivityDesc/").find(currentAct.getActivityDef());
	                MainFrame.treeBrowser.push(actPath);
				} catch (ObjectNotFoundException e1) { }
            }
        });
    }

    /**
     *
     */

    public void select(Vertex vert) {
        if (vert instanceof ActivitySlotDef) {
            findButton.setEnabled(true);
            currentAct = (ActivitySlotDef)vert;
        }
        else 
            clear();
            
    }

    /**
     *
     */

    public void clear() {
        findButton.setEnabled(false);
        currentAct = null;
    }

}