KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > genimen > djeneric > tools > generator > ui > TemplateCheckBox


1 package com.genimen.djeneric.tools.generator.ui;
2
3 import java.awt.event.ActionEvent JavaDoc;
4 import java.awt.event.ActionListener JavaDoc;
5
6 import javax.swing.JCheckBox JavaDoc;
7
8 import com.genimen.djeneric.tools.generator.util.ProjectProperties;
9 import com.genimen.djeneric.tools.generator.util.Template;
10
11 public class TemplateCheckBox extends JCheckBox JavaDoc implements ActionListener JavaDoc
12 {
13   private static final long serialVersionUID = 1L;
14   Template _template;
15   ProjectProperties _projectProperties;
16   String JavaDoc _propertyKey;
17
18   public TemplateCheckBox(Template template, ProjectProperties props)
19   {
20     super(template.getModuleName());
21     _template = template;
22     _projectProperties = props;
23
24     _propertyKey = template.getModuleName();
25     setSelected(props.isTemplateEnabled(_propertyKey));
26
27     addActionListener(this);
28     setToolTipText(_template.getLocation());
29   }
30
31   public void actionPerformed(ActionEvent JavaDoc e)
32   {
33     _projectProperties.enableTemplate(_propertyKey, isSelected());
34   }
35
36   public Template getTemplate()
37   {
38     return _template;
39   }
40 }
Popular Tags