Skip to content

Commit 85074e3

Browse files
committed
Fixed an issue where property would apply to newly selected entity instead of currently detailed entity
1 parent 4f1c4c6 commit 85074e3

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

src/main/matlab/+symphonyui/+ui/+presenters/DataManagerPresenter.m

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
documentationService
1111
acquisitionService
1212
configurationService
13+
detailedEntitySet
1314
uuidToNode
1415
end
1516

@@ -26,6 +27,7 @@
2627
obj.documentationService = documentationService;
2728
obj.acquisitionService = acquisitionService;
2829
obj.configurationService = configurationService;
30+
obj.detailedEntitySet = symphonyui.core.persistent.collections.EntitySet();
2931
obj.uuidToNode = containers.Map();
3032
end
3133

@@ -135,7 +137,7 @@ function onViewSelectedConfigureDevices(obj, ~, ~)
135137

136138
function onViewSelectedAddSource(obj, ~, ~)
137139
selectedParent = [];
138-
entitySet = obj.getSelectedEntitySet();
140+
entitySet = obj.detailedEntitySet;
139141
if entitySet.size == 1 && entitySet.getEntityType() == symphonyui.core.persistent.EntityType.SOURCE
140142
selectedParent = entitySet.get(1);
141143
end
@@ -182,7 +184,7 @@ function populateDetailsForSourceSet(obj, sourceSet)
182184
end
183185

184186
function onViewSetSourceLabel(obj, ~, ~)
185-
sourceSet = obj.getSelectedEntitySet();
187+
sourceSet = obj.detailedEntitySet;
186188
try
187189
sourceSet.label = obj.view.getSourceLabel();
188190
catch x
@@ -220,7 +222,7 @@ function populateDetailsForExperimentSet(obj, experimentSet)
220222
end
221223

222224
function onViewSetExperimentPurpose(obj, ~, ~)
223-
experimentSet = obj.getSelectedEntitySet();
225+
experimentSet = obj.detailedEntitySet;
224226
try
225227
experimentSet.purpose = obj.view.getExperimentPurpose();
226228
catch x
@@ -365,7 +367,7 @@ function populateDetailsForEpochGroupSet(obj, groupSet)
365367
end
366368

367369
function onViewSetEpochGroupLabel(obj, ~, ~)
368-
groupSet = obj.getSelectedEntitySet();
370+
groupSet = obj.detailedEntitySet;
369371
try
370372
groupSet.label = obj.view.getEpochGroupLabel();
371373
catch x
@@ -377,7 +379,7 @@ function onViewSetEpochGroupLabel(obj, ~, ~)
377379
end
378380

379381
function onViewSelectedEpochGroupSource(obj, ~, ~)
380-
groupSet = obj.getSelectedEntitySet();
382+
groupSet = obj.detailedEntitySet;
381383
try
382384
groupSet.source = obj.view.getSelectedEpochGroupSource();
383385
catch x
@@ -511,7 +513,7 @@ function populateDetailsForHeterogeneousEntitySet(obj, entitySet)
511513
obj.populateCommonDetailsForEntitySet(entitySet);
512514
end
513515

514-
function onViewSelectedNodes(obj, ~, ~)
516+
function onViewSelectedNodes(obj, ~, ~)
515517
obj.view.stopEditingProperties();
516518
obj.view.resetSelectedPreset();
517519
obj.view.update();
@@ -549,6 +551,8 @@ function populateCommonDetailsForEntitySet(obj, entitySet)
549551
obj.populateKeywordsForEntitySet(entitySet);
550552
obj.populateNotesForEntitySet(entitySet);
551553
obj.populatePresetsForEntitySet(entitySet);
554+
555+
obj.detailedEntitySet = entitySet;
552556
end
553557

554558
function populatePropertiesForEntitySet(obj, entitySet)
@@ -575,7 +579,7 @@ function updatePropertiesForEntitySet(obj, entitySet)
575579

576580
function onViewSetProperty(obj, ~, event)
577581
p = event.data.Property;
578-
entitySet = obj.getSelectedEntitySet();
582+
entitySet = obj.detailedEntitySet;
579583
try
580584
entitySet.setProperty(p.Name, p.Value);
581585
catch x
@@ -586,7 +590,7 @@ function onViewSetProperty(obj, ~, event)
586590
end
587591

588592
function onViewSelectedAddProperty(obj, ~, ~)
589-
entitySet = obj.getSelectedEntitySet();
593+
entitySet = obj.detailedEntitySet;
590594
presenter = symphonyui.ui.presenters.AddPropertyPresenter(entitySet);
591595
presenter.goWaitStop();
592596

@@ -601,7 +605,7 @@ function onViewSelectedRemoveProperty(obj, ~, ~)
601605
return;
602606
end
603607

604-
entitySet = obj.getSelectedEntitySet();
608+
entitySet = obj.detailedEntitySet;
605609
try
606610
tf = entitySet.removeProperty(key);
607611
catch x
@@ -631,7 +635,7 @@ function populateKeywordsForEntitySet(obj, entitySet)
631635
end
632636

633637
function onViewSelectedAddKeyword(obj, ~, ~)
634-
entitySet = obj.getSelectedEntitySet();
638+
entitySet = obj.detailedEntitySet;
635639
presenter = symphonyui.ui.presenters.AddKeywordPresenter(entitySet);
636640
presenter.goWaitStop();
637641

@@ -647,7 +651,7 @@ function onViewSelectedRemoveKeyword(obj, ~, ~)
647651
return;
648652
end
649653

650-
entitySet = obj.getSelectedEntitySet();
654+
entitySet = obj.detailedEntitySet;
651655
try
652656
entitySet.removeKeyword(keyword);
653657
catch x
@@ -671,7 +675,7 @@ function populateNotesForEntitySet(obj, entitySet)
671675
end
672676

673677
function onViewSelectedAddNote(obj, ~, ~)
674-
entitySet = obj.getSelectedEntitySet();
678+
entitySet = obj.detailedEntitySet;
675679
presenter = symphonyui.ui.presenters.AddNotePresenter(entitySet);
676680
presenter.goWaitStop();
677681

@@ -690,7 +694,7 @@ function populatePresetsForEntitySet(obj, entitySet)
690694
function onViewSelectedPreset(obj, ~, ~)
691695
import symphonyui.core.persistent.EntityType;
692696

693-
entitySet = obj.getSelectedEntitySet();
697+
entitySet = obj.detailedEntitySet;
694698

695699
name = obj.view.getSelectedPreset();
696700
try
@@ -718,29 +722,29 @@ function onViewSelectedAddPreset(obj, ~, ~)
718722
obj.view.stopEditingProperties();
719723
obj.view.update();
720724

721-
entitySet = obj.getSelectedEntitySet();
725+
entitySet = obj.detailedEntitySet;
722726
presenter = symphonyui.ui.presenters.AddEntityPresetPresenter(obj.documentationService, entitySet);
723727
presenter.goWaitStop();
724728
end
725729

726730
function onServiceAddedEntityPreset(obj, ~, ~)
727-
entitySet = obj.getSelectedEntitySet();
731+
entitySet = obj.detailedEntitySet;
728732
obj.populatePresetsForEntitySet(entitySet);
729733
end
730734

731735
function onViewSelectedManagePresets(obj, ~, ~)
732-
entitySet = obj.getSelectedEntitySet();
736+
entitySet = obj.detailedEntitySet;
733737
presenter = symphonyui.ui.presenters.EntityPresetsPresenter(obj.documentationService, entitySet);
734738
presenter.goWaitStop();
735739
end
736740

737741
function onServiceRemovedEntityPreset(obj, ~, ~)
738-
entitySet = obj.getSelectedEntitySet();
742+
entitySet = obj.detailedEntitySet;
739743
obj.populatePresetsForEntitySet(entitySet);
740744
end
741745

742746
function onViewSelectedSendEntityToWorkspace(obj, ~, ~)
743-
entitySet = obj.getSelectedEntitySet();
747+
entitySet = obj.detailedEntitySet;
744748
for i = 1:entitySet.size
745749
try
746750
obj.documentationService.sendEntityToWorkspace(entitySet.get(i));

0 commit comments

Comments
 (0)