Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion scripted/src/exhibit-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,36 @@ var Exhibit = {
/**
* @constant An Exhibit.Registry of static components.
*/
registry: null
registry: null,

/**
* @namespace for official Exhibit documentation.
*/
Documentation: {}
};

// Exhibit Core Specifications
Exhibit._extensionSpecs = {
viewSpecs: {
"TabularView": {},
"ThumbnailView": { dependencies: ["OrderedViewFrame"]},
"TileView": { dependencies: ["OrderedViewFrame"]}
},
facetSpecs: {
"AlphaRangeFacet" : {},
"CloudFacet": { dependencies: ["EnumeratedFacet"]},
"HierarchicalFacet": {},
"ImageFacet": { dependencies: ["EnumeratedFacet"]},
"ListFacet": { dependencies: ["EnumeratedFacet"]},
"MonthFacet": {},
"NumericRangeFacet": {},
"SliderFacet": {},
"TextSearchFacet": {},
"TimegridFacet": {},
"WeekFacet": {}
}
}

/*! LAB.js (LABjs :: Loading And Blocking JavaScript)
v2.0.3 (c) Kyle Simpson
MIT License
Expand Down
30 changes: 30 additions & 0 deletions scripted/src/extensions/map/map-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,36 @@ Exhibit.onjQueryLoaded(function() {
Exhibit.includeCssFiles(document, null, cssURLs);
Exhibit.includeJavascriptFiles(null, scriptURLs);

Exhibit.MapExtension._extensionSpecs = {
viewSpecs: {
"MapView": {}
},
documentation: ' \
<div> \
<p>To add this view to your exhibit, you must include the \
map extension for Exhibit (in addition to the Exhibit API): \
</p> \
<div class="border"> \
<pre> &lt;link rel="exhibit-extension" href=<a href="http://api.simile-widgets.org/exhibit/current/extensions/map/map-extension.js">"http://api.simile-widgets.org/exhibit/current/extensions/map/map-extension.js"</a>/&gt; \
</pre> \
</div> \
</div>'
}

/**
* @static
* @public
* @param {jQuery.Event} evt
* @param {extensionRegistry: []} reg
*/
Exhibit.MapExtension.registerExtension = function(evt, reg) {
if ($.inArray('MapExtension', reg.extensionRegistry) < 0) {
reg.extensionRegistry.push('MapExtension');
}
};

$(document).on("registerExtensions.exhibit", Exhibit.MapExtension.registerExtension);

};

Exhibit.jQuery(document).one("loadExtensions.exhibit", loader);
Expand Down
235 changes: 123 additions & 112 deletions scripted/src/extensions/map/scripts/map-view.js

Large diffs are not rendered by default.

