Append this rule the formatter.

@param mainSelector optional selectors of the calling rule if this is a mixin.
@param formatter current formatter
351445
void appendTo( @Nullable String[] mainSelector, CssFormatter formatter ) {
        try {
            String[] sel = selectors;

            for( int s = 0; s < sel.length; s++ ) {
                final String selector = sel[s];
                String str = SelectorUtils.replacePlaceHolder( formatter, selector, this );
                if( selector != str ) {
                    if( sel == selectors ) {
                        sel = sel.clone(); // we does not want change the declaration of this selectors
                    }
                    sel[s] = str;
                }
            }

            if( mainSelector == null ) {        // main ruls
                for( int i = 0; i < sel.length; i++ ) {
                    sel[i] = SelectorUtils.fastReplace( sel[i], "&", "" );
                }
            } else if( sel[0].charAt( 0 ) == '@' ) {
                // media
                bubbling( sel, mainSelector, formatter );
                return;
            } else {
                sel = SelectorUtils.merge( mainSelector, sel );
            }
            formatter.addMixin( this, null, variables );

            if( sel[0].startsWith( "@" ) ) {
                ruleset( sel, formatter );
            } else {
                if( properties.size() > 0 ) {
                    int size0 = formatter.getOutputSize();
                    CssFormatter block = formatter.startBlock( sel );
                    int size1 = block.getOutputSize();
                    appendPropertiesTo( block );
                    int size2 = block.getOutputSize();
                    block.endBlock();
                    if( block == formatter && size1 == size2 ) {
                        formatter.setOutputSize( size0 );
                    }
                }

                for( Formattable prop : properties ) {
                    if( prop instanceof Mixin ) {
                        ((Mixin)prop).appendSubRules( sel, formatter );
                    }
                }

                for( Rule rule : subrules ) {
                    if( rule.isValidCSS( formatter ) && !rule.isInlineRule( formatter) ) {
                        rule.appendTo( params != null ? mainSelector : sel, formatter );
                    }
                }
            }
            formatter.removeMixin();
        } catch( LessException ex ) {
            ex.addPosition( filename, line, column );
            throw ex;
        } catch( Exception ex ) {
            throw createException( ex );
        }
    }
40834
private void escape( CssFormatter formatter ) {
        String url = get( 0 ).stringValue( formatter );
        url = UrlUtils.removeQuote( url );
        for( int i = 0; i < url.length(); i++ ) {
            char ch = url.charAt( i );
            if( ch < 0x80 ) {
                if( ch > ' ' ) {
                    switch( ch ){
                        case '#':
                        case '^':
                        case '(':
                        case ')':
                        case '{':
                        case '}':
                        case '|':
                        case ':':
                        case '>':
                        case '<':
                        case ';':
                        case '[':
                        case ']':
                        case '=':
                            break;
                        default:
                            formatter.append( ch );
                            continue;
                    }
                }
                formatter.append( '%' );
                formatter.appendHex( ch, 2 );
            } else {
                byte[] bytes = String.valueOf( ch ).getBytes(StandardCharsets.UTF_8);
                for( int j = 0; j < bytes.length; j++ ) {
                    formatter.append( '%' );
                    formatter.appendHex( bytes[j], 2 );
                }
            }
        }
    }
83461
public void setHighlighter(String highlighter) {

        try {
            m_highlighter = (I_CmsTermHighlighter)Class.forName(highlighter).newInstance();
        } catch (Exception e) {
            m_highlighter = null;
            LOG.error(e.getLocalizedMessage(), e);
        }
    }
232056
public CharSequence format(Formatter formatter) {
    CharSequence input = format();
    return formatter.format(String.valueOf(input));
  }
1104041
def add_formatter(self, sqla_col_type, formatter, key_specific=None):
        
        self.add_item(sqla_col_type, formatter, key_specific)
268685
public CellField<T> add(final FieldValidator<T> validator) {
        ArgUtils.notNull(validator, "validator");
        this.validators.add(validator);

        return this;
    }
422850
public void setFormatter(I_CmsListFormatter formatter) {

        m_formatter = formatter;
        // set the formatter for all default actions
        Iterator<CmsListDefaultAction> it = m_defaultActions.iterator();
        while (it.hasNext()) {
            CmsListDefaultAction action = it.next();
            action.setColumnForLink(this);
        }
    }
