KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > oddjob > designer > actions > ViewComponentsAction


1 /*
2  * (c) Rob Gordon 2005
3  */

4 package org.oddjob.designer.actions;
5
6 import java.awt.event.ActionEvent JavaDoc;
7
8 import javax.swing.AbstractAction JavaDoc;
9 import javax.swing.Action JavaDoc;
10
11 import org.oddjob.designer.components.UnknownDC;
12 import org.oddjob.designer.model.DesignerModel;
13 import org.oddjob.monitor.Standards;
14
15
16 public class ViewComponentsAction extends AbstractAction JavaDoc {
17     private final DesignerModel model;
18     
19     public ViewComponentsAction(DesignerModel model) {
20         this.model = model;
21         putValue(Action.NAME, "View Components");
22         putValue(Action.MNEMONIC_KEY, Standards.VIEW_COMP_MNEMONIC_KEY);
23         putValue(Action.ACCELERATOR_KEY, Standards.VIEW_COMP_ACCELERATOR_KEY);
24     }
25     
26     /* (non-Javadoc)
27      * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
28      */

29     public void actionPerformed(ActionEvent JavaDoc e) {
30         UnknownDC unknown = (UnknownDC) model.getCurrentSelection().getDesignComponent();
31         String JavaDoc xml = unknown.unknown();
32
33         model.replaceSelected(xml);
34         
35     }
36 }
Popular Tags