Skip to content

Commit

Permalink
Added Borders
Browse files Browse the repository at this point in the history
  • Loading branch information
nealus committed Aug 20, 2017
1 parent 52557cd commit 11c0a97
Show file tree
Hide file tree
Showing 20 changed files with 968 additions and 69 deletions.
83 changes: 69 additions & 14 deletions examples/demo/layouts/default.layout
Original file line number Diff line number Diff line change
@@ -1,41 +1,96 @@
{
"global": {},
"layout":
{
"global": {},
"layout": {
"type": "row",
"weight": 100,
"id": "#4",
"children": [
{
"type": "tabset",
"weight": 50,
"selected": 0,
"weight": 12.5,
"active": true,
"id": "#5",
"children": [
{
"type": "tab",
"name": "FX",
"component":"grid",
"component": "grid",
"config": {
"id": "1"
}
},
"id": "#6"
}
]
},
{
"type": "tabset",
"weight": 50,
"color": "#ffcccc",
"selected": 0,
"weight": 25,
"id": "#7",
"children": [
{
"type": "tab",
"name": "FI",
"component":"grid",
"component": "grid",
"config": {
"id": "2"
}
},
"id": "#8"
}
]
}
]
}
},
"border": [
{
"location": "left",
"children": [
{
"type": "tab",
"enableClose":false,
"name": "Navigation",
"component": "grid",
"id": "#24"
}
]
},
{
"location": "right",
"children": [
{
"type": "tab",
"enableClose":false,
"name": "Options",
"component": "grid",
"config": {
"id": "1"
},
"id": "#3"
}
]
},
{
"location": "bottom",
"children": [
{
"type": "tab",
"enableClose":false,
"name": "Activity Blotter",
"component": "grid",
"config": {
"id": "1"
},
"id": "#2"
},
{
"type": "tab",
"enableClose":false,
"name": "Execution Blotter",
"component": "grid",
"config": {
"id": "1"
},
"id": "#1"
}
]
}
]
}
4 changes: 3 additions & 1 deletion examples/demo/layouts/simple.layout
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"global": {},
"global": {
"tabEnableRename":false
},
"layout":
{
"type": "row",
Expand Down
42 changes: 42 additions & 0 deletions src/DockLocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class DockLocation {
return this._name;
}

getOrientation() {
return this._orientation;
}

static getByName(name) {
return values[name];
}
Expand Down Expand Up @@ -59,6 +63,44 @@ class DockLocation {
}
}

split(rect, size) {
if (this === DockLocation.TOP) {
let r1 = new Rect(rect.x, rect.y, rect.width, size);
let r2 = new Rect(rect.x, rect.y + size, rect.width, rect.height - size);
return {start: r1, end: r2};
}
else if (this === DockLocation.LEFT) {
let r1 = new Rect(rect.x, rect.y, size, rect.height);
let r2 = new Rect(rect.x + size, rect.y, rect.width - size, rect.height);
return {start: r1, end: r2};
}
if (this === DockLocation.RIGHT) {
let r1 = new Rect(rect.getRight() - size, rect.y, size, rect.height);
let r2 = new Rect(rect.x, rect.y, rect.width - size, rect.height);
return {start: r1, end: r2};
}
else if (this === DockLocation.BOTTOM) {
let r1 = new Rect(rect.x, rect.getBottom() - size, rect.width, size);
let r2 = new Rect(rect.x, rect.y, rect.width, rect.height - size);
return {start: r1, end: r2};
}
}

reflect() {
if (this === DockLocation.TOP) {
return DockLocation.BOTTOM
}
else if (this === DockLocation.LEFT) {
return DockLocation.RIGHT
}
if (this === DockLocation.RIGHT) {
return DockLocation.LEFT
}
else if (this === DockLocation.BOTTOM) {
return DockLocation.TOP
}
}

toString() {
return "(DockLocation: name=" + this._name + ", orientation=" + this._orientation + ")";
}
Expand Down
4 changes: 2 additions & 2 deletions src/JsonConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class JsonConverter {
name: name,
jsonName: jsonName,
defaultValue: defaultValue,
alwaysWriteJson: (alwayWriteJson === undefined) ? false : true
alwaysWriteJson: alwayWriteJson
});
}

Expand Down Expand Up @@ -75,7 +75,7 @@ class JsonConverter {
for (let i = 0; i < this.conversions.length; i++) {
let c = this.conversions[i];
//if (obj[c.name] !== c.defaultValue) {
lines.push("<tr><td>" + c.jsonName + "</td><td>" + c.defaultValue + "</td><td>" + JSON.stringify(obj[c.name]) + "</td></tr>");
lines.push("<tr><td>" + c.jsonName + "</td><td>" + c.defaultValue + "</td><td>" + JSON.stringify(obj[c.name]) + "</td></tr>");
//}
}
lines.push("</table>");
Expand Down
1 change: 0 additions & 1 deletion src/Utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

class Utils {

static getGetters(thisObj, obj, valueMap) {
Expand Down
7 changes: 6 additions & 1 deletion src/model/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Actions {
}

/**
* Moves a noded (tab or tabset) from one location to another
* Moves a node (tab or tabset) from one location to another
* @param fromNodeId the id of the node to move
* @param toNodeId the id of the node to receive the moved node
* @param location the location where the moved node will be added, one of the DockLocation enum values.
Expand Down Expand Up @@ -91,6 +91,10 @@ class Actions {
};
}

static adjustBorderSplit(nodeId, pos) {
return {type: Actions.ADJUST_BORDER_SPLIT, node: nodeId, pos: pos};
}

/**
* Maximizes the given tabset
* @param tabsetNodeId the id of the tabset to maximize
Expand Down Expand Up @@ -127,6 +131,7 @@ Actions.RENAME_TAB = "FlexLayout_RenameTab";
Actions.SELECT_TAB = "FlexLayout_SelectTab";
Actions.SET_ACTIVE_TABSET = "FlexLayout_SetActiveTabset";
Actions.ADJUST_SPLIT = "FlexLayout_AdjustSplit";
Actions.ADJUST_BORDER_SPLIT = "FlexLayout_AdjustBorderSplit";
Actions.MAXIMIZE_TOGGLE = "FlexLayout_MaximizeToggle";
Actions.UPDATE_MODEL_ATTRIBUTES = "FlexLayout_UpdateModelAttributes";
Actions.UPDATE_NODE_ATTRIBUTES = "FlexLayout_UpdateNodeAttributes";
Expand Down
Loading

0 comments on commit 11c0a97

Please sign in to comment.