/*
 * MMCDPanel.java
 *
 * Created on 18 �ubat 2005 Cuma, 00:26
 */

package com.isoft.mmcd.skin.widgets ;

import com.isoft.mmcd.skin.* ;
import com.isoft.mmcd.utils.cfgreader.* ;
import com.isoft.mmcd.exceptions.* ;

import java.awt.* ;
import javax.swing.* ;

/**
 *
 * @author Fatih
 */
public class MMCDPanel extends JPanel implements java.io.Serializable, Widget, ResizableWidget
{
    protected String helpId = "" ;

    protected DynamicWidgetBounds dwbounds = null ;

    protected String widgetName = "" ;

    protected String popupMenuName = null ;

    protected int zIndex ;

    /** Creates a new instance of MMCDPanel */
    public MMCDPanel( )
    {
        super( ) ;
    }

    public boolean init( MCCompoundProperty property ) throws MMCDException
    {
        return true ;
    }

    public DynamicWidgetBounds getDynamicWidgetBounds( )
    {
        return dwbounds ;
    }

    public void setDynamicWidgetBounds( DynamicWidgetBounds dwb )
    {
        this.dwbounds = dwb ;
    }

    public void resizeWidget( Rectangle newParentBounds )
    {
        getDynamicWidgetBounds( ).calculateBounds( newParentBounds ) ;
        setBounds( getDynamicWidgetBounds( ).getBounds( ) ) ;
        setPreferredSize( new Dimension( getDynamicWidgetBounds( ).getBounds( ).width, getDynamicWidgetBounds( ).getBounds( ).height ) ) ;
    }

    public String getWidgetName( )
    {
        return widgetName ;
    }

    public void setWidgetName( String widgetName )
    {
        this.widgetName = widgetName ;
    }

    /* (non-Javadoc)
     * @see com.isoft.mmcd.skin.Widget#getPopUpMenuName()
     */
    public String getPopUpMenuName( )
    {
        return this.popupMenuName ;
    }

    /* (non-Javadoc)
     * @see com.isoft.mmcd.skin.Widget#setPopUpMenuName(java.lang.String)
     */
    public void setPopUpMenuName( String popupMenuName )
    {
        this.popupMenuName = popupMenuName ;
    }

    /* (non-Javadoc)
     * @see com.isoft.mmcd.skin.Widget#setHelpId(java.lang.String)
     */
    public void setHelpId( String helpId )
    {
        this.helpId = helpId ;
    }

    /* (non-Javadoc)
     * @see com.isoft.mmcd.skin.Widget#getHelpId()
     */
    public String getHelpId( )
    {
        return this.helpId ;
    }

}