Skip to content

Commit

Permalink
Feature/131 add resource model (#156)
Browse files Browse the repository at this point in the history
also: 
* fix objective renaming
* edit minValues of dropdowns

---------

Co-authored-by: Franka-T <[email protected]>
Co-authored-by: Simon Nowack <[email protected]>
Co-authored-by: Pierre Burghardt <[email protected]>
  • Loading branch information
4 people authored May 11, 2023
1 parent cf18950 commit f8c5dd0
Show file tree
Hide file tree
Showing 84 changed files with 8,747 additions and 171 deletions.
178 changes: 84 additions & 94 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,116 +5,106 @@
<meta charset="utf-8">
<title>for-Construction-Modeling</title>

<link rel="stylesheet" href="vendor/bpmn-js/assets/diagram-js.css"/>
<link rel="stylesheet" href="vendor/bpmn-js/assets/bpmn-font/css/bpmn-embedded.css"/>
<link rel="stylesheet" href="css/index.css"/>
<link rel="stylesheet" href="css/lib.css"/>
<link rel="stylesheet" href="vendor/bpmn-js/assets/diagram-js.css" />
<link rel="stylesheet" href="vendor/bpmn-js/assets/bpmn-font/css/bpmn-embedded.css" />
<link rel="stylesheet" href="css/index.css" />
<link rel="stylesheet" href="css/lib.css" />
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Quicksand"/>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Quicksand" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>

<body>
<div id="navigationBar" class="topBar">
<a id="newButton" class="barButton barContent"> New </a>
<a id="openButton" class="barButton barContent"> Open </a>
<a id="saveButton" class="barButton barContent"> Save </a>
<a id="noteAreaToggleButton" class="barButton barContent"> Toggle Note Area </a>
<a class="barButton barContent" href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki"
target="_blank"> Guideline Help </a>
<h3 id="fileName" class="barContent">Unnamed file</h3>
</div>
<div id="note-area-wrapper" class="hidden">
<div id="note-area-drag" style="display:inline"><i class="material-icons">crop</i></div>
<div id="note-area-close" style="display:inline"><i class="material-icons">close</i></div>
<textarea class="note-area"></textarea>
</div>
<div id="main" class="mainContent">
<div id="fragments-canvas" class="canvas focus">
<div class="canvasHeader">
<h3 class="focusHeader" id="titleFM"><i class="material-icons focusHeaderIcon">photo_size_select_small</i>
</h3>
<a class="questionButton" href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Fragments"
target="_blank">?</a>
</div>
<div id="navigationBar" class="topBar">
<a id="newButton" class="barButton barContent"> New </a>
<a id="openButton" class="barButton barContent"> Open </a>
<a id="saveButton" class="barButton barContent"> Save </a>
<a id="noteAreaToggleButton" class="barButton barContent"> Toggle Note Area </a>
<a class="barButton barContent" href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki" target="_blank"> Guideline Help </a>
<h3 id="fileName" class="barContent">Unnamed file</h3>
</div>
<div id="datamodel-canvas" class="canvas hidden">
<div class="canvasHeader">
<h3 class="focusHeader" id="titleDM"><i class="material-icons focusHeaderIcon">photo_size_select_small</i>
</h3>
<a class="questionButton" href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Data-Model"
target="_blank">?</a>
</div>
<div id="note-area-wrapper" class="hidden">
<div id="note-area-drag" style="display:inline"><i class="material-icons">crop</i></div>
<div id="note-area-close" style="display:inline"><i class="material-icons">close</i></div>
<textarea class="note-area"></textarea>
</div>
<div id="objectivemodel-canvas" class="canvas hidden">
<div class="canvasHeader">
<h3 class="focusHeader" id="titleOM"><i class="material-icons focusHeaderIcon">photo_size_select_small</i>
</h3>
<a class="questionButton"
href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Objective-Model"
target="_blank">?</a>
<div id="main" class="mainContent">
<div id="fragments-canvas" class="canvas focus">
<div class="canvasHeader">
<h3 class="focusHeader" id="titleFM"> <i class="material-icons focusHeaderIcon">photo_size_select_small</i></h3>
<a class="questionButton" href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Fragments" target="_blank">?</a>
</div>
</div>
</div>
<div id="rolemodel-canvas" class="canvas hidden">
<div class="canvasHeader">
<h3 class="focusHeader" id="titleROM"><i class="material-icons focusHeaderIcon">photo_size_select_small</i>
</h3>
<a class="questionButton"
href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Role-Model"
target="_blank">?</a>
<div id="datamodel-canvas" class="canvas hidden">
<div class="canvasHeader">
<h3 class="focusHeader" id="titleDM"> <i class="material-icons focusHeaderIcon">photo_size_select_small</i></h3>
<a class="questionButton" href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Data-Model" target="_blank">?</a>
</div>
</div>
</div>
<div id="terminationcondition-canvas" class="canvas hidden">
<div class="canvasHeader" style="position:relative; display:inline-flex">
<h3 class="focusHeader" id="titleTC"><i class="material-icons focusHeaderIcon">photo_size_select_small</i>
</h3>
<a class="questionButton"
href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Termination-Condition"
target="_blank">?</a>
<div id="objectivemodel-canvas" class="canvas hidden">
<div class="canvasHeader">
<h3 class="focusHeader" id="titleOM"> <i class="material-icons focusHeaderIcon">photo_size_select_small</i></h3>
<a class="questionButton" href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Objective-Model" target="_blank">?</a>
</div>
</div>
</div>
<div id="dependencymodel-canvas" class="canvas hidden">
<div class="canvasHeader">
<h3 class="focusHeader" id="titleDEP"><i class="material-icons focusHeaderIcon">photo_size_select_small</i>
</h3>
<a class="questionButton"
href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Dependency-Model"
target="_blank">?</a>
<div id="rolemodel-canvas" class="canvas hidden">
<div class="canvasHeader">
<h3 class="focusHeader" id="titleROM"><i class="material-icons focusHeaderIcon">photo_size_select_small</i>
</h3>
<a class="questionButton"
href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Role-Model"
target="_blank">?</a>
</div>
</div>
</div>
<div id="olc-canvas" class="canvas hidden">
<div class="canvasHeader">
<h3 class="focusHeader" id="titleOLC"><i class="material-icons focusHeaderIcon">photo_size_select_small</i>
</h3>
<a class="questionButton"
href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Object-Lifecycle-(OLC)"
target="_blank">?</a>
<div id="resourcemodel-canvas" class="canvas hidden">
<div class="canvasHeader">
<h3 class="focusHeader" id="titleREM"><i class="material-icons focusHeaderIcon">photo_size_select_small</i></h3>
<a class="questionButton"
href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Resource-Model"
target="_blank">?</a>
</div>
</div>
</div>
</div>
<div id="errorBar" class="hidingTable">
<table id="errorTable" class="errorTable">
<tr>
<th></th>
<th>Message</th>
<th></th>
<th>Element</th>
<th>Artifact</th>
</tr>
</table>
<div class="errorBarControls">
<div>
<a id="toggleErrorTable" class="barButton barContent"></a>
<div id="terminationcondition-canvas" class="canvas hidden">
<div class="canvasHeader" style="position:relative; display:inline-flex">
<h3 class="focusHeader" id="titleTC"> <i class="material-icons focusHeaderIcon">photo_size_select_small</i></h3>
<a class="questionButton" href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Termination-Condition" target="_blank">?</a>
</div>
</div>
<div id="numberOfViolations">

<div id="dependencymodel-canvas" class="canvas hidden">
<div class="canvasHeader">
<h3 class="focusHeader" id="titleDEP"> <i class="material-icons focusHeaderIcon">photo_size_select_small</i></h3>
<a class="questionButton" href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Dependency-Model" target="_blank">?</a>
</div>
</div>
<div id="olc-canvas" class="canvas hidden">
<div class="canvasHeader">
<h3 class="focusHeader" id="titleOLC"> <i class="material-icons focusHeaderIcon">photo_size_select_small</i></h3>
<a class="questionButton" href="https://github.com/Noel-Bastubbe/for-Construction-Modeling/wiki/Object-Lifecycle-(OLC)" target="_blank">?</a>
</div>
</div>
</div>
<div id="errorBar" class="hidingTable">
<table id="errorTable" class="errorTable">
<tr>
<th> </th>
<th>Message</th>
<th> </th>
<th>Element</th>
<th>Artifact</th>
</tr>
</table>
<div class="errorBarControls">
<div>
<a id="toggleErrorTable" class="barButton barContent"></a>
</div>
<div id="numberOfViolations">

</div>
</div>
</div>
</div>

<script src="./index.js"></script>
<script src="./index.js"></script>
</body>

</html>
21 changes: 19 additions & 2 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import DataModelModeler from './lib/datamodelmodeler/Modeler';
import ObjectiveModeler from './lib/objectivemodeler/OmModeler';
import DependencyModeler from './lib/dependencymodeler/DependencyModeler';
import RoleModeler from './lib/rolemodeler/RoleModeler';
import RemModeler from './lib/resourcemodeler/RemModeler';

import $ from 'jquery';
import Mediator from './lib/mediator/Mediator';
Expand Down Expand Up @@ -93,6 +94,17 @@ var roleModeler = new RoleModeler({
}]
});

