/**
 * 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.auxiliary;

import org.inb.biomoby.shared.datatypes.MobyString;
import org.inb.biomoby.shared.message.AbstractMobyObject;
import org.inb.biomoby.shared.ontology.CommentedNASequence;

/**
 * @author Dmitry Repchevsky
 */

public class MultilineCommentedNASequenceDescriptionMobyComponent extends AbstractMultilineDescriptionMobyComponent
{
    private CommentedNASequence sequence;
    
    public MultilineCommentedNASequenceDescriptionMobyComponent() {}

    public MultilineCommentedNASequenceDescriptionMobyComponent(CommentedNASequence sequence)
    {
        this.sequence = sequence;
    }

    public void setCommentedAASequence(CommentedNASequence sequence)
    {
        this.sequence = sequence;
        repaint();
    }

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

    @Override
    protected String getDescription()
    {
        if (sequence != null)
        {
            MobyString mobyString = sequence.getDescription();
            
            if (mobyString != null)
            {
                String description = mobyString.getString();
                if (description != null)
                {
                    return description;
                }
            }
        }
        
        return null;
    }
}
