1 | /*
|
---|
2 | * Indoorhelper is a JOSM plug-in to support users when creating their own indoor maps.
|
---|
3 | * Copyright (C) 2016 Erik Gruschka
|
---|
4 | *
|
---|
5 | * This program is free software: you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
17 | */
|
---|
18 |
|
---|
19 | package views;
|
---|
20 |
|
---|
21 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
22 |
|
---|
23 | import java.awt.BorderLayout;
|
---|
24 | import java.awt.Container;
|
---|
25 | import java.awt.FlowLayout;
|
---|
26 | import java.awt.GridBagConstraints;
|
---|
27 | import java.awt.GridBagLayout;
|
---|
28 | import java.awt.Insets;
|
---|
29 | import java.awt.event.ActionListener;
|
---|
30 |
|
---|
31 | import javax.swing.JButton;
|
---|
32 | import javax.swing.JFrame;
|
---|
33 | import javax.swing.JLabel;
|
---|
34 | import javax.swing.JPanel;
|
---|
35 | import javax.swing.border.EmptyBorder;
|
---|
36 |
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * The view for the pop-up hint that tells the user, that he has to start the fitting
|
---|
40 | * of his indoor building plans.
|
---|
41 | *
|
---|
42 | * @author egru
|
---|
43 | */
|
---|
44 | @SuppressWarnings("serial")
|
---|
45 | public class FittingView extends JFrame {
|
---|
46 |
|
---|
47 | private JPanel dialogPane;
|
---|
48 | private JPanel contentPanel;
|
---|
49 | private JLabel label1;
|
---|
50 | private JPanel buttonBar;
|
---|
51 | private JButton okButton;
|
---|
52 |
|
---|
53 | public FittingView() {
|
---|
54 | initComponents();
|
---|
55 | }
|
---|
56 |
|
---|
57 | private void initComponents() {
|
---|
58 | dialogPane = new JPanel();
|
---|
59 | contentPanel = new JPanel();
|
---|
60 | label1 = new JLabel();
|
---|
61 | buttonBar = new JPanel();
|
---|
62 | okButton = new JButton();
|
---|
63 |
|
---|
64 | //======== this ========
|
---|
65 | setTitle(tr("Fitting"));
|
---|
66 | Container contentPane = getContentPane();
|
---|
67 | contentPane.setLayout(new BorderLayout());
|
---|
68 |
|
---|
69 | //======== dialogPane ========
|
---|
70 | {
|
---|
71 | dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
|
---|
72 | dialogPane.setLayout(new BorderLayout());
|
---|
73 |
|
---|
74 | //======== contentPanel ========
|
---|
75 | {
|
---|
76 | contentPanel.setLayout(new FlowLayout());
|
---|
77 |
|
---|
78 | //---- label1 ----
|
---|
79 | label1.setText(tr("<html>Please mind to start fitting your building-plans now.<br>" +
|
---|
80 | "To do so, use the PicLayer plug-in, which you can install<br>" +
|
---|
81 | "using the JOSM plug-in management.</html>"));
|
---|
82 | contentPanel.add(label1);
|
---|
83 | }
|
---|
84 | dialogPane.add(contentPanel, BorderLayout.CENTER);
|
---|
85 |
|
---|
86 | //======== buttonBar ========
|
---|
87 | {
|
---|
88 | buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
|
---|
89 | buttonBar.setLayout(new GridBagLayout());
|
---|
90 | ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 80};
|
---|
91 | ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0};
|
---|
92 |
|
---|
93 | //---- okButton ----
|
---|
94 | okButton.setText(tr("OK"));
|
---|
95 | buttonBar.add(okButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
|
---|
96 | GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
---|
97 | new Insets(0, 0, 0, 0), 0, 0));
|
---|
98 | }
|
---|
99 | dialogPane.add(buttonBar, BorderLayout.SOUTH);
|
---|
100 | }
|
---|
101 | contentPane.add(dialogPane, BorderLayout.CENTER);
|
---|
102 | pack();
|
---|
103 | setLocationRelativeTo(getOwner());
|
---|
104 | }
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * Set the given {@link ActionListener} to the OK-Button of the {@link FittingView}.
|
---|
108 | *
|
---|
109 | * @param l the listener which should be set
|
---|
110 | */
|
---|
111 | public void setOkButtonListener(ActionListener l) {
|
---|
112 | this.okButton.addActionListener(l);
|
---|
113 | }
|
---|
114 | }
|
---|