merge the formfield patch from ooo-build
[ooovba.git] / scripting / workben / installer / NavPanel.java
blobf766da7c0e23fef8fe450f0f0787a496b15d82c9
1 package installer;
3 import javax.swing.*;
4 import java.awt.*;
5 import java.awt.event.*;
6 public class NavPanel extends JPanel implements ActionListener {
8 NavPanel(InstallWizard wizard, boolean bBack, boolean bNext, boolean bCancel, String prev, String next) {
9 setBackground(Color.white);
10 setBorder(new javax.swing.border.EtchedBorder(javax.swing.border.EtchedBorder.LOWERED));
11 this.wizard = wizard;
12 this.next = next;
13 this.prev = prev;
14 navBack = new javax.swing.JButton("<< Back");
15 navNext = new javax.swing.JButton("Next >>");
16 navCancel = new javax.swing.JButton("Cancel");
17 setLayout(new GridBagLayout());
19 gridBagConstraints1 = new java.awt.GridBagConstraints();
20 gridBagConstraints1.insets = new java.awt.Insets(1, 1, 1, 1);
21 gridBagConstraints1.anchor = gridBagConstraints1.WEST;
23 gridBagConstraints2 = new java.awt.GridBagConstraints();
24 gridBagConstraints2.gridx = 2;
25 gridBagConstraints2.gridy = 0;
27 gridBagConstraints3 = new java.awt.GridBagConstraints();
28 gridBagConstraints3.gridx = 6;
29 gridBagConstraints3.gridy = 0;
31 navNext.setEnabled(bNext);
32 navBack.setEnabled(bBack);
33 navCancel.setEnabled(bCancel);
34 navNext.addActionListener(this);
35 navBack.addActionListener(this);
36 navCancel.addActionListener(this);
37 add(navBack, gridBagConstraints1);
38 add(navNext, gridBagConstraints2);
39 add(navCancel, gridBagConstraints3);
42 public void enableNext(boolean bEnable) {
43 navNext.setEnabled(bEnable);
46 public void enableBack(boolean bEnable) {
47 navBack.setEnabled(bEnable);
50 public void enableCancel(boolean bEnable) {
51 navCancel.setEnabled(bEnable);
54 public void enableIDE(boolean bEnable) {
55 ideDetected = bEnable;
58 public void actionPerformed(ActionEvent ev) {
59 if ((ev.getSource() == navNext) && (next.length() != 0)) {
60 wizard.show(next);
62 if ((ev.getSource() == navBack) && (prev.length() != 0)) {
63 wizard.show(prev);
65 if (ev.getSource() == navCancel) {
66 if( ideDetected ) {
67 wizard.show(InstallWizard.IDEWELCOME);
69 else {
70 wizard.exitForm(null);
72 enableIDE(false);
76 public void setNextListener(ActionListener listener) {
77 navNext.addActionListener(listener);
80 public void setBackListener(ActionListener listener) {
81 navBack.addActionListener(listener);
84 public void setCancelListener(ActionListener listener) {
85 navCancel.addActionListener(listener);
88 public void removeNextListener(ActionListener listener)
90 navNext.removeActionListener(listener);
93 public void removeBackListener(ActionListener listener)
95 navBack.removeActionListener(listener);
98 public void removeCancelListener(ActionListener listener)
100 navCancel.removeActionListener(listener);
103 public JButton navBack;
104 public JButton navNext;
105 public JButton navCancel;
106 private GridBagConstraints gridBagConstraints1;
107 private GridBagConstraints gridBagConstraints2;
108 private GridBagConstraints gridBagConstraints3;
109 private InstallWizard wizard;
110 private String next;
111 private String prev;
112 private boolean ideDetected = false;