/**
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 *
 * Copyright (C)
 * <a href="http://www.inab.org">Spanish National Institute of Bioinformatics (INB)</a>
 * <a href="http://www.bsc.es">Barcelona Supercomputing Center (BSC)</a>
 * <a href="http://inb.bsc.es">Computational Node 6</a>
 */

package org.inb.biomoby.client.gui.ontology;

import java.awt.Color;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import org.inb.biomoby.client.gui.AbstractMobyComponent;
import org.inb.biomoby.shared.message.AbstractMobyObject;
import org.inb.biomoby.shared.message.MobyObject;
import org.inb.biomoby.client.gui.swing.border.RoundedBorder;

/**
 * @author Dmitry Repchevsky
 */

public class MobyObjectComponent extends AbstractMobyComponent
{
    private MobyObject object;

    public MobyObjectComponent(MobyObject object)
    {
        this.object = object;

        setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

        StringBuilder sb = new StringBuilder();

        sb.append("<html>");
        sb.append("<font style='color: blue'>").append(object.getMobyId()).append("</font> ");
        sb.append("<font style='color: #996600'>(").append(object.getNamespace()).append(")</font>");
        sb.append("</html>");

        add(new JLabel(sb.toString(), JLabel.CENTER));

        this.setBorder(new RoundedBorder(4, Color.DARK_GRAY));

    }

    @Override
    public AbstractMobyObject getData()
    {
        return object;
    }
}
