KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > memoire > vainstall > builder > gui > ProductBasePanel


1 /*
2  * $RCSfile: ProductBasePanel.java,v $
3  * @modification $Date: 2001/09/28 19:35:30 $
4  * @version $Id: ProductBasePanel.java,v 1.1 2001/09/28 19:35:30 hfalk Exp $
5  *
6  */

7
8 package com.memoire.vainstall.builder.gui;
9
10 import com.memoire.vainstall.VAGlobals;
11 import com.memoire.vainstall.builder.*;
12
13 import java.awt.*;
14 import java.awt.event.*;
15
16 import javax.swing.*;
17 import javax.swing.border.*;
18
19 /**
20  * This panel is shown in the product dialog
21  *
22  * This is not just a view panel because it has a reference to the
23  * VAIProductModel.
24  *
25  *
26  * @see com.memoire.vainstall.builder.gui.VAIProductInternalFrame
27  * @see javax.swing.JPanel
28  *
29  * @author Henrik Falk
30  * @version $Id: ProductBasePanel.java,v 1.1 2001/09/28 19:35:30 hfalk Exp $
31  */

32 public class ProductBasePanel extends JPanel implements FocusListener {
33
34     private VAIProductModel model;
35
36     private final static Border loweredBorder = new SoftBevelBorder(BevelBorder.LOWERED);
37
38     RequiredTextField installFileNameField;
39
40     public ProductBasePanel() {
41
42         setBorder(loweredBorder);
43
44         GridBagLayout layout = new GridBagLayout();
45         setLayout(layout);
46
47         GridBagConstraints contraint=new GridBagConstraints();
48
49         // Filename
50
JLabel installFileNameLabel = new JLabel();
51         installFileNameLabel.setText("Filename of generated package:");
52         contraint.fill = GridBagConstraints.BOTH;
53         contraint.insets = new Insets(16,16,0,16);
54         contraint.anchor = GridBagConstraints.WEST;
55         contraint.gridx = 0;
56         contraint.gridy = 0;
57         contraint.gridwidth = 1;
58         contraint.gridheight = 1;
59         contraint.weightx = 0;
60         contraint.weighty = 0;
61         layout.setConstraints(installFileNameLabel,contraint);
62         add(installFileNameLabel);
63
64         installFileNameField = new RequiredTextField();
65         contraint.fill = GridBagConstraints.HORIZONTAL;
66         contraint.insets = new Insets(16,16,0,16);
67         contraint.anchor = GridBagConstraints.CENTER;
68         contraint.gridx = 1;
69         contraint.gridy = 0;
70         contraint.gridwidth = 1;
71         contraint.gridheight = 1;
72         contraint.weightx = 1;
73         contraint.weighty = 0;
74         layout.setConstraints(installFileNameField,contraint);
75         add(installFileNameField);
76
77         JPanel fillPanel = new JPanel();
78         contraint.fill = GridBagConstraints.BOTH;
79         contraint.insets = new Insets(4,4,4,4);
80         contraint.anchor = GridBagConstraints.CENTER;
81         contraint.gridx = 2;
82         contraint.gridy = 1;
83         contraint.gridwidth = 1;
84         contraint.gridheight = 1;
85         contraint.weightx = 1;
86         contraint.weighty = 1;
87         layout.setConstraints(fillPanel,contraint);
88         add(fillPanel);
89
90     }
91
92
93     /**
94      * save
95      */

96     public void save() {
97     }
98
99     /**
100      * initialize the panel
101      */

102     public void initialize(VAIProductModel model) {
103         this.model = model;
104
105         installFileNameField.addFocusListener(this);
106         installFileNameField.initialize(model,"Install Filename");
107         if(model.getPackageName() != null) {
108             installFileNameField.setText(model.getPackageName());
109         }
110     }
111
112     /**
113      * stop
114      */

115     public void stop() {
116     }
117
118     public void focusGained(FocusEvent evt) {
119     }
120
121     public void focusLost(FocusEvent evt) {
122
123         if (evt.getSource() == installFileNameField && installFileNameField.hasChanged() == true) {
124             model.setPackageName(installFileNameField.getText());
125             installFileNameField.setChanged(false);
126         }
127     }
128
129 }
130
Popular Tags