/*
 * GCalendarLayer.java
 * 
 * Tide project - Timeline and Schedule. 
 * Reusable GUI components 
 * 
 * To Do:
 * - Javadoc kommentointi ja siistiminen
 * 
 * Done:
 * - P„ivien piirto. Teemu
 * - Otsikkojen piirto. Teemu 9.11.1999
 * - Kuukausiviivojen piirto. Teemu 10.11.1999
 * - jako UIdelegaattiin ja komponenttiin. Teemu 14.11.19999
 * 
 */
package fi.helsinki.cs.gist.timeline;


import fi.helsinki.cs.gist.plaf.GCalendarLayerUI;
import javax.swing.UIManager;

import javax.swing.JComponent;
import java.awt.Color;

/**
 * GCalendarLayer 
 *
 * @author Teemu Kurppa
 * @version 14.11.1999
 *
 */
public class GCalendarLayer extends JComponent { 

/////////////////////////////////
// Class variables and constants
/////////////////////////////////
  private static final String uiClassID = "GCalendarLayerUI";
  
  static {
    System.out.println("Installing GIST GCalendarLayer");
    UIManager.put(uiClassID, 
		  "fi.helsinki.cs.gist.plaf.windows.WindowsCalendarLayerUI");
  }


//////////////////////
// Instance Variables
//////////////////////

    private GCalendarScrollbar calSB;
    private GDayNumberRenderer dayRenderer;

///////////////////
// Constuctors
///////////////////
    public GCalendarLayer(GCalendarScrollbar calSB, 
		 	 GDayNumberRenderer dayRenderer) {
      setOpaque(false);

      this.calSB = calSB;
      this.dayRenderer = dayRenderer;
      setForeground(Color.black);

      init();
    }

  protected void init() {
    updateUI();
  }


  /////////////////////////
  // UI-delegate methods
  /////////////////////////

  /**
    * Returns the L&F object that renders this component.
    *
    * @return GCalendarLayerUI object
    */
  public GCalendarLayerUI getUI() {
    return (GCalendarLayerUI)ui;
  }


  /**
   * Sets the L&F object that renders this component.
   *
   * @param ui  the GCalendarLayerUI L&F object
   * @see UIDefaults#getUI
   * @beaninfo
   *      expert: true
   *  description: The L&F object that renders this component.
   */
  public void setUI(GCalendarLayerUI ui) {
        super.setUI(ui);
    }


  /**
   * Notification from the UIFactory that the L&F
   * has changed.
   *
   * @see JComponent#updateUI
   */
  public void updateUI() {
    setUI((GCalendarLayerUI)UIManager.getUI(this));
  }


  /**
   * Returns a string that specifies the name of the l&f class
   * that renders this component.
   *
   * @return String "GCalendarLayerUI"
   *
   * @see JComponent#getUIClassID
   * @see UIDefaults#getUI
   */
  public String getUIClassID() {
    return uiClassID;
  }

///////////////////
// Public methods
///////////////////

  public GCalendarScrollbar getCalendarScrollbar() {
    return calSB;
  }

  public GDayNumberRenderer getDayNumberRenderer() {
    return dayRenderer;
  }

////////////////////////
// Event handling
////////////////////////
			

/////////////////////////
// Implementation
/////////////////////////
  


//////////////////
// Testing methods
//////////////////
      

}

