Created
April 6, 2011 21:13
-
-
Save dmachi/906539 to your computer and use it in GitHub Desktop.
Some sample files for dojox/application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
efine(["dojo", "dojox/application"], function(dojo, Application) { | |
app = new Application({ | |
"id": "test", | |
"author": "jdoe", | |
"description": "A Test Application", | |
"defaultScene": { | |
"$ref": "#scenes.main" | |
}, | |
"splash": "splash", | |
// Modules for the application. The are basically used as the second | |
// array of mixins in a dojo.declare(). Modify the top level behavior | |
// of the application, how it processes the config or any other life cycle | |
// by creating and including one or more of these | |
"modules": [ | |
//"dojox/application/phonegap", //"dojox/application/somePlugin"], | |
//schemas we are using in this app | |
"schemas": { | |
"contact": { | |
"$ref": "http://json-schema.org/card" | |
} | |
"user": { | |
"$ref": "http://json-schema.org/card" | |
} | |
}, | |
//stores we are using | |
"stores": { | |
"contact": { | |
"type": "dojo.store.Memory" | |
} | |
"news": { | |
"type": "dojo.store.Memory", | |
"params": { | |
"idAttribute": "articleId" | |
} | |
} | |
}, | |
//models and instantiation parameters for the models. Including 'type' as a property allows | |
//one to overide the class that will be used for the model. By default it is dojox/mvc/model | |
"models": { | |
"contact": { | |
"schemas": [{ | |
"$ref": "#schemas.contact"}], | |
"stores": [{ | |
"$ref": "#stores.contact"}] | |
} | |
"news": { | |
"schemas": [{ | |
"$ref": "#schemas.news"}], | |
"stores": [{ | |
"$ref": "#stores.news"}] | |
} | |
}, | |
//views for the classes. Like the models, type can be specified to override the class. The params property defines the | |
//default parameters that will be used to instantiate this view. Parameters define in the view definitions below get mixed | |
//into the parameter set when using that scene/view/model combination. Parameters outside of the 'param's object | |
//are used to advise the management of the view by the application controller and are not passed to the view. | |
"views": { | |
"viewA": { | |
"params": { | |
"template": "templates/viewA.html", | |
"persist": true | |
} | |
}, | |
"viewB": { | |
"type": "dojox.mvc.QueryView", | |
"params": { | |
"models": [{ | |
"$ref": "#schemas.contact"}], | |
"template": "templates/viewB.html", | |
"query": {} | |
} | |
}, | |
"viewB": { | |
"type": "dojox.mvc.TemplatedView", | |
"params": { | |
"template": "templates/viewB.html", | |
"defaultParams": { | |
"foo": "bar" | |
} | |
} | |
}, | |
}, | |
//scenes are groups of views and models loaded at once | |
"scenes": { | |
"main": { | |
//all views in the main scene will be bound to the user model | |
"models": [{ | |
"$ref": "#models.user"}], | |
//the views available to this scene | |
"views": [ | |
{ | |
"view": { | |
"$ref": "#views.viewA" | |
}}, | |
{ | |
"view": { | |
"$ref": "#views.viewB" | |
}, | |
"params": { | |
"query": { | |
"organization": "Acme" | |
} | |
}, | |
{ | |
"view": { | |
"$ref": "#views.viewc" | |
}, | |
"params": { | |
"foo": "fubar" | |
} | |
}] | |
} | |
} | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"description":"A representation of an Application", | |
"type": "object", | |
"properties":{ | |
"author": {"$ref": "http://json-schema.org/card"}, | |
"description": { | |
"description": "Description of the application represented here", | |
"type": "string" | |
}, | |
"modules": { | |
"type": "array", | |
"description": "Modules this application requires " | |
"default": [], | |
"items":{ | |
"type": "string", | |
"description": "Module to be loaded and mixed into the application" | |
} | |
}, | |
"defaultScene": { | |
"type": {"$ref":"http://somewhere/schema/scene"}, | |
"description": "Default Scene to load for this application" | |
}, | |
"scenes": { | |
"type": "object", | |
"description": "This object contains references to scene objects, which are collections of views and models making up a closely related set of the ui" | |
"additionalProperties":{"$ref":"http://somewhere/schema/scene"} | |
}, | |
"stores": { | |
"type": "object", | |
"description":"This object contains references to store instances that the rest of the application will use." | |
"additionalProperties": {"$ref":"http://somewhere/schema/store"} | |
"default": {} | |
}, | |
"models": { | |
"type": "object", | |
"description": "This object contains references to model instances the application uses", | |
"additionalProperties":{"$ref":"http://somewhere/schema/model"}, | |
"default": {}, | |
}, | |
"views": { | |
"type": "object", | |
"description": "This object contains references to view instances the application uses", | |
"additionalProperties":{"$ref":"http://somewhere/schema/view"}, | |
"default": {} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"description":"An applications model declaration", | |
"type": "object", | |
"properties":{ | |
"type": { | |
"type": "string", | |
"description": "Model Instance Type (Class)" | |
}, | |
}, | |
"additionalProperties": true | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"description":"An application's scene instance declarations", | |
"type": "object", | |
"properties":{ | |
"type": { | |
"type": "string", | |
"description": "Scene Instance Type (Class)" | |
}, | |
"models": { | |
"type": "array", | |
"items": {"$ref": "http://somewhere/schema/model"} | |
}, | |
"views": { | |
"type": "array", | |
"items": {"$ref": "http://somewhere/schema/view"} | |
} | |
}, | |
"additionalProperties": true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"description":"An applications store instance declarations", | |
"type": "object", | |
"properties":{ | |
"type": { | |
"type": "string", | |
"description": "Store Instance Type (Class)" | |
}, | |
}, | |
"additionalProperties": true | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"description": "Base View Schema for defining View Instances in an application", | |
"type": "object", | |
"properties": { | |
"type": { | |
"type":"string", | |
"description": "The Name of the Class to be used for this view" | |
}, | |
"models": { | |
"type": "array", | |
"items": { | |
"type":{"$ref":"http://somewhere/schema/model"} | |
"description": "Models that this view requires. These should reference one of the available #models" | |
} | |
}, | |
"persist": { | |
"type": "boolean", | |
"description":"Keep this view loaded on the dom or memory, but not necessarily visible" | |
}, | |
"template": { | |
"type": "string", | |
"description": "Template to be used with this view" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment