Ignore:
Timestamp:
2016-07-11T22:48:15+02:00 (9 years ago)
Author:
donvip
Message:

checkstyle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/indoorhelper/src/views/FittingView.java

    r32122 r32637  
    2121import static org.openstreetmap.josm.tools.I18n.tr;
    2222
    23 import java.awt.*;
     23import java.awt.BorderLayout;
     24import java.awt.Container;
     25import java.awt.FlowLayout;
     26import java.awt.GridBagConstraints;
     27import java.awt.GridBagLayout;
     28import java.awt.Insets;
    2429import java.awt.event.ActionListener;
    2530
    26 import javax.swing.*;
    27 import javax.swing.border.*;
     31import javax.swing.JButton;
     32import javax.swing.JFrame;
     33import javax.swing.JLabel;
     34import javax.swing.JPanel;
     35import javax.swing.border.EmptyBorder;
    2836
    2937
     
    3139 * The view for the pop-up hint that tells the user, that he has to start the fitting
    3240 * of his indoor building plans.
    33  * 
     41 *
    3442 * @author egru
    3543 */
    3644@SuppressWarnings("serial")
    3745public class FittingView extends JFrame {
    38        
    39         private JPanel dialogPane;
    40         private JPanel contentPanel;
    41         private JLabel label1;
    42         private JPanel buttonBar;
    43         private JButton okButton;
    44        
    45         public FittingView() {
    46                 initComponents();
    47         }
    4846
    49         private void initComponents() {
    50                 dialogPane = new JPanel();
    51                 contentPanel = new JPanel();
    52                 label1 = new JLabel();
    53                 buttonBar = new JPanel();
    54                 okButton = new JButton();
     47    private JPanel dialogPane;
     48    private JPanel contentPanel;
     49    private JLabel label1;
     50    private JPanel buttonBar;
     51    private JButton okButton;
    5552
    56                 //======== this ========
    57                 setTitle(tr("Fitting"));
    58                 Container contentPane = getContentPane();
    59                 contentPane.setLayout(new BorderLayout());
     53    public FittingView() {
     54        initComponents();
     55    }
    6056
    61                 //======== dialogPane ========
    62                 {
    63                         dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
    64                         dialogPane.setLayout(new BorderLayout());
     57    private void initComponents() {
     58        dialogPane = new JPanel();
     59        contentPanel = new JPanel();
     60        label1 = new JLabel();
     61        buttonBar = new JPanel();
     62        okButton = new JButton();
    6563
    66                         //======== contentPanel ========
    67                         {
    68                                 contentPanel.setLayout(new FlowLayout());
     64        //======== this ========
     65        setTitle(tr("Fitting"));
     66        Container contentPane = getContentPane();
     67        contentPane.setLayout(new BorderLayout());
    6968
    70                                 //---- label1 ----
    71                                 label1.setText(tr("<html>Please mind to start fitting your building-plans now.<br>" +
    72                                                 "To do so, use the PicLayer plug-in, which you can install<br>" +
    73                                                 "using the JOSM plug-in management.</html>"));
    74                                 contentPanel.add(label1);
    75                         }
    76                         dialogPane.add(contentPanel, BorderLayout.CENTER);
     69        //======== dialogPane ========
     70        {
     71            dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
     72            dialogPane.setLayout(new BorderLayout());
    7773
    78                         //======== buttonBar ========
    79                         {
    80                                 buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
    81                                 buttonBar.setLayout(new GridBagLayout());
    82                                 ((GridBagLayout)buttonBar.getLayout()).columnWidths = new int[] {0, 80};
    83                                 ((GridBagLayout)buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0};
     74            //======== contentPanel ========
     75            {
     76                contentPanel.setLayout(new FlowLayout());
    8477
    85                                 //---- okButton ----
    86                                 okButton.setText(tr("OK"));
    87                                 buttonBar.add(okButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
    88                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    89                                         new Insets(0, 0, 0, 0), 0, 0));
    90                         }
    91                         dialogPane.add(buttonBar, BorderLayout.SOUTH);
    92                 }
    93                 contentPane.add(dialogPane, BorderLayout.CENTER);
    94                 pack();
    95                 setLocationRelativeTo(getOwner());
    96         }
    97        
    98         /**
    99          * Set the given {@link ActionListener} to the OK-Button of the {@link FittingView}.
    100          *
    101          * @param l the listener which should be set
    102          */
    103         public void setOkButtonListener(ActionListener l){
    104                 this.okButton.addActionListener(l);
    105         }
     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    }
    106114}
Note: See TracChangeset for help on using the changeset viewer.