﻿/**
* Class: VisKort.Component
* 
* Base class for components.
* A component contains the client side functionality related to one tab in the tab control.
* One sub class to this base class must exists for all the tabs.
*
* All components (sub classes) to visible tabs must be initialized and added to the VisKort.Application 
* using the addComponent method.
*
* Components are initialized when a page is requested in popup or iframe-mode.
*/
VisKort.Component = OpenLayers.Class({

    /** 
    * Property: application
    * {<VisKort.Application>} The application
    */
    application: null,

    /** 
    * Property: map
    * {<VisStedet.Map>} The map
    */
    map: null,

    /** 
    * Property: pagemode
    * {<String>} pagemode can either be "popup" or "iframe"
    */
    pagemode: null,

    /** 
    * Constructor: VisKort.Component
    */
    initialize: function() {
    },

    /** 
    * Method: startup
    * Invoked after the component has been added to the map. 
    * May be used in sub class for initialization purposes when access to local properties 
    * (application and map) is needed.
    */
    startup: function() {
    },

    /** 
    * Method: activate
    * Invoked when the component/tab gets active. 
    * E.g. the user clicks on the tab
    */
    activate: function() {
    },

    /** 
    * Method: activate
    * Invoked when the component/tab gets inactive. 
    */    
    deActivate: function() {
    },

    /** 
    * Method: setContext
    * To setup the values of the properties of the class
    *
    * Parameters:
    * application - <VisKort.Application>
    * map - <VisStedet.Map>
    * pagemode - <String>
    */
    setContext: function(application, map, pagemode) {
        this.application = application;
        this.map = map;
        this.pagemode = pagemode;
    },

    CLASS_NAME: "VisKort.Component"
});