63 changes: 37 additions & 26 deletions scripted/src/extensions/time/scripts/timeline-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,29 @@ Exhibit.TimelineView._intervalChoices = [
* @constant
*/
Exhibit.TimelineView._settingSpecs = {
"topBandHeight": { "type": "int", "defaultValue": 75 },
"topBandUnit": { "type": "enum", "choices": Exhibit.TimelineView._intervalChoices },
"topBandPixelsPerUnit": { "type": "int", "defaultValue": 200 },
"bottomBandHeight": { "type": "int", "defaultValue": 25 },
"bottomBandUnit": { "type": "enum", "choices": Exhibit.TimelineView._intervalChoices },
"bottomBandPixelsPerUnit": { "type": "int", "defaultValue": 200 },
"timelineHeight": { "type": "int", "defaultValue": 400 },
"timelineConstructor": { "type": "function", "defaultValue": null },
"colorCoder": { "type": "text", "defaultValue": null },
"iconCoder": { "type": "text", "defaultValue": null },
"selectCoordinator": { "type": "text", "defaultValue": null },
"showHeader": { "type": "boolean", "defaultValue": true },
"showSummary": { "type": "boolean", "defaultValue": true },
"showFooter": { "type": "boolean", "defaultValue": true }
"topBandHeight": { "type": "int", "defaultValue": 75, description: "percent of the height that the top band takes up", importance: 1},
"topBandUnit": { "type": "enum", "choices": Exhibit.TimelineView._intervalChoices, description: "unit of the top band", importance: 1},
"topBandPixelsPerUnit": { "type": "int", "defaultValue": 200, description: "width of each interval in the top band in pixels", importance:1},
"bottomBandHeight": { "type": "int", "defaultValue": 25, description: "percent of the height that the bottom band takes up", importance: 1},
"bottomBandUnit": { "type": "enum", "choices": Exhibit.TimelineView._intervalChoices, description: "unit of the bottom band", importance: 1},
"bottomBandPixelsPerUnit": { "type": "int", "defaultValue": 200, description: "width of each interval in the bottom band in pixels", importance: 1},
"timelineHeight": { "type": "int", "defaultValue": 400, description: "height of timeline in pixels", importance: 1},
"timelineConstructor": { "type": "function", "defaultValue": null, description: "custom constructor for the timeline", importance: 1},
"colorCoder": { "type": "text", "defaultValue": null, description: "id of color coder", importance: 1},
"iconCoder": { "type": "text", "defaultValue": null, description: "id of icon coder", importance: 1},
"selectCoordinator": { "type": "text", "defaultValue": null, description: "id of coordinator", importance: 1},
"showHeader": { "type": "boolean", "defaultValue": true, description: "show header of view", importance: 2},
"showSummary": { "type": "boolean", "defaultValue": true, description: "show summary information of the view", importance: 2},
"showFooter": { "type": "boolean", "defaultValue": true, description: "show footer of the view", importance: 2}
};

/**
* @constant
*/
Exhibit.TimelineView._accessorSpecs = [
{ "accessorName": "getProxy",
"attributeName": "proxy"
"attributeName": "proxy",
importance: 1
},
{ "accessorName": "getDuration",
"bindings": [
Expand All @@ -95,36 +96,48 @@ Exhibit.TimelineView._accessorSpecs = [
"bindingName": "end",
"optional": true
}
]
],
required: true,
description: "start: property used for the start date \nend: property used for the end date",
importance: 10
},
{ "accessorName": "getColorKey",
"attributeName": "marker", // backward compatibility
"type": "text"
"type": "text",
"description": "property used by the color coder (backward compatibility)",
importance: 1
},
{ "accessorName": "getColorKey",
"attributeName": "colorKey",
"type": "text"
"type": "text",
"description": "property used by the color coder",
importance: 1
},
{ "accessorName": "getIconKey",
"attributeName": "iconKey",
"type": "text"
"type": "text",
"description": "property used by the icon coder",
importance: 1
},
{ "accessorName": "getEventLabel",
"attributeName": "eventLabel",
"type": "text"
"type": "text",
importance: 3
},
// hoverText is deprecated in Timeline, does not work at all with an event.
// It will still work here as an attribute name, but it will be overridden
// by caption. Eventually hoverText will disappear as an option.
{
"accessorName": "getHoverText",
"attributeName": "hoverText",
"type": "text"
"type": "text",
importance: 3
},
{
"accessorName": "getCaption",
"attributeName": "caption",
"type": "text"
"type": "text",
importance: 3
}
];

Expand Down Expand Up @@ -281,7 +294,6 @@ Exhibit.TimelineView.prototype._initializeUI = function() {
Exhibit.TimelineView.prototype._reconstructTimeline = function(newEvents) {
var settings, timelineDiv, theme, topIntervalUnit, bottomIntervalUnit, earliest, latest, totalDuration, totalEventCount, totalDensity, intervalDuration, eventsPerPixel, bandInfos, self, listener, i;
settings = this._settings;

if (this._timeline !== null) {
this._timeline.dispose();
}
Expand Down Expand Up @@ -374,7 +386,6 @@ Exhibit.TimelineView.prototype._reconstructTimeline = function(newEvents) {
];
bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true;

this._timeline = Timeline.create(timelineDiv, bandInfos, Timeline.HORIZONTAL);
}

Expand Down Expand Up @@ -553,7 +564,7 @@ Exhibit.TimelineView.prototype._reconstruct = function() {
legendWidget.addEntry(iconCoder.getMissingIcon(), iconCoder.getMissingLabel(), 'icon');
}
}

