Ignore:
Timestamp:
2018-01-13T18:19:22+01:00 (7 years ago)
Author:
donvip
Message:

code cleanup

File:
1 edited

Legend:

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

    r33997 r34005  
    5757@SuppressWarnings("serial")
    5858public class ToolBoxView extends ToggleDialog {
    59         private JPanel dialogPanel;
    60         private JPanel contentPanel;
    61         private JLabel levelLabel;
    62         private JCheckBox levelCheckBox;
    63         private JLabel levelNameLabel;
    64         private DisableShortcutsOnFocusGainedTextField levelNameField;
    65         private JLabel repeatOnLabel;
    66         private DisableShortcutsOnFocusGainedTextField repeatOnField;
    67         private JLabel objectLabel;
    68         private JosmComboBox<TagCatalog.IndoorObject> objectBox;
    69         private JLabel nameLabel;
    70         private DisableShortcutsOnFocusGainedTextField nameField;
    71         private JLabel refLabel;
    72         private DisableShortcutsOnFocusGainedTextField refField;
    73         private JLabel multiLabel;
    74         private JButton multiOuterButton;
    75         private JButton multiInnerButton;
    76         private JCheckBox multiCheckBox;
    77         private JPanel buttonBar;
    78         private JButton applyButton;
    79         private JSeparator separator1;
    80         private JSeparator separator2;
    81         private PresetButton preset1;
    82         private PresetButton preset2;
    83         private PresetButton preset3;
    84         private PresetButton preset4;
    85         private JButton addLevelButton;
    86         private JButton helpButton;
    87 
     59    private JPanel dialogPanel;
     60    private JPanel contentPanel;
     61    private JLabel levelLabel;
     62    private JCheckBox levelCheckBox;
     63    private JLabel levelNameLabel;
     64    private DisableShortcutsOnFocusGainedTextField levelNameField;
     65    private JLabel repeatOnLabel;
     66    private DisableShortcutsOnFocusGainedTextField repeatOnField;
     67    private JLabel objectLabel;
     68    private JosmComboBox<TagCatalog.IndoorObject> objectBox;
     69    private JLabel nameLabel;
     70    private DisableShortcutsOnFocusGainedTextField nameField;
     71    private JLabel refLabel;
     72    private DisableShortcutsOnFocusGainedTextField refField;
     73    private JLabel multiLabel;
     74    private JButton multiOuterButton;
     75    private JButton multiInnerButton;
     76    private JCheckBox multiCheckBox;
     77    private JPanel buttonBar;
     78    private JButton applyButton;
     79    private JSeparator separator1;
     80    private JSeparator separator2;
     81    private PresetButton preset1;
     82    private PresetButton preset2;
     83    private PresetButton preset3;
     84    private PresetButton preset4;
     85    private JButton addLevelButton;
     86    private JButton helpButton;
    8887
    8988   public ToolBoxView() {
     
    9493   }
    9594
    96 /*************************************************
    97 * CREATES THE LAYOUT OF THE PLUG-IN.
    98 *
    99 */
    10095   private void initComponents() {
    10196       dialogPanel = new JPanel();
     
    133128
    134129       //======== dialogPane ========
    135        {
    136            dialogPanel.setBorder(new EmptyBorder(12, 12, 12, 12));
    137            dialogPanel.setLayout(new BorderLayout());
    138 
    139            //======== contentPanel ========
    140            {
    141                contentPanel.setLayout(new GridBagLayout());
    142                ((GridBagLayout) contentPanel.getLayout()).columnWidths = new int[] {
    143                        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};
    144                ((GridBagLayout) contentPanel.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0};
    145                ((GridBagLayout) contentPanel.getLayout()).columnWeights = new double[] {
    146                        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};
    147                ((GridBagLayout) contentPanel.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
    148 
    149 
    150                //---- addLevelButton ----
    151                addLevelButton.setText(tr("Insert level"));
    152                addLevelButton.setToolTipText(tr("Add a new level to layer."));
    153                addLevelButton.setEnabled(false);
    154                contentPanel.add(addLevelButton, new GridBagConstraints(12, 1, 3, 1, 0.0, 1.0,
    155                        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    156                        new Insets(0, 0, 5, 30), 0, 0));
    157 
    158                //---- helpButton ----
    159                helpButton.setText(tr("<html><b>?</strong></b>"));
    160                helpButton.setToolTipText(tr("Show Help-Browser."));
    161                helpButton.setBackground(Color.LIGHT_GRAY);
    162                helpButton.setEnabled(false);
    163                contentPanel.add(helpButton, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0,
    164                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    165                    new Insets(0, 0, 5, 0), 0, 0));
    166 
    167                //---- levelNameLabel ----
    168                levelNameLabel.setText(tr("Level name"));
    169                contentPanel.add(levelNameLabel, new GridBagConstraints(0, 1, 3, 1, 0.0, 1.0,
    170                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    171                    new Insets(0, 0, 5, 5), 0, 0));
    172 
    173                //---- levelNameField ----
    174                levelNameField.setEnabled(false);
    175                levelNameField.setToolTipText(tr("Sets optional name tag for a level."));
    176                contentPanel.add(levelNameField, new GridBagConstraints(3, 1, 3, 1, 0.0, 1.0,
    177                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    178                    new Insets(0, 0, 5, 30), 0, 0));
    179 
    180                //---- levelLabel ----
    181               levelLabel.setText(tr("Working level: NONE"));
    182               levelLabel.setToolTipText(tr("Shows the current working level."));
    183                contentPanel.add(levelLabel, new GridBagConstraints(6, 1, 3, 1, 0.0, 1.0,
    184                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    185                    new Insets(0, 0, 5, 5), 0, 0));
    186 
    187                //---- levelCheckBox ----
    188                levelCheckBox.setToolTipText(tr("Deactivate automatic level tagging."));
    189                contentPanel.add(levelCheckBox, new GridBagConstraints(9, 1, 1, 1, 0.0, 1.0,
    190                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    191                    new Insets(0, 0, 5, 5), 0, 0));
    192                contentPanel.add(separator1, new GridBagConstraints(0, 2, 0, 1, 0.0, 0.0,
    193                        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    194                        new Insets(0, 0, 5, 5), 0, 0));
    195 
    196                //---- objectLabel ----
    197                objectLabel.setText(tr("Object"));
    198                contentPanel.add(objectLabel, new GridBagConstraints(0, 3, 3, 1, 0.0, 1.0,
    199                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    200                    new Insets(0, 0, 5, 5), 0, 0));
    201 
    202                //---- objectBox ----
    203                objectBox.setEnabled(false);
    204                objectBox.setPrototypeDisplayValue(IndoorObject.CONCRETE_WALL);
    205                objectBox.setToolTipText(tr("The object preset you want to tag."));
    206                contentPanel.add(objectBox, new GridBagConstraints(3, 3, 3, 1, 0.0, 1.0,
    207                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    208                    new Insets(0, 0, 5, 30), 0, 0));
    209 
    210                //---- nameLabel ----
    211                nameLabel.setText(tr("Name"));
    212                contentPanel.add(nameLabel, new GridBagConstraints(0, 4, 3, 1, 0.0, 1.0,
    213                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    214                    new Insets(0, 0, 5, 5), 0, 0));
    215 
    216                //---- nameField ----
    217                nameField.setEnabled(false);
    218                nameField.addFocusListener(new FocusListener() {
    219 
    220                    @Override
    221                    public void focusLost(FocusEvent e) {}
    222 
    223                    @Override
    224                    public void focusGained(FocusEvent e) {
    225                        nameField.selectAll();
    226                    }
    227                });
    228                nameField.setToolTipText(tr("Sets the name tag."));
    229                contentPanel.add(nameField, new GridBagConstraints(3, 4, 3, 1, 0.0, 1.0,
    230                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    231                    new Insets(0, 0, 5, 30), 0, 0));
    232 
    233                //---- refLabel ----
    234                refLabel.setText(tr("Reference"));
    235                contentPanel.add(refLabel, new GridBagConstraints(0, 5, 3, 1, 0.0, 1.0,
    236                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    237                    new Insets(0, 0, 5, 5), 0, 0));
    238 
    239                //---- refField ----
    240                refField.setEnabled(false);
    241                refField.addFocusListener(new FocusListener() {
    242 
    243                    @Override
    244                    public void focusLost(FocusEvent e) {}
    245 
    246                    @Override
    247                    public void focusGained(FocusEvent e) {
    248                        refField.selectAll();
    249                    }
    250                });
    251                refField.setToolTipText(tr("Sets the referance tag."));
    252                contentPanel.add(refField, new GridBagConstraints(3, 5, 3, 1, 0.0, 1.0,
    253                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    254                    new Insets(0, 0, 5, 30), 0, 0));
    255 
    256                //---- repeatOnLabel ----
    257                repeatOnLabel.setText(tr("Repeat on"));
    258                contentPanel.add(repeatOnLabel, new GridBagConstraints(0, 6, 3, 1, 0.0, 1.0,
    259                 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    260                    new Insets(0, 0, 5, 5), 0, 0));
    261 
    262                //---- repeatOnField ----
    263                repeatOnField.setEnabled(false);
    264                repeatOnField.addFocusListener(new FocusListener() {
    265 
    266                 @Override
    267                 public void focusLost(FocusEvent e) {}
    268 
    269                 @Override
    270                 public void focusGained(FocusEvent e) {
    271                         repeatOnField.selectAll();
    272                 }
    273                });
    274                repeatOnField.setToolTipText(tr("Sets the repeat on tag when highway objects are selected. Please tag like this: -3-4 or -2--3 or 5-6 ."));
    275                contentPanel.add(repeatOnField, new GridBagConstraints(3, 6, 3, 1, 0.0, 1.0,
    276                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    277                    new Insets(0, 0, 5, 30), 0, 0));
    278                contentPanel.add(separator2, new GridBagConstraints(0, 7, 0, 1, 0.0, 1.0,
    279                        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    280                        new Insets(0, 0, 5, 5), 0, 0));
    281 
    282                //---- preset1 ----
    283                preset1.setEnabled(false);
    284                contentPanel.add(preset1, new GridBagConstraints(6, 3, 1, 1, 0.0, 0.0,
    285                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    286                    new Insets(0, 0, 5, 5), 0, 0));
    287                //---- preset2 ----
    288                preset2.setEnabled(false);
    289                contentPanel.add(preset2, new GridBagConstraints(6, 4, 1, 1, 0.0, 0.0,
    290                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    291                    new Insets(0, 0, 5, 5), 0, 0));
    292 
    293                //---- preset3 ----
    294                preset3.setEnabled(false);
    295                contentPanel.add(preset3, new GridBagConstraints(6, 5, 1, 1, 0.0, 0.0,
    296                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    297                    new Insets(0, 0, 5, 5), 0, 0));
    298 
    299                //---- preset4 ----
    300                preset4.setEnabled(false);
    301                contentPanel.add(preset4, new GridBagConstraints(6, 6, 1, 1, 0.0, 0.0,
    302                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    303                    new Insets(0, 0, 5, 5), 0, 0));
    304 
    305                //---- multiLabel ----
    306                multiLabel.setText(tr("Multipolygon"));
    307                contentPanel.add(multiLabel, new GridBagConstraints(0, 8, 3, 1, 0.0, 1.0,
    308                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    309                    new Insets(0, 0, 5, 5), 0, 0));
    310 
    311                //---- multiOuterButton ----
    312                multiOuterButton.setText(tr("OUTER"));
    313                multiOuterButton.setToolTipText(tr("Creation-Tool for multipolygon with role: outer. To finish press the spacebar."));
    314                multiOuterButton.setEnabled(false);
    315                contentPanel.add(multiOuterButton, new GridBagConstraints(3, 8, 3, 1, 0.0, 1.0,
    316                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    317                    new Insets(0, 0, 5, 30), 0, 0));
    318 
    319                //---- multiInnerButton ----
    320                multiInnerButton.setText(tr("INNER"));
    321                multiInnerButton.setToolTipText(tr("Creation-Tool for multipolygons with role: inner. To finish press spacebar. To add to relation select \"outer\" and press enter."));
    322                multiInnerButton.setEnabled(false);
    323                contentPanel.add(multiInnerButton, new GridBagConstraints(6, 8, 1, 1, 0.0, 0.0,
    324                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    325                    new Insets(0, 0, 5, 5), 0, 0));
    326 
    327              //---- multiCheckBox ----
    328                multiCheckBox.setToolTipText(tr("Deactivate multipolygon function."));
    329                contentPanel.add(multiCheckBox, new GridBagConstraints(9, 8, 1, 1, 0.0, 1.0,
    330                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    331                    new Insets(0, 0, 5, 5), 0, 0));
     130
     131       dialogPanel.setBorder(new EmptyBorder(12, 12, 12, 12));
     132       dialogPanel.setLayout(new BorderLayout());
     133
     134       //======== contentPanel ========
     135
     136       contentPanel.setLayout(new GridBagLayout());
     137       ((GridBagLayout) contentPanel.getLayout()).columnWidths = new int[] {
     138               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};
     139       ((GridBagLayout) contentPanel.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0};
     140       ((GridBagLayout) contentPanel.getLayout()).columnWeights = new double[] {
     141               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,
     142               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};
     143       ((GridBagLayout) contentPanel.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
     144
     145       //---- addLevelButton ----
     146       addLevelButton.setText(tr("Insert level"));
     147       addLevelButton.setToolTipText(tr("Add a new level to layer."));
     148       addLevelButton.setEnabled(false);
     149       contentPanel.add(addLevelButton, new GridBagConstraints(12, 1, 3, 1, 0.0, 1.0,
     150               GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     151               new Insets(0, 0, 5, 30), 0, 0));
     152
     153       //---- helpButton ----
     154       helpButton.setText(tr("<html><b>?</strong></b>"));
     155       helpButton.setToolTipText(tr("Show Help-Browser."));
     156       helpButton.setBackground(Color.LIGHT_GRAY);
     157       helpButton.setEnabled(false);
     158       contentPanel.add(helpButton, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0,
     159           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     160           new Insets(0, 0, 5, 0), 0, 0));
     161
     162       //---- levelNameLabel ----
     163       levelNameLabel.setText(tr("Level name"));
     164       contentPanel.add(levelNameLabel, new GridBagConstraints(0, 1, 3, 1, 0.0, 1.0,
     165           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     166           new Insets(0, 0, 5, 5), 0, 0));
     167
     168       //---- levelNameField ----
     169       levelNameField.setEnabled(false);
     170       levelNameField.setToolTipText(tr("Sets optional name tag for a level."));
     171       contentPanel.add(levelNameField, new GridBagConstraints(3, 1, 3, 1, 0.0, 1.0,
     172           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     173           new Insets(0, 0, 5, 30), 0, 0));
     174
     175       //---- levelLabel ----
     176       levelLabel.setText(tr("Working level: NONE"));
     177       levelLabel.setToolTipText(tr("Shows the current working level."));
     178       contentPanel.add(levelLabel, new GridBagConstraints(6, 1, 3, 1, 0.0, 1.0,
     179           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     180           new Insets(0, 0, 5, 5), 0, 0));
     181
     182       //---- levelCheckBox ----
     183       levelCheckBox.setToolTipText(tr("Deactivate automatic level tagging."));
     184       contentPanel.add(levelCheckBox, new GridBagConstraints(9, 1, 1, 1, 0.0, 1.0,
     185           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     186           new Insets(0, 0, 5, 5), 0, 0));
     187       contentPanel.add(separator1, new GridBagConstraints(0, 2, 0, 1, 0.0, 0.0,
     188               GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     189               new Insets(0, 0, 5, 5), 0, 0));
     190
     191       //---- objectLabel ----
     192       objectLabel.setText(tr("Object"));
     193       contentPanel.add(objectLabel, new GridBagConstraints(0, 3, 3, 1, 0.0, 1.0,
     194           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     195           new Insets(0, 0, 5, 5), 0, 0));
     196
     197       //---- objectBox ----
     198       objectBox.setEnabled(false);
     199       objectBox.setPrototypeDisplayValue(IndoorObject.CONCRETE_WALL);
     200       objectBox.setToolTipText(tr("The object preset you want to tag."));
     201       contentPanel.add(objectBox, new GridBagConstraints(3, 3, 3, 1, 0.0, 1.0,
     202           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     203           new Insets(0, 0, 5, 30), 0, 0));
     204
     205       //---- nameLabel ----
     206       nameLabel.setText(tr("Name"));
     207       contentPanel.add(nameLabel, new GridBagConstraints(0, 4, 3, 1, 0.0, 1.0,
     208           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     209           new Insets(0, 0, 5, 5), 0, 0));
     210
     211       //---- nameField ----
     212       nameField.setEnabled(false);
     213       nameField.addFocusListener(new FocusListener() {
     214
     215           @Override
     216           public void focusLost(FocusEvent e) {}
     217
     218           @Override
     219           public void focusGained(FocusEvent e) {
     220               nameField.selectAll();
    332221           }
    333            dialogPanel.add(contentPanel, BorderLayout.CENTER);
    334 
    335            //======== buttonBar ========
    336            {
    337                buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
    338                buttonBar.setLayout(new GridBagLayout());
    339                ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 80};
    340                ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0};
    341 
    342                //---- applyButton ----
    343                applyButton.setText(tr("Apply"));
    344                applyButton.setToolTipText(tr("Add selected tags and/or relations to obeject."));
    345                applyButton.setEnabled(false);
    346                buttonBar.add(applyButton, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0,
    347                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    348                    new Insets(0, 0, 0, 0), 0, 0));
     222       });
     223       nameField.setToolTipText(tr("Sets the name tag."));
     224       contentPanel.add(nameField, new GridBagConstraints(3, 4, 3, 1, 0.0, 1.0,
     225           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     226           new Insets(0, 0, 5, 30), 0, 0));
     227
     228       //---- refLabel ----
     229       refLabel.setText(tr("Reference"));
     230       contentPanel.add(refLabel, new GridBagConstraints(0, 5, 3, 1, 0.0, 1.0,
     231           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     232           new Insets(0, 0, 5, 5), 0, 0));
     233
     234       //---- refField ----
     235       refField.setEnabled(false);
     236       refField.addFocusListener(new FocusListener() {
     237
     238           @Override
     239           public void focusLost(FocusEvent e) {}
     240
     241           @Override
     242           public void focusGained(FocusEvent e) {
     243               refField.selectAll();
    349244           }
    350            dialogPanel.add(buttonBar, BorderLayout.SOUTH);
    351        }
     245       });
     246       refField.setToolTipText(tr("Sets the referance tag."));
     247       contentPanel.add(refField, new GridBagConstraints(3, 5, 3, 1, 0.0, 1.0,
     248           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     249           new Insets(0, 0, 5, 30), 0, 0));
     250
     251       //---- repeatOnLabel ----
     252       repeatOnLabel.setText(tr("Repeat on"));
     253       contentPanel.add(repeatOnLabel, new GridBagConstraints(0, 6, 3, 1, 0.0, 1.0,
     254           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     255           new Insets(0, 0, 5, 5), 0, 0));
     256
     257       //---- repeatOnField ----
     258       repeatOnField.setEnabled(false);
     259       repeatOnField.addFocusListener(new FocusListener() {
     260
     261           @Override
     262           public void focusLost(FocusEvent e) {}
     263
     264           @Override
     265           public void focusGained(FocusEvent e) {
     266               repeatOnField.selectAll();
     267           }
     268       });
     269       repeatOnField.setToolTipText(
     270               tr("Sets the repeat on tag when highway objects are selected. Please tag like this: -3-4 or -2--3 or 5-6 ."));
     271       contentPanel.add(repeatOnField, new GridBagConstraints(3, 6, 3, 1, 0.0, 1.0,
     272           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     273           new Insets(0, 0, 5, 30), 0, 0));
     274       contentPanel.add(separator2, new GridBagConstraints(0, 7, 0, 1, 0.0, 1.0,
     275               GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     276               new Insets(0, 0, 5, 5), 0, 0));
     277
     278       //---- preset1 ----
     279       preset1.setEnabled(false);
     280       contentPanel.add(preset1, new GridBagConstraints(6, 3, 1, 1, 0.0, 0.0,
     281           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     282           new Insets(0, 0, 5, 5), 0, 0));
     283       //---- preset2 ----
     284       preset2.setEnabled(false);
     285       contentPanel.add(preset2, new GridBagConstraints(6, 4, 1, 1, 0.0, 0.0,
     286           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     287           new Insets(0, 0, 5, 5), 0, 0));
     288
     289       //---- preset3 ----
     290       preset3.setEnabled(false);
     291       contentPanel.add(preset3, new GridBagConstraints(6, 5, 1, 1, 0.0, 0.0,
     292           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     293           new Insets(0, 0, 5, 5), 0, 0));
     294
     295       //---- preset4 ----
     296       preset4.setEnabled(false);
     297       contentPanel.add(preset4, new GridBagConstraints(6, 6, 1, 1, 0.0, 0.0,
     298           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     299           new Insets(0, 0, 5, 5), 0, 0));
     300
     301       //---- multiLabel ----
     302       multiLabel.setText(tr("Multipolygon"));
     303       contentPanel.add(multiLabel, new GridBagConstraints(0, 8, 3, 1, 0.0, 1.0,
     304           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     305           new Insets(0, 0, 5, 5), 0, 0));
     306
     307       //---- multiOuterButton ----
     308       multiOuterButton.setText(tr("OUTER"));
     309       multiOuterButton.setToolTipText(tr("Creation-Tool for multipolygon with role: outer. To finish press the spacebar."));
     310       multiOuterButton.setEnabled(false);
     311       contentPanel.add(multiOuterButton, new GridBagConstraints(3, 8, 3, 1, 0.0, 1.0,
     312           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     313           new Insets(0, 0, 5, 30), 0, 0));
     314
     315       //---- multiInnerButton ----
     316       multiInnerButton.setText(tr("INNER"));
     317       multiInnerButton.setToolTipText(
     318               tr("Creation-Tool for multipolygons with role: inner. To finish press spacebar. To add to relation select \"outer\" and press enter."));
     319       multiInnerButton.setEnabled(false);
     320       contentPanel.add(multiInnerButton, new GridBagConstraints(6, 8, 1, 1, 0.0, 0.0,
     321           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     322           new Insets(0, 0, 5, 5), 0, 0));
     323
     324       //---- multiCheckBox ----
     325       multiCheckBox.setToolTipText(tr("Deactivate multipolygon function."));
     326       contentPanel.add(multiCheckBox, new GridBagConstraints(9, 8, 1, 1, 0.0, 1.0,
     327           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     328           new Insets(0, 0, 5, 5), 0, 0));
     329
     330       dialogPanel.add(contentPanel, BorderLayout.CENTER);
     331
     332       //======== buttonBar ========
     333       buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
     334       buttonBar.setLayout(new GridBagLayout());
     335       ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 80};
     336       ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0};
     337
     338       //---- applyButton ----
     339       applyButton.setText(tr("Apply"));
     340       applyButton.setToolTipText(tr("Add selected tags and/or relations to obeject."));
     341       applyButton.setEnabled(false);
     342       buttonBar.add(applyButton, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0,
     343           GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     344           new Insets(0, 0, 0, 0), 0, 0));
     345
     346       dialogPanel.add(buttonBar, BorderLayout.SOUTH);
     347
    352348       this.createLayout(dialogPanel, true, null);
    353 
    354    }
    355 
    356 /*************************************************
    357 * ENABLES OR DISABLES UI ELEMENTS
    358 *
    359 */
     349   }
     350
    360351   /**
    361352    * Enables or disables the interactive UI elements of the toolbox.
     
    364355    */
    365356   public void setAllUiElementsEnabled(boolean enabled) {
    366            this.applyButton.setEnabled(enabled);
    367            this.levelCheckBox.setEnabled(enabled);
    368            this.helpButton.setEnabled(enabled);
     357       this.applyButton.setEnabled(enabled);
     358       this.levelCheckBox.setEnabled(enabled);
     359       this.helpButton.setEnabled(enabled);
    369360       this.objectBox.setEnabled(enabled);
    370361       this.levelNameField.setEnabled(enabled);
     
    402393    * Enables or disables the interactive text box element {@link #repeatOn}.
    403394    * @param enabled set this true for enabled elements
    404         */
    405    public void setROUiElementsEnabled(boolean enabled){
    406                 this.repeatOnField.setEnabled(enabled);
    407 
     395    */
     396   public void setROUiElementsEnabled(boolean enabled) {
     397       this.repeatOnField.setEnabled(enabled);
    408398   }
    409399
     
    411401    * Enables or disables the interactive text box element {@link #levelName}.
    412402    * @param enabled set this true for enabled elements
    413         */
     403    */
    414404   public void setLVLUiElementsEnabled(boolean enabled) {
    415            this.levelNameField.setEnabled(enabled);
    416            this.addLevelButton.setEnabled(enabled);
     405       this.levelNameField.setEnabled(enabled);
     406       this.addLevelButton.setEnabled(enabled);
    417407
    418408   }
     
    421411    * Enables or disables the interactive ComboBoxes {@link #multiRoleBox} and {@link #multiEditBox }.
    422412    * @param enabled set this true for enabled elements
    423         */
     413    */
    424414   public void setMultiUiElementsEnabled(boolean enabled) {
    425            this.multiOuterButton.setEnabled(enabled);
    426            this.multiInnerButton.setEnabled(enabled);
    427 
    428            if (enabled == false) resetUiElements();
     415       this.multiOuterButton.setEnabled(enabled);
     416       this.multiInnerButton.setEnabled(enabled);
     417
     418       if (enabled == false) resetUiElements();
    429419   }
    430420
     
    436426   }
    437427
    438 
    439 /*************************************************
    440 * GETTER and SETTER FOR THE INTERACTIVE UI BOXES
    441 *
    442 */
    443428   /**
    444429    * Getter for the selected {@link IndoorObject} in the objectBox.
     
    480465    * Setter for the current level value tag
    481466    *
     467    * @author rebsc
    482468    * @param current level value as String
    483     * @author rebsc
    484469    */
    485470   public void setLevelLabel(String levelTag) {
    486            if (getLevelCheckBoxStatus() == false) {
    487                   if(!levelTag.equals("")) {
    488                           this.levelLabel.setText((tr("Working level: {0}",levelTag)));
    489                   }
    490                   else {
    491                           this.levelLabel.setText((tr("Working level: NONE")));
    492                   }
    493            }
    494            else {
    495                    this.levelLabel.setText((tr("Working level: NONE")));
    496            }
     471       if (getLevelCheckBoxStatus() == false) {
     472          if (!levelTag.equals("")) {
     473              this.levelLabel.setText((tr("Working level: {0}", levelTag)));
     474          } else {
     475              this.levelLabel.setText((tr("Working level: NONE")));
     476          }
     477       } else {
     478           this.levelLabel.setText((tr("Working level: NONE")));
     479       }
    497480   }
    498481
     
    503486    */
    504487   public boolean getLevelCheckBoxStatus() {
    505            return this.levelCheckBox.isSelected();
     488       return this.levelCheckBox.isSelected();
    506489   }
    507490
     
    522505       return this.repeatOnField.getText();
    523506   }
    524 
    525 
    526 /*************************************************
    527 * RESETER FOR THE INTERACTIVE UI BOXES
    528 *
    529 */
    530507
    531508   /**
     
    540517   }
    541518
    542 
    543 /*************************************************
    544 * SETTERS FOR THE BUTTON LISTENER
    545 *
    546 */
    547 
    548519   /**
    549520    * Set the listener for the apply button.
     
    560531    */
    561532   public void setLevelCheckBoxListener(ItemListener l) {
    562            this.levelCheckBox.addItemListener(l);
     533       this.levelCheckBox.addItemListener(l);
    563534   }
    564535
     
    568539    */
    569540   public void setHelpButtonListener(ActionListener l) {
    570            this.helpButton.addActionListener(l);
     541       this.helpButton.addActionListener(l);
    571542   }
    572543
     
    576547    */
    577548   public void setAddLevelButtonListener(ActionListener l) {
    578            this.addLevelButton.addActionListener(l);
     549       this.addLevelButton.addActionListener(l);
    579550   }
    580551
     
    616587   }
    617588
    618 /*************************************************
    619 * PRESET BUTTON FUNCTION
    620 *
    621 */
    622589   public void setPresetButtons(List<IndoorObject> objects) {
    623590       this.preset1.setIndoorObject(objects.get(0));
     
    658625       return preset4.getIndoorObject();
    659626   }
    660 
    661 
    662 /**
    663 *
    664 *
    665 *
    666 *
    667 *
    668 *
    669 *
    670 *
    671 *
    672 */
    673627}
Note: See TracChangeset for help on using the changeset viewer.