Saves the label for given component, for macro recording and for accessing the component in macros.
(Object component, String label)
| 310 | |
| 311 | /** Saves the label for given component, for macro recording and for accessing the component in macros. */ |
| 312 | private void saveLabel(Object component, String label) { |
| 313 | if (labels==null) |
| 314 | labels = new Hashtable(); |
| 315 | if (label.length()>0) |
| 316 | label = Macro.trimKey(label.trim()); |
| 317 | if (label.length()>0 && hasLabel(label)) { // not a unique label? |
| 318 | label += "_0"; |
| 319 | for (int n=1; hasLabel(label); n++) { // while still not a unique label |
| 320 | label = label.substring(0, label.lastIndexOf('_')); //remove counter |
| 321 | label += "_"+n; |
| 322 | } |
| 323 | } |
| 324 | labels.put(component, label); |
| 325 | } |
| 326 | |
| 327 | /** Returns whether the list of labels for macro recording or macro creation contains a given label. */ |
| 328 | private boolean hasLabel(String label) { |
no test coverage detected