114878
protected void formatCell (HTMLTable.CellFormatter formatter, int row, int col, int limit)
    {
        formatter.setHorizontalAlignment(row, col, _cellHorizAlign);
        formatter.setVerticalAlignment(row, col, _cellVertAlign);
        formatter.setStyleName(row, col, "Cell");
        if (row == (limit-1)/_cols) {
            formatter.addStyleName(row, col, "BottomCell");
        } else if (row == 0) {
            formatter.addStyleName(row, col, "TopCell");
        } else {
            formatter.addStyleName(row, col, "MiddleCell");
        }
    }
852356
public function setFormatter(Formatter $formatter)
    {
        $this->output->setFormatter($formatter);
        $this->errorOutput->setFormatter($formatter);
    }
215466
function OutlineRenderer (options, explorer, title, inputManager) {
		this.explorer = explorer;
		this._init(options);
		this.title = title;
		this.inputManager = inputManager;
	}
612571
void storeFormatterSelection(CmsContainerElementBean elementBean, Map<String, String> settings) {

        Entry<String, String> previousFormatterEntry = null;
        for (Entry<String, String> entry : elementBean.getIndividualSettings().entrySet()) {
            if (entry.getKey().startsWith(CmsFormatterConfig.FORMATTER_SETTINGS_KEY)) {
                previousFormatterEntry = entry;
                break;
            }
        }
        Entry<String, String> formatterEntry = null;
        for (Entry<String, String> entry : settings.entrySet()) {
            if (entry.getKey().startsWith(CmsFormatterConfig.FORMATTER_SETTINGS_KEY)) {
                formatterEntry = entry;
                break;
            }
        }
        if ((formatterEntry != null)
            && ((previousFormatterEntry == null)
                || !formatterEntry.getKey().equals(previousFormatterEntry.getKey())
                || !formatterEntry.getValue().equals(previousFormatterEntry.getValue()))) {
            String idString = formatterEntry.getValue();
            if (CmsUUID.isValidUUID(idString)) { // TODO: Make this work for schema formatters
                // the formatter setting has changed
                I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(elementBean.getResource());
                getSessionCache().addRecentFormatter(resType.getTypeName(), new CmsUUID(idString));
            }
        }
    }
320062
@Nonnull
  public static JSInvocation setSelectOptions (@Nonnull final IJSExpression aSelector,
                                               @Nonnull final IJSExpression aValueList)
  {
    return getFormHelper ().invoke ("setSelectOptions").arg (aSelector).arg (aValueList);
  }
1056029
private static void appendEncode( CssFormatter formatter, byte[] bytes ) {
        for( byte b : bytes ) {
            if ((b >= 'a' && b <= 'z' ) || (b >= 'A' && b <= 'Z' ) || (b >= '0' && b <= '9' )) {
                formatter.append( (char )b );
            } else {
                switch( b ) {
                    case '-':
                    case '_':
                    case '*':
                    case '.':
                        formatter.append( (char )b );
                        break;
                    default:
                        formatter.append( '%' );
                        formatter.append( Character.toUpperCase( Character.forDigit((b >> 4) & 0xF, 16) ) );
                        formatter.append( Character.toUpperCase( Character.forDigit(b & 0xF, 16) ) );
                }
            }
        }
    }
832222
public void setFormatHandler(CmsImageFormatHandler formatHandler) {

        m_formatHandler = formatHandler;
        m_croppingParam = m_formatHandler.getCroppingParam();
        m_formatHandler.addValueChangeHandler(this);
        onCroppingChanged();
    }
663166
protected void primary(final String name, final AttributeConverter<? extends Object> converter) {
        primaries.add(name);
        converters.put(name, converter);
    }
150336
public static void configureDefaultHandler (Formatter formatter)
    {
        Logger logger = LogManager.getLogManager().getLogger("");
        for (Handler handler : logger.getHandlers()) {
            handler.setFormatter(formatter);
        }
    }
1289929
static String replacePlaceHolder( CssFormatter formatter, String str, LessObject caller ) {
        int pos = str.startsWith( "@{" ) ? 0 : str.indexOf( "@", 1 );
        if( pos >= 0 ) {
            formatter.addOutput();
            SelectorUtils.appendToWithPlaceHolder( formatter, str, pos, false, caller );
            return formatter.releaseOutput();
        }
        return str;
    }