Skip to content

Commit eaf12d5

Browse files
committed
Merge pull request #7 from filmackay/master
Port to JS
2 parents 51e6b7a + 9954e37 commit eaf12d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+24232
-15
lines changed

.gitignore

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
# Dart Excludes #
2-
#################
3-
*~
4-
*.js
5-
*.js_
6-
.children
7-
.project
8-
.gitmodules
9-
*.map
10-
*.lock
11-
*.tmp
12-
packages/
13-
out/
14-
151
# Compiled source #
162
###################
173
*.com
@@ -48,8 +34,9 @@ out/
4834
ehthumbs.db
4935
Icon?
5036
Thumbs.db
37+
.idea/
5138

5239
# Binary directories #
5340
######################
5441
bin/
55-
obj/
42+
obj/

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
Ali Akbar <[email protected]>
44
Marius Volkhart <[email protected]>
5+
Fil Mackay <[email protected]>

dart/.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Dart Excludes #
2+
#################
3+
4+
*~
5+
*.js
6+
*.js_
7+
.children
8+
.project
9+
.gitmodules
10+
*.map
11+
*.lock
12+
*.tmp
13+
packages/
14+
out/

dart_web_ui/.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Dart Excludes #
2+
#################
3+
4+
*~
5+
*.js
6+
*.js_
7+
.children
8+
.project
9+
.gitmodules
10+
*.map
11+
*.lock
12+
*.tmp
13+
packages/
14+
out/

js/.empty

Whitespace-only changes.

js/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

js/build.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REM Smash .js files together: npm install smash
2+
node node_modules/smash/smash lib/combine.js > out/js/dockspawn.js

js/lib/combine.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
(function()
2+
{
3+
dockspawn = {version: "0.0.2"};
4+
5+
import "tab/";
6+
import "dialog/";
7+
import "decorators/";
8+
import "dock/";
9+
import "containers/";
10+
import "splitter/";
11+
import "serialization/";
12+
import "utils/";
13+
14+
})();
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import "FillDockContainer";
2+
3+
/**
4+
* The document manager is then central area of the dock layout hierarchy.
5+
* This is where more important panels are placed (e.g. the text editor in an IDE,
6+
* 3D view in a modelling package etc
7+
*/
8+
dockspawn.DocumentManagerContainer = function(dockManager)
9+
{
10+
dockspawn.FillDockContainer.call(this, dockManager, dockspawn.TabHost.DIRECTION_TOP);
11+
this.minimumAllowedChildNodes = 0;
12+
this.element.classList.add("document-manager");
13+
this.tabHost.createTabPage = this._createDocumentTabPage;
14+
this.tabHost.displayCloseButton = true;
15+
};
16+
dockspawn.DocumentManagerContainer.prototype = new dockspawn.FillDockContainer();
17+
dockspawn.DocumentManagerContainer.prototype.constructor = dockspawn.DocumentManagerContainer;
18+
19+
dockspawn.DocumentManagerContainer.prototype._createDocumentTabPage = function(tabHost, container)
20+
{
21+
return new dockspawn.DocumentTabPage(tabHost, container);
22+
};
23+
24+
dockspawn.DocumentManagerContainer.prototype.saveState = function(state)
25+
{
26+
dockspawn.FillDockContainer.prototype.saveState.call(this, state);
27+
state.documentManager = true;
28+
};
29+
30+
/** Returns the selected document tab */
31+
dockspawn.DocumentManagerContainer.prototype.selectedTab = function()
32+
{
33+
return this.tabHost.activeTab;
34+
};
35+
36+
/**
37+
* Specialized tab page that doesn't display the panel's frame when docked in a tab page
38+
*/
39+
dockspawn.DocumentTabPage = function(host, container)
40+
{
41+
dockspawn.TabPage.call(this, host, container);
42+
43+
// If the container is a panel, extract the content element and set it as the tab's content
44+
if (this.container.containerType == "panel")
45+
{
46+
this.panel = container;
47+
this.containerElement = this.panel.elementContent;
48+
49+
// detach the container element from the panel's frame.
50+
// It will be reattached when this tab page is destroyed
51+
// This enables the panel's frame (title bar etc) to be hidden
52+
// inside the tab page
53+
removeNode(this.containerElement);
54+
}
55+
};
56+
dockspawn.DocumentTabPage.prototype = new dockspawn.TabPage();
57+
dockspawn.DocumentTabPage.prototype.constructor = dockspawn.DocumentTabPage;
58+
59+
dockspawn.DocumentTabPage.prototype.destroy = function()
60+
{
61+
dockspawn.TabPage.prototype.destroy.call(this);
62+
63+
// Restore the panel content element back into the panel frame
64+
removeNode(this.containerElement);
65+
this.panel.elementContentHost.appendChild(this.containerElement);
66+
};
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import "../tab/TabHost";
2+
3+
dockspawn.FillDockContainer = function(dockManager, tabStripDirection)
4+
{
5+
if (arguments.length == 0)
6+
return;
7+
8+
if (tabStripDirection === undefined)
9+
tabStripDirection = dockspawn.TabHost.DIRECTION_BOTTOM;
10+
11+
this.dockManager = dockManager;
12+
this.tabOrientation = tabStripDirection;
13+
this.name = getNextId("fill_");
14+
this.element = document.createElement("div");
15+
this.containerElement = this.element;
16+
this.containerType = "fill";
17+
this.minimumAllowedChildNodes = 2;
18+
this.element.classList.add("dock-container");
19+
this.element.classList.add("dock-container-fill");
20+
this.tabHost = new dockspawn.TabHost(this.tabOrientation);
21+
this.element.appendChild(this.tabHost.hostElement);
22+
}
23+
24+
dockspawn.FillDockContainer.prototype.setActiveChild = function(child)
25+
{
26+
this.tabHost.setActiveTab(child);
27+
};
28+
29+
dockspawn.FillDockContainer.prototype.resize = function(width, height)
30+
{
31+
this.element.style.width = width + "px";
32+
this.element.style.height = height + "px";
33+
this.tabHost.resize(width, height);
34+
};
35+
36+
dockspawn.FillDockContainer.prototype.performLayout = function(children)
37+
{
38+
this.tabHost.performLayout(children);
39+
};
40+
41+
dockspawn.FillDockContainer.prototype.destroy = function()
42+
{
43+
if (removeNode(this.element))
44+
delete this.element;
45+
};
46+
47+
dockspawn.FillDockContainer.prototype.saveState = function(state)
48+
{
49+
state.width = this.width;
50+
state.height = this.height;
51+
};
52+
53+
dockspawn.FillDockContainer.prototype.loadState = function(state)
54+
{
55+
this.width = state.width;
56+
this.height = state.height;
57+
};
58+
59+
Object.defineProperty(dockspawn.FillDockContainer.prototype, "width", {
60+
get: function() { return this.element.clientWidth; },
61+
set: function(value) { this.element.style.width = value + "px" }
62+
});
63+
64+
Object.defineProperty(dockspawn.FillDockContainer.prototype, "height", {
65+
get: function() { return this.element.clientHeight; },
66+
set: function(value) { this.element.style.height = value + "px" }
67+
});

0 commit comments

Comments
 (0)