aboutsummaryrefslogtreecommitdiff
path: root/js/document/models/base-document.js
blob: 918b51ad4610a65191b18fa2f2d1261816b0608c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* <copyright>
This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
(c) Copyright 2011 Motorola Mobility, Inc.  All Rights Reserved.
</copyright> */

//BaseDocument Object for all files types and base class for HTML documents.

var Montage = require("montage/core/core").Montage;

var BaseDocument = exports.BaseDocument = Montage.create(Montage, {
    /** Private Members **/
    _name: { value: null, enumerable: false },
    _uri: { value: null, enumerable: false },
    _documentType: { value: null, enumerable: false },
    _container: {value: null, enumerable: false },
    _uuid: { value: null, enumerable: false },
    _isActive: { value: true, enumerable: false },
    _dirtyFlag: { value: false, enumerable: false },
    _callback: { value: null, enumerable: false },
    _currentView: { value: null, enumerable: false},

    /** Getters/Setters **/
    name: {
        get: function() { return this._name; },
        set: function(value) { this._name = value; }
    },

    uri: {
        get: function() { return this._uri; },
        set: function(value) { this._uri = value; }
    },

    documentType: {
        get: function() { return this._documentType; },
        set: function(value) { this._documentType = value;  }
    },

    container: {
        get: function() { return this._container; },
        set: function(value) { this._container = value; }
    },

    uuid: {
        get: function() { return this._uuid; },
        set: function(value) { this._uuid = value; }
    },

    isActive: {
        get: function() { return this._isActive; },
        set: function(value) { this._isActive = value; }
    },

    dirtyFlag: {
        get: function() { return this._dirtyFlag; },
        set: function(value) { this._dirtyFlag = value; }
    },

    callback: {
        get: function() { return this._callback; },
        set: function(value) { this._callback = value; }
    },

    currentView: {
        get: function() { return this._currentView; },
        set: function(value) { this._currentView = value }
    },

    /** Base Methods **/
    init: {
        value: function(name, uri, type, container, uuid, callback) {
            this.name = name;
            this.uri = uri;
            this.documentType = type;
            this.container = container;
            this.uuid = uuid;
            this.callback = callback;
        }
    },

    loadDocument: {
        value: function() {
            // Have the XHR here?
        }
    },

    save:{
        value:function(){
            //base function - to be overridden
        }
    }

});