Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
147826e9
Commit
147826e9
authored
Jun 17, 2014
by
Romain Courteaud
Committed by
Jérome Perrin
Aug 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Publish static files.
parent
2ae6d546
Changes
29
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
697 additions
and
564 deletions
+697
-564
dream/platform/static/dream/InputModule_viewInputList.js
dream/platform/static/dream/InputModule_viewInputList.js
+8
-13
dream/platform/static/dream/Input_viewDocumentManagement.html
...m/platform/static/dream/Input_viewDocumentManagement.html
+0
-1
dream/platform/static/dream/Input_viewDocumentManagement.js
dream/platform/static/dream/Input_viewDocumentManagement.js
+3
-4
dream/platform/static/dream/Input_viewProductionLine.html
dream/platform/static/dream/Input_viewProductionLine.html
+0
-1
dream/platform/static/dream/Input_viewProductionLine.js
dream/platform/static/dream/Input_viewProductionLine.js
+4
-5
dream/platform/static/dream/Input_viewResultList.html
dream/platform/static/dream/Input_viewResultList.html
+25
-0
dream/platform/static/dream/Input_viewResultList.js
dream/platform/static/dream/Input_viewResultList.js
+37
-0
dream/platform/static/dream/Input_viewSimulation.html
dream/platform/static/dream/Input_viewSimulation.html
+0
-1
dream/platform/static/dream/Input_viewSimulation.js
dream/platform/static/dream/Input_viewSimulation.js
+21
-19
dream/platform/static/dream/Input_viewTable.html
dream/platform/static/dream/Input_viewTable.html
+0
-1
dream/platform/static/dream/Input_viewTable.js
dream/platform/static/dream/Input_viewTable.js
+3
-4
dream/platform/static/dream/Output_viewDebugJson.html
dream/platform/static/dream/Output_viewDebugJson.html
+0
-1
dream/platform/static/dream/Output_viewDebugJson.js
dream/platform/static/dream/Output_viewDebugJson.js
+11
-16
dream/platform/static/dream/Output_viewExitStatistics.html
dream/platform/static/dream/Output_viewExitStatistics.html
+0
-1
dream/platform/static/dream/Output_viewExitStatistics.js
dream/platform/static/dream/Output_viewExitStatistics.js
+5
-6
dream/platform/static/dream/Output_viewJobGantt.html
dream/platform/static/dream/Output_viewJobGantt.html
+0
-1
dream/platform/static/dream/Output_viewJobGantt.js
dream/platform/static/dream/Output_viewJobGantt.js
+5
-6
dream/platform/static/dream/Output_viewJobScheduleSpreadsheet.html
...tform/static/dream/Output_viewJobScheduleSpreadsheet.html
+0
-1
dream/platform/static/dream/Output_viewJobScheduleSpreadsheet.js
...latform/static/dream/Output_viewJobScheduleSpreadsheet.js
+5
-6
dream/platform/static/dream/Output_viewQueueStatGraph.html
dream/platform/static/dream/Output_viewQueueStatGraph.html
+0
-1
dream/platform/static/dream/Output_viewQueueStatGraph.js
dream/platform/static/dream/Output_viewQueueStatGraph.js
+5
-6
dream/platform/static/dream/Output_viewStationUtilisationGraph.html
...form/static/dream/Output_viewStationUtilisationGraph.html
+0
-1
dream/platform/static/dream/Output_viewStationUtilisationGraph.js
...atform/static/dream/Output_viewStationUtilisationGraph.js
+5
-6
dream/platform/static/dream/index.css
dream/platform/static/dream/index.css
+1
-1
dream/platform/static/dream/index.html
dream/platform/static/dream/index.html
+17
-3
dream/platform/static/dream/index.js
dream/platform/static/dream/index.js
+182
-43
dream/platform/static/jsplumb/index.html
dream/platform/static/jsplumb/index.html
+18
-7
dream/platform/static/jsplumb/jsplumb.css
dream/platform/static/jsplumb/jsplumb.css
+1
-0
dream/platform/static/jsplumb/jsplumb.js
dream/platform/static/jsplumb/jsplumb.js
+341
-409
No files found.
dream/platform/static/dream/InputModule_viewInputList.js
View file @
147826e9
...
...
@@ -8,12 +8,12 @@
// Precompile the templates while loading the first gadget instance
var
gadget_klass
=
rJS
(
window
),
source
=
gadget_klass
.
__template_element
.
getElementById
(
"
table-template
"
).
innerHTML
,
table_template
=
Handlebars
.
compile
(
source
);
initGadgetMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
aq_allDocs
"
,
"
allDocs
"
).
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
declareAcquiredMethod
(
"
whoWantToDisplayThis
Page
"
,
"
whoWantToDisplayThisPage
"
).
declareAcquiredMethod
(
"
whoWantToDisplayThis
Document
"
,
"
whoWantToDisplayThisDocument
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
gadget_klass
.
declareAcquiredMethod
(
"
aq_allDocs
"
,
"
allDocs
"
).
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
declareAcquiredMethod
(
"
whoWantToDisplayThisDocument
"
,
"
whoWantToDisplayThisDocument
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
return
gadget
.
aq_allDocs
({
select_list
:
[
"
title
"
,
"
modified
"
]
}).
push
(
function
(
document_list
)
{
var
result_list
=
[
gadget
.
whoWantToDisplayThisPage
(
"
InputModule_viewAddDocumentDialog
"
)
],
doc
,
i
;
var
result_list
=
[],
doc
,
i
;
for
(
i
=
0
;
i
<
document_list
.
data
.
total_rows
;
i
+=
1
)
{
doc
=
document_list
.
data
.
rows
[
i
];
result_list
.
push
(
RSVP
.
all
([
gadget
.
whoWantToDisplayThisDocument
(
doc
.
id
),
doc
.
value
.
title
,
doc
.
value
.
modified
]));
...
...
@@ -21,13 +21,15 @@
return
RSVP
.
all
(
result_list
);
}).
push
(
function
(
document_list
)
{
// Create new doc if nothing exists
if
(
document_list
.
length
===
1
)
{
return
gadget
.
pleaseRedirectMyHash
(
document_list
[
0
]);
if
(
document_list
.
length
===
0
)
{
return
gadget
.
whoWantToDisplayThisDocument
(
undefined
,
"
view_fast_input
"
).
push
(
function
(
url
)
{
return
gadget
.
pleaseRedirectMyHash
(
url
);
});
}
var
i
,
parameter_list
=
[],
doc
;
for
(
i
=
1
;
i
<
document_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
document_list
.
length
;
i
+=
1
)
{
doc
=
document_list
[
i
];
parameter_list
[
i
-
1
]
=
{
parameter_list
[
i
]
=
{
link
:
doc
[
0
],
title
:
doc
[
1
]
+
"
(
"
+
doc
[
2
]
+
"
)
"
};
...
...
@@ -37,12 +39,5 @@
documentlist
:
parameter_list
});
});
}).
declareMethod
(
"
getNavigationList
"
,
function
()
{
return
this
.
whoWantToDisplayThisPage
(
"
InputModule_viewAddDocumentDialog
"
).
push
(
function
(
url
)
{
return
[
{
title
:
"
New Document
"
,
link
:
url
}
];
});
});
})(
window
,
rJS
,
RSVP
,
Handlebars
,
initGadgetMixin
);
\ No newline at end of file
dream/platform/static/dream/Input_viewDocumentManagement.html
View file @
147826e9
...
...
@@ -11,7 +11,6 @@
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_promise.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_document_page.js"
type=
"text/javascript"
></script>
<script
src=
"Input_viewDocumentManagement.js"
type=
"text/javascript"
></script>
</head>
<body>
...
...
dream/platform/static/dream/Input_viewDocumentManagement.js
View file @
147826e9
/*global console, rJS, RSVP,
initDocumentPageMixin,
jQuery,
/*global console, rJS, RSVP, jQuery,
promiseEventListener, initGadgetMixin */
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
$
,
promiseEventListener
,
initGadgetMixin
)
{
(
function
(
window
,
rJS
,
RSVP
,
$
,
promiseEventListener
,
initGadgetMixin
)
{
"
use strict
"
;
function
datatouri
(
data
,
mime_type
)
{
var
result
=
"
data:
"
;
...
...
@@ -75,7 +75,6 @@
}
var
gadget_klass
=
rJS
(
window
);
initGadgetMixin
(
gadget_klass
);
initDocumentPageMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
aq_remove
"
,
"
jio_remove
"
).
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareAcquiredMethod
(
"
aq_putAttachment
"
,
"
jio_putAttachment
"
).
declareAcquiredMethod
(
"
aq_get
"
,
"
jio_get
"
).
declareAcquiredMethod
(
"
aq_ajax
"
,
"
jio_ajax
"
).
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
declareAcquiredMethod
(
"
whoWantToDisplayThisDocument
"
,
"
whoWantToDisplayThisDocument
"
).
declareAcquiredMethod
(
"
whoWantToDisplayHome
"
,
"
whoWantToDisplayHome
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
this
.
props
.
jio_key
=
options
.
id
;
var
gadget
=
this
;
...
...
@@ -94,4 +93,4 @@
}).
declareMethod
(
"
startService
"
,
function
()
{
return
RSVP
.
all
([
waitForDeletion
(
this
),
waitForKnowledgeExtraction
(
this
)
]);
});
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
jQuery
,
promiseEventListener
,
initGadgetMixin
);
\ No newline at end of file
})(
window
,
rJS
,
RSVP
,
jQuery
,
promiseEventListener
,
initGadgetMixin
);
\ No newline at end of file
dream/platform/static/dream/Input_viewProductionLine.html
View file @
147826e9
...
...
@@ -7,7 +7,6 @@
<script
src=
"../lib/rsvp.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/renderjs.min.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_document_page.js"
type=
"text/javascript"
></script>
<script
src=
"Input_viewProductionLine.js"
type=
"text/javascript"
></script>
</head>
<body>
...
...
dream/platform/static/dream/Input_viewProductionLine.js
View file @
147826e9
/*global window, rJS, RSVP, initDocumentPageMixin */
/*jslint nomen: true */
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
)
{
/*global window, rJS, RSVP */
(
function
(
window
,
rJS
,
RSVP
)
{
"
use strict
"
;
var
gadget_klass
=
rJS
(
window
);
initDocumentPageMixin
(
gadget_klass
);
gadget_klass
.
ready
(
function
(
g
)
{
g
.
props
=
{};
}).
ready
(
function
(
g
)
{
...
...
@@ -14,6 +12,7 @@
var
jio_key
=
options
.
id
,
gadget
=
this
;
gadget
.
props
.
jio_key
=
jio_key
;
return
new
RSVP
.
Queue
().
push
(
function
()
{
/*jslint nomen: true*/
return
RSVP
.
all
([
gadget
.
aq_getAttachment
({
_id
:
jio_key
,
_attachment
:
"
body.json
"
...
...
@@ -26,4 +25,4 @@
return
productionline
.
startService
();
});
});
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
);
\ No newline at end of file
})(
window
,
rJS
,
RSVP
);
\ No newline at end of file
dream/platform/static/dream/Input_viewResultList.html
0 → 100644
View file @
147826e9
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Result List
</title>
<script
src=
"../lib/rsvp.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/renderjs.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/handlebars.min.js"
type=
"text/javascript"
></script>
<script
id=
"table-template"
type=
"text/x-handlebars-template"
>
<
ul
data
-
role
=
"
listview
"
data
-
inset
=
"
true
"
class
=
"
document-listview
"
>
{{
#
documentlist
}}
<
li
><
a
href
=
"
{{link}}
"
>
{{
title
}}
<
/a></
li
>
{{
/
documentlist
}}
<
/ul
>
</script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"Input_viewResultList.js"
type=
"text/javascript"
></script>
</head>
<body>
<section
class=
"document_list"
></section>
</body>
</html>
dream/platform/static/dream/Input_viewResultList.js
0 → 100644
View file @
147826e9
/*global console, rJS, RSVP, Handlebars, initGadgetMixin */
/*jslint nomen: true */
(
function
(
window
,
rJS
,
RSVP
,
Handlebars
,
initGadgetMixin
)
{
"
use strict
"
;
/////////////////////////////////////////////////////////////////
// Handlebars
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
var
gadget_klass
=
rJS
(
window
),
source
=
gadget_klass
.
__template_element
.
getElementById
(
"
table-template
"
).
innerHTML
,
table_template
=
Handlebars
.
compile
(
source
);
initGadgetMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareAcquiredMethod
(
"
whoWantToDisplayThisResult
"
,
"
whoWantToDisplayThisResult
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
this
.
props
.
jio_key
=
options
.
id
;
return
gadget
.
aq_getAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
simulation.json
"
}).
push
(
function
(
sim_json
)
{
var
document_list
=
JSON
.
parse
(
sim_json
),
result_list
=
[],
i
;
for
(
i
=
0
;
i
<
document_list
.
length
;
i
+=
1
)
{
result_list
.
push
(
RSVP
.
all
([
gadget
.
whoWantToDisplayThisResult
(
gadget
.
props
.
jio_key
,
i
),
document_list
[
i
].
score
,
document_list
[
i
].
key
]));
}
return
RSVP
.
all
(
result_list
);
}).
push
(
function
(
document_list
)
{
var
i
,
parameter_list
=
[],
doc
;
for
(
i
=
0
;
i
<
document_list
.
length
;
i
+=
1
)
{
doc
=
document_list
[
i
];
parameter_list
[
i
]
=
{
link
:
doc
[
0
],
title
:
doc
[
1
]
+
"
"
+
doc
[
2
]
};
}
gadget
.
props
.
element
.
querySelector
(
"
.document_list
"
).
innerHTML
=
table_template
({
documentlist
:
parameter_list
});
});
});
})(
window
,
rJS
,
RSVP
,
Handlebars
,
initGadgetMixin
);
\ No newline at end of file
dream/platform/static/dream/Input_viewSimulation.html
View file @
147826e9
...
...
@@ -16,7 +16,6 @@
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_promise.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_document_page.js"
type=
"text/javascript"
></script>
<script
src=
"Input_viewSimulation.js"
type=
"text/javascript"
></script>
</head>
<body>
...
...
dream/platform/static/dream/Input_viewSimulation.js
View file @
147826e9
/*global rJS, RSVP,
initDocumentPageMixin,
jQuery, Handlebars,
/*global rJS, RSVP, jQuery, Handlebars,
promiseEventListener, initGadgetMixin */
/*jslint nomen: true */
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
$
,
Handlebars
,
promiseEventListener
,
initGadgetMixin
)
{
(
function
(
window
,
rJS
,
RSVP
,
$
,
Handlebars
,
promiseEventListener
,
initGadgetMixin
)
{
"
use strict
"
;
/////////////////////////////////////////////////////////////////
// Handlebars
...
...
@@ -9,16 +9,9 @@
// Precompile the templates while loading the first gadget instance
var
gadget_klass
=
rJS
(
window
),
source
=
gadget_klass
.
__template_element
.
getElementById
(
"
label-template
"
).
innerHTML
,
label_template
=
Handlebars
.
compile
(
source
);
initGadgetMixin
(
gadget_klass
);
initDocumentPageMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareAcquiredMethod
(
"
aq_putAttachment
"
,
"
jio_putAttachment
"
).
declareAcquiredMethod
(
"
aq_ajax
"
,
"
jio_ajax
"
).
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
declareAcquiredMethod
(
"
whoWantToDisplayThisDocumentPage
"
,
"
whoWantToDisplayThisDocumentPage
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
i
,
gadget
=
this
,
property
,
parent_element
=
gadget
.
props
.
element
.
querySelector
(
"
.simulation_parameters
"
),
value
,
queue
,
data
,
property_list
=
options
.
configuration_dict
[
"
Dream-Configuration
"
].
property_list
;
gadget_klass
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareAcquiredMethod
(
"
aq_putAttachment
"
,
"
jio_putAttachment
"
).
declareAcquiredMethod
(
"
aq_ajax
"
,
"
jio_ajax
"
).
declareAcquiredMethod
(
"
aq_getConfigurationDict
"
,
"
getConfigurationDict
"
).
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
declareAcquiredMethod
(
"
whoWantToDisplayThisDocument
"
,
"
whoWantToDisplayThisDocument
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
i
,
gadget
=
this
,
property
,
parent_element
=
gadget
.
props
.
element
.
querySelector
(
"
.simulation_parameters
"
),
value
,
queue
,
data
;
this
.
props
.
jio_key
=
options
.
id
;
queue
=
gadget
.
aq_getAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
body.json
"
}).
push
(
function
(
json
)
{
data
=
JSON
.
parse
(
json
).
general
;
});
function
addField
(
property
,
value
)
{
var
sub_gadget
;
queue
.
push
(
function
()
{
...
...
@@ -42,6 +35,14 @@
parent_element
.
appendChild
(
sub_element
);
});
}
queue
=
gadget
.
aq_getAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
body.json
"
}).
push
(
function
(
json
)
{
data
=
JSON
.
parse
(
json
).
general
;
return
gadget
.
aq_getConfigurationDict
();
}).
push
(
function
(
configuration_dict
)
{
var
property_list
=
configuration_dict
[
"
Dream-Configuration
"
].
property_list
;
for
(
i
=
0
;
i
<
property_list
.
length
;
i
+=
1
)
{
property
=
property_list
[
i
];
if
(
property
.
_class
===
"
Dream.Property
"
)
{
...
...
@@ -49,6 +50,7 @@
addField
(
property
,
value
);
}
}
});
return
queue
;
}).
declareMethod
(
"
startService
"
,
function
()
{
var
gadget
=
this
;
...
...
@@ -89,9 +91,9 @@
_mimetype
:
"
application/json
"
});
}).
push
(
function
(
result
)
{
return
gadget
.
whoWantToDisplayThisDocument
Page
(
"
Output_viewDebugJson
"
,
gadget
.
props
.
jio_key
);
return
gadget
.
whoWantToDisplayThisDocument
(
gadget
.
props
.
jio_key
,
"
view_result
"
);
}).
push
(
function
(
url
)
{
return
gadget
.
pleaseRedirectMyHash
(
url
);
});
});
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
jQuery
,
Handlebars
,
promiseEventListener
,
initGadgetMixin
);
\ No newline at end of file
})(
window
,
rJS
,
RSVP
,
jQuery
,
Handlebars
,
promiseEventListener
,
initGadgetMixin
);
\ No newline at end of file
dream/platform/static/dream/Input_viewTable.html
View file @
147826e9
...
...
@@ -8,7 +8,6 @@
<script
src=
"../lib/renderjs.min.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_document_page.js"
type=
"text/javascript"
></script>
<script
src=
"Input_viewTable.js"
type=
"text/javascript"
></script>
</head>
<body>
...
...
dream/platform/static/dream/Input_viewTable.js
View file @
147826e9
/*global console, rJS, RSVP, init
DocumentPageMixin, init
GadgetMixin */
(
function
(
window
,
rJS
,
RSVP
,
init
DocumentPageMixin
,
init
GadgetMixin
)
{
/*global console, rJS, RSVP, initGadgetMixin */
(
function
(
window
,
rJS
,
RSVP
,
initGadgetMixin
)
{
"
use strict
"
;
var
gadget_klass
=
rJS
(
window
);
initDocumentPageMixin
(
gadget_klass
);
initGadgetMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
jio_key
=
options
.
id
,
gadget
=
this
;
...
...
@@ -20,4 +19,4 @@
return
tableeditor
.
startService
();
});
});
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
initGadgetMixin
);
\ No newline at end of file
})(
window
,
rJS
,
RSVP
,
initGadgetMixin
);
\ No newline at end of file
dream/platform/static/dream/Output_viewDebugJson.html
View file @
147826e9
...
...
@@ -7,7 +7,6 @@
<script
src=
"../lib/rsvp.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/renderjs.min.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_document_page.js"
type=
"text/javascript"
></script>
<script
src=
"Output_viewDebugJson.js"
type=
"text/javascript"
></script>
</head>
<body>
...
...
dream/platform/static/dream/Output_viewDebugJson.js
View file @
147826e9
/*global console, rJS, RSVP, init
DocumentPageMixin, init
GadgetMixin */
(
function
(
window
,
rJS
,
RSVP
,
init
DocumentPageMixin
,
init
GadgetMixin
)
{
/*global console, rJS, RSVP, initGadgetMixin */
(
function
(
window
,
rJS
,
RSVP
,
initGadgetMixin
)
{
"
use strict
"
;
var
gadget_klass
=
rJS
(
window
);
initGadgetMixin
(
gadget_klass
);
initDocumentPageMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
this
.
props
.
jio_key
=
options
.
id
;
return
new
RSVP
.
Queue
().
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
aq_getAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
body.json
"
}),
gadget
.
aq_getAttachment
({
this
.
props
.
result
=
options
.
result
;
return
gadget
.
aq_getAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
simulation.json
"
})
]);
}).
push
(
function
(
result_list
)
{
gadget
.
props
.
element
.
querySelector
(
"
.json_input
"
).
textContent
=
result_list
[
0
];
// XXX Hardcoded result
gadget
.
props
.
element
.
querySelector
(
"
.json_output
"
).
textContent
=
JSON
.
stringify
(
JSON
.
parse
(
result_list
[
1
])[
0
].
result
);
}).
push
(
function
(
result_json
)
{
var
result
=
JSON
.
parse
(
result_json
);
gadget
.
props
.
element
.
querySelector
(
"
.json_input
"
).
textContent
=
JSON
.
stringify
(
result
[
gadget
.
props
.
result
].
input
);
gadget
.
props
.
element
.
querySelector
(
"
.json_output
"
).
textContent
=
JSON
.
stringify
(
result
[
gadget
.
props
.
result
].
result
);
});
});
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
initGadgetMixin
);
\ No newline at end of file
})(
window
,
rJS
,
RSVP
,
initGadgetMixin
);
\ No newline at end of file
dream/platform/static/dream/Output_viewExitStatistics.html
View file @
147826e9
...
...
@@ -8,7 +8,6 @@
<script
src=
"../lib/renderjs.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/handlebars.min.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_document_page.js"
type=
"text/javascript"
></script>
<script
src=
"Output_viewExitStatistics.js"
type=
"text/javascript"
></script>
<script
id=
"interval-through-metric-template"
type=
"text/x-handlebars-template"
>
...
...
dream/platform/static/dream/Output_viewExitStatistics.js
View file @
147826e9
/*global console, rJS, RSVP,
initDocumentPageMixin,
Handlebars,
/*global console, rJS, RSVP, Handlebars,
initGadgetMixin */
/*jslint nomen: true */
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
Handlebars
,
initGadgetMixin
)
{
(
function
(
window
,
rJS
,
RSVP
,
Handlebars
,
initGadgetMixin
)
{
"
use strict
"
;
/////////////////////////////////////////////////////////////////
// Handlebars
...
...
@@ -85,17 +85,16 @@
return
result
;
}
initGadgetMixin
(
gadget_klass
);
initDocumentPageMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
jio_key
=
options
.
id
,
gadget
=
this
;
gadget
.
props
.
jio_key
=
jio_key
;
gadget
.
props
.
result
=
options
.
result
;
return
gadget
.
aq_getAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
simulation.json
"
}).
push
(
function
(
simulation_json
)
{
var
result
=
calculate_exit_stat
(
// XXX Hardcoded result
JSON
.
parse
(
simulation_json
)[
0
].
result
);
var
result
=
calculate_exit_stat
(
JSON
.
parse
(
simulation_json
)[
gadget
.
props
.
result
].
result
);
gadget
.
props
.
element
.
innerHTML
=
result
;
});
});
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
Handlebars
,
initGadgetMixin
);
\ No newline at end of file
})(
window
,
rJS
,
RSVP
,
Handlebars
,
initGadgetMixin
);
\ No newline at end of file
dream/platform/static/dream/Output_viewJobGantt.html
View file @
147826e9
...
...
@@ -11,7 +11,6 @@
<script
src=
"../lib/jquery.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/dhtmlxgantt.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_document_page.js"
type=
"text/javascript"
></script>
<script
src=
"Output_viewJobGantt.js"
type=
"text/javascript"
></script>
</head>
<body>
...
...
dream/platform/static/dream/Output_viewJobGantt.js
View file @
147826e9
/*global console, rJS, RSVP,
initDocumentPageMixin,
jQuery, gantt,
/*global console, rJS, RSVP, jQuery, gantt,
initGadgetMixin */
/*jslint nomen: true */
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
$
,
gantt
,
initGadgetMixin
)
{
(
function
(
window
,
rJS
,
RSVP
,
$
,
gantt
,
initGadgetMixin
)
{
"
use strict
"
;
gantt
.
templates
.
task_class
=
function
(
start
,
end
,
obj
)
{
return
obj
.
parent
?
"
sub_task
"
:
""
;
...
...
@@ -161,16 +161,15 @@
}
var
gadget_klass
=
rJS
(
window
);
initGadgetMixin
(
gadget_klass
);
initDocumentPageMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
jio_key
=
options
.
id
,
gadget
=
this
;
gadget
.
props
.
jio_key
=
jio_key
;
gadget
.
props
.
result
=
options
.
result
;
return
gadget
.
aq_getAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
simulation.json
"
}).
push
(
function
(
simulation_json
)
{
gadget
.
props
.
result
=
job_gantt_widget
(
// XXX Hardcoded result
JSON
.
parse
(
simulation_json
)[
0
]);
gadget
.
props
.
result
=
job_gantt_widget
(
JSON
.
parse
(
simulation_json
)[
gadget
.
props
.
result
]);
});
}).
declareMethod
(
"
startService
"
,
function
()
{
$
(
this
.
props
.
element
).
find
(
"
.gant_container
"
).
dhx_gantt
({
...
...
@@ -200,4 +199,4 @@
throw
error
;
});
});
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
jQuery
,
gantt
,
initGadgetMixin
);
\ No newline at end of file
})(
window
,
rJS
,
RSVP
,
jQuery
,
gantt
,
initGadgetMixin
);
\ No newline at end of file
dream/platform/static/dream/Output_viewJobScheduleSpreadsheet.html
View file @
147826e9
...
...
@@ -9,7 +9,6 @@
<script
src=
"../lib/moment.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_document_page.js"
type=
"text/javascript"
></script>
<script
src=
"Output_viewJobScheduleSpreadsheet.js"
type=
"text/javascript"
></script>
</head>
<body>
...
...
dream/platform/static/dream/Output_viewJobScheduleSpreadsheet.js
View file @
147826e9
/*global console, rJS, RSVP,
initDocumentPageMixin,
moment, initGadgetMixin */
/*global console, rJS, RSVP, moment, initGadgetMixin */
/*jslint nomen: true */
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
moment
,
initGadgetMixin
)
{
(
function
(
window
,
rJS
,
RSVP
,
moment
,
initGadgetMixin
)
{
"
use strict
"
;
function
job_schedule_spreadsheet_widget
(
all_data
)
{
var
now
=
new
Date
(),
input_data
=
all_data
.
input
,
output_data
=
all_data
.
result
,
spreadsheet_data
=
[],
spreadsheet_header
=
[
[
"
Jobs
"
,
"
ID
"
,
"
Project Manager
"
,
"
Due Date
"
,
"
Priority
"
,
"
Entrance Time
"
,
"
Processing Time
"
,
"
Station ID
"
,
"
Step No.
"
]
],
simulation_start_date
=
new
Date
(
input_data
.
general
.
currentDate
||
now
.
getTime
()),
i
,
j
,
k
,
obj
,
node
,
component
,
order
,
node_id
,
due_date
,
entrance_date
,
duration
,
schedule
,
input_job
=
null
,
input_order
=
null
;
...
...
@@ -90,22 +90,21 @@
}
var
gadget_klass
=
rJS
(
window
);
initGadgetMixin
(
gadget_klass
);
initDocumentPageMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
jio_key
=
options
.
id
,
gadget
=
this
;
gadget
.
props
.
jio_key
=
jio_key
;
gadget
.
props
.
result
=
options
.
result
;
return
new
RSVP
.
Queue
().
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
aq_getAttachment
({
_id
:
jio_key
,
_attachment
:
"
simulation.json
"
}),
gadget
.
getDeclaredGadget
(
"
tableeditor
"
)
]);
}).
push
(
function
(
result_list
)
{
// XXX Hardcoded result
return
result_list
[
1
].
render
(
JSON
.
stringify
(
job_schedule_spreadsheet_widget
(
JSON
.
parse
(
result_list
[
0
])[
0
])));
return
result_list
[
1
].
render
(
JSON
.
stringify
(
job_schedule_spreadsheet_widget
(
JSON
.
parse
(
result_list
[
0
])[
gadget
.
props
.
result
])));
});
}).
declareMethod
(
"
startService
"
,
function
()
{
return
this
.
getDeclaredGadget
(
"
tableeditor
"
).
push
(
function
(
tableeditor
)
{
return
tableeditor
.
startService
();
});
});
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
moment
,
initGadgetMixin
);
\ No newline at end of file
})(
window
,
rJS
,
RSVP
,
moment
,
initGadgetMixin
);
\ No newline at end of file
dream/platform/static/dream/Output_viewQueueStatGraph.html
View file @
147826e9
...
...
@@ -9,7 +9,6 @@
<script
src=
"../lib/jquery.flot.js"
></script>
<script
src=
"../lib/jquery.flot.stack.js"
></script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_document_page.js"
type=
"text/javascript"
></script>
<script
src=
"Output_viewQueueStatGraph.js"
type=
"text/javascript"
></script>
</head>
<body>
...
...
dream/platform/static/dream/Output_viewQueueStatGraph.js
View file @
147826e9
/*global console, rJS, RSVP,
initDocumentPageMixin,
jQuery, initGadgetMixin */
/*global console, rJS, RSVP, jQuery, initGadgetMixin */
/*jslint nomen: true */
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
$
,
initGadgetMixin
)
{
(
function
(
window
,
rJS
,
RSVP
,
$
,
initGadgetMixin
)
{
"
use strict
"
;
function
queue_stat_widget
(
output_data
)
{
/* FIXME: does not support more than one replic.
...
...
@@ -19,19 +19,18 @@
}
var
gadget_klass
=
rJS
(
window
);
initGadgetMixin
(
gadget_klass
);
initDocumentPageMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
jio_key
=
options
.
id
,
gadget
=
this
;
gadget
.
props
.
jio_key
=
jio_key
;
gadget
.
props
.
result
=
options
.
result
;
return
gadget
.
aq_getAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
simulation.json
"
}).
push
(
function
(
simulation_json
)
{
gadget
.
props
.
series
=
queue_stat_widget
(
// XXX Hardcoded result
JSON
.
parse
(
simulation_json
)[
0
].
result
);
gadget
.
props
.
series
=
queue_stat_widget
(
JSON
.
parse
(
simulation_json
)[
gadget
.
props
.
result
].
result
);
});
}).
declareMethod
(
"
startService
"
,
function
()
{
// XXX Manually calculate width and height when resizing
$
.
plot
(
this
.
props
.
element
.
querySelector
(
"
.graph_container
"
),
this
.
props
.
series
);
});
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
jQuery
,
initGadgetMixin
);
\ No newline at end of file
})(
window
,
rJS
,
RSVP
,
jQuery
,
initGadgetMixin
);
\ No newline at end of file
dream/platform/static/dream/Output_viewStationUtilisationGraph.html
View file @
147826e9
...
...
@@ -10,7 +10,6 @@
<script
src=
"../lib/jquery.flot.js"
></script>
<script
src=
"../lib/jquery.flot.stack.js"
></script>
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"mixin_document_page.js"
type=
"text/javascript"
></script>
<script
src=
"Output_viewStationUtilisationGraph.js"
type=
"text/javascript"
></script>
</head>
<body>
...
...
dream/platform/static/dream/Output_viewStationUtilisationGraph.js
View file @
147826e9
/*global console, rJS, RSVP,
initDocumentPageMixin,
jQuery, initGadgetMixin */
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
$
,
initGadgetMixin
)
{
/*global console, rJS, RSVP, jQuery, initGadgetMixin */
(
function
(
window
,
rJS
,
RSVP
,
$
,
initGadgetMixin
)
{
"
use strict
"
;
function
station_utilisation_graph_widget
(
output_data
)
{
var
blockage_data
=
[],
waiting_data
=
[],
failure_data
=
[],
working_data
=
[],
ticks
=
[],
counter
=
1
,
series
,
options
;
...
...
@@ -97,19 +97,18 @@
}
var
gadget_klass
=
rJS
(
window
);
initGadgetMixin
(
gadget_klass
);
initDocumentPageMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
jio_key
=
options
.
id
,
gadget
=
this
;
gadget
.
props
.
jio_key
=
jio_key
;
gadget
.
props
.
result
=
options
.
result
;
return
gadget
.
aq_getAttachment
({
_id
:
gadget
.
props
.
jio_key
,
_attachment
:
"
simulation.json
"
}).
push
(
function
(
simulation_json
)
{
gadget
.
props
.
result_list
=
station_utilisation_graph_widget
(
// XXX Hardcoded result
JSON
.
parse
(
simulation_json
)[
0
].
result
);
gadget
.
props
.
result_list
=
station_utilisation_graph_widget
(
JSON
.
parse
(
simulation_json
)[
gadget
.
props
.
result
].
result
);
});
}).
declareMethod
(
"
startService
"
,
function
()
{
// XXX Manually calculate width and height when resizing
$
.
plot
(
this
.
props
.
element
.
querySelector
(
"
.graph_container
"
),
this
.
props
.
result_list
[
0
],
this
.
props
.
result_list
[
1
]);
});
})(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
jQuery
,
initGadgetMixin
);
\ No newline at end of file
})(
window
,
rJS
,
RSVP
,
jQuery
,
initGadgetMixin
);
\ No newline at end of file
dream/platform/static/dream/index.css
View file @
147826e9
@media
(
min-width
:
35em
){
.jqm-navmenu-panel.ui-panel-closed
{
visibility
:
visible
!important
;
width
:
17em
;
-webkit-transition
:
none
!important
;
-moz-transition
:
none
!important
;
transition
:
none
!important
;
-webkit-transform
:
none
!important
;
-moz-transform
:
none
!important
;
transform
:
none
!important
;
-webkit-box-shadow
:
none
;
-moz-box-shadow
:
none
;
box-shadow
:
none
;
height
:
100%
;
position
:
absolute
;
display
:
block
}
.ui-panel-page-content-open
{
width
:
auto
}
.ui-panel-page-content-open.ui-panel-page-content-position-left
{
margin-right
:
17em
}
.ui-panel-dismiss
,
.menu_link
{
display
:
none
!important
}
.gadget_container
,
header
{
margin-left
:
17em
}
.close-entry
{
display
:
none
!important
}
.gadget_container
{
padding
:
1em
}}
[
data-gadget-scope
=
productionline
]
#main
{
position
:
relative
;
margin
:
20px
auto
;
font-size
:
80%
;
border
:
1px
solid
#999
;
width
:
100%
;
height
:
600px
;
overflow
:
hidden
;
border-radius
:
10px
;
background-color
:
#eaedef
;
text-align
:
center
}
[
data-gadget-scope
=
productionline
]
.selected
{
color
:
#bd0b0b
!important
}
[
data-gadget-scope
=
productionline
]
.window
,[
data-gadget-scope
=
productionline
]
.label
{
background-color
:
#fff
;
text-align
:
center
;
z-index
:
23
;
cursor
:
pointer
;
box-shadow
:
2px
2px
19px
#aaa
;
-o-box-shadow
:
2px
2px
19px
#aaa
;
-webkit-box-shadow
:
2px
2px
19px
#aaa
;
-moz-box-shadow
:
2px
2px
19px
#aaa
}
[
data-gadget-scope
=
productionline
]
path
,[
data-gadget-scope
=
productionline
]
._jsPlumb_endpoint
{
cursor
:
pointer
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_endpoint_drop_allowed
{
border
:
4px
solid
#123456
;
box-shadow
:
6px
6px
19px
#444
;
-o-box-shadow
:
6px
6px
19px
#444
;
-webkit-box-shadow
:
6px
6px
19px
#444
;
-moz-box-shadow
:
6px
6px
19px
#444
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_connector
{
z-index
:
18
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_endpoint
{
z-index
:
19
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_overlay
{
z-index
:
23
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_connector._jsPlumb_hover
{
z-index
:
21
!important
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_endpoint._jsPlumb_hover
{
z-index
:
22
!important
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_overlay
{
border
:
1px
solid
#346789
;
opacity
:
.8
;
filter
:
alpha
(
opacity
=
80
);
background-color
:
#fff
;
color
:
#000
;
font-family
:
helvetica
;
padding
:
.5em
}
[
data-gadget-scope
=
productionline
]
.Dream-Source
,[
data-gadget-scope
=
productionline
]
.Dream-BatchSource
{
border
:
1px
solid
#bbc
;
background-color
:
#ffe
;
background-image
:
linear-gradient
(
to
bottom
,
#ffe
0
,
#dde
100%
)}
[
data-gadget-scope
=
productionline
]
.Dream-Machine
,[
data-gadget-scope
=
productionline
]
.Dream-MachineJobShop
,[
data-gadget-scope
=
productionline
]
.Dream-BatchScrapMachine
,[
data-gadget-scope
=
productionline
]
.Dream-MachineManagedJob
,[
data-gadget-scope
=
productionline
]
.Dream-MouldAssembly
{
border
:
1px
solid
#cbc
;
background-color
:
#fef
;
background-image
:
linear-gradient
(
to
bottom
,
#fef
0
,
#ede
100%
)}
[
data-gadget-scope
=
productionline
]
.Dream-Queue
,[
data-gadget-scope
=
productionline
]
.Dream-QueueJobShop
,[
data-gadget-scope
=
productionline
]
.Dream-LineClearance
,[
data-gadget-scope
=
productionline
]
.Dream-QueueManagedJob
,[
data-gadget-scope
=
productionline
]
.Dream-ConditionalBuffer
,[
data-gadget-scope
=
productionline
]
.Dream-OrderDecomposition
,[
data-gadget-scope
=
productionline
]
.Dream-MouldAssemblyBuffer
{
border
:
1px
solid
#bcc
;
background-color
:
#eff
;
background-image
:
linear-gradient
(
to
bottom
,
#eff
0
,
#dee
100%
)}
[
data-gadget-scope
=
productionline
]
.Dream-Exit
,[
data-gadget-scope
=
productionline
]
.Dream-ExitJobShop
{
border
:
1px
solid
#ccb
;
background-color
:
#eef
;
background-image
:
linear-gradient
(
to
bottom
,
#eef
0
,
#dde
100%
)}
[
data-gadget-scope
=
productionline
]
.Dream-EventGenerator
{
border
:
1px
solid
#cba
;
background-color
:
#fdc
;
background-image
:
linear-gradient
(
to
bottom
,
#fdc
0
,
#ecb
100%
)}
[
data-gadget-scope
=
productionline
]
.Dream-BatchDecomposition
,[
data-gadget-scope
=
productionline
]
.Dream-BatchDecompositionStartTime
,[
data-gadget-scope
=
productionline
]
.Dream-BatchReassembly
{
border
:
1px
solid
#bcb
;
background-color
:
#dfd
;
background-image
:
linear-gradient
(
to
bottom
,
#dfd
0
,
#cec
100%
)}
[
data-gadget-scope
=
productionline
]
.Dream-Repairman
{
border
:
1px
solid
#cbb
;
background-color
:
#fdd
;
background-image
:
linear-gradient
(
to
bottom
,
#fdd
0
,
#dcc
100%
)}
[
data-gadget-scope
=
productionline
]
.window
,[
data-gadget-scope
=
productionline
]
.dummy_window
{
border
:
1px
solid
#d3d3d3
;
width
:
100px
;
height
:
64px
;
position
:
absolute
;
color
:
#000
;
font-family
:
serif
;
font-style
:
italic
;
padding-top
:
.9em
;
font-size
:
.9em
;
cursor
:
move
;
font-size
:
11px
;
-webkit-transition
:
background-color
.1s
ease-in
;
-moz-transition
:
background-color
.1s
ease-in
;
transition
:
background-color
.1s
ease-in
;
border-radius
:
5px
}
[
data-gadget-scope
=
productionline
]
.window
:hover
{
background-color
:
#5c96bc
;
background-image
:
none
;
color
:
#fff
}
[
data-gadget-scope
=
productionline
]
.dummy_window
{
position
:
absolute
;
top
:
0
;
left
:
0
;
visibility
:
hidden
}
[
data-gadget-scope
=
productionline
]
.ep
{
position
:
absolute
;
bottom
:
37%
;
right
:
5px
;
width
:
1em
;
height
:
1em
;
background-color
:
orange
;
cursor
:
pointer
;
box-shadow
:
0
0
2px
#000
;
-webkit-transition
:
-webkit-box-shadow
.25s
ease-in
;
-moz-transition
:
-moz-box-shadow
.25s
ease-in
;
transition
:
box-shadow
.25s
ease-in
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_source_hover
,[
data-gadget-scope
=
productionline
]
._jsPlumb_target_hover
,[
data-gadget-scope
=
productionline
]
.dragHover
{
background-color
:
#1e8151
;
background-image
:
none
;
color
:
#fff
}
[
data-gadget-scope
=
productionline
]
path
{
cursor
:
pointer
}
\ No newline at end of file
@media
(
min-width
:
35em
){
.jqm-navmenu-panel.ui-panel-closed
{
visibility
:
visible
!important
;
width
:
17em
;
-webkit-transition
:
none
!important
;
-moz-transition
:
none
!important
;
transition
:
none
!important
;
-webkit-transform
:
none
!important
;
-moz-transform
:
none
!important
;
transform
:
none
!important
;
-webkit-box-shadow
:
none
;
-moz-box-shadow
:
none
;
box-shadow
:
none
;
height
:
100%
;
position
:
absolute
;
display
:
block
}
.ui-panel-page-content-open
{
width
:
auto
}
.ui-panel-page-content-open.ui-panel-page-content-position-left
{
margin-right
:
17em
}
.ui-panel-dismiss
,
.menu_link
{
display
:
none
!important
}
.gadget_container
,
header
,
nav
{
margin-left
:
17em
}
.close-entry
{
display
:
none
!important
}
.gadget_container
{
padding
:
1em
}}
[
data-gadget-scope
=
productionline
]
#main
{
position
:
relative
;
margin
:
20px
auto
;
font-size
:
80%
;
border
:
1px
solid
#999
;
width
:
100%
;
height
:
600px
;
overflow
:
hidden
;
border-radius
:
10px
;
background-color
:
#eaedef
;
text-align
:
center
}
[
data-gadget-scope
=
productionline
]
.selected
{
color
:
#bd0b0b
!important
}
[
data-gadget-scope
=
productionline
]
.window
,[
data-gadget-scope
=
productionline
]
.label
{
background-color
:
#fff
;
text-align
:
center
;
z-index
:
23
;
cursor
:
pointer
;
box-shadow
:
2px
2px
19px
#aaa
;
-o-box-shadow
:
2px
2px
19px
#aaa
;
-webkit-box-shadow
:
2px
2px
19px
#aaa
;
-moz-box-shadow
:
2px
2px
19px
#aaa
}
[
data-gadget-scope
=
productionline
]
path
,[
data-gadget-scope
=
productionline
]
._jsPlumb_endpoint
{
cursor
:
pointer
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_endpoint_drop_allowed
{
border
:
4px
solid
#123456
;
box-shadow
:
6px
6px
19px
#444
;
-o-box-shadow
:
6px
6px
19px
#444
;
-webkit-box-shadow
:
6px
6px
19px
#444
;
-moz-box-shadow
:
6px
6px
19px
#444
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_connector
{
z-index
:
18
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_endpoint
{
z-index
:
19
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_overlay
{
z-index
:
23
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_connector._jsPlumb_hover
{
z-index
:
21
!important
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_endpoint._jsPlumb_hover
{
z-index
:
22
!important
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_overlay
{
border
:
1px
solid
#346789
;
opacity
:
.8
;
filter
:
alpha
(
opacity
=
80
);
background-color
:
#fff
;
color
:
#000
;
font-family
:
helvetica
;
padding
:
.5em
}
[
data-gadget-scope
=
productionline
]
.Dream-Source
,[
data-gadget-scope
=
productionline
]
.Dream-BatchSource
{
border
:
1px
solid
#bbc
;
background-color
:
#ffe
;
background-image
:
linear-gradient
(
to
bottom
,
#ffe
0
,
#dde
100%
)}
[
data-gadget-scope
=
productionline
]
.Dream-Machine
,[
data-gadget-scope
=
productionline
]
.Dream-MachineJobShop
,[
data-gadget-scope
=
productionline
]
.Dream-BatchScrapMachine
,[
data-gadget-scope
=
productionline
]
.Dream-MachineManagedJob
,[
data-gadget-scope
=
productionline
]
.Dream-MouldAssembly
{
border
:
1px
solid
#cbc
;
background-color
:
#fef
;
background-image
:
linear-gradient
(
to
bottom
,
#fef
0
,
#ede
100%
)}
[
data-gadget-scope
=
productionline
]
.Dream-Queue
,[
data-gadget-scope
=
productionline
]
.Dream-QueueJobShop
,[
data-gadget-scope
=
productionline
]
.Dream-LineClearance
,[
data-gadget-scope
=
productionline
]
.Dream-QueueManagedJob
,[
data-gadget-scope
=
productionline
]
.Dream-ConditionalBuffer
,[
data-gadget-scope
=
productionline
]
.Dream-OrderDecomposition
,[
data-gadget-scope
=
productionline
]
.Dream-MouldAssemblyBuffer
{
border
:
1px
solid
#bcc
;
background-color
:
#eff
;
background-image
:
linear-gradient
(
to
bottom
,
#eff
0
,
#dee
100%
)}
[
data-gadget-scope
=
productionline
]
.Dream-Exit
,[
data-gadget-scope
=
productionline
]
.Dream-ExitJobShop
{
border
:
1px
solid
#ccb
;
background-color
:
#eef
;
background-image
:
linear-gradient
(
to
bottom
,
#eef
0
,
#dde
100%
)}
[
data-gadget-scope
=
productionline
]
.Dream-EventGenerator
{
border
:
1px
solid
#cba
;
background-color
:
#fdc
;
background-image
:
linear-gradient
(
to
bottom
,
#fdc
0
,
#ecb
100%
)}
[
data-gadget-scope
=
productionline
]
.Dream-BatchDecomposition
,[
data-gadget-scope
=
productionline
]
.Dream-BatchDecompositionStartTime
,[
data-gadget-scope
=
productionline
]
.Dream-BatchReassembly
{
border
:
1px
solid
#bcb
;
background-color
:
#dfd
;
background-image
:
linear-gradient
(
to
bottom
,
#dfd
0
,
#cec
100%
)}
[
data-gadget-scope
=
productionline
]
.Dream-Repairman
{
border
:
1px
solid
#cbb
;
background-color
:
#fdd
;
background-image
:
linear-gradient
(
to
bottom
,
#fdd
0
,
#dcc
100%
)}
[
data-gadget-scope
=
productionline
]
.window
,[
data-gadget-scope
=
productionline
]
.dummy_window
{
border
:
1px
solid
#d3d3d3
;
width
:
100px
;
height
:
64px
;
position
:
absolute
;
color
:
#000
;
font-family
:
serif
;
font-style
:
italic
;
padding-top
:
.9em
;
font-size
:
.9em
;
cursor
:
move
;
font-size
:
11px
;
-webkit-transition
:
background-color
.1s
ease-in
;
-moz-transition
:
background-color
.1s
ease-in
;
transition
:
background-color
.1s
ease-in
;
border-radius
:
5px
}
[
data-gadget-scope
=
productionline
]
.window
:hover
{
background-color
:
#5c96bc
;
background-image
:
none
;
color
:
#fff
}
[
data-gadget-scope
=
productionline
]
.dummy_window
{
position
:
absolute
;
top
:
0
;
left
:
0
;
visibility
:
hidden
}
[
data-gadget-scope
=
productionline
]
.ep
{
position
:
absolute
;
bottom
:
37%
;
right
:
5px
;
width
:
1em
;
height
:
1em
;
background-color
:
orange
;
cursor
:
pointer
;
box-shadow
:
0
0
2px
#000
;
-webkit-transition
:
-webkit-box-shadow
.25s
ease-in
;
-moz-transition
:
-moz-box-shadow
.25s
ease-in
;
transition
:
box-shadow
.25s
ease-in
}
[
data-gadget-scope
=
productionline
]
._jsPlumb_source_hover
,[
data-gadget-scope
=
productionline
]
._jsPlumb_target_hover
,[
data-gadget-scope
=
productionline
]
.dragHover
{
background-color
:
#1e8151
;
background-image
:
none
;
color
:
#fff
}
[
data-gadget-scope
=
productionline
]
path
{
cursor
:
pointer
}
\ No newline at end of file
dream/platform/static/dream/index.html
View file @
147826e9
...
...
@@ -16,13 +16,24 @@
<script
src=
"mixin_gadget.js"
type=
"text/javascript"
></script>
<script
src=
"index.js"
type=
"text/javascript"
></script>
<script
id=
"
navigation
-template"
type=
"text/x-handlebars-template"
>
<script
id=
"
panel
-template"
type=
"text/x-handlebars-template"
>
<
ul
data
-
role
=
"
listview
"
>
<
li
><
a
class
=
"
home_link ui-btn ui-icon-home ui-btn-icon-left
"
data
-
icon
=
"
home
"
>
Documents
<
/a></
li
>
<
li
><
a
class
=
"
fast_input_link ui-btn ui-icon-plus ui-btn-icon-left
"
data
-
icon
=
"
plus
"
>
New
Document
<
/a></
li
>
{{
#
navigationlist
}}
<
li
><
a
href
=
"
{{link}}
"
>
{{
title
}}
<
/a></
li
>
{{
/
navigationlist
}}
<
/ul
>
</script>
<script
id=
"active-navigation-template"
type=
"text/x-handlebars-template"
>
<
li
><
a
class
=
"
ui-btn-active ui-state-persist
"
href
=
"
{{link}}
"
>
{{
title
}}
<
/a></
li
>
</script>
<script
id=
"navigation-template"
type=
"text/x-handlebars-template"
>
<
li
><
a
href
=
"
{{link}}
"
>
{{
title
}}
<
/a></
li
>
</script>
</head>
<body>
...
...
@@ -36,11 +47,14 @@
</div>
<header
data-role=
"header"
>
<a
href=
"#leftpanel"
class=
"menu_link"
>
Menu
</a>
<a
href=
"#leftpanel"
data-icon=
"bars"
class=
"menu_link ui-btn ui-icon-bars ui-btn-icon-left"
>
Menu
</a>
<h1>
Dream Simulation
</h1>
<a
class=
"home_link ui-btn ui-icon-home ui-btn-icon-left"
data-icon=
"home"
>
Home
</a>
</header>
<div
class=
"nav_container"
></div>
<article
class=
"gadget_container"
></article>
<aside>
...
...
dream/platform/static/dream/index.js
View file @
147826e9
...
...
@@ -9,7 +9,128 @@
$
.
mobile
.
linkBindingEnabled
=
false
;
$
.
mobile
.
hashListeningEnabled
=
false
;
$
.
mobile
.
pushStateEnabled
=
false
;
var
navigation_template
,
gadget_klass
=
rJS
(
window
);
/////////////////////////////////////////////////////////////////
// Minimalistic ERP5's like portal type configuration
/////////////////////////////////////////////////////////////////
var
portal_types
=
{
"
Input Module
"
:
{
view
:
{
gadget
:
"
InputModule_viewInputList
"
,
type
:
"
object_list
"
,
title
:
"
Document List
"
},
view_fast_input
:
{
gadget
:
"
InputModule_viewAddDocumentDialog
"
,
type
:
"
object_fast_input
"
,
title
:
"
Create Document
"
}
},
Input
:
{
view
:
{
gadget
:
"
Input_viewProductionLine
"
,
type
:
"
object_view
"
,
title
:
"
Production Line
"
},
view_table
:
{
gadget
:
"
Input_viewTable
"
,
type
:
"
object_view
"
,
title
:
"
Edit table
"
},
view_simu
:
{
gadget
:
"
Input_viewSimulation
"
,
type
:
"
object_view
"
,
title
:
"
Run simulation
"
},
view_management
:
{
gadget
:
"
Input_viewDocumentManagement
"
,
type
:
"
object_view
"
,
title
:
"
Manage document
"
},
view_result
:
{
gadget
:
"
Input_viewResultList
"
,
type
:
"
object_view
"
,
title
:
"
Results
"
}
},
Output
:
{
view
:
{
gadget
:
"
Output_viewStationUtilisationGraph
"
,
type
:
"
object_view
"
,
title
:
"
Stations Utilization
"
},
view_queue_stat
:
{
gadget
:
"
Output_viewQueueStatGraph
"
,
type
:
"
object_view
"
,
title
:
"
Queues Statistics
"
},
view_exit_stat
:
{
gadget
:
"
Output_viewExitStatistics
"
,
type
:
"
object_view
"
,
title
:
"
Exit Statistics
"
},
view_gantt
:
{
gadget
:
"
Output_viewJobGantt
"
,
type
:
"
object_view
"
,
title
:
"
Job Gantt
"
},
view_schedule
:
{
gadget
:
"
Output_viewJobScheduleSpreadsheet
"
,
type
:
"
object_view
"
,
title
:
"
Job Schedule
"
},
view_debug
:
{
gadget
:
"
Output_viewDebugJson
"
,
type
:
"
object_view
"
,
title
:
"
Debug JSON
"
}
}
},
panel_template
,
navigation_template
,
active_navigation_template
,
gadget_klass
=
rJS
(
window
);
function
calculateTabHTML
(
gadget
,
options
,
key
,
title
,
active
)
{
return
new
RSVP
.
Queue
().
push
(
function
()
{
var
kw
=
{
action
:
key
,
id
:
options
.
id
};
if
(
options
.
result
!==
undefined
)
{
kw
.
result
=
options
.
result
;
}
return
gadget
.
aq_pleasePublishMyState
(
kw
);
}).
push
(
function
(
url
)
{
var
kw
=
{
title
:
title
,
link
:
url
};
if
(
active
===
true
)
{
return
active_navigation_template
(
kw
);
}
return
navigation_template
(
kw
);
});
}
function
calculateNavigationHTML
(
gadget
,
portal_type
,
options
)
{
var
nav_html
,
action
;
if
(
portal_types
[
portal_type
][
options
.
action
].
type
===
"
object_view
"
)
{
return
new
RSVP
.
Queue
().
push
(
function
()
{
var
url_list
=
[],
key2
;
for
(
key2
in
portal_types
[
portal_type
])
{
if
(
portal_types
[
portal_type
].
hasOwnProperty
(
key2
))
{
action
=
portal_types
[
portal_type
][
key2
];
if
(
action
.
type
===
"
object_view
"
)
{
url_list
.
push
(
calculateTabHTML
(
gadget
,
options
,
key2
,
action
.
title
,
key2
===
options
.
action
));
}
}
}
return
RSVP
.
all
(
url_list
);
}).
push
(
function
(
entry_list
)
{
var
i
;
nav_html
=
'
<nav data-role="navbar" data-collapsible="true"><ul>
'
;
for
(
i
=
0
;
i
<
entry_list
.
length
;
i
+=
1
)
{
nav_html
+=
entry_list
[
i
];
}
nav_html
+=
"
</ul></nav>
"
;
return
nav_html
;
});
}
}
initGadgetMixin
(
gadget_klass
);
gadget_klass
.
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
).
allowPublicAcquisition
(
"
allDocs
"
,
function
(
param_list
)
{
return
this
.
getDeclaredGadget
(
"
jio
"
).
push
(
function
(
jio_gadget
)
{
...
...
@@ -42,26 +163,45 @@
}).
allowPublicAcquisition
(
"
whoWantToDisplayHome
"
,
function
(
param_list
)
{
// Hey, I want to display some URL
return
this
.
aq_pleasePublishMyState
({});
}).
allowPublicAcquisition
(
"
whoWantToDisplayThisPage
"
,
function
(
param_list
)
{
// Hey, I want to display some URL
return
this
.
aq_pleasePublishMyState
({
page
:
param_list
[
0
]
});
}).
allowPublicAcquisition
(
"
whoWantToDisplayThisDocument
"
,
function
(
param_list
)
{
// Hey, I want to display some jIO document
return
this
.
aq_pleasePublishMyState
({
page
:
"
Input_viewTable
"
,
id
:
param_list
[
0
]
});
}).
allowPublicAcquisition
(
"
whoWantToDisplayThisDocumentPage
"
,
function
(
param_list
)
{
var
kw
=
{
action
:
param_list
[
1
]
||
"
view
"
};
if
(
param_list
[
0
]
!==
undefined
)
{
kw
.
id
=
param_list
[
0
];
}
return
this
.
aq_pleasePublishMyState
(
kw
);
}).
allowPublicAcquisition
(
"
whoWantToDisplayThisResult
"
,
function
(
param_list
)
{
// Hey, I want to display some jIO document
return
this
.
aq_pleasePublishMyState
({
page
:
param_list
[
0
],
id
:
param_list
[
1
]
action
:
"
view
"
,
id
:
param_list
[
0
],
result
:
param_list
[
1
]
});
}).
allowPublicAcquisition
(
"
getConfigurationDict
"
,
function
(
param_list
)
{
return
this
.
props
.
configuration_dict
;
}).
ready
(
function
(
g
)
{
if
(
panel_template
===
undefined
)
{
// XXX Only works as root gadget
panel_template
=
Handlebars
.
compile
(
document
.
getElementById
(
"
panel-template
"
).
innerHTML
);
navigation_template
=
Handlebars
.
compile
(
document
.
getElementById
(
"
navigation-template
"
).
innerHTML
);
active_navigation_template
=
Handlebars
.
compile
(
document
.
getElementById
(
"
active-navigation-template
"
).
innerHTML
);
}
}).
ready
(
function
(
g
)
{
return
g
.
aq_pleasePublishMyState
({}).
push
(
function
(
link
)
{
g
.
props
.
element
.
getElementsByClassName
(
"
home_link
"
)[
0
].
href
=
link
;
return
new
RSVP
.
Queue
().
push
(
function
()
{
return
RSVP
.
all
([
g
.
aq_pleasePublishMyState
({}),
g
.
aq_pleasePublishMyState
({
action
:
"
view_fast_input
"
})
]);
}).
push
(
function
(
link_list
)
{
var
panel
=
g
.
props
.
element
.
querySelector
(
"
#leftpanel
"
);
panel
.
innerHTML
=
panel_template
({
navigationlist
:
[]
});
panel
.
getElementsByClassName
(
"
home_link
"
)[
0
].
href
=
link_list
[
0
];
panel
.
getElementsByClassName
(
"
fast_input_link
"
)[
0
].
href
=
link_list
[
1
];
// XXX JQuery mobile
$
(
panel
).
trigger
(
"
create
"
);
});
}).
ready
(
function
(
g
)
{
var
jio_gadget
;
...
...
@@ -80,43 +220,42 @@
}).
push
(
function
(
evt
)
{
g
.
props
.
configuration_dict
=
JSON
.
parse
(
evt
.
target
.
responseText
);
});
}).
ready
(
function
(
g
)
{
if
(
navigation_template
===
undefined
)
{
// XXX Only works as root gadget
var
source
=
document
.
getElementById
(
"
navigation-template
"
).
innerHTML
;
navigation_template
=
Handlebars
.
compile
(
source
);
}
}).
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
page_gadget
,
element
=
gadget
.
props
.
element
.
getElementsByClassName
(
"
gadget_container
"
)[
0
];
options
.
configuration_dict
=
gadget
.
props
.
configuration_dict
;
if
(
options
.
page
===
undefined
)
{
// Redirect to the about page
return
gadget
.
aq_pleasePublishMyState
({
page
:
"
InputModule_viewInputList
"
}).
push
(
gadget
.
pleaseRedirectMyHash
.
bind
(
gadget
));
}
return
gadget
.
declareGadget
(
options
.
page
+
"
.html
"
).
push
(
function
(
g
)
{
var
gadget
=
this
,
page_gadget
,
portal_type
=
"
Input Module
"
,
nav_element
=
gadget
.
props
.
element
.
getElementsByClassName
(
"
nav_container
"
)[
0
],
element
=
gadget
.
props
.
element
.
getElementsByClassName
(
"
gadget_container
"
)[
0
];
if
(
options
.
action
===
undefined
)
{
// Redirect to the view action
options
.
action
=
"
view
"
;
return
gadget
.
aq_pleasePublishMyState
(
options
).
push
(
gadget
.
pleaseRedirectMyHash
.
bind
(
gadget
));
}
// Detect what is the kind of document displayed
if
(
options
.
id
!==
undefined
)
{
if
(
options
.
result
===
undefined
)
{
portal_type
=
"
Input
"
;
}
else
{
portal_type
=
"
Output
"
;
}
}
// Get the action informations
return
gadget
.
declareGadget
(
portal_types
[
portal_type
][
options
.
action
].
gadget
+
"
.html
"
).
push
(
function
(
g
)
{
page_gadget
=
g
;
if
(
page_gadget
.
render
!==
undefined
)
{
return
page_gadget
.
render
(
options
);
}
}).
push
(
function
()
{
var
navigation_list
=
[];
if
(
page_gadget
.
getNavigationList
!==
undefined
)
{
navigation_list
=
page_gadget
.
getNavigationList
();
}
return
RSVP
.
all
([
page_gadget
.
getTitle
(),
page_gadget
.
getElement
(),
navigation_list
]);
return
RSVP
.
all
([
page_gadget
.
getElement
(),
calculateNavigationHTML
(
gadget
,
portal_type
,
options
)
]);
}).
push
(
function
(
result_list
)
{
var
title
=
result_list
[
0
],
page_element
=
result_list
[
1
],
navigation_list
=
result_list
[
2
],
panel
=
gadget
.
props
.
element
.
querySelector
(
"
#leftpanel
"
);
gadget
.
props
.
element
.
querySelector
(
"
header h1
"
).
textContent
=
title
;
while
(
panel
.
firstChild
)
{
panel
.
removeChild
(
panel
.
firstChild
);
var
nav_html
=
result_list
[
1
],
page_element
=
result_list
[
0
];
// Update title
gadget
.
props
.
element
.
querySelector
(
"
header h1
"
).
textContent
=
portal_type
;
// Update the navigation panel
// Clear the previous rendering
while
(
nav_element
.
firstChild
)
{
nav_element
.
removeChild
(
nav_element
.
firstChild
);
}
if
(
nav_html
!==
undefined
)
{
nav_element
.
innerHTML
=
nav_html
;
$
(
nav_element
).
trigger
(
"
create
"
);
}
panel
.
innerHTML
=
navigation_template
({
navigationlist
:
navigation_list
});
// XXX JQuery mobile
$
(
panel
).
trigger
(
"
create
"
);
// Append in the DOM at the end to reduce flickering and reduce DOM
// modifications
// Clear the previous rendering
...
...
dream/platform/static/jsplumb/index.html
View file @
147826e9
...
...
@@ -2,13 +2,24 @@
<html>
<head>
<meta
charset=
"utf-8"
>
<!--link rel="stylesheet" href="lib/jquery-ui.css"-->
<link
rel=
"stylesheet"
href=
"../lib/jquery-ui.css"
>
<link
rel=
"stylesheet"
href=
"jsplumb.css"
>
<!--script src="curl.jquery.relative_dest %>"></script-->
<!--script src="curl.jqueryuijs.relative_dest %>"></script-->
<script
src=
"../lib/rsvp.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/renderjs.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/jquery.jsplumb.min.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/jquery.js"
></script>
<script
src=
"../lib/jquery-ui.js"
></script>
<script
src=
"../lib/rsvp.min.js"
></script>
<script
src=
"../lib/renderjs.min.js"
></script>
<script
src=
"../lib/jquery.jsplumb.min.js"
></script>
<script
src=
"../lib/handlebars.min.js"
></script>
<script
id=
"node-template"
type=
"text/x-handlebars-template"
>
<
div
class
=
"
window {{class}}
"
id
=
"
{{element_id}}
"
title
=
"
{{title}}
"
>
{{
id
}}
<
div
class
=
"
ep
"
><
/div
>
<
/div
>
</script>
<script
src=
"jsplumb.js"
></script>
</head>
...
...
dream/platform/static/jsplumb/jsplumb.css
0 → 100644
View file @
147826e9
#main
{
position
:
relative
;
margin
:
20px
auto
;
font-size
:
80%
;
border
:
1px
solid
#999
;
width
:
100%
;
height
:
600px
;
overflow
:
hidden
;
border-radius
:
10px
;
background-color
:
#eaedef
;
text-align
:
center
}
.selected
{
color
:
#bd0b0b
!important
}
.window
,
.label
{
background-color
:
#fff
;
text-align
:
center
;
z-index
:
23
;
cursor
:
pointer
;
box-shadow
:
2px
2px
19px
#aaa
;
-o-box-shadow
:
2px
2px
19px
#aaa
;
-webkit-box-shadow
:
2px
2px
19px
#aaa
;
-moz-box-shadow
:
2px
2px
19px
#aaa
}
path
,
._jsPlumb_endpoint
{
cursor
:
pointer
}
._jsPlumb_endpoint_drop_allowed
{
border
:
4px
solid
#123456
;
box-shadow
:
6px
6px
19px
#444
;
-o-box-shadow
:
6px
6px
19px
#444
;
-webkit-box-shadow
:
6px
6px
19px
#444
;
-moz-box-shadow
:
6px
6px
19px
#444
}
._jsPlumb_connector
{
z-index
:
18
}
._jsPlumb_endpoint
{
z-index
:
19
}
._jsPlumb_overlay
{
z-index
:
23
}
._jsPlumb_connector._jsPlumb_hover
{
z-index
:
21
!important
}
._jsPlumb_endpoint._jsPlumb_hover
{
z-index
:
22
!important
}
._jsPlumb_overlay
{
border
:
1px
solid
#346789
;
opacity
:
.8
;
filter
:
alpha
(
opacity
=
80
);
background-color
:
#fff
;
color
:
#000
;
font-family
:
helvetica
;
padding
:
.5em
}
.Dream-Source
,
.Dream-BatchSource
{
border
:
1px
solid
#bbc
;
background-color
:
#ffe
;
background-image
:
linear-gradient
(
to
bottom
,
#ffe
0
,
#dde
100%
)}
.Dream-Machine
,
.Dream-MachineJobShop
,
.Dream-BatchScrapMachine
,
.Dream-MachineManagedJob
,
.Dream-MouldAssembly
{
border
:
1px
solid
#cbc
;
background-color
:
#fef
;
background-image
:
linear-gradient
(
to
bottom
,
#fef
0
,
#ede
100%
)}
.Dream-Queue
,
.Dream-QueueJobShop
,
.Dream-LineClearance
,
.Dream-QueueManagedJob
,
.Dream-ConditionalBuffer
,
.Dream-OrderDecomposition
,
.Dream-MouldAssemblyBuffer
{
border
:
1px
solid
#bcc
;
background-color
:
#eff
;
background-image
:
linear-gradient
(
to
bottom
,
#eff
0
,
#dee
100%
)}
.Dream-Exit
,
.Dream-ExitJobShop
{
border
:
1px
solid
#ccb
;
background-color
:
#eef
;
background-image
:
linear-gradient
(
to
bottom
,
#eef
0
,
#dde
100%
)}
.Dream-EventGenerator
{
border
:
1px
solid
#cba
;
background-color
:
#fdc
;
background-image
:
linear-gradient
(
to
bottom
,
#fdc
0
,
#ecb
100%
)}
.Dream-BatchDecomposition
,
.Dream-BatchDecompositionStartTime
,
.Dream-BatchReassembly
{
border
:
1px
solid
#bcb
;
background-color
:
#dfd
;
background-image
:
linear-gradient
(
to
bottom
,
#dfd
0
,
#cec
100%
)}
.Dream-Repairman
{
border
:
1px
solid
#cbb
;
background-color
:
#fdd
;
background-image
:
linear-gradient
(
to
bottom
,
#fdd
0
,
#dcc
100%
)}
.window
,
.dummy_window
{
border
:
1px
solid
#d3d3d3
;
width
:
100px
;
height
:
64px
;
position
:
absolute
;
color
:
#000
;
font-family
:
serif
;
font-style
:
italic
;
padding-top
:
.9em
;
font-size
:
.9em
;
cursor
:
move
;
font-size
:
11px
;
-webkit-transition
:
background-color
.1s
ease-in
;
-moz-transition
:
background-color
.1s
ease-in
;
transition
:
background-color
.1s
ease-in
;
border-radius
:
5px
}
.window
:hover
{
background-color
:
#5c96bc
;
background-image
:
none
;
color
:
#fff
}
.dummy_window
{
position
:
absolute
;
top
:
0
;
left
:
0
;
visibility
:
hidden
}
.ep
{
position
:
absolute
;
bottom
:
37%
;
right
:
5px
;
width
:
1em
;
height
:
1em
;
background-color
:
orange
;
cursor
:
pointer
;
box-shadow
:
0
0
2px
#000
;
-webkit-transition
:
-webkit-box-shadow
.25s
ease-in
;
-moz-transition
:
-moz-box-shadow
.25s
ease-in
;
transition
:
box-shadow
.25s
ease-in
}
._jsPlumb_source_hover
,
._jsPlumb_target_hover
,
.dragHover
{
background-color
:
#1e8151
;
background-image
:
none
;
color
:
#fff
}
path
{
cursor
:
pointer
}
\ No newline at end of file
dream/platform/static/jsplumb/jsplumb.js
View file @
147826e9
...
...
@@ -15,429 +15,355 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with DREAM. If not, see <http://www.gnu.org/licenses/>.
* ======================================================================== */
/*global jsPlumb, rJS, RSVP */
/*jslint maxlen: 200 */
(
function
(
jsPlumb
,
rJS
,
RSVP
)
{
* ==========================================================================*/
/*global RSVP, rJS, $, jsPlumb, Handlebars*/
(
function
(
RSVP
,
rJS
,
$
,
jsPlumb
,
Handlebars
)
{
"
use strict
"
;
// var that = {}, priv = {}, gadget_element;
//
// that.getNodeId = function (element_id) {
// var node_id;
// $.each(priv.node_container, function (k, v) {
// if (v.element_id === element_id) {
// node_id = k;
// return false;
// }
// });
// return node_id;
// };
//
// that.getElementId = function (node_id) {
// return priv.node_container[node_id].element_id;
// };
//
// that.generateNodeId = function (element_type, option) {
/*jslint nomen: true*/
var
gadget_klass
=
rJS
(
window
),
node_template_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
node-template
"
).
innerHTML
,
node_template
=
Handlebars
.
compile
(
node_template_source
);
function
getNodeId
(
node_container
,
element_id
)
{
var
node_id
;
$
.
each
(
node_container
,
function
(
k
,
v
)
{
if
(
v
.
element_id
===
element_id
)
{
node_id
=
k
;
return
false
;
}
});
return
node_id
;
}
function
getElementId
(
node_container
,
node_id
)
{
return
node_container
[
node_id
].
element_id
;
}
// function generateNodeId(node_container, element_type, option) {
// var n = 1;
// while (((option.short_id || element_type) + n) in priv.node_container) {
// while (node_container[
// ((option.short_id || element_type) + n)
// ] !== undefined) {
// n += 1;
// }
// return (option.short_id || element_type) + n;
// };
//
// that.generateElementId = function () {
// }
// function generateElementId(gadget_element) {
// var n = 1;
// while ($(gadget_element).find('#DreamNode_' + n).length > 0) {
// n += 1;
// }
// return 'DreamNode_' + n;
// };
//
// priv.initJsPlumb = function () {
// jsPlumb.setRenderMode(jsPlumb.SVG);
// jsPlumb.importDefaults({
// HoverPaintStyle: {
// strokeStyle: "#1e8151",
// lineWidth: 2
// },
// Endpoint: ["Dot", {
// radius: 2
// }],
// ConnectionOverlays: [
// ["Arrow", {
// location: 1,
// id: "arrow",
// length: 14,
// foldback: 0.8
// }]
// ],
// Container: "main"
// });
// // listen for clicks on connections, and offer to change values on click.
// jsPlumb.bind("click", function (conn) {
// jsPlumb.detach(conn);
// });
//
// jsPlumb.bind("beforeDetach", function (conn) {
// return confirm("Delete connection?");
// });
//
// jsPlumb.bind("connectionDrag", function (connection) {});
//
// jsPlumb.bind("connectionDragStop", function (connection) {});
// // split in 2 methods ? one for events one for manip
// that.updateConnectionData = function (connection, remove, edge_data) {
// if (remove) {
// delete(priv.edge_container[connection.id]);
// } else {
// priv.edge_container[connection.id] = [
// that.getNodeId(connection.sourceId),
// that.getNodeId(connection.targetId), edge_data || {}
// ];
// }
// priv.onDataChange();
// };
//
// // bind to connection/connectionDetached events, and update the list of connections on screen.
// jsPlumb.bind("connection", function (info, originalEvent) {
// that.updateConnectionData(info.connection);
function
onDataChange
()
{
//$.publish("Dream.Gui.onDataChange", g.private.getData());
return
undefined
;
}
function
convertToAbsolutePosition
(
gadget
,
x
,
y
)
{
var
zoom_level
=
(
gadget
.
private
.
preference_container
.
zoom_level
||
1
)
*
1.1111
,
canvas_size_x
=
$
(
gadget
.
private
.
element
).
find
(
"
#main
"
).
width
(),
canvas_size_y
=
$
(
gadget
.
private
.
element
).
find
(
"
#main
"
).
height
(),
size_x
=
$
(
gadget
.
private
.
element
).
find
(
"
.dummy_window
"
).
width
()
*
zoom_level
,
size_y
=
$
(
gadget
.
private
.
element
).
find
(
"
.dummy_window
"
).
height
()
*
zoom_level
,
top
=
Math
.
floor
(
y
*
(
canvas_size_y
-
size_y
))
+
"
px
"
,
left
=
Math
.
floor
(
x
*
(
canvas_size_x
-
size_x
))
+
"
px
"
;
return
[
left
,
top
];
}
function
convertToRelativePosition
(
gadget
,
x
,
y
)
{
var
zoom_level
=
(
gadget
.
private
.
preference_container
.
zoom_level
||
1
)
*
1.1111
,
canvas_size_x
=
$
(
gadget
.
private
.
element
).
find
(
"
#main
"
).
width
(),
canvas_size_y
=
$
(
gadget
.
private
.
element
).
find
(
"
#main
"
).
height
(),
size_x
=
$
(
gadget
.
private
.
element
).
find
(
"
.dummy_window
"
).
width
()
*
zoom_level
,
size_y
=
$
(
gadget
.
private
.
element
).
find
(
"
.dummy_window
"
).
height
()
*
zoom_level
,
top
=
Math
.
max
(
Math
.
min
(
y
.
replace
(
"
px
"
,
""
)
/
(
canvas_size_y
-
size_y
),
1
),
0
),
left
=
Math
.
max
(
Math
.
min
(
x
.
replace
(
"
px
"
,
""
)
/
(
canvas_size_x
-
size_x
),
1
),
0
);
return
[
left
,
top
];
}
function
updateElementCoordinate
(
gadget
,
node_id
,
coordinate
)
{
var
element_id
=
gadget
.
private
.
node_container
[
node_id
].
element_id
,
coordinates
=
gadget
.
private
.
preference_container
.
coordinates
||
{},
element
,
relative_position
;
if
(
coordinate
===
undefined
)
{
coordinate
=
{};
element
=
$
(
gadget
.
private
.
element
).
find
(
"
#
"
+
element_id
);
relative_position
=
convertToRelativePosition
(
gadget
,
element
.
css
(
"
left
"
),
element
.
css
(
"
top
"
));
coordinate
.
top
=
relative_position
[
1
];
coordinate
.
left
=
relative_position
[
0
];
}
coordinates
[
node_id
]
=
coordinate
;
gadget
.
private
.
preference_container
.
coordinates
=
coordinates
;
onDataChange
();
return
coordinate
;
}
function
draggable
(
gadget
)
{
var
jsplumb_instance
=
gadget
.
private
.
jsplumb_instance
,
stop
=
function
(
element
)
{
updateElementCoordinate
(
gadget
,
getNodeId
(
gadget
.
private
.
node_container
,
element
.
target
.
id
));
};
jsplumb_instance
.
draggable
(
jsplumb_instance
.
getSelector
(
"
.window
"
),
{
containment
:
"
parent
"
,
grid
:
[
10
,
10
],
stop
:
stop
});
jsplumb_instance
.
makeSource
(
jsplumb_instance
.
getSelector
(
"
.window
"
),
{
filter
:
"
.ep
"
,
anchor
:
"
Continuous
"
,
connector
:
[
"
StateMachine
"
,
{
curviness
:
20
}
],
connectorStyle
:
{
strokeStyle
:
"
#5c96bc
"
,
lineWidth
:
2
,
outlineColor
:
"
transparent
"
,
outlineWidth
:
4
}
});
jsplumb_instance
.
makeTarget
(
jsplumb_instance
.
getSelector
(
"
.window
"
),
{
dropOptions
:
{
hoverClass
:
"
dragHover
"
},
anchor
:
"
Continuous
"
});
}
function
initJsPlumb
(
gadget
)
{
var
jsplumb_instance
=
gadget
.
private
.
jsplumb_instance
;
jsplumb_instance
.
setRenderMode
(
jsplumb_instance
.
SVG
);
jsplumb_instance
.
importDefaults
({
HoverPaintStyle
:
{
strokeStyle
:
"
#1e8151
"
,
lineWidth
:
2
},
Endpoint
:
[
"
Dot
"
,
{
radius
:
2
}
],
ConnectionOverlays
:
[
[
"
Arrow
"
,
{
location
:
1
,
id
:
"
arrow
"
,
length
:
14
,
foldback
:
.
8
}
]
],
Container
:
"
main
"
});
// listen for clicks on connections,
// and offer to change values on click.
// jsplumb_instance.bind("click", function (conn) {
// jsplumb_instance.detach(conn);
// });
// jsPlumb.bind("connectionDetached", function (info, originalEvent
) {
// that.updateConnectionData(info.connection, true
);
// jsplumb_instance.bind("beforeDetach", function (conn
) {
// return confirm("Delete connection?"
);
// });
// priv.onDataChange();
// priv.draggable();
// };
//
// priv.updateElementCoordinate = function (node_id, coordinate) {
// var element_id = priv.node_container[node_id].element_id;
// var coordinates = priv.preference_container['coordinates'] || {}, element;
// if (coordinate === undefined) {
// coordinate = {};
// element = $(gadget_element).find("#" + element_id);
// var relative_position = that.convertToRelativePosition(
// element.css('left'), element.css('top'));
// coordinate.top = relative_position[1];
// coordinate.left = relative_position[0];
// }
// coordinates[node_id] = coordinate;
// priv.preference_container['coordinates'] = coordinates;
// priv.onDataChange();
// return coordinate;
// };
//
// priv.updateNodeStyle = function (element_id) {
// var zoom_level = (priv.preference_container['zoom_level'] || 1.0) * 1.1111;
// var element = $(gadget_element).find("#" + element_id);
// console.log(gadget_element);
// $.each(priv.style_attr_list, function (i, j) {
// var new_value = $(gadget_element).find('.dummy_window').css(j).replace('px', '') * zoom_level + 'px';
// element.css(j, new_value);
// jsplumb_instance
// .bind("connectionDrag", function (connection) {
// return undefined;
// });
// };
//
// priv.convertToAbsolutePosition = function (x, y) {
// var zoom_level = (priv.preference_container['zoom_level'] || 1.0) * 1.1111;
// var canvas_size_x = $(gadget_element).find('#main').width();
// var canvas_size_y = $(gadget_element).find('#main').height();
// var size_x = $(gadget_element).find('.dummy_window').width() * zoom_level;
// var size_y = $(gadget_element).find('.dummy_window').height() * zoom_level;
// var top = Math.floor(y * (canvas_size_y - size_y)) + "px";
// var left = Math.floor(x * (canvas_size_x - size_x)) + "px";
// return [left, top];
// };
//
// that.convertToRelativePosition = function (x, y) {
// var zoom_level = (priv.preference_container['zoom_level'] || 1.0) * 1.1111;
// var canvas_size_x = $(gadget_element).find('#main').width();
// var canvas_size_y = $(gadget_element).find('#main').height();
// var size_x = $(gadget_element).find('.dummy_window').width() * zoom_level;
// var size_y = $(gadget_element).find('.dummy_window').height() * zoom_level;
// var top = Math.max(Math.min(y.replace('px', '') / (canvas_size_y - size_y), 1), 0);
// var left = Math.max(Math.min(x.replace('px', '') / (canvas_size_x - size_x), 1), 0);
// return [left, top];
// };
// priv.draggable = function () {
// var stop = function (element) {
// priv.updateElementCoordinate(that.getNodeId(element.target.id));
// };
//
// jsPlumb.draggable(jsPlumb.getSelector(".window"), {
// containment: 'parent',
// grid: [10, 10],
// stop: stop // FIXME: we should only accept if dropped in #main
// jsplumb_instance
// .bind("connectionDragStop", function (connection) {
// return undefined;
// });
//
// jsPlumb.makeSource(jsPlumb.getSelector(".window"), {
// filter: ".ep",
// anchor: "Continuous",
// connector: ["StateMachine", {
// curviness: 20
// }],
// connectorStyle: {
// strokeStyle: "#5c96bc",
// lineWidth: 2,
// outlineColor: "transparent",
// outlineWidth: 4
// }
// split in 2 methods ? one for events one for manip
gadget
.
private
.
updateConnectionData
=
function
(
connection
,
remove
,
edge_data
)
{
if
(
remove
)
{
delete
gadget
.
private
.
edge_container
[
connection
.
id
];
}
else
{
gadget
.
private
.
edge_container
[
connection
.
id
]
=
[
getNodeId
(
gadget
.
private
.
node_container
,
connection
.
sourceId
),
getNodeId
(
gadget
.
private
.
node_container
,
connection
.
targetId
),
edge_data
||
{}
];
}
onDataChange
();
};
// bind to connection/connectionDetached events,
// and update the list of connections on screen.
// jsplumb_instance
// .bind("connection", function (info, originalEvent) {
// gadget.private.updateConnectionData(info.connection);
// });
//
// jsPlumb.makeTarget(jsPlumb.getSelector(".window"), {
// dropOptions: {
// hoverClass: "dragHover"
// },
// anchor: "Continuous"
// jsplumb_instance
// .bind("connectionDetached", function (info, originalEvent) {
// gadget.private.updateConnectionData(info.connection, true);
// });
//
// };
// priv.addElementToContainer = function (element) {
// // Now update the container of elements
// var element_data = {
// _class: element._class,
// element_id: element.element_id,
// };
// priv.node_container[element.id] = element_data;
// };
// priv.onDataChange = function () {
// //$.publish("Dream.Gui.onDataChange", priv.getData());
// };
// priv.style_attr_list = ['width', 'height', 'padding-top', 'line-height'];
// that.positionGraph = function () {
onDataChange
();
draggable
(
gadget
);
}
function
updateNodeStyle
(
gadget
,
element_id
)
{
var
zoom_level
=
(
gadget
.
private
.
preference_container
.
zoom_level
||
1
)
*
1.1111
,
element
=
$
(
gadget
.
private
.
element
).
find
(
"
#
"
+
element_id
),
new_value
;
$
.
each
(
gadget
.
private
.
style_attr_list
,
function
(
i
,
j
)
{
new_value
=
$
(
gadget
.
private
.
element
).
find
(
"
.dummy_window
"
).
css
(
j
).
replace
(
"
px
"
,
""
)
*
zoom_level
+
"
px
"
;
element
.
css
(
j
,
new_value
);
});
}
function
addElementToContainer
(
node_container
,
element
)
{
// Now update the container of elements
/*jslint nomen: true*/
var
element_data
=
{
_class
:
element
.
_class
,
element_id
:
element
.
element_id
};
node_container
[
element
.
id
]
=
element_data
;
}
function
redraw
(
gadget
)
{
var
coordinates
=
gadget
.
private
.
preference_container
.
coordinates
||
{},
absolute_position
,
element
;
$
.
each
(
coordinates
,
function
(
node_id
,
v
)
{
absolute_position
=
convertToAbsolutePosition
(
gadget
,
v
.
left
,
v
.
top
);
element
=
$
(
gadget
.
private
.
element
).
find
(
"
#
"
+
getElementId
(
gadget
.
private
.
node_container
,
node_id
));
element
.
css
(
"
top
"
,
absolute_position
[
1
]);
element
.
css
(
"
left
"
,
absolute_position
[
0
]);
gadget
.
private
.
jsplumb_instance
.
repaint
(
element
);
});
}
// function positionGraph(gadget) {
// $.ajax(
// '/positionGraph', {
// data: JSON.stringify(priv.getData()),
// '/positionGraph',
// {
// data: JSON.stringify(getData()),
// contentType: 'application/json',
// type: 'POST',
// success: function (data, textStatus, jqXHR) {
// $.each(data, function (node, pos) {
// var absolute_position = priv.convertToAbsolutePosition(
// pos.left, pos.top);
// priv.updateElementCoordinate(node, {
// convertToAbsolutePosition(
// gadget,
// pos.left,
// pos.top
// );
// updateElementCoordinate(gadget, node, {
// top: pos.top,
// left: pos.left
// });
// });
// that.redraw();
// }
// });
//
// };
// that.setZoom = function (zoom_level) {
// $.each(priv.style_attr_list, function (i, j) {
// var new_value = $(gadget_element).find('.dummy_window').css(j).replace('px', '') * zoom_level + 'px';
// $(gadget_element).find('.window').css(j, new_value);
// });
// };
//
// that.zoom_in = function () {
// var zoom_level = (priv.preference_container['zoom_level'] || 1.0) * 1.1111;
// that.setZoom(zoom_level);
// priv.preference_container['zoom_level'] = zoom_level;
// priv.onDataChange();
// that.redraw();
// };
//
// that.zoom_out = function () {
// var zoom_level = (priv.preference_container['zoom_level'] || 1.0) * 0.9;
// that.setZoom(zoom_level);
// priv.preference_container['zoom_level'] = zoom_level;
// priv.onDataChange();
// that.redraw();
// };
//
// that.redraw = function () {
// var coordinates = priv.preference_container['coordinates'] || {};
// $.each(coordinates, function (node_id, v) {
// var absolute_position = priv.convertToAbsolutePosition(
// v['left'], v['top']);
// var element = $(gadget_element).find('#' + that.getElementId(node_id));
// element.css('top', absolute_position[1]);
// element.css('left', absolute_position[0]);
// jsPlumb.repaint(element);
// });
// };
//
// priv.getData = function () {
// var data = {
// "nodes": priv.node_container,
// "edges": priv.edge_container,
// "preference": priv.preference_container,
// "general": priv.general_container
// };
// var wip_spreadsheet = $(gadget_element).find('#wip_spreadsheet');
// if (wip_spreadsheet.length > 0) {
// data['wip_spreadsheet'] = wip_spreadsheet.handsontable('getData');
// redraw(gadget);
// }
// var wip_part_spreadsheet = $(gadget_element).find('#wip_part_spreadsheet');
// if (wip_part_spreadsheet.length > 0) {
// data['wip_part_spreadsheet'] = wip_part_spreadsheet.handsontable('getData');
// }
// var shift_spreadsheet = $(gadget_element).find('#shift_spreadsheet');
// if (shift_spreadsheet.length > 0) {
// data['shift_spreadsheet'] = shift_spreadsheet.handsontable('getData');
// }
// return data;
// };
// priv.removeElement = function (node_id) {
// var element_id = priv.node_container[node_id].element_id;
// jsPlumb.removeAllEndpoints($(gadget_element).find("#" + element_id));
// $(gadget_element).find("#" + element_id).remove();
// delete(priv.node_container[node_id]);
// delete(priv.preference_container['coordinates'][node_id]);
// $.each(priv.edge_container, function (k, v) {
// if (node_id == v[0] || node_id == v[1]) {
// delete(priv.edge_container[k]);
// );
// }
// function setZoom(gadget, zoom_level) {
// $.each(gadget.private.style_attr_list, function (i, j) {
// var new_value = $(gadget.private.element).find('.dummy_window')
// .css(j).replace('px', '') * zoom_level + 'px';
// $(gadget.private.element).find('.window').css(j, new_value);
// });
// priv.onDataChange();
// };
//
// that.updateElementData = function (node_id, data) {
// var element_id = priv.node_container[node_id].element_id;
// if (data['name']) {
// $(gadget_element).find("#" + element_id).text(data["name"]).append('<div class="ep"></div></div>');
// priv.node_container[node_id].name = data['name'];
// }
// var new_id = data['id'];
// delete(data['id']);
// $.extend(priv.node_container[node_id], data.data);
// if (new_id && new_id !== node_id) {
// priv.node_container[new_id] = priv.node_container[node_id];
// delete(priv.node_container[node_id]);
// $.each(priv.edge_container, function (k, v) {
// if (v[0] === node_id) {
// v[0] = new_id;
// function zoom_in(gadget) {
// var zoom_level = (gadget.private.preference_container.zoom_level || 1.0) *
// 1.1111;
// setZoom(gadget, zoom_level);
// gadget.private.preference_container.zoom_level = zoom_level;
// onDataChange();
// redraw(gadget);
// }
// if (v[1] === node_id) {
// v[1] = new_id;
// function zoom_out(gadget) {
// var zoom_level = (gadget.private.preference_container.zoom_level || 1.0) *
// 0.9;
// setZoom(gadget, zoom_level);
// gadget.private.preference_container.zoom_level = zoom_level;
// onDataChange();
// redraw(gadget);
// }
// });
// priv.preference_container['coordinates'][new_id] = priv.preference_container['coordinates'][node_id];
// delete(priv.preference_container['coordinates'][node_id]);
// function removeElement(gadget, node_id) {
// var element_id = gadget.private.node_container[node_id].element_id;
// gadget.private.jsplumb_instance.removeAllEndpoints(
// $(gadget.private.element).find("#" + element_id)
// );
// $(gadget.private.element).find("#" + element_id).remove();
// delete gadget.private.node_container[node_id];
// delete gadget.private.preference_container.coordinates[node_id];
// $.each(gadget.private.edge_container, function (k, v) {
// if (node_id === v[0] || node_id === v[1]) {
// delete gadget.private.edge_container[k];
// }
// priv.onDataChange();
// };
//
// that.removeElement = function (node_id) {
// priv.removeElement(node_id);
// };
//
// that.getData = function () {
// return priv.getData();
// };
//
// that.clearAll = function () {
// $.each(priv.node_container, function (node_id) {
// priv.removeElement(node_id);
// });
// // delete anything if still remains
// $(gadget_element).find("#main").children().remove();
// priv.node_container = {};
// priv.edge_container = {};
// priv.preference_container = {};
// priv.general_container = {};
// that.initGeneralProperties();
// that.prepareDialogForGeneralProperties();
// };
// that.addEdge = function (edge_id, edge_data) {
// var source_id = edge_data[0],
// target_id = edge_data[1],
// data = edge_data[2],
// overlays = []
//
// if (data && data.title){
// overlays = [ ["Label", { cssClass:"l1 component label",
// label: data.title,
// }] ]
//
// onDataChange();
// }
// var connection = jsPlumb.connect({
// source: that.getElementId(source_id),
// target: that.getElementId(target_id),
// Connector: [ "Bezier", { curviness:75 } ],
// overlays:overlays
//
function
updateElementData
(
gadget
,
node_id
,
data
)
{
var
element_id
=
gadget
.
private
.
node_container
[
node_id
].
element_id
,
new_id
=
data
.
id
;
if
(
data
.
name
)
{
$
(
gadget
.
private
.
element
).
find
(
"
#
"
+
element_id
).
text
(
data
.
name
).
append
(
'
<div class="ep"></div></div>
'
);
gadget
.
private
.
node_container
[
node_id
].
name
=
data
.
name
;
}
delete
data
.
id
;
$
.
extend
(
gadget
.
private
.
node_container
[
node_id
],
data
.
data
);
if
(
new_id
&&
new_id
!==
node_id
)
{
gadget
.
private
.
node_container
[
new_id
]
=
gadget
.
private
.
node_container
[
node_id
];
delete
gadget
.
private
.
node_container
[
node_id
];
$
.
each
(
gadget
.
private
.
edge_container
,
function
(
k
,
v
)
{
if
(
v
[
0
]
===
node_id
)
{
v
[
0
]
=
new_id
;
}
if
(
v
[
1
]
===
node_id
)
{
v
[
1
]
=
new_id
;
}
});
gadget
.
private
.
preference_container
.
coordinates
[
new_id
]
=
gadget
.
private
.
preference_container
.
coordinates
[
node_id
];
delete
gadget
.
private
.
preference_container
.
coordinates
[
node_id
];
}
onDataChange
();
}
// function clearAll(gadget) {
// $.each(gadget.private.node_container, function (node_id) {
// removeElement(gadget, node_id);
// });
// // call again updateConnectionData to set the connection data that
// // was not passed to the connection hook
// that.updateConnectionData(connection, 0, data)
// };
//
// that.setPreferences = function (preferences) {
// priv.preference_container = preferences;
// var zoom_level = priv.preference_container['zoom_level'] || 1.0;
// that.setZoom(zoom_level);
// };
// that.setGeneralProperties = function (properties) {
// priv.general_container = properties;
// priv.onDataChange();
// };
//
// that.updateGeneralProperties = function (properties) {
// $.extend(priv.general_container, properties);
// priv.onDataChange();
// };
// that.newElement = function (element, option) {
// element.name = element.name || option.name;
// priv.addElementToContainer(element);
// var render_element, style_string = "",
// coordinate = element.coordinate,
// box;
// render_element = $(gadget_element).find("#main");
// if (coordinate !== undefined) {
// coordinate = priv.updateElementCoordinate(element.id, coordinate);
// // delete anything if still remains
// $(gadget.private.element).find("#main").children().remove();
// gadget.private.node_container = {};
// gadget.private.edge_container = {};
// gadget.private.preference_container = {};
// gadget.private.general_container = {};
// gadget.private.initGeneralProperties();
// gadget.private.prepareDialogForGeneralProperties();
// }
// render_element.append('<div class="window ' + element._class.replace('.', '-') + '" id="' +
// element.element_id + '" title="' + (element.name || element.id) + '">' + element.id + '<div class="ep"></div></div>');
// box = $(gadget_element).find("#" + element.element_id);
// var absolute_position = priv.convertToAbsolutePosition(
// coordinate.left, coordinate.top);
// box.css("top", absolute_position[1]);
// box.css("left", absolute_position[0]);
// priv.updateNodeStyle(element.element_id);
// priv.draggable();
// priv.onDataChange();
// };
function
initJsPlumb
(
container
)
{
var
j
=
jsPlumb
.
getInstance
({
HoverPaintStyle
:
{
strokeStyle
:
"
#1e8151
"
,
lineWidth
:
2
},
Endpoint
:
[
"
Dot
"
,
{
radius
:
2
function
addEdge
(
gadget
,
edge_id
,
edge_data
)
{
var
source_id
=
edge_data
[
0
],
target_id
=
edge_data
[
1
],
data
=
edge_data
[
2
],
overlays
=
[],
connection
;
if
(
data
&&
data
.
title
)
{
overlays
=
[
[
"
Label
"
,
{
cssClass
:
"
l1 component label
"
,
label
:
data
.
title
}
]
];
}
connection
=
gadget
.
private
.
jsplumb_instance
.
connect
({
source
:
getElementId
(
gadget
.
private
.
node_container
,
source_id
),
target
:
getElementId
(
gadget
.
private
.
node_container
,
target_id
),
Connector
:
[
"
Bezier
"
,
{
curviness
:
75
}
],
ConnectionOverlays
:
[
[
"
Arrow
"
,
{
location
:
1
,
id
:
"
arrow
"
,
length
:
14
,
foldback
:
.
8
}
]
],
Container
:
container
overlays
:
overlays
});
j
.
setRenderMode
(
jsPlumb
.
SVG
);
return
j
;
// call again updateConnectionData to set the connection data that
// was not passed to the connection hook
gadget
.
private
.
updateConnectionData
(
connection
,
0
,
data
);
}
rJS
(
window
).
ready
(
function
(
g
)
{
g
.
props
=
{
// function setPreferences(gadget, preferences) {
// gadget.private.preference_container = preferences;
// var zoom_level = gadget.private.preference_container.zoom_level || 1.0;
// setZoom(gadget, zoom_level);
// }
// function setGeneralProperties(gadget, properties) {
// gadget.private.general_container = properties;
// onDataChange();
// }
// function updateGeneralProperties(gadget, properties) {
// $.extend(gadget.private.general_container, properties);
// onDataChange();
// }
function
newElement
(
gadget
,
element
,
option
)
{
element
.
name
=
element
.
name
||
option
.
name
;
addElementToContainer
(
gadget
.
private
.
node_container
,
element
);
var
render_element
=
$
(
gadget
.
private
.
element
).
find
(
"
#main
"
),
coordinate
=
element
.
coordinate
,
box
,
absolute_position
;
if
(
coordinate
!==
undefined
)
{
coordinate
=
updateElementCoordinate
(
gadget
,
element
.
id
,
coordinate
);
}
/*jslint nomen: true*/
render_element
.
append
(
node_template
({
"
class
"
:
element
.
_class
.
replace
(
"
.
"
,
"
-
"
),
element_id
:
element
.
element_id
,
title
:
element
.
name
||
element
.
id
,
id
:
element
.
id
}));
box
=
$
(
gadget
.
private
.
element
).
find
(
"
#
"
+
element
.
element_id
);
absolute_position
=
convertToAbsolutePosition
(
gadget
,
coordinate
.
left
,
coordinate
.
top
);
box
.
css
(
"
top
"
,
absolute_position
[
1
]);
box
.
css
(
"
left
"
,
absolute_position
[
0
]);
updateNodeStyle
(
gadget
,
element
.
element_id
);
draggable
(
gadget
);
onDataChange
();
}
gadget_klass
.
ready
(
function
(
g
)
{
g
.
private
=
{
node_container
:
{},
edge_container
:
{},
preference_container
:
{},
general_container
:
{}
style_attr_list
:
[
"
width
"
,
"
height
"
,
"
padding-top
"
,
"
line-height
"
]
};
return
g
.
getElement
().
push
(
function
(
element
)
{
g
.
props
.
element
=
element
;
});
}).
declareMethod
(
"
render
"
,
function
(
data
)
{
this
.
props
.
data
=
JSON
.
parse
(
data
);
this
.
private
.
data
=
JSON
.
parse
(
data
);
this
.
private
.
jsplumb_instance
=
jsPlumb
.
getInstance
();
}).
declareMethod
(
"
getData
"
,
function
()
{
return
JSON
.
stringify
({
nodes
:
this
.
private
.
node_container
,
edges
:
this
.
private
.
edge_container
,
preference
:
this
.
private
.
preference_container
});
}).
declareMethod
(
"
startService
"
,
function
()
{
var
gadget
=
this
,
// Create jsPlumb instance
// jsplumb = initJsPlumb(gadget.props.element),
preference
=
gadget
.
props
.
data
.
preference
||
{},
coordinates
=
preference
.
coordinates
,
key
,
value
;
initJsPlumb
(
gadget
.
props
.
element
);
for
(
key
in
gadget
.
props
.
data
.
nodes
)
{
if
(
gadget
.
props
.
data
.
nodes
.
hasOwnProperty
(
key
))
{
value
=
gadget
.
props
.
data
.
nodes
[
key
];
var
gadget
=
this
,
preference
=
gadget
.
private
.
data
.
preference
!==
undefined
?
gadget
.
private
.
data
.
preference
:
{},
coordinates
=
preference
.
coordinates
;
return
gadget
.
getElement
().
then
(
function
(
el
)
{
gadget
.
private
.
element
=
el
;
initJsPlumb
(
gadget
);
$
.
each
(
gadget
.
private
.
data
.
nodes
,
function
(
key
,
value
)
{
if
(
coordinates
===
undefined
||
coordinates
[
key
]
===
undefined
)
{
value
.
coordinate
=
{
top
:
0
,
...
...
@@ -447,12 +373,18 @@
value
.
coordinate
=
coordinates
[
key
];
}
value
.
id
=
key
;
newElement
(
gadget
,
value
);
if
(
value
.
data
)
{
// backward compatibility
updateElementData
(
gadget
,
key
,
{
data
:
value
.
data
});
}
}
for
(
key
in
gadget
.
props
.
data
.
edges
)
{
if
(
gadget
.
props
.
data
.
edges
.
hasOwnProperty
(
key
))
{
value
=
gadget
.
props
.
data
.
edges
[
key
];
}
}
});
})(
jsPlumb
,
rJS
,
RSVP
);
\ No newline at end of file
$
.
each
(
gadget
.
private
.
data
.
edges
,
function
(
key
,
value
)
{
addEdge
(
gadget
,
key
,
value
);
});
redraw
(
gadget
);
});
});
})(
RSVP
,
rJS
,
$
,
jsPlumb
,
Handlebars
);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment