<commit_before>/*
 * Copyright (c) 2008 Haulmont Technology Ltd. All Rights Reserved.
 * Haulmont Technology proprietary and confidential.
 * Use is subject to license terms.

 * Author: <NAME>
 * Created: 22.12.2008 18:20:37
 * $Id$
 */
package com.haulmont.cuba.gui.xml.layout.loaders;

import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.components.Label;
import com.haulmont.cuba.gui.xml.layout.ComponentsFactory;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Element;

public class LabelLoader extends AbstractDatasourceComponentLoader {
    public LabelLoader(Context context) {
        super(context);
    }

    public Component loadComponent(
            ComponentsFactory factory,
            Element element, Component parent
    ) throws InstantiationException, IllegalAccessException {
        final Label component = factory.createComponent("label");

        assignXmlDescriptor(component, element);
        loadId(component, element);
        loadDatasource(component, element);

        loadVisible(component, element);

        loadStyleName(component, element);

        String caption = element.attributeValue("value");
        if (!StringUtils.isEmpty(caption)) {
            caption = loadResourceString(caption);
            component.setValue(caption);
        }

        loadWidth(component, element, "-1px");

        component.setFormatter(loadFormatter(element));

        assignFrame(component);

        return component;
    }
}<commit_msg>- loading alignment for label<commit_after>/*
 * Copyright (c) 2008 Haulmont Technology Ltd. All Rights Reserved.
 * Haulmont Technology proprietary and confidential.
 * Use is subject to license terms.

 * Author: <NAME>
 * Created: 22.12.2008 18:20:37
 * $Id$
 */
package com.haulmont.cuba.gui.xml.layout.loaders;

import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.components.Label;
import com.haulmont.cuba.gui.xml.layout.ComponentsFactory;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Element;

public class LabelLoader extends AbstractDatasourceComponentLoader {
    public LabelLoader(Context context) {
        super(context);
    }

    public Component loadComponent(
            ComponentsFactory factory,
            Element element, Component parent
    ) throws InstantiationException, IllegalAccessException {
        final Label component = factory.createComponent("label");

        assignXmlDescriptor(component, element);
        loadId(component, element);
        loadDatasource(component, element);

        loadVisible(component, element);

        loadAlign(component, element);

        loadStyleName(component, element);

        String caption = element.attributeValue("value");
        if (!StringUtils.isEmpty(caption)) {
            caption = loadResourceString(caption);
            component.setValue(caption);
        }

        loadWidth(component, element, "-1px");

        component.setFormatter(loadFormatter(element));

        assignFrame(component);

        return component;
    }
}
{'fraction_non_alphanumeric': 0.09695201037613489, 'fraction_numerical': 0.01297016861219196, 'mean_word_length': 3.326788218793829, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3524895', 'n_tokens_mistral': 843, 'n_tokens_neox': 775, 'n_words': 184}