/*
 * Copyright (c) 2008-2013 Haulmont. All rights reserved.
 * Use is subject to license terms, see http://www.cuba-platform.com/license for details.
 */
package com.haulmont.cuba.gui.xml.layout.loaders;

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

/**
 * @author abramov
 * @version $Id$
 */
public class LinkLoader extends AbstractDatasourceComponentLoader {

    public LinkLoader(Context context) {
        super(context);
    }

    @Override
    public Component loadComponent(ComponentsFactory factory, Element element, Component parent) {
        final Link component = factory.createComponent("link");

        initComponent(component, element, parent);

        return component;
    }

    protected void initComponent(Link component, Element element, Component parent) {
        assignXmlDescriptor(component, element);
        loadId(component, element);

        loadVisible(component, element);
        loadAlign(component, element);
        loadStyleName(component, element);

        String caption = element.attributeValue("caption");
        if (StringUtils.isNotEmpty(caption)) {
            caption = loadResourceString(caption);
            component.setCaption(caption);
        }

        String url = element.attributeValue("url");
        if (StringUtils.isNotEmpty(url)) {
            component.setUrl(url);
        }

        String target = element.attributeValue("target");
        if (StringUtils.isNotEmpty(target)) {
            component.setTarget(target);
        }

        loadWidth(component, element, Component.AUTO_SIZE);
        loadHeight(component, element, Component.AUTO_SIZE);

        assignFrame(component);
    }
}
@@ -1207,26 +1207,24 @@
 ment);%0D%0A
-%0D%0A
         
 String c
@@ -1219,214 +1219,86 @@
     
-String caption = element.attributeValue(%22caption%22);%0D%0A        if (StringUtils.isNotEmpty(caption)) %7B%0D%0A            caption = loadResourceString(caption);%0D%0A            component.setCaption(caption);%0D%0A        %7D
+loadDescription(component, element);%0D%0A        loadCaption(component, element);
 %0D%0A%0D%0A

Support description for link #PL-4862