summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/edit/htdocs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/edit/edit.html69
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/edit/index.html33
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/graph.js (renamed from sca-cpp/trunk/modules/js/htdocs/graph.js)54
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/index.html38
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/main/dashboard.html104
-rw-r--r--sca-cpp/trunk/modules/edit/htdocs/main/index.html36
6 files changed, 312 insertions, 22 deletions
diff --git a/sca-cpp/trunk/modules/edit/htdocs/edit/edit.html b/sca-cpp/trunk/modules/edit/htdocs/edit/edit.html
new file mode 100644
index 0000000000..5e1e41bf5c
--- /dev/null
+++ b/sca-cpp/trunk/modules/edit/htdocs/edit/edit.html
@@ -0,0 +1,69 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+-->
+<html>
+<head>
+<link rel="stylesheet" type="text/css" href="/ui.css">
+<script type="text/javascript" src="/util.js"></script>
+<script type="text/javascript" src="/elemutil.js"></script>
+<script type="text/javascript" src="/xmlutil.js"></script>
+<script type="text/javascript" src="/atomutil.js"></script>
+<script type="text/javascript" src="/scdl.js"></script>
+<script type="text/javascript" src="/ui.js"></script>
+<script type="text/javascript" src="/component.js"></script>
+<script type="text/javascript" src="/graph.js"></script>
+</head>
+<body>
+
+<script type="text/javascript">
+var editWidget = sca.component("EditWidget");
+var dashboard = sca.reference(editWidget, "dashboard");
+var apps = sca.reference(editWidget, "apps");
+
+if (false) {
+dashboard.get('', function(doc) {
+ var entries = cddr(atom.readATOMFeedDocument(doc));
+ var entry = car(entries);
+ var item = caddr(entry);
+ var composite = cddr(item);
+ var comps = scdl.components(composite);
+
+ var g = graph.mkgraph();
+ var shapes = graph.composite(composite);
+ log(shapes);
+ for (var s in shapes)
+ g.appendChild(shapes[s]);
+});
+}
+
+apps.get('store', function(doc) {
+ var entry = atom.readATOMEntryDocument(doc);
+ var item = caddr(entry);
+ var composite = cddr(item);
+ var comps = scdl.components(composite);
+
+ var g = graph.mkgraph();
+ var shapes = graph.composite(composite);
+ log(shapes);
+ for (var s in shapes)
+ g.appendChild(shapes[s]);
+});
+
+</script>
+</body>
+</html>
diff --git a/sca-cpp/trunk/modules/edit/htdocs/edit/index.html b/sca-cpp/trunk/modules/edit/htdocs/edit/index.html
new file mode 100644
index 0000000000..7cdfcd81a4
--- /dev/null
+++ b/sca-cpp/trunk/modules/edit/htdocs/edit/index.html
@@ -0,0 +1,33 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+-->
+<html>
+<head>
+<title>App Editor</title>
+<link rel="stylesheet" type="text/css" href="/ui.css">
+<script type="text/javascript" src="/util.js"></script>
+<script type="text/javascript" src="/ui.js"></script>
+</head>
+<body>
+<iframe id="editFrame" src="edit.html" style="visibility: visible; height: 100%; width: 100%; border: 0px;" scrolling="no" frameborder="0"></iframe>
+
+<script type="text/javascript">
+</script>
+</body>
+</html>
+
diff --git a/sca-cpp/trunk/modules/js/htdocs/graph.js b/sca-cpp/trunk/modules/edit/htdocs/graph.js
index 883b3aa801..20f71a5dd4 100644
--- a/sca-cpp/trunk/modules/js/htdocs/graph.js
+++ b/sca-cpp/trunk/modules/edit/htdocs/graph.js
@@ -46,12 +46,19 @@ graph.supportsSVG = function() {
/**
* Basic colors
*/
-graph.red = 'red';
-graph.green = 'green';
-graph.blue = 'blue';
-graph.yellow = 'yellow';
-graph.orange = '#ffa500';
-graph.gray = 'gray'
+graph.colors = new Object();
+graph.colors.black = '#000000';
+graph.colors.blue = '#0000ff';
+graph.colors.cyan = '#00ffff';
+graph.colors.gray = '#808080'
+graph.colors.green = '#008000';
+graph.colors.magenta = '#008000';
+graph.colors.orange = '#ffa500';
+graph.colors.pink = '#ffc0cb';
+graph.colors.purple = '#800080';
+graph.colors.red = '#ff0000';
+graph.colors.white = '#ffffff';
+graph.colors.yellow = '#ffff00';
/**
* Base path class.
@@ -204,10 +211,13 @@ if (graph.supportsVML()) {
/**
* Make a title element.
*/
- graph.mktitle = function(t) {
+ graph.mktitle = function(comp) {
+ var t = scdl.name(comp);
+ var tsvcs = graph.tsvcs(comp);
+ var lsvcs = graph.lsvcs(comp);
var title = document.createElement('v:textbox');
- title.style.left = '25';
- title.style.top = '5';
+ title.style.left = '' + (isNil(lsvcs)? 7 : 27);
+ title.style.top = '' + (isNil(tsvcs)? 5 : 25);
title.style.position = 'absolute';
var tnode = document.createTextNode(t);
title.appendChild(tnode);
@@ -217,7 +227,8 @@ if (graph.supportsVML()) {
/**
* Return the width of a title.
*/
- graph.titlewidth = function(t) {
+ graph.titlewidth = function(comp) {
+ var t = scdl.name(comp);
graph.textWidthDiv.innerHTML = t;
var twidth = graph.textWidthDiv.offsetWidth;
graph.textWidthDiv.innerHTML = '';
@@ -228,8 +239,7 @@ if (graph.supportsVML()) {
* Make a component shape.
*/
graph.mkcompshape = function(comp, cassoc) {
- var name = scdl.name(comp);
- var title = graph.mktitle(name);
+ var title = graph.mktitle(comp);
var d = graph.mkcomppath(comp, cassoc).str();
@@ -247,8 +257,8 @@ if (graph.supportsVML()) {
contour.coordsize = '500,500';
contour.setAttribute('path', d);
contour.filled = 'false';
- contour.strokecolor = graph.gray;
- contour.strokeweight = '3';
+ contour.strokecolor = graph.colors.gray;
+ contour.strokeweight = '2';
contour.style.top = 1;
contour.style.left = 1;
var stroke = document.createElement('v:stroke');
@@ -381,7 +391,8 @@ if (graph.supportsSVG()) {
/**
* Make a title element.
*/
- graph.mktitle = function(t) {
+ graph.mktitle = function(comp) {
+ var t = scdl.name(comp);
var title = document.createElementNS(graph.svgns, 'text');
title.setAttribute('text-anchor', 'start');
title.setAttribute('x', 5);
@@ -394,8 +405,8 @@ if (graph.supportsSVG()) {
/**
* Return a width of a title.
*/
- graph.titlewidth = function(t) {
- var title = graph.mktitle(t);
+ graph.titlewidth = function(comp) {
+ var title = graph.mktitle(comp);
var width = title.getBBox().width;
graph.textWidthSvg.removeChild(title);
return width;
@@ -405,8 +416,7 @@ if (graph.supportsSVG()) {
* Make a component shape.
*/
graph.mkcompshape = function(comp, cassoc) {
- var name = scdl.name(comp);
- var title = graph.mktitle(name);
+ var title = graph.mktitle(comp);
var d = graph.mkcomppath(comp, cassoc).str();
@@ -417,7 +427,7 @@ if (graph.supportsSVG()) {
var contour = document.createElementNS(graph.svgns, 'path');
contour.setAttribute('d', d);
contour.setAttribute('fill', 'none');
- contour.setAttribute('stroke', graph.gray);
+ contour.setAttribute('stroke', graph.colors.gray);
contour.setAttribute('stroke-width', '4');
contour.setAttribute('stroke-opacity', '0.20');
contour.setAttribute('transform', 'translate(1,1)');
@@ -491,7 +501,7 @@ graph.rrefs = function(comp) {
*/
graph.color = function(comp) {
var c = scdl.color(comp);
- return c == null? graph.blue : c;
+ return c == null? graph.colors.blue : graph.colors[c];
}
/**
@@ -548,7 +558,7 @@ graph.refswidth = function(refs, cassoc) {
* Return the width of a component.
*/
graph.compwidth = function(comp, cassoc) {
- var twidth = graph.titlewidth(scdl.name(comp)) + 20;
+ var twidth = graph.titlewidth(comp) + 20;
var tsvcs = graph.tsvcs(comp);
var tsvcsw = Math.max(1, length(tsvcs)) * 60 + 20;
var brefs = graph.brefs(comp);
diff --git a/sca-cpp/trunk/modules/edit/htdocs/index.html b/sca-cpp/trunk/modules/edit/htdocs/index.html
new file mode 100644
index 0000000000..3c18fdbd47
--- /dev/null
+++ b/sca-cpp/trunk/modules/edit/htdocs/index.html
@@ -0,0 +1,38 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+-->
+<html>
+<head>
+<title>App Edit Tools</title>
+<link rel="stylesheet" type="text/css" href="/ui.css">
+<script type="text/javascript" src="/util.js"></script>
+<script type="text/javascript" src="/ui.js"></script>
+</head>
+<body>
+<h1>App Edit Tools</h1>
+<p>This module implements simple tools to help you create Tuscany apps.</p>
+
+<h2>App Dashboard</h1>
+<p>Try the <a href="main">App Dashboard</a> to manage your collection of apps.</p>
+
+<h2>App Editor</h1>
+<p>Try the <a href="edit">App Editor</a> to edit an app.</p>
+
+</body>
+</html>
+
diff --git a/sca-cpp/trunk/modules/edit/htdocs/main/dashboard.html b/sca-cpp/trunk/modules/edit/htdocs/main/dashboard.html
new file mode 100644
index 0000000000..a5e5b12aef
--- /dev/null
+++ b/sca-cpp/trunk/modules/edit/htdocs/main/dashboard.html
@@ -0,0 +1,104 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+-->
+<html>
+<head>
+<link rel="stylesheet" type="text/css" href="/ui.css">
+<script type="text/javascript" src="/util.js"></script>
+<script type="text/javascript" src="/elemutil.js"></script>
+<script type="text/javascript" src="/xmlutil.js"></script>
+<script type="text/javascript" src="/atomutil.js"></script>
+<script type="text/javascript" src="/scdl.js"></script>
+<script type="text/javascript" src="/ui.js"></script>
+<script type="text/javascript" src="/component.js"></script>
+</head>
+<body>
+<div id="dashboard">
+
+<form id="appsForm">
+<div id="apps"></div>
+<br/>
+&gt;<a href="" id="addAppLink">Add</a>&nbsp;<a href="" id="deleteAppLink">Delete</a>
+</form>
+
+<div id="newApp" style="visibility: hidden;">
+<form id="newAppForm">
+<table width="100%">
+<tr><th>Add a New App</th></tr>
+<tr><td>Add a new App to your dashboard.</td></tr>
+</table>
+<br>
+
+<table>
+<tr><td>App name:</td><td><input type="text" name="appName" size="50"/></td></td><td>e.g. mycoolapp</td></tr>
+<tr><td>Title:</td><td><input type="text" name="appTitle" size="50"/></td></td><td>e.g. My really cool app</td></tr>
+</table>
+<input id="addAppButton" type="button" value="Add"/>
+</form>
+</div>
+
+</div>
+
+<script type="text/javascript">
+ui.installwidget();
+
+var editWidget = sca.component("EditWidget");
+var dashboard = sca.reference(editWidget, "dashboard");
+
+// Get and display list of apps
+dashboard.get('', function(doc) {
+ var apps = '';
+ apps += '<table width="100%">';
+ apps += '<tr><th>App</th><th>Title</th></tr>';
+
+ var entries = cddr(atom.readATOMFeedDocument(doc));
+ for (var i = 0; i < length(entries); i++) {
+ var entry = entries[i];
+ var item = caddr(entry);
+ var composite = cddr(item);
+ var comps = scdl.components(composite);
+
+ name = cadr(entry);
+ title = car(entry);
+
+ apps += '<tr>';
+ apps += '<td><input name="apps" type="checkbox" value="' + name + '">' + '<a href=\"' + '/edit/?app=' + name + '\">' + name + '</a></td>';
+ apps += '<td class="tdw">' + title + '</td>';
+ apps += '</tr>';
+ }
+ apps += '</table>';
+ $('apps').innerHTML = apps;
+
+});
+
+// Toggle new app form
+$('addAppLink').onclick = function() {
+ var div = $('newApp');
+ div.style.visibility = div.style.visibility == 'hidden'? 'visible' : 'hidden';
+ return false;
+};
+
+// Add a new app
+$('addAppButton').onclick = function() {
+ alert('Add new app');
+ return false;
+};
+
+</script>
+</body>
+</html>
diff --git a/sca-cpp/trunk/modules/edit/htdocs/main/index.html b/sca-cpp/trunk/modules/edit/htdocs/main/index.html
new file mode 100644
index 0000000000..13b2662645
--- /dev/null
+++ b/sca-cpp/trunk/modules/edit/htdocs/main/index.html
@@ -0,0 +1,36 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+-->
+<html>
+<head>
+<title>App Dashboard</title>
+<link rel="stylesheet" type="text/css" href="/ui.css">
+<script type="text/javascript" src="/util.js"></script>
+<script type="text/javascript" src="/ui.js"></script>
+</head>
+<body>
+<h1>Welcome to your App Dashboard!</h1>
+<div id="dashboard"></div>
+<iframe id="dashboardFrame" src="dashboard.html"></iframe>
+
+<script type="text/javascript">
+ui.bindwidget('dashboardFrame', 'dashboard');
+</script>
+</body>
+</html>
+