01: package org.dbbrowser.ui.helper.exporthelper.wizard.panel;
02:
03: import infrastructure.internationalization.InternationalizationManager;
04: import java.awt.BorderLayout;
05: import java.awt.event.ActionEvent;
06: import java.awt.event.ActionListener;
07: import javax.swing.BorderFactory;
08: import javax.swing.BoxLayout;
09: import javax.swing.ButtonGroup;
10: import javax.swing.JPanel;
11: import javax.swing.JRadioButton;
12: import org.dbbrowser.ui.UIControllerForQueries;
13: import org.dbbrowser.ui.helper.exporthelper.wizard.WizardState;
14:
15: public class PageSetupWizardPanel extends AbstractWizardPanel implements
16: ActionListener {
17: private static final long serialVersionUID = UIControllerForQueries.version;
18: private static final String PANEL_TITLE = InternationalizationManager
19: .getInstance()
20: .getMessage(
21: "dbbrowser-export-wizard",
22: "dbbrowser-ui-export-wizard-page-setup-format-panel-title",
23: null);;
24: private static final String LANDSCAPE_BUTTON_LABEL = InternationalizationManager
25: .getInstance()
26: .getMessage(
27: "dbbrowser-export-wizard",
28: "dbbrowser-ui-export-wizard-landscape-button-label",
29: null);
30: private static final String PORTRAIT_BUTTON_LABEL = InternationalizationManager
31: .getInstance().getMessage("dbbrowser-export-wizard",
32: "dbbrowser-ui-export-wizard-portrait-button-label",
33: null);
34: private static final String PORTRAIT = "PORTRAIT";
35: private static final String LANDSCAPE = "LANDSCAPE";
36: private String paperOrientation = PORTRAIT;
37:
38: /**
39: * Constrcuter
40: * @param wizard
41: */
42: public PageSetupWizardPanel() {
43: super (PANEL_TITLE);
44: this .add(setupPanel(), BorderLayout.CENTER);
45: }
46:
47: private JPanel setupPanel() {
48: JPanel panel = new JPanel();
49: panel.setBorder(BorderFactory.createEtchedBorder());
50: panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
51:
52: //Setup the radio button for page format
53: JRadioButton buttonForLandscapeFormat = new JRadioButton(
54: LANDSCAPE_BUTTON_LABEL);
55: buttonForLandscapeFormat.setActionCommand(LANDSCAPE);
56: JRadioButton buttonForPortraitFormat = new JRadioButton(
57: PORTRAIT_BUTTON_LABEL);
58: buttonForPortraitFormat.setActionCommand(PORTRAIT);
59: panel.add(buttonForLandscapeFormat);
60: panel.add(buttonForPortraitFormat);
61: ButtonGroup buttonGroup = new ButtonGroup();
62: buttonGroup.add(buttonForLandscapeFormat);
63: buttonGroup.add(buttonForPortraitFormat);
64: buttonForLandscapeFormat.addActionListener(this );
65: buttonForPortraitFormat.addActionListener(this );
66:
67: //Set the default paper orientation to be portrait
68: buttonForPortraitFormat.setSelected(true);
69:
70: return panel;
71: }
72:
73: public String getPaperOrientation() {
74: return this .paperOrientation;
75: }
76:
77: public void actionPerformed(ActionEvent e) {
78: WizardState.getInstance().setState("Paper Orientation",
79: e.getActionCommand());
80: paperOrientation = e.getActionCommand();
81: }
82: }
|