2 'libs/jquery-1.9.1.min',
3 'modules/documentCanvas/canvas/widgets'
4 ], function($, widgets) {
9 var DocumentElementAPI = function(documentElement) {
11 this.addWidget = function(widget) {
12 documentElement.dom().find('.canvas-widgets').append(widget);
15 this.clearWidgets = function() {
16 documentElement.dom().find('.canvas-widgets').empty();
19 this.setDisplayStyle = function(displayStyle) {
20 documentElement.dom().css('display', displayStyle);
21 documentElement._container().css('display', displayStyle);
24 this.tag = function() {
25 return documentElement.getWlxmlTag();
28 this.klass = function() {
29 return documentElement.getWlxmlClass();
33 var getDisplayStyle = function(tag, klass) {
34 if(tag === 'metadata')
41 var GenericManager = function(wlxmlElement) {
42 this.el = wlxmlElement;
45 $.extend(GenericManager.prototype, {
47 this.el.setDisplayStyle(getDisplayStyle(this.el.tag(), this.el.klass()));
49 this.el.clearWidgets();
50 this.el.addWidget(widgets.labelWidget(this.el.tag(), this.el.klass()));
56 getFor: function(documentElement) {
57 var wlxmlElement = new DocumentElementAPI(documentElement);
58 return new GenericManager(wlxmlElement);