plottableSize = currentSize - unplottableItems.length;
if (plottableSize > this._largestSize) {
this._largestSize = plottableSize;
Expand Down Expand Up @@ -603,4 +614,4 @@ Exhibit.TimelineView.prototype._select = function(selection) {
*/
Exhibit.TimelineView.prototype._fillInfoBubble = function(evt, elmt, theme, labeller) {
this.getUIContext().getLensRegistry().createLens(evt._itemID, Exhibit.jQuery(elmt), this.getUIContext());
};
};
29 changes: 29 additions & 0 deletions scripted/src/extensions/time/time-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,35 @@ Exhibit.onjQueryLoaded(function() {
}
};
finishedLoading();

Exhibit.TimeExtension._extensionSpecs = {
viewSpecs: {
"TimelineView": {}
},
documentation: ' \
<div> \
<p>To add this view to your exhibit, you must include the \
time extension for Exhibit (in addition to the Exhibit API): \
</p> \
<div class="border"> \
<pre> &lt;link rel="exhibit-extension" href=<a href="http://api.simile-widgets.org/exhibit/current/extensions/time/time-extension.js">"http://api.simile-widgets.org/exhibit/current/extensions/time/time-extension.js"</a>/&gt; \
</pre> \
</div> \
</div>'
}

/**
* @static
* @public
* @param {jQuery.Event} evt
* @param {extensionRegistry: []} reg
*/
Exhibit.TimeExtension.registerExtension = function(evt, reg) {
if (Exhibit.jQuery.inArray('TimeExtension', reg.extensionRegistry) < 0) {
reg.extensionRegistry.push('TimeExtension');
}
};
Exhibit.jQuery(document).on("registerExtensions.exhibit", Exhibit.TimeExtension.registerExtension);
};

Exhibit.jQuery(document).one("loadExtensions.exhibit", loader);
Expand Down
5 changes: 4 additions & 1 deletion scripted/src/scripts/exhibit.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ Exhibit._Impl = function(database) {
this._uiContext = Exhibit.UIContext.createRootContext({}, this);
this._registry = new Exhibit.Registry();
Exhibit.jQuery(document).trigger("registerComponents.exhibit", this._registry);
// keep track of loaded extensions
this._extensionRegistry = [];
Exhibit.jQuery(document).trigger("registerExtensions.exhibit", {'extensionRegistry': this._extensionRegistry});
this._collectionMap = {};
};

Expand All @@ -292,7 +295,7 @@ Exhibit._Impl.prototype.dispose = function() {
this._collectionMap = null;
this._uiContext = null;
this._database = null;
this._registry.dispose();
// this._registry.dispose();
this._registry = null;
};

Expand Down
28 changes: 14 additions & 14 deletions scripted/src/scripts/ui/views/ordered-view-frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ Exhibit.OrderedViewFrame = function(uiContext) {
* @constant
*/
Exhibit.OrderedViewFrame._settingSpecs = {
"showAll": { type: "boolean", defaultValue: false },
"grouped": { type: "boolean", defaultValue: true },
"showDuplicates": { type: "boolean", defaultValue: false },
"abbreviatedCount": { type: "int", defaultValue: 10 },
"showHeader": { type: "boolean", defaultValue: true },
"showSummary": { type: "boolean", defaultValue: true },
"showControls": { type: "boolean", defaultValue: true },
"showFooter": { type: "boolean", defaultValue: true },
"paginate": { type: "boolean", defaultValue: false },
"pageSize": { type: "int", defaultValue: 20 },
"pageWindow": { type: "int", defaultValue: 2 },
"page": { type: "int", defaultValue: 0 },
"alwaysShowPagingControls": { type: "boolean", defaultValue: false },
"showAll": { type: "boolean", defaultValue: false, description: "show all items", importance: 3},
"grouped": { type: "boolean", defaultValue: true, description: "show items in group if they are equal in current sorting order", importance: 1},
"showDuplicates": { type: "boolean", defaultValue: false, description: "show duplicates of items", importance: 3},
"abbreviatedCount": { type: "int", defaultValue: 10, description: "number of items to show if showAll is false", importance: 3},
"showHeader": { type: "boolean", defaultValue: true, description: "show header of view", importance: 2},
"showSummary": { type: "boolean", defaultValue: true, description: "show summary information of the view", importance: 2},
"showControls": { type: "boolean", defaultValue: true, description: "show controls for sorting", importance: 2},
"showFooter": { type: "boolean", defaultValue: true, description: "show footer of the view", importance: 2},
"paginate": { type: "boolean", defaultValue: false, description: "split items among multiple pages", importance: 2.9},
"pageSize": { type: "int", defaultValue: 20, description: "number of items displayed per page", importance: 2.8},
"pageWindow": { type: "int", defaultValue: 2, description: "window size of available paging controls", importance: 2.6},
"page": { type: "int", defaultValue: 0, description: "zero-based index of starting page", importance: 2.7},
"alwaysShowPagingControls": { type: "boolean", defaultValue: false, description: "always show paging controls", importance: 2.4},
"pagingControlLocations": { type: "enum", defaultValue: "topbottom",
choices: [ "top", "bottom", "topbottom" ] }
choices: [ "top", "bottom", "topbottom" ], description: "location of paging controls", importance: 2.5}
};

