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

code cleanup

Location:
applications/editors/josm/plugins/indoorhelper/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/indoorhelper/src/controller/IndoorHelperController.java

    r33997 r34005  
    8383   private EnterAction EnterAction;
    8484   private transient Shortcut EnterShortcut;
    85    private boolean OuterHelp,InnerHelp,LevelHelp;
     85   private boolean OuterHelp, InnerHelp, LevelHelp;
    8686   private Collection<OsmPrimitive> innerRelation;
    8787   private LevelSelectorView selectorView;
     
    9393   public IndoorHelperController() {
    9494
    95            this.model = new IndoorHelperModel();
     95       this.model = new IndoorHelperModel();
    9696       this.toolboxView = new ToolBoxView();
    9797
     
    115115               "", KeyEvent.VK_SPACE, Shortcut.DIRECT);
    116116       this.SpaceAction = new SpaceAction();
    117        MainApplication.registerActionShortcut(SpaceAction,SpaceShortcut);
     117       MainApplication.registerActionShortcut(SpaceAction, SpaceShortcut);
    118118
    119119       EnterShortcut = Shortcut.registerShortcut("mapmode:ALT",
    120120               "", KeyEvent.VK_ENTER, Shortcut.DIRECT);
    121121       this.EnterAction = new EnterAction();
    122        MainApplication.registerActionShortcut(EnterAction,EnterShortcut);
     122       MainApplication.registerActionShortcut(EnterAction, EnterShortcut);
    123123
    124124       // Helper
     
    126126       InnerHelp = false;
    127127       LevelHelp = false;
    128            innerRelation = null;
    129            levelValue = new String();
    130            levelNum = new String();
     128       innerRelation = null;
     129       levelValue = new String();
     130       levelNum = new String();
    131131
    132132   }
     
    166166    }
    167167
    168 /*************************************************
    169 * TOOLBOX LISTENER
    170 *
    171 */
    172 
    173168   /**
    174169    * The listener which provides the handling of the apply button.
     
    186181           IndoorObject indoorObject = toolboxView.getSelectedObject();
    187182
    188                    // collecting all tags
     183               // collecting all tags
    189184               List<Tag> tags = new ArrayList<>();
    190185               if (toolboxView.getLevelCheckBoxStatus() == false && !levelValue.equals("")) {
    191                    tags.add(new Tag("level",levelValue));
     186                   tags.add(new Tag("level", levelValue));
    192187               }
    193                    if (!toolboxView.getLevelNameText().isEmpty() && !toolboxView.getLevelCheckBoxStatus()) {
    194                            tags.add(new Tag("level_name",toolboxView.getLevelNameText()));
    195                    }
     188                  if (!toolboxView.getLevelNameText().isEmpty() && !toolboxView.getLevelCheckBoxStatus()) {
     189                      tags.add(new Tag("level_name", toolboxView.getLevelNameText()));
     190                  }
    196191               if (!toolboxView.getNameText().isEmpty()) {
    197192                   tags.add(new Tag("name", toolboxView.getNameText()));
     
    200195                   tags.add(new Tag("ref", toolboxView.getRefText()));
    201196               }
    202                if (!toolboxView.getRepeatOnText().isEmpty()){
    203                                 tags.add(new Tag("repeat_on",toolboxView.getRepeatOnText()));
    204                    }
    205                    if (!toolboxView.getLevelNameText().isEmpty() && !toolboxView.getLevelCheckBoxStatus()) {
    206                            tags.add(new Tag("level_name",toolboxView.getLevelNameText()));
    207                    }
     197               if (!toolboxView.getRepeatOnText().isEmpty()) {
     198                       tags.add(new Tag("repeat_on", toolboxView.getRepeatOnText()));
     199                  }
     200                  if (!toolboxView.getLevelNameText().isEmpty() && !toolboxView.getLevelCheckBoxStatus()) {
     201                      tags.add(new Tag("level_name", toolboxView.getLevelNameText()));
     202                  }
    208203
    209204           // Tagging to OSM Data
     
    236231               toolboxView.setNRUiElementsEnabled(true);
    237232               toolboxView.setROUiElementsEnabled(false);
    238            }
    239            else if (toolboxView.getSelectedObject().equals(IndoorObject.STEPS) ||
    240                         toolboxView.getSelectedObject().equals(IndoorObject.ELEVATOR)) {
    241                         toolboxView.setROUiElementsEnabled(true);
    242                         toolboxView.setNRUiElementsEnabled(true);
    243                 }
    244            else {
     233           } else if (toolboxView.getSelectedObject().equals(IndoorObject.STEPS) ||
     234                   toolboxView.getSelectedObject().equals(IndoorObject.ELEVATOR)) {
     235                    toolboxView.setROUiElementsEnabled(true);
     236                    toolboxView.setNRUiElementsEnabled(true);
     237           } else {
    245238               toolboxView.setROUiElementsEnabled(false);
    246239           }
     
    253246    * @author rebsc
    254247    */
    255    class ToolLevelCheckBoxListener implements ItemListener{
     248   class ToolLevelCheckBoxListener implements ItemListener {
    256249       @Override
    257250       public void itemStateChanged(ItemEvent e) {
    258            if(e.getStateChange() == ItemEvent.SELECTED) {
    259                    toolboxView.setLVLUiElementsEnabled(false);
    260            }
    261            else {
    262                    toolboxView.setLVLUiElementsEnabled(true);
    263            }
     251           if (e.getStateChange() == ItemEvent.SELECTED) {
     252               toolboxView.setLVLUiElementsEnabled(false);
     253           } else {
     254               toolboxView.setLVLUiElementsEnabled(true);
     255           }
    264256       }
    265257   }
     
    270262    * @author rebsc
    271263    */
    272    static class ToolHelpButtonListener implements ActionListener{
    273 
    274            @Override
    275            public void actionPerformed(ActionEvent e) {
    276                    String topic = "indoorHelper";
    277                    //Open HelpBrowser for short description about the plugin
    278                    HelpBrowser.setUrlForHelpTopic(Optional.ofNullable(topic).orElse("/"));
    279            }
     264   static class ToolHelpButtonListener implements ActionListener {
     265
     266       @Override
     267       public void actionPerformed(ActionEvent e) {
     268           String topic = "indoorHelper";
     269           //Open HelpBrowser for short description about the plugin
     270           HelpBrowser.setUrlForHelpTopic(Optional.ofNullable(topic).orElse("/"));
     271       }
    280272   }
    281273
     
    285277    * @author rebsc
    286278    */
    287    class ToolAddLevelButtonListener implements ActionListener{
    288 
    289            @Override
    290            public void actionPerformed(ActionEvent e) {
    291 
    292                    if(selectorView == null) {
    293                            selectorView = new LevelSelectorView();
    294                            addLevelSelectorListeners();
    295 
    296                            //Show LevelSelectorView
    297                            selectorView.setVisible(true);
    298                    } else {
    299                            //Put focus back on LevelSelectorView
    300                            selectorView.toFront();
    301                    }
    302 
    303            }
     279   class ToolAddLevelButtonListener implements ActionListener {
     280
     281       @Override
     282       public void actionPerformed(ActionEvent e) {
     283
     284           if (selectorView == null) {
     285               selectorView = new LevelSelectorView();
     286               addLevelSelectorListeners();
     287
     288               //Show LevelSelectorView
     289               selectorView.setVisible(true);
     290           } else {
     291               //Put focus back on LevelSelectorView
     292               selectorView.toFront();
     293           }
     294
     295       }
    304296   }
    305297
     
    309301    * @author rebsc
    310302    */
    311    class ToolMultiCheckBoxListener implements ItemListener{
     303   class ToolMultiCheckBoxListener implements ItemListener {
    312304       @Override
    313305       public void itemStateChanged(ItemEvent e) {
    314            if(e.getStateChange() == ItemEvent.SELECTED) {
    315                    toolboxView.setMultiUiElementsEnabled(false);
    316            }
    317            else {
    318                    toolboxView.setMultiUiElementsEnabled(true);
    319            }
     306           if (e.getStateChange() == ItemEvent.SELECTED) {
     307               toolboxView.setMultiUiElementsEnabled(false);
     308           } else {
     309               toolboxView.setMultiUiElementsEnabled(true);
     310           }
    320311       }
    321312   }
     
    326317    * @author rebsc
    327318    */
    328    class ToolOuterButtonListener implements ActionListener{
    329 
    330            @Override
    331            public void actionPerformed(ActionEvent e) {
    332                    // Select drawing action
    333                    map.selectMapMode(drawAction);
    334 
    335                    // For space shortcut to add the relation after spacebar got pushed {@link SpaceAction}
    336                    OuterHelp = true;
    337                    InnerHelp = false;
    338            }
     319   class ToolOuterButtonListener implements ActionListener {
     320
     321       @Override
     322       public void actionPerformed(ActionEvent e) {
     323           // Select drawing action
     324           map.selectMapMode(drawAction);
     325
     326           // For space shortcut to add the relation after spacebar got pushed {@link SpaceAction}
     327           OuterHelp = true;
     328           InnerHelp = false;
     329       }
    339330   }
    340331
     
    345336    */
    346337   class ToolInnerButtonListener implements ActionListener {
    347            @Override
    348            public void actionPerformed(ActionEvent e) {
    349                    // Select drawing action
    350                    map.selectMapMode(drawAction);
    351 
    352                    // For space shortcut to edit the relation after enter got pushed {@link SpaceAction}{@link EnterAction}
    353                    InnerHelp = true;
    354                    OuterHelp = false;
    355 
    356            }
     338       @Override
     339       public void actionPerformed(ActionEvent e) {
     340           // Select drawing action
     341           map.selectMapMode(drawAction);
     342
     343           // For space shortcut to edit the relation after enter got pushed {@link SpaceAction}{@link EnterAction}
     344           InnerHelp = true;
     345           OuterHelp = false;
     346
     347       }
    357348   }
    358349
     
    416407   }
    417408
    418 /*************************************************
    419 * LEVEL SELCTOR VIEW LISTENER
    420 *
    421 */
    422409   /**
    423410    * Specific listener for the applyButton
     
    429416       @Override
    430417       public void actionPerformed(ActionEvent e) {
    431            LevelHelp = true;
    432 
    433            //Get insert level number out of SelectorView
    434            if(!selectorView.getLevelNumber().equals("")) {
    435                    levelNum = selectorView.getLevelNumber();
    436 
    437                    //Unset visibility
    438                    selectorView.dispose();
    439                    //Select draw-action
    440                    map.selectMapMode(drawAction);
    441 
    442            }else {
    443                    JOptionPane.showMessageDialog(null, tr("Please insert a value."), tr("Error"), JOptionPane.ERROR_MESSAGE);
    444            }
    445 
    446            selectorView = null;
     418           LevelHelp = true;
     419
     420           // Get insert level number out of SelectorView
     421           if (!selectorView.getLevelNumber().equals("")) {
     422               levelNum = selectorView.getLevelNumber();
     423
     424               //Unset visibility
     425               selectorView.dispose();
     426               //Select draw-action
     427               map.selectMapMode(drawAction);
     428
     429           } else {
     430               JOptionPane.showMessageDialog(null, tr("Please insert a value."), tr("Error"), JOptionPane.ERROR_MESSAGE);
     431           }
     432
     433           selectorView = null;
    447434       }
    448435   }
     
    467454    *
    468455    */
    469    class ToolSelectorWindowSListener implements WindowListener{
    470 
    471         @Override
    472         public void windowClosed(WindowEvent e) {
    473                 selectorView = null;
    474         }
    475 
    476         @Override
    477         public void windowClosing(WindowEvent e) {
    478                 selectorView = null;
    479         }
    480 
    481         @Override
    482         public void windowActivated(WindowEvent arg0) {
    483                 // TODO Auto-generated method stub
    484 
    485         }
    486 
    487         @Override
    488         public void windowDeactivated(WindowEvent arg0) {
    489                 // TODO Auto-generated method stub
    490 
    491         }
    492 
    493         @Override
    494         public void windowDeiconified(WindowEvent arg0) {
    495                 // TODO Auto-generated method stub
    496 
    497         }
    498 
    499         @Override
    500         public void windowIconified(WindowEvent arg0) {
    501                 // TODO Auto-generated method stub
    502 
    503         }
    504 
    505         @Override
    506         public void windowOpened(WindowEvent arg0) {
    507                 // TODO Auto-generated method stub
    508 
    509         }
    510    }
    511 
    512 
    513 /*************************************************
    514 * SHORTCUT METHODS
    515 *
    516 */
     456   class ToolSelectorWindowSListener implements WindowListener {
     457
     458    @Override
     459    public void windowClosed(WindowEvent e) {
     460        selectorView = null;
     461    }
     462
     463    @Override
     464    public void windowClosing(WindowEvent e) {
     465        selectorView = null;
     466    }
     467
     468    @Override
     469    public void windowActivated(WindowEvent arg0) {
     470        // TODO Auto-generated method stub
     471
     472    }
     473
     474    @Override
     475    public void windowDeactivated(WindowEvent arg0) {
     476        // TODO Auto-generated method stub
     477
     478    }
     479
     480    @Override
     481    public void windowDeiconified(WindowEvent arg0) {
     482        // TODO Auto-generated method stub
     483
     484    }
     485
     486    @Override
     487    public void windowIconified(WindowEvent arg0) {
     488        // TODO Auto-generated method stub
     489
     490    }
     491
     492    @Override
     493    public void windowOpened(WindowEvent arg0) {
     494        // TODO Auto-generated method stub
     495
     496    }
     497   }
     498
    517499   /**
    518500    * Shortcut for Spacebar
     
    521503   private class SpaceAction extends AbstractAction {
    522504
    523         private static final long serialVersionUID = 1L;
    524 
    525         @Override
    526        public void actionPerformed(ActionEvent e) {
    527            if(OuterHelp) {
    528 
    529                    //Create new relation and add the currently drawn object to it
    530                    model.addRelation("outer");
    531                    map.selectMapMode(selectAction);
    532                    OuterHelp = false;
    533 
    534                    //Clear currently selection
    535                    MainApplication.getLayerManager().getEditDataSet().clearSelection();
    536            }
    537            else if(InnerHelp) {
    538 
    539                    //Save new drawn relation for adding
    540                    innerRelation = MainApplication.getLayerManager().getEditDataSet().getAllSelected();
    541                            map.selectMapMode(selectAction);
    542 
    543                    //Clear currently selection
    544                    MainApplication.getLayerManager().getEditDataSet().clearSelection();
    545            }
    546            else if(LevelHelp) {
     505    private static final long serialVersionUID = 1L;
     506
     507    @Override
     508       public void actionPerformed(ActionEvent e) {
     509           if (OuterHelp) {
     510
     511               //Create new relation and add the currently drawn object to it
     512               model.addRelation("outer");
     513               map.selectMapMode(selectAction);
     514               OuterHelp = false;
     515
     516               //Clear currently selection
     517               MainApplication.getLayerManager().getEditDataSet().clearSelection();
     518           } else if (InnerHelp) {
     519
     520               //Save new drawn relation for adding
     521               innerRelation = MainApplication.getLayerManager().getEditDataSet().getAllSelected();
     522                     map.selectMapMode(selectAction);
     523
     524               //Clear currently selection
     525               MainApplication.getLayerManager().getEditDataSet().clearSelection();
     526           } else if (LevelHelp) {
    547527
    548528               List<Tag> tags = new ArrayList<>();
    549                    tags.add(new Tag("level",levelNum));
    550 
    551                    //Add level tag
    552                    model.addTagsToOSM(tags);
    553 
    554                    //Change action
    555                    map.selectMapMode(selectAction);
    556                    LevelHelp = false;
     529               tags.add(new Tag("level", levelNum));
     530
     531               //Add level tag
     532               model.addTagsToOSM(tags);
     533
     534               //Change action
     535               map.selectMapMode(selectAction);
     536               LevelHelp = false;
    557537           }
    558538       }
     
    565545   private class EnterAction extends AbstractAction {
    566546
    567         private static final long serialVersionUID = 1L;
    568 
    569         @Override
    570        public void actionPerformed(ActionEvent e) {
    571 
    572            if(InnerHelp && !OuterHelp) {
    573 
    574                    // Edit the new drawn relation member to selected relation
    575                    model.editRelation("inner", innerRelation);
    576                    InnerHelp = false;
    577 
    578            }else if((InnerHelp && OuterHelp) || (OuterHelp && !InnerHelp)){
    579                    JOptionPane.showMessageDialog(null, tr("Please press spacebar first to add \"outer\" object to relation."), tr("Relation-Error"), JOptionPane.ERROR_MESSAGE);
    580                    resetHelper();
    581            }
    582        }
    583    }
    584 
    585 /*************************************************
    586 * FILTER METHODS
    587 *
    588 */
     547    private static final long serialVersionUID = 1L;
     548
     549       @Override
     550       public void actionPerformed(ActionEvent e) {
     551           if (InnerHelp && !OuterHelp) {
     552               // Edit the new drawn relation member to selected relation
     553               model.editRelation("inner", innerRelation);
     554               InnerHelp = false;
     555           } else if ((InnerHelp && OuterHelp) || (OuterHelp && !InnerHelp)) {
     556               JOptionPane.showMessageDialog(null,
     557                       tr("Please press spacebar first to add \"outer\" object to relation."), tr("Relation-Error"), JOptionPane.ERROR_MESSAGE);
     558               resetHelper();
     559           }
     560       }
     561   }
     562
    589563   /**
    590564    * Function which unset the disabled state of currently hidden and/or disabled objects which have a
     
    592566    * current working level.
    593567    * Specific example: key: repeat_on ; value: 1-4;
    594     *                                   If current selected workinglevel is "3" all objects with the leveltag "level=3" are hidden but the
    595     *                                   objects with the key "repeat_on" and the value which includes "3" or is (minValue+1) - maxValue (4-...),
    596     *                                   because repeat_on tag starts on the current workinglevel+1.
     568    *                     If current selected workinglevel is "3" all objects with the leveltag "level=3" are hidden but the
     569    *                     objects with the key "repeat_on" and the value which includes "3" or is (minValue+1) - maxValue (4-...),
     570    *                     because repeat_on tag starts on the current workinglevel+1.
     571    * @author rebsc
    597572    * @param key sepcific key to unset hidden objects which contains it
    598     * @author rebsc
    599573    */
    600574   public void unsetSpecificKeyFilter(String key) {
    601575
    602          Collection<OsmPrimitive> p = Main.main.getEditDataSet().allPrimitives();
    603          Map<String, String> tags = new HashMap<>();
    604          Integer level = Integer.parseInt(levelValue);
    605          Integer firstVal, secVal;
    606 
    607          //Find all primitives with the specific tag and check if value is part of the current
    608          //workinglevel. After that unset the disabled status.
    609          for(OsmPrimitive osm: p) {
    610                  if((osm.isDisabledAndHidden() || osm.isDisabled()) && osm.hasKey(key)) {
    611 
    612                          tags = osm.getInterestingTags();
    613 
    614                          for(Map.Entry<String, String> e: tags.entrySet()) {
    615                                 if(e.getKey().equals(key)) {
    616                                         String val = e.getValue();
    617 
    618                                         //Extract values
    619                                         if(val.indexOf("-") == 0) {
    620                                                 firstVal = (Integer.parseInt(val.split("-",2)[1].split("-",2)[0]))*-1;
    621                                                 secVal = Integer.parseInt(val.split("-",2)[1].split("-",2)[1]);
    622                                         }else {
    623                                                 firstVal = Integer.parseInt(val.split("-")[0]);
    624                                                 secVal = Integer.parseInt(val.split("-")[1]);
    625                                         }
    626 
    627                                         //Compare values to current working level
    628                                         if(level >= ((firstVal)-1) && level <= secVal) {
    629                                                 osm.unsetDisabledState();
    630                                         }else {
    631                                                 osm.setDisabledState(true);
    632                                         }
    633                                 }
    634 
    635                          }
    636 
    637                  }
    638          }
    639 
    640    }
    641 
    642   /**
    643    * Function which updates the current working level tag
    644    *
    645    * @param indoorLevel: current working level
    646    */
    647    public void setIndoorLevel(String indoorLevel) {
    648            this.toolboxView.setLevelLabel(indoorLevel);
    649    }
    650 
    651    /**
    652     * Function which gets the current working level tag
    653     *
    654     * @param indoorLevel: current working level
    655     */
     576     Collection<OsmPrimitive> p = Main.main.getEditDataSet().allPrimitives();
     577     Map<String, String> tags = new HashMap<>();
     578     Integer level = Integer.parseInt(levelValue);
     579     Integer firstVal, secVal;
     580
     581     //Find all primitives with the specific tag and check if value is part of the current
     582     //workinglevel. After that unset the disabled status.
     583     for (OsmPrimitive osm: p) {
     584         if ((osm.isDisabledAndHidden() || osm.isDisabled()) && osm.hasKey(key)) {
     585
     586             tags = osm.getInterestingTags();
     587
     588             for (Map.Entry<String, String> e: tags.entrySet()) {
     589                if (e.getKey().equals(key)) {
     590                    String val = e.getValue();
     591
     592                    //Extract values
     593                    if (val.indexOf("-") == 0) {
     594                        firstVal = (Integer.parseInt(val.split("-", 2)[1].split("-", 2)[0]))*-1;
     595                        secVal = Integer.parseInt(val.split("-", 2)[1].split("-", 2)[1]);
     596                    } else {
     597                        firstVal = Integer.parseInt(val.split("-")[0]);
     598                        secVal = Integer.parseInt(val.split("-")[1]);
     599                    }
     600
     601                    //Compare values to current working level
     602                    if (level >= ((firstVal)-1) && level <= secVal) {
     603                        osm.unsetDisabledState();
     604                    } else {
     605                        osm.setDisabledState(true);
     606                    }
     607                }
     608             }
     609         }
     610     }
     611   }
     612
     613    /**
     614     * Function which updates the current working level tag
     615     *
     616     * @param indoorLevel current working level
     617     */
     618    public void setIndoorLevel(String indoorLevel) {
     619       this.toolboxView.setLevelLabel(indoorLevel);
     620    }
     621
     622    /**
     623     * Function which gets the current working level tag
     624     *
     625     * @param indoorLevel current working level
     626     */
    656627    public void getIndoorLevel(String indoorLevel) {
    657         levelValue = indoorLevel;
    658 
    659     }
    660 
    661 
    662 /*************************************************
    663 * HELPER METHODS
    664 *
    665 */
    666 
    667    /**
    668     * Function which resets the helper for relation adding
    669     */
    670    private void resetHelper() {
    671            InnerHelp = false;
    672            OuterHelp = false;
    673    }
     628        levelValue = indoorLevel;
     629    }
     630
     631    /**
     632     * Function which resets the helper for relation adding
     633     */
     634    private void resetHelper() {
     635        InnerHelp = false;
     636        OuterHelp = false;
     637    }
    674638
    675639    /**
     
    686650    }
    687651
    688    /**
    689     * Enables or disables the preferences for the mapcss-style and the validator.
    690     *
    691     * @param enabled Activates or disables the settings.
    692     */
    693         @SuppressWarnings("deprecation")
    694         private void setPluginPreferences(boolean enabled) {
     652    /**
     653     * Enables or disables the preferences for the mapcss-style and the validator.
     654     *
     655     * @param enabled Activates or disables the settings.
     656     */
     657    private void setPluginPreferences(boolean enabled) {
    695658       Map<String, Setting<?>> settings = Main.pref.getAllSettings();
    696659
     
    727690           indoorValidator.put("title", "Indoor");
    728691           indoorValidator.put("active", "true");
    729            indoorValidator.put("url", Main.pref.getUserDataDirectory()+ sep +"validator" +
     692           indoorValidator.put("url", Main.pref.getDirs().getUserDataDirectory(true)+ sep +"validator" +
    730693                   sep + "indoorhelper.validator.mapcss");
    731694
     
    750713           indoorMapPaint.put("title", tr("Indoor"));
    751714           indoorMapPaint.put("active", "true");
    752            indoorMapPaint.put("url", Main.pref.getUserDataDirectory() + sep + "styles"
     715           indoorMapPaint.put("url", Main.pref.getDirs().getUserDataDirectory(true) + sep + "styles"
    753716                   + sep + "sit.mapcss");
    754717           styleMapsNew.add(indoorMapPaint);
     
    774737           indoorValidator.put("title", tr("Indoor"));
    775738           indoorValidator.put("active", "false");
    776            indoorValidator.put("url", Main.pref.getUserDataDirectory()+ sep +"validator" +
     739           indoorValidator.put("url", Main.pref.getDirs().getUserDataDirectory(true)+ sep +"validator" +
    777740                   sep + "indoorhelper.validator.mapcss");
    778741
     
    798761           indoorMapPaint.put("title", tr("Indoor"));
    799762           indoorMapPaint.put("active", "false");
    800            indoorMapPaint.put("url", Main.pref.getUserDataDirectory() + sep + "styles"
     763           indoorMapPaint.put("url", Main.pref.getDirs().getUserDataDirectory(true) + sep + "styles"
    801764                   + sep + "sit.mapcss");
    802765           styleMapsNew.add(indoorMapPaint);
     
    806769       }
    807770   }
    808 
    809 
    810 
    811 
    812 
    813 /**
    814  *
    815  *
    816  *
    817  *
    818  *
    819  *
    820  *
    821  *
    822  *
    823  */
    824771}
  • applications/editors/josm/plugins/indoorhelper/src/model/IndoorHelperModel.java

    r33997 r34005  
    4646 * @author rebsc
    4747 */
    48 public class IndoorHelperModel{
     48public class IndoorHelperModel {
    4949
    5050    private TagCatalog tags;
     
    7474     * directly to the relation otherwise add it to nodes and/or ways.
    7575     *
     76     * @author rebsc
    7677     * @param object the object which defines the tag-set you want to add
    7778     * @param userTags the tags which are given by the user input
    78      * @author rebsc
    79      */
    80         public void addTagsToOSM(IndoorObject object, List<Tag> userTags) {
     79     */
     80    public void addTagsToOSM(IndoorObject object, List<Tag> userTags) {
    8181        if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty()) {
    8282
    83                 DataSet ds = Main.main.getEditDataSet();
     83            DataSet ds = Main.main.getEditDataSet();
    8484            List<Tag> tags = this.getObjectTags(object);
    8585            Collection<Relation> relations = ds.getRelations();
     
    9292
    9393            // Put value on {@link relationToAdd} if selected object is a relation.
    94             relationToAdd = getRelationFromDataSet(ds,relations);
    95 
    96             if(relationToAdd != null) {
    97                 //Add tags to relation
    98                 for (Tag t : tags) {
    99                                 Main.main.undoRedo.add(new ChangePropertyCommand(relationToAdd, t.getKey(), t.getValue()));
    100                 }
    101             }else{
    102                 //Add tags to ways or nodes
    103                     for (Tag t : tags) {
    104                         Main.main.undoRedo.add(new ChangePropertyCommand(Main.main.getInProgressSelection(), t.getKey(), t.getValue()));
    105                     }
     94            relationToAdd = getRelationFromDataSet(ds, relations);
     95
     96            if (relationToAdd != null) {
     97                //Add tags to relation
     98                for (Tag t : tags) {
     99                        Main.main.undoRedo.add(new ChangePropertyCommand(relationToAdd, t.getKey(), t.getValue()));
     100                }
     101            } else {
     102                //Add tags to ways or nodes
     103                for (Tag t : tags) {
     104                    Main.main.undoRedo.add(new ChangePropertyCommand(Main.main.getInProgressSelection(), t.getKey(), t.getValue()));
     105                }
    106106            }
    107107        //If the selected dataset is empty
    108108        } else if (MainApplication.getLayerManager().getEditDataSet().selectionEmpty()) {
    109109
    110                 JOptionPane.showMessageDialog(null, tr("No data selected."), tr("Error"), JOptionPane.ERROR_MESSAGE);
     110            JOptionPane.showMessageDialog(null, tr("No data selected."), tr("Error"), JOptionPane.ERROR_MESSAGE);
    111111        }
    112112    }
     
    117117     * @param object the object which defines the tag-set you want to add
    118118     */
    119         public void addTagsToOSM(IndoorObject object) {
     119    public void addTagsToOSM(IndoorObject object) {
    120120
    121121        if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty()) {
     
    138138     * Method which adds a list of tag-sets to the currently selected OSM data. Tags directly to ways and/or nodes.
    139139     *
     140     * @author rebsc
    140141     * @param userTags the tags which are given by the user input
    141      * @author rebsc
    142      */
    143         public void addTagsToOSM(List<Tag> userTags) {
     142     */
     143    public void addTagsToOSM(List<Tag> userTags) {
    144144
    145145        if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty()) {
     
    149149                Main.main.undoRedo.add(new ChangePropertyCommand(Main.main.getInProgressSelection(), t.getKey(), t.getValue()));
    150150            }
    151         }
    152         else if (MainApplication.getLayerManager().getEditDataSet().selectionEmpty()) {
     151        } else if (MainApplication.getLayerManager().getEditDataSet().selectionEmpty()) {
    153152            JOptionPane.showMessageDialog(null, tr("No data selected."), tr("Error"), JOptionPane.ERROR_MESSAGE);
    154153        }
     
    158157     * Method which adds the relation to OSM data. Also adds the selected tag-set to relation object.
    159158     *
     159     * @author rebsc
    160160     * @param String the Multipolygon Role as String
    161      * @author rebsc
    162      */
    163         public void addRelation(String role){
    164         Relation newRelation = new Relation();
    165         RelationMember newMember;
    166         DataSet ds = Main.main.getEditDataSet();
     161     */
     162    public void addRelation(String role) {
     163        Relation newRelation = new Relation();
     164        RelationMember newMember;
     165        DataSet ds = Main.main.getEditDataSet();
    167166
    168167        // Create new relation and add a new member with specific role
    169         if(!MainApplication.getLayerManager().getEditDataSet().selectionEmpty()) {
    170                 for (OsmPrimitive osm : ds.getSelected()) {
     168        if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty()) {
     169            for (OsmPrimitive osm : ds.getSelected()) {
    171170                 newMember = new RelationMember(role == null ? "" : role, osm);
    172171                 newRelation.addMember(newMember);
    173172            }
    174         }
    175         // Add relation to OSM data
     173        }
     174        // Add relation to OSM data
    176175        MainApplication.undoRedo.add(new AddCommand(MainApplication.getLayerManager().getEditDataSet(), newRelation));
    177176    }
     
    180179     * Method which edits the selected object to the currently selected OSM data (relations).
    181180     *
     181     * @author rebsc
    182182     * @param role The Multipolygon Role as String
    183      * @param relation
    184      * @author rebsc
    185      */
    186         public void editRelation(String role, Collection<OsmPrimitive> innerRelation){
    187 
    188         RelationMember newMember;
    189         DataSet ds = Main.main.getEditDataSet();
    190         Collection<Relation> relations = ds.getRelations();
    191         Relation relation = getRelationFromDataSet(ds,relations);
     183     */
     184    public void editRelation(String role, Collection<OsmPrimitive> innerRelation) {
     185
     186        RelationMember newMember;
     187        DataSet ds = Main.main.getEditDataSet();
     188        Collection<Relation> relations = ds.getRelations();
     189        Relation relation = getRelationFromDataSet(ds, relations);
    192190
    193191        if (!MainApplication.getLayerManager().getEditDataSet().selectionEmpty() && !Main.main.getInProgressSelection().isEmpty() &&
    194                         !innerRelation.isEmpty() && getRole(ds,relations).equals("outer")) {
    195 
    196                 //Add new relation member to selected relation
     192                !innerRelation.isEmpty() && getRole(ds, relations).equals("outer")) {
     193
     194            //Add new relation member to selected relation
    197195            for (OsmPrimitive osm : innerRelation) {
    198196                 newMember = new RelationMember(role == null ? "" : role, osm);
     
    201199
    202200        //Check if dataset is not empty or if {@link innerRelation} has no value
    203         }else if (MainApplication.getLayerManager().getEditDataSet().selectionEmpty() || innerRelation.isEmpty()) {
     201        } else if (MainApplication.getLayerManager().getEditDataSet().selectionEmpty() || innerRelation.isEmpty()) {
    204202            JOptionPane.showMessageDialog(null, tr("No data selected."), tr("Error"), JOptionPane.ERROR_MESSAGE);
    205203
    206204        //If selected object is not a relation member or not a relation member with role "outer"
    207         }else if(!getRole(ds,relations).equals("outer")) {
    208                 JOptionPane.showMessageDialog(null, tr("No relation or no relation member with role \"outer\" selected."), tr("Error"), JOptionPane.ERROR_MESSAGE);
    209         }
    210 
    211     }
    212 
    213   /**
     205        } else if (!getRole(ds, relations).equals("outer")) {
     206            JOptionPane.showMessageDialog(null,
     207                    tr("No relation or no relation member with role \"outer\" selected."), tr("Error"), JOptionPane.ERROR_MESSAGE);
     208        }
     209    }
     210
     211    /**
    214212     * Returns the current ranking of the preset counter, which includes the 4 most used items.
    215213     *
     
    220218    }
    221219
    222 
    223 
    224 /*************************************************
    225 * HELPER METHODS
    226 *
    227 */
    228 
    229220    /**
    230221     * Function which returns the the relation (if any) of the currently selected object.
    231222     * If not returns null.
     223     * @author rebsc
    232224     * @param ds actual working dataset
    233225     * @param relations collection of relations in the dataset
    234226     * @return relation of currently selected dataset
    235      * @author rebsc
    236227     */
    237228    private Relation getRelationFromDataSet(DataSet ds, Collection<Relation> relations) {
    238         for(Relation r: relations) {
    239                 for(RelationMember rm: r.getMembers()) {
    240                         for(OsmPrimitive osm: ds.getSelected()) {
    241                                 if(rm.refersTo(osm)) {
    242                                         return r;
    243                                 }
    244                         }
    245                 }
    246         }
    247         return null;
     229        for (Relation r: relations) {
     230            for (RelationMember rm: r.getMembers()) {
     231                for (OsmPrimitive osm: ds.getSelected()) {
     232                    if (rm.refersTo(osm)) {
     233                        return r;
     234                    }
     235                }
     236            }
     237        }
     238        return null;
    248239    }
    249240
     
    251242     * Function which returns the relation role (if any) of the currently selected object.
    252243     * If object is not a relation returns empty string.
     244     * @author rebsc
    253245     * @param ds active dataset
    254246     * @param relations collection of relations in the dataset
    255247     * @return role of currently selected relation member if any
    256      * @author rebsc
    257248     */
    258249    private String getRole(DataSet ds, Collection<Relation> relations) {
    259250
    260         if(isRelationMember(ds,relations)) {
    261                 for(Relation r: relations) {
    262                         for(RelationMember rm: r.getMembers()) {
    263                                 for(OsmPrimitive osm: ds.getSelected()) {
    264                                         if(rm.refersTo(osm)) {
    265                                                 return rm.getRole();
    266                                         }
    267                                 }
    268                         }
    269                 }
    270         }
    271         return "";
     251        if (isRelationMember(ds, relations)) {
     252            for (Relation r: relations) {
     253                for (RelationMember rm: r.getMembers()) {
     254                    for (OsmPrimitive osm: ds.getSelected()) {
     255                        if (rm.refersTo(osm)) {
     256                            return rm.getRole();
     257                        }
     258                    }
     259                }
     260            }
     261        }
     262        return "";
    272263    }
    273264
    274265    /**
    275266     * Function which returns true if the currently selected object is a relation
     267     * @author rebsc
    276268     * @param ds active dataset
    277269     * @return true if selected object is a relation
    278      * @author rebsc
    279270     */
    280271    private boolean isRelationMember(DataSet ds, Collection<Relation> relations) {
    281         for(Relation r: relations) {
    282                 for(RelationMember rm: r.getMembers()) {
    283                         for(OsmPrimitive osm: ds.getSelected()) {
    284                                 if(rm.refersTo(osm)) {
    285                                         return true;
    286                                 }
    287                         }
    288                 }
    289         }
    290         return false;
    291     }
    292 
    293 
    294 /**
    295 *
    296 *
    297 *
    298 *
    299 *
    300 *
    301 *
    302 *
    303 *
    304 */
     272        for (Relation r: relations) {
     273            for (RelationMember rm: r.getMembers()) {
     274                for (OsmPrimitive osm: ds.getSelected()) {
     275                    if (rm.refersTo(osm)) {
     276                        return true;
     277                    }
     278                }
     279            }
     280        }
     281        return false;
     282    }
    305283}
  • applications/editors/josm/plugins/indoorhelper/src/model/PresetCounter.java

    r33997 r34005  
    137137            return 0;
    138138        }
    139 
    140139    }
    141 
    142 
    143 
    144 /**
    145 *
    146 *
    147 *
    148 *
    149 *
    150 *
    151 *
    152 *
    153 *
    154 */
    155140}
  • applications/editors/josm/plugins/indoorhelper/src/model/TagCatalog.java

    r33997 r34005  
    1919
    2020package model;
    21 
    22 /**
    23  * Class to provide the indoor tagging catalog.
    24  *
    25  * @author egru
    26  * @author rebsc
    27  *
    28  */
    29 import static org.openstreetmap.josm.tools.I18n.tr;
    3021
    3122import java.util.ArrayList;
     
    5344        case DOOR_PRIVATE:
    5445            tagList.add(new Tag("door", "yes"));
    55             tagList.add(new Tag ("access","private"));
     46            tagList.add(new Tag("access", "private"));
    5647            return tagList;
    5748        case DOOR_PUBLIC:
    5849            tagList.add(new Tag("door", "yes"));
    59             tagList.add(new Tag ("access","public"));
     50            tagList.add(new Tag("access", "public"));
    6051            return tagList;
    6152        case ELEVATOR:
     
    6960            return tagList;
    7061        case ACCESS_PRIVATE:
    71                 tagList.add(new Tag("access","private"));
    72                 return tagList;
     62            tagList.add(new Tag("access", "private"));
     63            return tagList;
    7364        case ACCESS_PUBLIC:
    74                 tagList.add(new Tag("access","public"));
    75                 return tagList;
     65            tagList.add(new Tag("access", "public"));
     66            return tagList;
    7667        case TOILET_FEMALE:
    7768            tagList.add(new Tag("indoor", "room"));
     
    9586            return tagList;
    9687        case CORRIDOR:
    97                 tagList.add(new Tag("indoor", "corridor"));
    98                 return tagList;
     88            tagList.add(new Tag("indoor", "corridor"));
     89            return tagList;
    9990        case BENCH:
    100                 tagList.add(new Tag("amenity","bench"));
    101                 return tagList;
     91            tagList.add(new Tag("amenity", "bench"));
     92            return tagList;
    10293        case ZONE:
    103                 tagList.add(new Tag("area","zone"));
    104                 return tagList;
     94            tagList.add(new Tag("area", "zone"));
     95            return tagList;
    10596        case NONE:
    106                 return tagList;
     97            return tagList;
    10798        default:
    10899            tagList = null;
     
    116107     * @author egru
    117108     * @author rebsc
    118      *
    119109     */
    120110    public enum IndoorObject {
    121111        CONCRETE_WALL, GLASS_WALL, ROOM, TOILET_MALE, TOILET_FEMALE, ELEVATOR, DOOR_PRIVATE, DOOR_PUBLIC, ENTRANCE,
    122         ENTRANCE_EXIT_ONLY,ACCESS_PRIVATE,ACCESS_PUBLIC,STEPS,CORRIDOR,BENCH,ZONE,NONE;
     112        ENTRANCE_EXIT_ONLY, ACCESS_PRIVATE, ACCESS_PUBLIC, STEPS, CORRIDOR, BENCH, ZONE, NONE;
    123113    }
    124 
    125 
    126 /**
    127 *
    128 *
    129 *
    130 *
    131 *
    132 *
    133 *
    134 *
    135 *
    136 */
    137114}
  • applications/editors/josm/plugins/indoorhelper/src/org/openstreetmap/josm/plugins/indoorhelper/IndoorHelperPlugin.java

    r33997 r34005  
    4040import controller.IndoorHelperController;
    4141
    42 
    4342/**
    4443 * This is the main class for the indoorhelper plug-in.
     
    5049public class IndoorHelperPlugin extends Plugin implements PaintableInvalidationListener, ActiveLayerChangeListener {
    5150
    52 
    53         @SuppressWarnings("unused")
     51    @SuppressWarnings("unused")
    5452    private IndoorHelperController controller;
    5553    String sep = System.getProperty("file.separator");
     
    9189     * Exports the mapcss validator file to the preferences directory.
    9290     */
    93     @SuppressWarnings("deprecation")
    94         private void exportValidator(String resourceName) throws Exception {
     91    private void exportValidator(String resourceName) throws Exception {
    9592        InputStream stream = null;
    9693        OutputStream resStreamOut = null;
     
    107104            byte[] buffer = new byte[4096];
    108105
    109             String valDirPath = Main.pref.getUserDataDirectory() + sep + "validator";
     106            String valDirPath = Main.pref.getDirs().getUserDataDirectory(true) + sep + "validator";
    110107            File valDir = new File(valDirPath);
    111108            valDir.mkdirs();
     
    129126     */
    130127    private void exportStyleFile(String resourceName) throws Exception {
    131         InputStream stream = null;
    132         OutputStream resStreamOut = null;
    133 
    134         try {
    135             stream = IndoorHelperPlugin.class.getResourceAsStream("/data/" + resourceName);
     128        try (InputStream stream = IndoorHelperPlugin.class.getResourceAsStream("/data/" + resourceName)) {
    136129            if (stream == null) {
    137130                System.out.println("MapPaint: stream is null");
     
    143136            byte[] buffer = new byte[4096];
    144137
    145             @SuppressWarnings("deprecation")
    146                         String valDirPath = Main.pref.getUserDataDirectory() + sep + "styles";
     138            String valDirPath = Main.pref.getDirs().getUserDataDirectory(true) + sep + "styles";
    147139            File valDir = new File(valDirPath);
    148140            valDir.mkdirs();
    149141            outPath = valDir.getAbsolutePath() +sep+ resourceName;
    150             System.out.println("MapPaint"+outPath);
    151 
    152             resStreamOut = new FileOutputStream(outPath);
    153             while ((readBytes = stream.read(buffer)) > 0) {
    154                 resStreamOut.write(buffer, 0, readBytes);
    155             }
    156             resStreamOut.close();
     142
     143            try (OutputStream resStreamOut = new FileOutputStream(outPath)) {
     144                while ((readBytes = stream.read(buffer)) > 0) {
     145                    resStreamOut.write(buffer, 0, readBytes);
     146                }
     147            }
    157148        } catch (Exception ex) {
    158149            throw ex;
    159         } finally {
    160             stream.close();
    161         }
    162     }
    163 
    164         @Override
    165         public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
    166                 OsmDataLayer editLayer = MainApplication.getLayerManager().getEditLayer();
     150        }
     151    }
     152
     153    @Override
     154    public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
     155        OsmDataLayer editLayer = MainApplication.getLayerManager().getEditLayer();
    167156        if (editLayer != null) {
    168157            editLayer.addInvalidationListener(this);
    169158        }
    170         }
    171 
    172         @Override
    173         public void paintableInvalidated(PaintableInvalidationEvent event){
    174                 AutoFilter currentAutoFilter = AutoFilterManager.getInstance().getCurrentAutoFilter();
    175                 String currentFilterValue = new String();
    176 
    177                 if(currentAutoFilter != null) {
    178                         currentFilterValue = currentAutoFilter.getFilter().text.split("=")[1];
    179 
    180                         this.controller.setIndoorLevel(currentFilterValue);
    181                         this.controller.getIndoorLevel(currentFilterValue);
    182                         this.controller.unsetSpecificKeyFilter("repeat_on");
    183 
    184                 }else{
    185                         currentFilterValue = "";
    186                         this.controller.setIndoorLevel(currentFilterValue);
    187                         this.controller.getIndoorLevel(currentFilterValue);
    188                 };
    189 
    190         }
     159    }
     160
     161    @Override
     162    public void paintableInvalidated(PaintableInvalidationEvent event) {
     163        AutoFilter currentAutoFilter = AutoFilterManager.getInstance().getCurrentAutoFilter();
     164        String currentFilterValue = new String();
     165
     166        if (currentAutoFilter != null) {
     167            currentFilterValue = currentAutoFilter.getFilter().text.split("=")[1];
     168
     169            this.controller.setIndoorLevel(currentFilterValue);
     170            this.controller.getIndoorLevel(currentFilterValue);
     171            this.controller.unsetSpecificKeyFilter("repeat_on");
     172
     173        } else {
     174            currentFilterValue = "";
     175            this.controller.setIndoorLevel(currentFilterValue);
     176            this.controller.getIndoorLevel(currentFilterValue);
     177        }
     178    }
    191179
    192180    /**
     
    232220//        }
    233221//    }
    234 
    235 /**
    236  *
    237  *
    238  *
    239  *
    240  *
    241  *
    242  *
    243  *
    244  *
    245  */
    246222}
  • applications/editors/josm/plugins/indoorhelper/src/views/DialogPanel.java

    r32637 r34005  
    6868        powerButton = new JToggleButton();
    6969        levelLabel = new JLabel();
    70         levelBox = new JosmComboBox<String>();
     70        levelBox = new JosmComboBox<>();
    7171        levelTagLabel = new JLabel();
    7272        levelTagField = new DisableShortcutsOnFocusGainedTextField();
     
    8888
    8989        //======== 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));
     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,
     102                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};
     103        ((GridBagLayout) contentPanel.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
     104
     105        //---- powerButton ----
     106        powerButton.setText(tr("POWER"));
     107        powerButton.setToolTipText(tr("Activates the plug-in"));
     108        contentPanel.add(powerButton, new GridBagConstraints(8, 0, 4, 1, 0.0, 0.0,
     109            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     110            new Insets(0, 0, 5, 5), 0, 0));
     111        contentPanel.add(separator1, new GridBagConstraints(1, 1, 12, 1, 0.0, 0.0,
     112            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     113            new Insets(0, 0, 5, 5), 0, 0));
     114
     115        //---- levelLabel ----
     116        levelLabel.setText(tr("Working Level"));
     117        contentPanel.add(levelLabel, new GridBagConstraints(1, 2, 2, 1, 0.0, 0.0,
     118            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     119            new Insets(0, 0, 5, 5), 0, 0));
     120
     121        //---- levelBox ----
     122        levelBox.setEnabled(false);
     123        levelBox.setEditable(false);
     124        levelBox.setToolTipText(tr("Selects the working level."));
     125        contentPanel.add(levelBox, new GridBagConstraints(3, 2, 3, 1, 0.0, 0.0,
     126            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     127            new Insets(0, 0, 5, 5), 0, 0));
     128
     129        //---- levelTagLabel ----
     130        levelTagLabel.setText(tr("Level Name"));
     131        contentPanel.add(levelTagLabel, new GridBagConstraints(7, 2, 1, 1, 0.0, 0.0,
     132            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     133            new Insets(0, 0, 5, 5), 0, 0));
     134
     135        //---- levelTagField ----
     136        levelTagField.setEnabled(false);
     137        levelTagField.setColumns(6);
     138        levelTagField.setToolTipText(tr("Optional name-tag for a level."));
     139        contentPanel.add(levelTagField, new GridBagConstraints(8, 2, 5, 1, 0.0, 0.0,
     140            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     141            new Insets(0, 0, 5, 5), 0, 0));
     142        contentPanel.add(separator2, new GridBagConstraints(1, 3, 12, 1, 0.0, 0.0,
     143            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     144            new Insets(0, 0, 5, 5), 0, 0));
     145
     146        //---- objectLabel ----
     147        objectLabel.setText(tr("Object"));
     148        contentPanel.add(objectLabel, new GridBagConstraints(0, 4, 3, 1, 0.0, 0.0,
     149            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     150            new Insets(0, 0, 5, 5), 0, 0));
     151
     152        //---- objectBox ----
     153        objectBox.setEnabled(false);
     154        objectBox.setPrototypeDisplayValue(IndoorObject.CONCRETE_WALL);
     155        objectBox.setToolTipText(tr("The object preset you want to tag."));
     156        contentPanel.add(objectBox, new GridBagConstraints(3, 4, 3, 1, 0.0, 0.0,
     157            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     158            new Insets(0, 0, 5, 5), 0, 0));
     159
     160        //---- nameLabel ----
     161        nameLabel.setText(tr("Name"));
     162        contentPanel.add(nameLabel, new GridBagConstraints(0, 5, 3, 1, 0.0, 0.0,
     163            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     164            new Insets(0, 0, 5, 5), 0, 0));
     165
     166        //---- nameField ----
     167        nameField.setEnabled(false);
     168        nameField.addFocusListener(new FocusListener() {
     169
     170            @Override
     171            public void focusLost(FocusEvent e) {}
     172
     173            @Override
     174            public void focusGained(FocusEvent e) {
     175                nameField.selectAll();
    204176            }
    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));
     177        });
     178        nameField.setToolTipText(tr("Sets the name tag when the room-object is selected."));
     179        contentPanel.add(nameField, new GridBagConstraints(3, 5, 3, 1, 0.0, 0.0,
     180            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     181            new Insets(0, 0, 5, 5), 0, 0));
     182
     183        //---- refLabel ----
     184        refLabel.setText(tr("Reference"));
     185        contentPanel.add(refLabel, new GridBagConstraints(0, 6, 3, 1, 0.0, 0.0,
     186            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     187            new Insets(0, 0, 0, 5), 0, 0));
     188
     189        //---- refField ----
     190        refField.setEnabled(false);
     191        refField.addFocusListener(new FocusListener() {
     192
     193            @Override
     194            public void focusLost(FocusEvent e) {}
     195
     196            @Override
     197            public void focusGained(FocusEvent e) {
     198                refField.selectAll();
    220199            }
    221             this.add(buttonBar, BorderLayout.SOUTH);
    222         }
     200        });
     201        refField.setToolTipText(tr("Sets the ref tag when the room-object is selected."));
     202        contentPanel.add(refField, new GridBagConstraints(3, 6, 3, 1, 0.0, 0.0,
     203            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     204            new Insets(0, 0, 0, 5), 0, 0));
     205
     206        this.add(contentPanel, BorderLayout.CENTER);
     207
     208        //======== buttonBar ========
     209
     210        buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
     211        buttonBar.setLayout(new GridBagLayout());
     212        ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 80};
     213        ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0};
     214
     215        //---- applyButton ----
     216        applyButton.setText(tr("Apply Tags"));
     217        applyButton.setEnabled(false);
     218        buttonBar.add(applyButton, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
     219            GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     220            new Insets(0, 0, 0, 0), 0, 0));
     221
     222        this.add(buttonBar, BorderLayout.SOUTH);
    223223    }
    224 
    225224}
  • applications/editors/josm/plugins/indoorhelper/src/views/FittingView.java

    r32637 r34005  
    6868
    6969        //======== dialogPane ========
    70         {
    71             dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
    72             dialogPane.setLayout(new BorderLayout());
    7370
    74             //======== contentPanel ========
    75             {
    76                 contentPanel.setLayout(new FlowLayout());
     71        dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
     72        dialogPane.setLayout(new BorderLayout());
    7773
    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);
     74        //======== contentPanel ========
    8575
    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};
     76        contentPanel.setLayout(new FlowLayout());
    9277
    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         }
     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
    101101        contentPane.add(dialogPane, BorderLayout.CENTER);
    102102        pack();
  • applications/editors/josm/plugins/indoorhelper/src/views/LevelSelectorView.java

    r33997 r34005  
    4646public class LevelSelectorView extends JFrame {
    4747
    48         private static final long serialVersionUID = 1L;
    49         private JPanel dialogPane;
     48    private static final long serialVersionUID = 1L;
     49    private JPanel dialogPane;
    5050    private JPanel contentPanel;
    5151    private JPanel infoBar;
     
    7878
    7979        //======== dialogPane ========
    80         {
    81             dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
    82             dialogPane.setLayout(new BorderLayout());
    8380
     81        dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
     82        dialogPane.setLayout(new BorderLayout());
    8483
    85                 //======== infoBar ========
    86                 {
     84        //======== infoBar ========
    8785
    88                         //---- Label1 ----
    89                         label1.setText(tr("<html> Please insert the new level number you want to add.<br> "
    90                                         + " <i>Info</i>: <br> If the OK button got pressed you will switch to the drawing action.<br>"
    91                                         + "To finish the new object please press the spacebar. The new level<br>will be tagged automatically. </html>"));
    92                         infoBar.add(label1);
    93                 }
    94                 dialogPane.add(infoBar,BorderLayout.NORTH);
     86        //---- Label1 ----
     87        label1.setText(tr("<html> Please insert the new level number you want to add.<br> "
     88                + " <i>Info</i>: <br> If the OK button got pressed you will switch to the drawing action.<br>"
     89                + "To finish the new object please press the spacebar. The new level<br>will be tagged automatically. </html>"));
     90        infoBar.add(label1);
     91        dialogPane.add(infoBar, BorderLayout.NORTH);
    9592
     93        //======== contentPanel ========
    9694
    97             //======== contentPanel ========
    98             {
    99                 contentPanel.setLayout(new GridBagLayout());
    100                 ((GridBagLayout) contentPanel.getLayout()).columnWidths = new int[] {0, 0, 0, 0, 0};
    101                 ((GridBagLayout) contentPanel.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0};
    102                 ((GridBagLayout) contentPanel.getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 1.0E-4};
    103                 ((GridBagLayout) contentPanel.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
     95        contentPanel.setLayout(new GridBagLayout());
     96        ((GridBagLayout) contentPanel.getLayout()).columnWidths = new int[] {0, 0, 0, 0, 0};
     97        ((GridBagLayout) contentPanel.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0};
     98        ((GridBagLayout) contentPanel.getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 1.0E-4};
     99        ((GridBagLayout) contentPanel.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
    104100
     101        //---- Label2 ----
     102        label2.setText(tr("level number:"));
     103        contentPanel.add(label2, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0,
     104                GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     105                new Insets(5, 5, 5, 30), 0, 0));
    105106
    106                 //---- Label2 ----
    107                 label2.setText(tr("level number:"));
    108                 contentPanel.add(label2,new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0,
    109                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    110                         new Insets(5, 5, 5, 30), 0, 0));
     107        //---- Field ----
     108        field.setToolTipText(tr("Example: '2' or '3'"));
     109        field.addFocusListener(new FocusListener() {
    111110
    112                 //---- Field ----
    113                 field.setToolTipText(tr("Example: '2' or '3'"));
    114                 field.addFocusListener(new FocusListener() {
     111            @Override
     112            public void focusLost(FocusEvent e) {}
    115113
    116                     @Override
    117                     public void focusLost(FocusEvent e) {}
     114            @Override
     115            public void focusGained(FocusEvent e) {
     116                field.selectAll();
     117            }
     118        });
     119        contentPanel.add(field, new GridBagConstraints(3, 0, 2, 1, 0.0, 0.0,
     120                GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     121                new Insets(5, 0, 5, 200), 0, 0));
    118122
    119                     @Override
    120                     public void focusGained(FocusEvent e) {
    121                         field.selectAll();
    122                     }
    123                 });
    124                 contentPanel.add(field, new GridBagConstraints(3, 0, 2, 1, 0.0, 0.0,
    125                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    126                         new Insets(5, 0, 5, 200), 0, 0));
     123        dialogPane.add(contentPanel, BorderLayout.CENTER);
    127124
    128             }
    129             dialogPane.add(contentPanel, BorderLayout.CENTER);
     125        //======== buttonBar ========
    130126
    131             //======== buttonBar ========
    132             {
    133                 buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
    134                 buttonBar.setLayout(new GridBagLayout());
    135                 ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 85, 80};
    136                 ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0, 0.0};
     127        buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
     128        buttonBar.setLayout(new GridBagLayout());
     129        ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 85, 80};
     130        ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0, 0.0};
    137131
    138                 //---- okButton ----
    139                 okButton.setText(tr("OK"));
    140                 buttonBar.add(okButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
    141                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    142                         new Insets(0, 0, 0, 5), 0, 0));
     132        //---- okButton ----
     133        okButton.setText(tr("OK"));
     134        buttonBar.add(okButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
     135                GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     136                new Insets(0, 0, 0, 5), 0, 0));
    143137
    144                 //---- Button ----
    145                cancelButton.setText(tr("Cancel"));
    146                 buttonBar.add(cancelButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
    147                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    148                         new Insets(0, 0, 0, 0), 0, 0));
    149             }
    150             dialogPane.add(buttonBar, BorderLayout.SOUTH);
    151         }
     138        //---- Button ----
     139        cancelButton.setText(tr("Cancel"));
     140        buttonBar.add(cancelButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
     141                GridBagConstraints.CENTER, GridBagConstraints.BOTH,
     142                new Insets(0, 0, 0, 0), 0, 0));
     143
     144        dialogPane.add(buttonBar, BorderLayout.SOUTH);
     145
    152146        contentPane.add(dialogPane, BorderLayout.CENTER);
    153147        pack();
    154148        setLocationRelativeTo(getOwner());
    155 
    156149    }
    157150
    158 /*************************************************
    159 * GETTER
    160 *
    161 */
    162151    /**
    163152     * Getter for the level number field.
     
    169158    }
    170159
    171 /*************************************************
    172 * SELECTOR VIEW LISTENER
    173 *
    174 */
    175 
    176         /**
     160    /**
    177161     * Set the listener for the OK button.
    178162     *
     
    183167    }
    184168
    185         /**
     169    /**
    186170     * Set the listener for the Cancel button.
    187171     *
     
    198182     */
    199183    public void setSelectorWindowListener(WindowListener l) {
    200         this.addWindowListener(l);
     184        this.addWindowListener(l);
    201185    }
    202 
    203 /**
    204 *
    205 *
    206 *
    207 *
    208 *
    209 *
    210 *
    211 *
    212 */
    213186}
  • applications/editors/josm/plugins/indoorhelper/src/views/PresetButton.java

    r33997 r34005  
    2929 *
    3030 */
    31 
    3231@SuppressWarnings("serial")
    3332class PresetButton extends JButton {
     
    4847        this.setToolTipText("Fast Tag: "+indoorObject.toString());
    4948    }
    50 
    51 
    52 /**
    53 *
    54 *
    55 *
    56 *
    57 *
    58 *
    59 *
    60 *
    61 */
    6249}
  • 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.