var resourceModeler = new RemModeler({
container: '#resourcemodel-canvas',
keyboard: {
bindTo: document.querySelector('#resourcemodel-canvas')
},
additionalModules: [{
__init__ : ['mediator'],
mediator : ['type', mediator.ResourceModelerHook]
}]
});

var terminationConditionModeler = new TerminationConditionModeler(
'#terminationcondition-canvas'
);
Expand Down Expand Up @@ -123,11 +135,12 @@ async function loadDebugData() {
async function createNewDiagram() {
try {
checker.deactivate();
await roleModeler.createDiagram();
await dependencyModeler.createNew();
await dataModeler.importXML(newDatamodel);
await fragmentModeler.importXML(diagramXML);
await olcModeler.createNew();
await dataModeler.importXML(newDatamodel);
await roleModeler.createDiagram();
await resourceModeler.createDiagram();
await objectiveModeler.createDiagram();
terminationConditionModeler.createNew();
if (LOAD_DUMMY) {
Expand Down Expand Up @@ -165,6 +178,8 @@ async function exportToZip() {
zip.file('objectiveModel.xml', objectiveModel);
const olcs = (await olcModeler.saveXML({format: true})).xml;
zip.file('olcs.xml', olcs);
const resourceModel = (await resourceModeler.saveXML({ format: true })).xml;
zip.file('resourceModel.xml', resourceModel);
const terminationCondition = (await terminationConditionModeler.saveXML({format: true})).xml;
zip.file('terminationCondition.xml', terminationCondition);
const dependencyModel = (await dependencyModeler.saveXML({format: true})).xml;
Expand All @@ -184,6 +199,7 @@ async function importFromZip(zipData) {
olcs: zip.file('olcs.xml'),
terminationCondition: zip.file('terminationCondition.xml'),
dependencyModel: zip.file('dependencyModel.xml'),
resourceModel: zip.file('resourceModel.xml'),
roleModel: zip.file('roleModel.xml')
};
Object.keys(files).forEach(key => {
Expand All @@ -198,6 +214,7 @@ async function importFromZip(zipData) {
await fragmentModeler.importXML(await files.fragments.async("string"));
await terminationConditionModeler.importXML(await files.terminationCondition.async("string"));
await objectiveModeler.importXML(await files.objectiveModel.async("string"));
await resourceModeler.importXML(await files.resourceModel.async("string"));
checker.activate();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import CommandInterceptor from "diagram-js/lib/command/CommandInterceptor";
import getDropdown from "../../util/Dropdown";
import {appendOverlayListeners} from "../../util/HtmlUtil";
import {is} from "../../util/Util";
import ObjectiveEvents from "../../objectivemodeler/ObjectiveEvents";

export default class DepLabelHandler extends CommandInterceptor {
constructor(eventBus, modeling, directEditing, overlays, dependencyModeler) {
Expand Down
4 changes: 2 additions & 2 deletions app/lib/fragmentmodeler/taskLabelHandling/taskLabelHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class TaskLabelHandler extends CommandInterceptor {
},
element
);
this._durationDropdown.addCreateElementInput(event => this._dropdownContainer.confirm(),"number",activity.duration);
this._durationDropdown.addCreateElementInput(event => this._dropdownContainer.confirm(),"number",activity.duration, "0");
}
const populateRoleDropdown = () => {
this._roleDropdown.populate(
Expand Down Expand Up @@ -96,7 +96,7 @@ export default class TaskLabelHandler extends CommandInterceptor {
this.updateName(newNameInput,element);
populateNameDropdown();
}
if (newDurationInput !== activity.duration && newDurationInput > 0) {
if (newDurationInput !== activity.duration && newDurationInput >= 0) {
this.updateDuration(newDurationInput,element);
populateDurationDropdown();
}
Expand Down
Loading

0 comments on commit f8c5dd0

Please sign in to comment.