source: osm/applications/editors/josm/plugins/indoorhelper/src/views/FittingView.java@ 33882

Last change on this file since 33882 was 32637, checked in by donvip, 8 years ago

checkstyle

File size: 3.8 KB
Line 
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
19package views;
20
21import static org.openstreetmap.josm.tools.I18n.tr;
22
23import java.awt.BorderLayout;
24import java.awt.Container;
25import java.awt.FlowLayout;
26import java.awt.GridBagConstraints;
27import java.awt.GridBagLayout;
28import java.awt.Insets;
29import java.awt.event.ActionListener;
30
31import javax.swing.JButton;
32import javax.swing.JFrame;
33import javax.swing.JLabel;
34import javax.swing.JPanel;
35import 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")
45public 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}
Note: See TracBrowser for help on using the repository browser.