/**
Expand Down
40 changes: 21 additions & 19 deletions scripted/src/scripts/ui/views/tabular-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,36 @@ Exhibit.TabularView = function(containerElmt, uiContext) {
* @constant
*/
Exhibit.TabularView._settingSpecs = {
"sortAscending": { type: "boolean", defaultValue: true },
"sortColumn": { type: "int", defaultValue: 0 },
"showSummary": { type: "boolean", defaultValue: true },
"border": { type: "int", defaultValue: 1 },
"cellPadding": { type: "int", defaultValue: 5 },
"cellSpacing": { type: "int", defaultValue: 3 },
"paginate": { type: "boolean", defaultValue: false },
"pageSize": { type: "int", defaultValue: 20 },
"pageWindow": { type: "int", defaultValue: 2 },
"page": { type: "int", defaultValue: 0 },
"alwaysShowPagingControls": { type: "boolean", defaultValue: false },
"pagingControlLocations": { type: "enum", defaultValue: "topbottom", choices: [ "top", "bottom", "topbottom" ] },
"rowStyler": {type: "function", defaultValue: undefined},
"tableStyler": {type: "function", defaultValue: undefined},
"columnLabels": {type: "text", dimensions: "*", description: "comma separated list of labels used for the column headers, e.g., 'Name, Position'"},
"columnFormats": {type: "text", description: "comma separated list of format expressions, e.g., 'list, image, date { mode: short }'"}
"sortAscending": { type: "boolean", defaultValue: true, description: "sort items in ascending or descending order", importance: 5},
"sortColumn": { type: "int", defaultValue: 0, description: "zero-based index of column to sort", importance: 5},
"showSummary": { type: "boolean", defaultValue: true, description: "show summary", importance: 2},
"border": { type: "text", defaultValue: "1", description: "styling for the border of a &lt;table&gt; element", importance: 2},
"cellPadding": { type: "int", defaultValue: 5, description: "cell padding of a &lt;table&gt; element", importance: 2},
"cellSpacing": { type: "int", defaultValue: 3, description: "cell spacing of a &lt;table&gt; element", importance: 2},
"paginate": { type: "boolean", defaultValue: false, description: "split items (rows) among multiple pages", importance: 2.9},
"pageSize": { type: "int", defaultValue: 20, description: "number of items (rows) displayed per page", importance: 2.8},
"pageWindow": { type: "int", defaultValue: 2, description: "window size of available paging controls", importance: 2.6},
"page": { type: "int", defaultValue: 0, description: "zero-based index of starting page", importance: 2.7},
"alwaysShowPagingControls": { type: "boolean", defaultValue: false, description: "always show paging controls", importance: 2.4},
"pagingControlLocations": { type: "enum", defaultValue: "topbottom", choices: [ "top", "bottom", "topbottom" ], description: "location of paging controls", importance: 2.5},
"rowStyler": {type: "function", defaultValue: undefined, description: "function that takes 3 arguments (item, database, tr) and is called to style each row", importance: 2},
"tableStyler": {type: "function", defaultValue: undefined, description: "function that takes 2 arguments (table, database) and is called to style the table", importance: 2},
"columnLabels": {type: "text", dimensions: "*", description: "comma separated list of labels used for the column headers, e.g., 'Name, Position'", importance: 8},
"columnFormats": {type: "text", description: "comma separated list of format expressions, e.g., 'list, image, date { mode: short }'", importance: 7}
};

Exhibit.TabularView._accessorSpecs = [{
accessorName : "getProxy",
attributeName : "proxy"
attributeName : "proxy",
importance: 1
}, {
accessorName : "getColumns",
attributeName : "columns",
type: "text",
expressions: true,
dimensions: "*"
dimensions: "*",
description: "comma separated list of one or more properties",
importance: 10
}];

/**
Expand Down Expand Up @@ -383,7 +386,6 @@ Exhibit.TabularView.prototype._reconstruct = function() {
column = self._columns[c];
td = Exhibit.jQuery("<td>");
tr.append(td);

results = column.expression.evaluate(
{ "value" : item.id },
{ "value" : "item" },
Expand Down
2 changes: 1 addition & 1 deletion scripted/src/scripts/ui/views/thumbnail-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Exhibit.ThumbnailView = function(containerElmt, uiContext) {
* @constant
*/
Exhibit.ThumbnailView._settingSpecs = {
"columnCount": { type: "int", defaultValue: -1 }
"columnCount": { type: "int", defaultValue: -1 , description: "number of columns used to display items", importance: 5}
};

/**
Expand Down
Loading