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

checkstyle

File:
1 edited

Legend:

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

    r32122 r32637  
    4444@SuppressWarnings("serial")
    4545public class DialogPanel extends JPanel {
    46         private JPanel contentPanel;
    47         private JToggleButton powerButton;
    48         private JLabel levelLabel;
    49         private JosmComboBox<String> levelBox;
    50         private JLabel levelTagLabel;
    51         private DisableShortcutsOnFocusGainedTextField levelTagField;
    52         private JLabel objectLabel;
    53         private JosmComboBox<TagCatalog.IndoorObject> objectBox;
    54         private JLabel nameLabel;
    55         private DisableShortcutsOnFocusGainedTextField nameField;
    56         private JLabel refLabel;
    57         private DisableShortcutsOnFocusGainedTextField refField;
    58         private JPanel buttonBar;
    59         private JButton applyButton;
    60         private JSeparator separator1;
    61         private JSeparator separator2;
    62 
    63         /**
    64          * Create the panel.
    65          */
    66         public DialogPanel() {
    67                 contentPanel = new JPanel();
    68                 powerButton = new JToggleButton();
    69                 levelLabel = new JLabel();
    70                 levelBox = new JosmComboBox<String>();
    71                 levelTagLabel = new JLabel();
    72                 levelTagField = new DisableShortcutsOnFocusGainedTextField();
    73                 objectLabel = new JLabel();
    74                 objectBox = new JosmComboBox<>();
    75                 objectBox.setModel(new DefaultComboBoxModel<>(TagCatalog.IndoorObject.values()));
    76                 nameLabel = new JLabel();
    77                 nameField = new DisableShortcutsOnFocusGainedTextField();
    78                 refLabel = new JLabel();
    79                 refField = new DisableShortcutsOnFocusGainedTextField();
    80                 buttonBar = new JPanel();
    81                 applyButton = new JButton();
    82                 separator1 = new JSeparator();
    83                 separator2 = new JSeparator();
    84 
    85                 //======== this ========
    86                 //Container contentPane = this.get;
    87                 //contentPane.setLayout(new BorderLayout());
    88 
    89                 //======== dialogPane ========
    90                 {
    91                         this.setBorder(new EmptyBorder(12, 12, 12, 12));
    92                         this.setLayout(new BorderLayout());
    93 
    94                         //======== contentPanel ========
    95                         {
    96                                 contentPanel.setLayout(new GridBagLayout());
    97                                 ((GridBagLayout)contentPanel.getLayout()).columnWidths = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    98                                 ((GridBagLayout)contentPanel.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0};
    99                                 ((GridBagLayout)contentPanel.getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
    100                                 ((GridBagLayout)contentPanel.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
    101 
    102                                 //---- powerButton ----
    103                                 powerButton.setText(tr("POWER"));
    104                                 powerButton.setToolTipText(tr("Activates the plug-in"));
    105                                 contentPanel.add(powerButton, new GridBagConstraints(8, 0, 4, 1, 0.0, 0.0,
    106                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    107                                         new Insets(0, 0, 5, 5), 0, 0));
    108                                 contentPanel.add(separator1, new GridBagConstraints(1, 1, 12, 1, 0.0, 0.0,
    109                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    110                                         new Insets(0, 0, 5, 5), 0, 0));
    111 
    112                                 //---- levelLabel ----
    113                                 levelLabel.setText(tr("Working Level"));
    114                                 contentPanel.add(levelLabel, new GridBagConstraints(1, 2, 2, 1, 0.0, 0.0,
    115                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    116                                         new Insets(0, 0, 5, 5), 0, 0));
    117 
    118                                 //---- levelBox ----
    119                                 levelBox.setEnabled(false);
    120                                 levelBox.setEditable(false);
    121                                 levelBox.setToolTipText(tr("Selects the working level."));
    122                                 contentPanel.add(levelBox, new GridBagConstraints(3, 2, 3, 1, 0.0, 0.0,
    123                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    124                                         new Insets(0, 0, 5, 5), 0, 0));
    125 
    126                                 //---- levelTagLabel ----
    127                                 levelTagLabel.setText(tr("Level Name"));
    128                                 contentPanel.add(levelTagLabel, new GridBagConstraints(7, 2, 1, 1, 0.0, 0.0,
    129                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    130                                         new Insets(0, 0, 5, 5), 0, 0));
    131 
    132                                 //---- levelTagField ----
    133                                 levelTagField.setEnabled(false);
    134                                 levelTagField.setColumns(6);
    135                                 levelTagField.setToolTipText(tr("Optional name-tag for a level."));
    136                                 contentPanel.add(levelTagField, new GridBagConstraints(8, 2, 5, 1, 0.0, 0.0,
    137                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    138                                         new Insets(0, 0, 5, 5), 0, 0));
    139                                 contentPanel.add(separator2, new GridBagConstraints(1, 3, 12, 1, 0.0, 0.0,
    140                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    141                                         new Insets(0, 0, 5, 5), 0, 0));
    142 
    143                                 //---- objectLabel ----
    144                                 objectLabel.setText(tr("Object"));
    145                                 contentPanel.add(objectLabel, new GridBagConstraints(0, 4, 3, 1, 0.0, 0.0,
    146                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    147                                         new Insets(0, 0, 5, 5), 0, 0));
    148 
    149                                 //---- objectBox ----
    150                                 objectBox.setEnabled(false);
    151                                 objectBox.setPrototypeDisplayValue(IndoorObject.CONCRETE_WALL);
    152                                 objectBox.setToolTipText(tr("The object preset you want to tag."));
    153                                 contentPanel.add(objectBox, new GridBagConstraints(3, 4, 3, 1, 0.0, 0.0,
    154                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    155                                         new Insets(0, 0, 5, 5), 0, 0));
    156 
    157                                 //---- nameLabel ----
    158                                 nameLabel.setText(tr("Name"));
    159                                 contentPanel.add(nameLabel, new GridBagConstraints(0, 5, 3, 1, 0.0, 0.0,
    160                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    161                                         new Insets(0, 0, 5, 5), 0, 0));
    162 
    163                                 //---- nameField ----
    164                                 nameField.setEnabled(false);
    165                                 nameField.addFocusListener(new FocusListener() {
    166                                        
    167                                         @Override
    168                                         public void focusLost(FocusEvent e) {}
    169                                        
    170                                         @Override
    171                                         public void focusGained(FocusEvent e) {
    172                                                 nameField.selectAll();                                         
    173                                         }
    174                                 });
    175                                 nameField.setToolTipText(tr("Sets the name tag when the room-object is selected."));
    176                                 contentPanel.add(nameField, new GridBagConstraints(3, 5, 3, 1, 0.0, 0.0,
    177                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    178                                         new Insets(0, 0, 5, 5), 0, 0));
    179 
    180                                 //---- refLabel ----
    181                                 refLabel.setText(tr("Reference"));
    182                                 contentPanel.add(refLabel, new GridBagConstraints(0, 6, 3, 1, 0.0, 0.0,
    183                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    184                                         new Insets(0, 0, 0, 5), 0, 0));
    185 
    186                                 //---- refField ----
    187                                 refField.setEnabled(false);
    188                                 refField.addFocusListener(new FocusListener() {
    189                                        
    190                                         @Override
    191                                         public void focusLost(FocusEvent e) {}
    192                                        
    193                                         @Override
    194                                         public void focusGained(FocusEvent e) {
    195                                                 refField.selectAll();
    196                                         }
    197                                 });
    198                                 refField.setToolTipText(tr("Sets the ref tag when the room-object is selected."));
    199                                 contentPanel.add(refField, new GridBagConstraints(3, 6, 3, 1, 0.0, 0.0,
    200                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    201                                         new Insets(0, 0, 0, 5), 0, 0));
    202                         }
    203                         this.add(contentPanel, BorderLayout.CENTER);
    204 
    205                         //======== buttonBar ========
    206                         {
    207                                 buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
    208                                 buttonBar.setLayout(new GridBagLayout());
    209                                 ((GridBagLayout)buttonBar.getLayout()).columnWidths = new int[] {0, 80};
    210                                 ((GridBagLayout)buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0};
    211 
    212                                 //---- applyButton ----
    213                                 applyButton.setText(tr("Apply Tags"));
    214                                 applyButton.setEnabled(false);
    215                                 buttonBar.add(applyButton, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
    216                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    217                                         new Insets(0, 0, 0, 0), 0, 0));
    218                         }
    219                         this.add(buttonBar, BorderLayout.SOUTH);
    220                 }
    221         }
     46    private JPanel contentPanel;
     47    private JToggleButton powerButton;
     48    private JLabel levelLabel;
     49    private JosmComboBox<String> levelBox;
     50    private JLabel levelTagLabel;
     51    private DisableShortcutsOnFocusGainedTextField levelTagField;
     52    private JLabel objectLabel;
     53    private JosmComboBox<TagCatalog.IndoorObject> objectBox;
     54    private JLabel nameLabel;
     55    private DisableShortcutsOnFocusGainedTextField nameField;
     56    private JLabel refLabel;
     57    private DisableShortcutsOnFocusGainedTextField refField;
     58    private JPanel buttonBar;
     59    private JButton applyButton;
     60    private JSeparator separator1;
     61    private JSeparator separator2;
     62
     63    /**
     64     * Create the panel.
     65     */
     66    public DialogPanel() {
     67        contentPanel = new JPanel();
     68        powerButton = new JToggleButton();
     69        levelLabel = new JLabel();
     70        levelBox = new JosmComboBox<String>();
     71        levelTagLabel = new JLabel();
     72        levelTagField = new DisableShortcutsOnFocusGainedTextField();
     73        objectLabel = new JLabel();
     74        objectBox = new JosmComboBox<>();
     75        objectBox.setModel(new DefaultComboBoxModel<>(TagCatalog.IndoorObject.values()));
     76        nameLabel = new JLabel();
     77        nameField = new DisableShortcutsOnFocusGainedTextField();
     78        refLabel = new JLabel();
     79        refField = new DisableShortcutsOnFocusGainedTextField();
     80        buttonBar = new JPanel();
     81        applyButton = new JButton();
     82        separator1 = new JSeparator();
     83        separator2 = new JSeparator();
     84
     85        //======== this ========
     86        //Container contentPane = this.get;
     87        //contentPane.setLayout(new BorderLayout());
     88
     89        //======== dialogPane ========
     90        {
     91            this.setBorder(new EmptyBorder(12, 12, 12, 12));
     92            this.setLayout(new BorderLayout());
     93
     94            //======== contentPanel ========
     95            {
     96                contentPanel.setLayout(new GridBagLayout());
     97                ((GridBagLayout) contentPanel.getLayout()).columnWidths = new int[] {
     98                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
     99                ((GridBagLayout) contentPanel.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0};
     100                ((GridBagLayout) contentPanel.getLayout()).columnWeights = new double[] {
     101                        0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
     102                ((GridBagLayout) contentPanel.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
     103
     104                //---- powerButton ----
     105                powerButton.setText(tr("POWER"));
     106                powerButton.setToolTipText(tr("Activates the plug-in"));
     107                contentPanel.add(powerButton, new GridBagConstraints(8, 0, 4, 1, 0.0, 0.0,
     108                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     109                    new Insets(0, 0, 5, 5), 0, 0));
     110                contentPanel.add(separator1, new GridBagConstraints(1, 1, 12, 1, 0.0, 0.0,
     111                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     112                    new Insets(0, 0, 5, 5), 0, 0));
     113
     114                //---- levelLabel ----
     115                levelLabel.setText(tr("Working Level"));
     116                contentPanel.add(levelLabel, new GridBagConstraints(1, 2, 2, 1, 0.0, 0.0,
     117                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     118                    new Insets(0, 0, 5, 5), 0, 0));
     119
     120                //---- levelBox ----
     121                levelBox.setEnabled(false);
     122                levelBox.setEditable(false);
     123                levelBox.setToolTipText(tr("Selects the working level."));
     124                contentPanel.add(levelBox, new GridBagConstraints(3, 2, 3, 1, 0.0, 0.0,
     125                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     126                    new Insets(0, 0, 5, 5), 0, 0));
     127
     128                //---- levelTagLabel ----
     129                levelTagLabel.setText(tr("Level Name"));
     130                contentPanel.add(levelTagLabel, new GridBagConstraints(7, 2, 1, 1, 0.0, 0.0,
     131                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     132                    new Insets(0, 0, 5, 5), 0, 0));
     133
     134                //---- levelTagField ----
     135                levelTagField.setEnabled(false);
     136                levelTagField.setColumns(6);
     137                levelTagField.setToolTipText(tr("Optional name-tag for a level."));
     138                contentPanel.add(levelTagField, new GridBagConstraints(8, 2, 5, 1, 0.0, 0.0,
     139                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     140                    new Insets(0, 0, 5, 5), 0, 0));
     141                contentPanel.add(separator2, new GridBagConstraints(1, 3, 12, 1, 0.0, 0.0,
     142                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     143                    new Insets(0, 0, 5, 5), 0, 0));
     144
     145                //---- objectLabel ----
     146                objectLabel.setText(tr("Object"));
     147                contentPanel.add(objectLabel, new GridBagConstraints(0, 4, 3, 1, 0.0, 0.0,
     148                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     149                    new Insets(0, 0, 5, 5), 0, 0));
     150
     151                //---- objectBox ----
     152                objectBox.setEnabled(false);
     153                objectBox.setPrototypeDisplayValue(IndoorObject.CONCRETE_WALL);
     154                objectBox.setToolTipText(tr("The object preset you want to tag."));
     155                contentPanel.add(objectBox, new GridBagConstraints(3, 4, 3, 1, 0.0, 0.0,
     156                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     157                    new Insets(0, 0, 5, 5), 0, 0));
     158
     159                //---- nameLabel ----
     160                nameLabel.setText(tr("Name"));
     161                contentPanel.add(nameLabel, new GridBagConstraints(0, 5, 3, 1, 0.0, 0.0,
     162                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     163                    new Insets(0, 0, 5, 5), 0, 0));
     164
     165                //---- nameField ----
     166                nameField.setEnabled(false);
     167                nameField.addFocusListener(new FocusListener() {
     168
     169                    @Override
     170                    public void focusLost(FocusEvent e) {}
     171
     172                    @Override
     173                    public void focusGained(FocusEvent e) {
     174                        nameField.selectAll();
     175                    }
     176                });
     177                nameField.setToolTipText(tr("Sets the name tag when the room-object is selected."));
     178                contentPanel.add(nameField, new GridBagConstraints(3, 5, 3, 1, 0.0, 0.0,
     179                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     180                    new Insets(0, 0, 5, 5), 0, 0));
     181
     182                //---- refLabel ----
     183                refLabel.setText(tr("Reference"));
     184                contentPanel.add(refLabel, new GridBagConstraints(0, 6, 3, 1, 0.0, 0.0,
     185                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     186                    new Insets(0, 0, 0, 5), 0, 0));
     187
     188                //---- refField ----
     189                refField.setEnabled(false);
     190                refField.addFocusListener(new FocusListener() {
     191
     192                    @Override
     193                    public void focusLost(FocusEvent e) {}
     194
     195                    @Override
     196                    public void focusGained(FocusEvent e) {
     197                        refField.selectAll();
     198                    }
     199                });
     200                refField.setToolTipText(tr("Sets the ref tag when the room-object is selected."));
     201                contentPanel.add(refField, new GridBagConstraints(3, 6, 3, 1, 0.0, 0.0,
     202                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     203                    new Insets(0, 0, 0, 5), 0, 0));
     204            }
     205            this.add(contentPanel, BorderLayout.CENTER);
     206
     207            //======== buttonBar ========
     208            {
     209                buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
     210                buttonBar.setLayout(new GridBagLayout());
     211                ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 80};
     212                ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0};
     213
     214                //---- applyButton ----
     215                applyButton.setText(tr("Apply Tags"));
     216                applyButton.setEnabled(false);
     217                buttonBar.add(applyButton, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
     218                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     219                    new Insets(0, 0, 0, 0), 0, 0));
     220            }
     221            this.add(buttonBar, BorderLayout.SOUTH);
     222        }
     223    }
    222224
    223225}
Note: See TracChangeset for help on using the changeset viewer.