public MapMode getMapMode() {
        final String name = propNameField.getText().trim();
        String value = null;
        String pattern = null;
        if (propValueList.getModel().getSize() == 0) {
            if (newValueTextField.getText().length() == 0)
                return null;
            value = newValueTextField.getText();
        } else if (propValueList.getModel().getSize() == 1) {
            value = (String) propValueList.getModel().getElementAt(0);
        } else {
            final StringBuilder patternBuilder = new StringBuilder("(");
            final int size = propValueList.getModel().getSize();
            for (int i = 0; i < size; i++) {
                patternBuilder.append((String) propValueList.getModel().getElementAt(i));
                if (i < size-1)
                    patternBuilder.append('|');
            }
            pattern = patternBuilder.append(')').toString();
        }
        
        if (countriesCheckBox.isSelected()) {
            if (value != null)
                return new CustomCountryMode(name, value);
            else
                return new AdvancedCustomCountryMode(name, pattern);
        } else {
            if (value != null)
                return new CustomMode(name, value);
            else
                return new AdvancedCustomMode(name, pattern);
        }
    }