package com.c2kernel.gui.lifecycle.instance; 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.gui.MainFrame; import com.c2kernel.gui.graph.view.SelectedVertexPanel; 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() { @Override public void actionPerformed(ActionEvent e) { try { DomainPath actPath = (DomainPath)new DomainPath("/desc/ActivityDesc/").find(currentAct.getActivityDef()); MainFrame.treeBrowser.push(actPath); } catch (ObjectNotFoundException e1) { } } }); } /** * */ @Override public void select(Vertex vert) { if (vert instanceof ActivitySlotDef) { findButton.setEnabled(true); currentAct = (ActivitySlotDef)vert; } else clear(); } /** * */ @Override public void clear() { findButton.setEnabled(false); currentAct = null; } }