-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #769 parameter should be global for interaction container
- Loading branch information
Showing
4 changed files
with
51 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 22 additions & 22 deletions
44
src/MoBi.Presentation/Mappers/MoleculeBuilderDTOToTreeNodeMapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,83 @@ | ||
using System.Linq; | ||
using OSPSuite.Utility; | ||
using OSPSuite.Utility.Extensions; | ||
using MoBi.Presentation.DTO; | ||
using MoBi.Presentation.Nodes; | ||
using OSPSuite.Assets; | ||
using OSPSuite.Utility; | ||
using OSPSuite.Utility.Extensions; | ||
|
||
namespace MoBi.Presentation.Mappers | ||
{ | ||
public interface IMoleculeBuilderDTOToTreeNodeMapper : IMapper<MoleculeBuilderDTO, IMoleculeTreeNode> | ||
{ | ||
} | ||
|
||
|
||
internal class MoleculeBuilderDTOToTreeNodeMapper : IMoleculeBuilderDTOToTreeNodeMapper | ||
{ | ||
private readonly ITransporterMoleculeContainerDTOToMoleculeTreeNodeMapper _activeTransportBuilderContaienrToMolceculeTreeNodeMapper; | ||
private readonly ITransporterMoleculeContainerDTOToMoleculeTreeNodeMapper _activeTransportBuilderContainerToMoleculeTreeNodeMapper; | ||
private readonly IInteractionContainerDTOToMoleculeTreeMapper _interactionContainerMapper; | ||
|
||
public MoleculeBuilderDTOToTreeNodeMapper(ITransporterMoleculeContainerDTOToMoleculeTreeNodeMapper activeTransportBuilderContaienrToMolceculeTreeNodeMapper, IInteractionContainerDTOToMoleculeTreeMapper interactionContainerMapper) | ||
public MoleculeBuilderDTOToTreeNodeMapper(ITransporterMoleculeContainerDTOToMoleculeTreeNodeMapper activeTransportBuilderContainerToMoleculeTreeNodeMapper, IInteractionContainerDTOToMoleculeTreeMapper interactionContainerMapper) | ||
{ | ||
_activeTransportBuilderContaienrToMolceculeTreeNodeMapper = activeTransportBuilderContaienrToMolceculeTreeNodeMapper; | ||
_activeTransportBuilderContainerToMoleculeTreeNodeMapper = activeTransportBuilderContainerToMoleculeTreeNodeMapper; | ||
_interactionContainerMapper = interactionContainerMapper; | ||
} | ||
|
||
public IMoleculeTreeNode MapFrom(MoleculeBuilderDTO input) | ||
public IMoleculeTreeNode MapFrom(MoleculeBuilderDTO moleculeBuilderDTO) | ||
{ | ||
var node = new MoleculeTreeNode(input) {Text = input.Name, Icon = ApplicationIcons.IconByName(input.Icon)}; | ||
var children = input.TransporterMolecules.MapAllUsing(_activeTransportBuilderContaienrToMolceculeTreeNodeMapper).ToList(); | ||
children = children.Union(input.InteractionContainerCollection.MapAllUsing(_interactionContainerMapper)).ToList(); | ||
var node = new MoleculeTreeNode(moleculeBuilderDTO) {Text = moleculeBuilderDTO.Name, Icon = ApplicationIcons.IconByName(moleculeBuilderDTO.Icon)}; | ||
var children = moleculeBuilderDTO.TransporterMolecules.MapAllUsing(_activeTransportBuilderContainerToMoleculeTreeNodeMapper).ToList(); | ||
children = children.Union(moleculeBuilderDTO.InteractionContainerCollection.MapAllUsing(_interactionContainerMapper)).ToList(); | ||
children.Each(node.AddChild); | ||
return node; | ||
} | ||
} | ||
|
||
|
||
public interface ITransporterMoleculeContainerDTOToMoleculeTreeNodeMapper : IMapper<TransporterMoleculeContainerDTO, IMoleculeTreeNode> | ||
{ | ||
} | ||
|
||
internal class TransporterMoleculeContainerDTOToMoleculeTreeNodeMapper : ITransporterMoleculeContainerDTOToMoleculeTreeNodeMapper | ||
{ | ||
private readonly ITranpsortBuilderDTOToMoleculeTreeNodeMapper _activeTransportRealizationsBuilderToMolceculeTreeNodeMapper; | ||
private readonly ITransportBuilderDTOToMoleculeTreeNodeMapper _activeTransportRealizationsBuilderToMoleculeTreeNodeMapper; | ||
|
||
public TransporterMoleculeContainerDTOToMoleculeTreeNodeMapper(ITranpsortBuilderDTOToMoleculeTreeNodeMapper activeTransportRealizationsBuilderToMolceculeTreeNodeMapper) | ||
public TransporterMoleculeContainerDTOToMoleculeTreeNodeMapper(ITransportBuilderDTOToMoleculeTreeNodeMapper activeTransportRealizationsBuilderToMoleculeTreeNodeMapper) | ||
{ | ||
_activeTransportRealizationsBuilderToMolceculeTreeNodeMapper = activeTransportRealizationsBuilderToMolceculeTreeNodeMapper; | ||
_activeTransportRealizationsBuilderToMoleculeTreeNodeMapper = activeTransportRealizationsBuilderToMoleculeTreeNodeMapper; | ||
} | ||
|
||
public IMoleculeTreeNode MapFrom(TransporterMoleculeContainerDTO input) | ||
{ | ||
var node = new MoleculeTreeNode(input) {Text = input.Name, Icon = ApplicationIcons.IconByName(input.Icon)}; | ||
var children = input.Realizations.MapAllUsing(_activeTransportRealizationsBuilderToMolceculeTreeNodeMapper); | ||
var children = input.Realizations.MapAllUsing(_activeTransportRealizationsBuilderToMoleculeTreeNodeMapper); | ||
children.Each(node.AddChild); | ||
return node; | ||
} | ||
} | ||
|
||
internal interface ITranpsortBuilderDTOToMoleculeTreeNodeMapper : IMapper<TransportBuilderDTO, IMoleculeTreeNode> | ||
internal interface ITransportBuilderDTOToMoleculeTreeNodeMapper : IMapper<TransportBuilderDTO, IMoleculeTreeNode> | ||
{ | ||
} | ||
|
||
internal class TranpsortBuilderDTOToMoleculeTreeNodeMapper : ITranpsortBuilderDTOToMoleculeTreeNodeMapper | ||
internal class TransportBuilderDTOToMoleculeTreeNodeMapper : ITransportBuilderDTOToMoleculeTreeNodeMapper | ||
{ | ||
public IMoleculeTreeNode MapFrom(TransportBuilderDTO input) | ||
{ | ||
return new MoleculeTreeNode(input) {Text = input.Name, Icon = ApplicationIcons.IconByName(input.Icon)}; | ||
} | ||
} | ||
|
||
public interface IInteractionContainerDTOToMoleculeTreeMapper:IMapper<InteractionContainerDTO,IMoleculeTreeNode> | ||
public interface IInteractionContainerDTOToMoleculeTreeMapper : IMapper<InteractionContainerDTO, IMoleculeTreeNode> | ||
{ | ||
|
||
} | ||
|
||
class InteractionContainerDTOToMoleculeTreeMapper : IInteractionContainerDTOToMoleculeTreeMapper | ||
public class InteractionContainerDTOToMoleculeTreeMapper : IInteractionContainerDTOToMoleculeTreeMapper | ||
{ | ||
public IMoleculeTreeNode MapFrom(InteractionContainerDTO input) | ||
public IMoleculeTreeNode MapFrom(InteractionContainerDTO interactionContainerDTO) | ||
{ | ||
return new MoleculeTreeNode(input) {Text = input.Name, Icon = ApplicationIcons.IconByName(input.Icon)}; | ||
return new MoleculeTreeNode(interactionContainerDTO) | ||
{ | ||
Text = interactionContainerDTO.Name, Icon = ApplicationIcons.IconByName(interactionContainerDTO.Icon) | ||
}; | ||
} | ||
} | ||
} |
18 changes: 8 additions & 10 deletions
18
...ation/MenusAndBars/ContextMenus/ContextMenuSpecificationFactoryForInteractionContainer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters