001: /*
002: * $RCSfile: ProductBasePanel.java,v $
003: * @modification $Date: 2001/09/28 19:35:30 $
004: * @version $Id: ProductBasePanel.java,v 1.1 2001/09/28 19:35:30 hfalk Exp $
005: *
006: */
007:
008: package com.memoire.vainstall.builder.gui;
009:
010: import com.memoire.vainstall.VAGlobals;
011: import com.memoire.vainstall.builder.*;
012:
013: import java.awt.*;
014: import java.awt.event.*;
015:
016: import javax.swing.*;
017: import javax.swing.border.*;
018:
019: /**
020: * This panel is shown in the product dialog
021: *
022: * This is not just a view panel because it has a reference to the
023: * VAIProductModel.
024: *
025: *
026: * @see com.memoire.vainstall.builder.gui.VAIProductInternalFrame
027: * @see javax.swing.JPanel
028: *
029: * @author Henrik Falk
030: * @version $Id: ProductBasePanel.java,v 1.1 2001/09/28 19:35:30 hfalk Exp $
031: */
032: public class ProductBasePanel extends JPanel implements FocusListener {
033:
034: private VAIProductModel model;
035:
036: private final static Border loweredBorder = new SoftBevelBorder(
037: BevelBorder.LOWERED);
038:
039: RequiredTextField installFileNameField;
040:
041: public ProductBasePanel() {
042:
043: setBorder(loweredBorder);
044:
045: GridBagLayout layout = new GridBagLayout();
046: setLayout(layout);
047:
048: GridBagConstraints contraint = new GridBagConstraints();
049:
050: // Filename
051: JLabel installFileNameLabel = new JLabel();
052: installFileNameLabel.setText("Filename of generated package:");
053: contraint.fill = GridBagConstraints.BOTH;
054: contraint.insets = new Insets(16, 16, 0, 16);
055: contraint.anchor = GridBagConstraints.WEST;
056: contraint.gridx = 0;
057: contraint.gridy = 0;
058: contraint.gridwidth = 1;
059: contraint.gridheight = 1;
060: contraint.weightx = 0;
061: contraint.weighty = 0;
062: layout.setConstraints(installFileNameLabel, contraint);
063: add(installFileNameLabel);
064:
065: installFileNameField = new RequiredTextField();
066: contraint.fill = GridBagConstraints.HORIZONTAL;
067: contraint.insets = new Insets(16, 16, 0, 16);
068: contraint.anchor = GridBagConstraints.CENTER;
069: contraint.gridx = 1;
070: contraint.gridy = 0;
071: contraint.gridwidth = 1;
072: contraint.gridheight = 1;
073: contraint.weightx = 1;
074: contraint.weighty = 0;
075: layout.setConstraints(installFileNameField, contraint);
076: add(installFileNameField);
077:
078: JPanel fillPanel = new JPanel();
079: contraint.fill = GridBagConstraints.BOTH;
080: contraint.insets = new Insets(4, 4, 4, 4);
081: contraint.anchor = GridBagConstraints.CENTER;
082: contraint.gridx = 2;
083: contraint.gridy = 1;
084: contraint.gridwidth = 1;
085: contraint.gridheight = 1;
086: contraint.weightx = 1;
087: contraint.weighty = 1;
088: layout.setConstraints(fillPanel, contraint);
089: add(fillPanel);
090:
091: }
092:
093: /**
094: * save
095: */
096: public void save() {
097: }
098:
099: /**
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
124: && installFileNameField.hasChanged() == true) {
125: model.setPackageName(installFileNameField.getText());
126: installFileNameField.setChanged(false);
127: }
128: }
129:
130: }
|