01: package org.dbbrowser.ui.helper.exporthelper.wizard.panel;
02:
03: import infrastructure.internationalization.InternationalizationManager;
04: import java.awt.BorderLayout;
05: import java.awt.GridLayout;
06: import java.awt.event.KeyEvent;
07: import java.awt.event.KeyListener;
08: import javax.swing.BorderFactory;
09: import javax.swing.JLabel;
10: import javax.swing.JPanel;
11: import javax.swing.JTextField;
12: import org.dbbrowser.ui.UIControllerForQueries;
13: import org.dbbrowser.ui.helper.exporthelper.wizard.WizardState;
14:
15: public class HeaderFooterWizardPanel extends AbstractWizardPanel
16: implements KeyListener {
17: private static final long serialVersionUID = UIControllerForQueries.version;
18:
19: private static final String PANEL_TITLE = InternationalizationManager
20: .getInstance()
21: .getMessage(
22: "dbbrowser-export-wizard",
23: "dbbrowser-ui-export-wizard-header-footer-panel-title",
24: null);
25: private static final String HEADER_LABEL = InternationalizationManager
26: .getInstance().getMessage("dbbrowser-export-wizard",
27: "dbbrowser-ui-export-wizard-header-label", null);
28: private static final String FOOTER_LABEL = InternationalizationManager
29: .getInstance().getMessage("dbbrowser-export-wizard",
30: "dbbrowser-ui-export-wizard-footer-label", null);
31: private JTextField fieldForHeader = new JTextField("");
32: private JTextField fieldForFooter = new JTextField("");
33:
34: /**
35: * Constrcuter
36: */
37: public HeaderFooterWizardPanel() {
38: super (PANEL_TITLE);
39: this .add(setupPanel(), BorderLayout.CENTER);
40: }
41:
42: public void keyTyped(KeyEvent e) {
43: }
44:
45: public void keyPressed(KeyEvent e) {
46: }
47:
48: public void keyReleased(KeyEvent e) {
49: WizardState.getInstance().setState("Header",
50: fieldForHeader.getText());
51: WizardState.getInstance().setState("Footer",
52: fieldForFooter.getText());
53: }
54:
55: private JPanel setupPanel() {
56: JPanel headerFooterPanel = new JPanel();
57: headerFooterPanel.setBorder(BorderFactory.createEtchedBorder());
58:
59: headerFooterPanel.setLayout(new GridLayout(10, 2));
60: JLabel labelForHeader = new JLabel(HEADER_LABEL);
61: headerFooterPanel.add(labelForHeader);
62: headerFooterPanel.add(fieldForHeader);
63: JLabel labelForFooter = new JLabel(FOOTER_LABEL);
64: headerFooterPanel.add(labelForFooter);
65: headerFooterPanel.add(fieldForFooter);
66:
67: //Add key listeners to set value for header and footer as the step listener does not work
68: fieldForHeader.addKeyListener(this );
69: fieldForFooter.addKeyListener(this );
70:
71: for (int i = 0; i < 12; i++) {
72: JLabel dummyLabel = new JLabel("");
73: headerFooterPanel.add(dummyLabel);
74: }
75:
76: return headerFooterPanel;
77: }
78: }
|