From 0d0db680388048c02db4baebc84111a54c58b39c Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Tue, 4 Mar 2014 21:33:47 -0300 Subject: [PATCH] Fix workspace. --- web2d/src/test/javascript/render/utils.js | 70 +++++++++---------- .../src/test/javascript/render/workspace.html | 14 ++-- 2 files changed, 40 insertions(+), 44 deletions(-) diff --git a/web2d/src/test/javascript/render/utils.js b/web2d/src/test/javascript/render/utils.js index f68922cf..03e92fb0 100755 --- a/web2d/src/test/javascript/render/utils.js +++ b/web2d/src/test/javascript/render/utils.js @@ -1,57 +1,53 @@ /* -* Copyright [2012] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright [2012] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -Grid = function(parent, colums, rows) -{ +Grid = function (parent, colums, rows) { var cellSize = "10px"; this._parent = parent; this._container = this._createContainer(); - var tbody = this._container.firstChild.firstChild; - for (var i = 0; i < rows; i++) - { - var trElement = document.createElement("tr"); - for (var j = 0; j < colums; j++) - { - var tdElement = document.createElement("td"); - tdElement.style.width = cellSize; - tdElement.style.height = cellSize; - tdElement.style.borderWidth = "1px"; - tdElement.style.borderStyle = "dashed"; - tdElement.style.borderColor = "lightsteelblue"; + var tbody = $(this._container.firstChild.firstChild); + for (var i = 0; i < rows; i++) { + var trElement = $(''); + for (var j = 0; j < colums; j++) { + var tdElement = $(''); + tdElement.css({ + width: cellSize, + height: cellSize, + borderWidth: "1px", + borderStyle: "dashed", + borderColor: "lightsteelblue"} + ); trElement.append(tdElement); } tbody.append(trElement); } }; -Grid.prototype.setPosition = function(x, y) -{ +Grid.prototype.setPosition = function (x, y) { this._container.style.left = x; this._container.style.top = y; }; -Grid.prototype.render = function() -{ - this._parent.append(this._container); +Grid.prototype.render = function () { + $(this._parent).append(this._container); }; -Grid.prototype._createContainer = function() -{ +Grid.prototype._createContainer = function () { var result = window.document.createElement("div"); result.style.tableLayout = "fixed"; result.style.borderCollapse = "collapse"; diff --git a/web2d/src/test/javascript/render/workspace.html b/web2d/src/test/javascript/render/workspace.html index 41dfb715..18633cad 100755 --- a/web2d/src/test/javascript/render/workspace.html +++ b/web2d/src/test/javascript/render/workspace.html @@ -73,7 +73,7 @@ var x = 100; var executer = function () { x = (x + 10) % 100; - divElem.style.left = x + "px"; + divElem.css('left', x + "px"); }; executer.periodical(100); @@ -136,13 +136,13 @@ }; var workspace100x100 = coordSizeSampleBuilder(100, 100); - workspace100x100.addItAsChildTo(document.id("coordsizeExample100x100")); + workspace100x100.addItAsChildTo($("#coordsizeExample100x100")); var workspace100x200 = coordSizeSampleBuilder(100, 200); - workspace100x200.addItAsChildTo(document.id("coordsizeExample100x200")); + workspace100x200.addItAsChildTo($("#coordsizeExample100x200")); var workspace200x100 = coordSizeSampleBuilder(200, 100); - workspace200x100.addItAsChildTo(document.id("coordsizeExample200x100")); + workspace200x100.addItAsChildTo($("#coordsizeExample200x100")); var dynamicWorkspace = coordSizeSampleBuilder(100, 100); dynamicWorkspace.addItAsChildTo($('#coordsizeExampleDynamic')); @@ -200,13 +200,13 @@ }; var workspace0x0 = coordOriginSampleBuilder(0, 0); - workspace0x0.addItAsChildTo(document.id("coordorigin0x0")); + workspace0x0.addItAsChildTo($("#coordorigin0x0")); var workspace0x50 = coordOriginSampleBuilder(0, 50); - workspace0x50.addItAsChildTo(document.id("coordorigin0x50")); + workspace0x50.addItAsChildTo($("#coordorigin0x50")); var workspace50x0 = coordOriginSampleBuilder(50, 0); - workspace50x0.addItAsChildTo(document.id("coordorigin50x0")); + workspace50x0.addItAsChildTo($("#coordorigin50x0")); // Workspace animation changing the coordsize from (30,30) to (100,100) var dynamicWorkspace = coordOriginSampleBuilder(100, 100);