package cnp.ew.lightweight;

import java.awt.*;
import java.util.*;
import cnp.ew.util.*;
import cnp.ew.text.*;

public class CpLcFrame extends Frame implements CpObserver
{
     CpLcPanel lcPanel;

    public CpLcFrame(String title)
    {
        super(title);
        setLayout(null);
        lcPanel = new CpLcPanel();
        super.add(lcPanel);
        layout();
    }

    public void layout()
    {
        if (lcPanel != null) {
            Insets insets = insets();
            lcPanel.reshape(insets.left, insets.top, size().width - insets.left - insets.right, size().height - insets.top - insets.bottom);
        }
    }

    public CpLcPanel getRootPanel()
    {
        return lcPanel;
    }

    public void setLc(CpLightweightComponent lc)
    {
        lcPanel.setLc(lc);
    }


    // One of these will bite us.  Guaranteed.
    public Component add(Component c)
    {
        return lcPanel.add(c);
    }

    public void add(CpLightweightComponent lc)
    {
        lcPanel.add(lc);
    }

    public void update(CpObservable target, int facet, Object arg)
    {
    }

    public Frame getFrame()
    {
        return this;
    }
}