Example #1
0
 public IMoleculeTreeNode MapFrom(TransportBuilderDTO input)
 {
     return(new MoleculeTreeNode(input)
     {
         Text = input.Name, Icon = ApplicationIcons.IconByName(input.Icon)
     });
 }
Example #2
0
 protected override void EditProcess(SystemicProcess systemicProcess, Compound compound)
 {
     _view.ApplicationIcon = ApplicationIcons.IconByName(systemicProcess.SystemicProcessType.IconName);
     _view.Caption         = PKSimConstants.UI.CreateSystemicProcess(systemicProcess.SystemicProcessType.DisplayName);
     _systemicProcessDTO   = _systemicProcessDTOMapper.MapFrom(systemicProcess, compound);
     _view.BindTo(_systemicProcessDTO);
 }
Example #3
0
        public SuperToolTip ToolTipFor(TransporterExpressionParameterDTO containerDTO)
        {
            var transportDirection = containerDTO.TransportDirection.Id;

            if (transportDirection == TransportDirectionId.None)
            {
                return(null);
            }

            var path = new List <string>();

            if (!string.IsNullOrEmpty(containerDTO.ContainerName))
            {
                path.Add(containerDTO.ContainerName);
            }

            if (!string.IsNullOrEmpty(containerDTO.CompartmentName))
            {
                path.Add(containerDTO.CompartmentName);
            }

            var containerDisplay = path.ToString(" - ");
            var info             = _representationInfoRepository.InfoFor(RepresentationObjectType.TRANSPORT_DIRECTION, transportDirection.ToString());

            return(CreateToolTip(info.Description, containerDisplay, ApplicationIcons.IconByName(info.IconName)));
        }
Example #4
0
 public IMoleculeTreeNode MapFrom(InteractionContainerDTO input)
 {
     return(new MoleculeTreeNode(input)
     {
         Text = input.Name, Icon = ApplicationIcons.IconByName(input.Icon)
     });
 }
Example #5
0
        public SuperToolTip ToolTipFor(JournalPageDTO journalPageDTO)
        {
            var toolTip = CreateToolTip(string.Empty, journalPageDTO.Title);

            toolTip.WithText(journalPageDTO.CreatedAtBy);
            toolTip.WithText(journalPageDTO.UpdatedAtBy);

            var relatedItems = journalPageDTO.RelatedItems;

            if (relatedItems.Any())
            {
                toolTip.Items.AddSeparator();
                toolTip.WithTitle(Captions.Journal.RelatedItems);
                foreach (var relatedItem in relatedItems)
                {
                    var item = toolTip.Items.Add(relatedItem.Display);
                    item.ImageOptions.SvgImage     = ApplicationIcons.IconByName(relatedItem.IconName);
                    item.ImageOptions.SvgImageSize = IconSizes.Size16x16;
                }
            }

            if (journalPageDTO.Tags.Any())
            {
                AddSubItemTo(toolTip, Captions.Journal.Tags, journalPageDTO.TagsDisplay);
            }

            return(toolTip);
        }
 public ITreeNode MapFrom(IObjectBaseDTO objectBaseDTO)
 {
     return(new ReferenceNode(objectBaseDTO)
     {
         Icon = ApplicationIcons.IconByName(objectBaseDTO.Icon),
         GetChildren = x => _getChildren(x).Select(MapFrom).ToList()
     });
 }
Example #7
0
        public ITreeNode <TObjectBase> CreateFor <TObjectBase>(TObjectBase entity, RepresentationInfo representationInfo) where TObjectBase : class, IObjectBase
        {
            var node = CreateObjectBaseNode(entity);

            node.Text    = representationInfo.DisplayName;
            node.ToolTip = _toolTipPartCreator.ToolTipFor(representationInfo.Description);
            node.Icon    = ApplicationIcons.IconByName(representationInfo.IconName);
            return(node);
        }
        public void SetData(DataTable mapping, DataTable containerTable, ICollection tissueLov)
        {
            grdMappping.DataSource = mapping;
            var view = grdMappping.MainView as GridView;

            if (view == null)
            {
                return;
            }
            GridColumn col;

            col         = view.Columns[DatabaseConfiguration.MappingColumns.COL_CONTAINER];
            col.Caption = PKSimConstants.ProteinExpressions.ColumnCaptions.Mapping.COL_CONTAINER;
            col.OptionsFilter.FilterPopupMode = FilterPopupMode.CheckedList;
            var containerComboBoxEditor = new RepositoryItemImageComboBox();
            var smallImages             = new ImageCollection();

            containerComboBoxEditor.SmallImages    = smallImages;
            containerComboBoxEditor.AllowNullInput = DefaultBoolean.True;
            containerComboBoxEditor.KeyDown       += onContainerComboBoxEditorKeyDown;

            containerComboBoxEditor.Items.BeginUpdate();
            foreach (DataRow row in containerTable.Rows)
            {
                var             container   = (string)row[ColumnNamesOfTransferTable.Container.ToString()];
                var             displayName = (string)row[ColumnNamesOfTransferTable.DisplayName.ToString()];
                ApplicationIcon icon        = ApplicationIcons.IconByName(container);
                if (icon != null && icon != ApplicationIcons.EmptyIcon)
                {
                    smallImages.AddImage(icon.ToImage(), container);
                    containerComboBoxEditor.Items.Add(new ImageComboBoxItem(displayName, container, smallImages.Images.Count - 1));
                }
                else if (container.Length > 0)
                {
                    containerComboBoxEditor.Items.Add(new ImageComboBoxItem(displayName, container));
                }
            }

            containerComboBoxEditor.Items.EndUpdate();
            col.ColumnEdit = containerComboBoxEditor;

            col         = view.Columns[DatabaseConfiguration.MappingColumns.COL_TISSUE];
            col.Caption = PKSimConstants.ProteinExpressions.ColumnCaptions.Mapping.COL_TISSUE;
            col.OptionsFilter.FilterPopupMode = FilterPopupMode.CheckedList;
            var tissueComboBoxEditor = new UxRepositoryItemComboBox(view);

            tissueComboBoxEditor.AutoComplete   = true;
            tissueComboBoxEditor.AllowNullInput = DefaultBoolean.True;
            tissueComboBoxEditor.KeyDown       += onTissueComboBoxEditorKeyDown;
            tissueComboBoxEditor.TextEditStyle  = TextEditStyles.DisableTextEditor;
            tissueComboBoxEditor.Items.BeginUpdate();
            tissueComboBoxEditor.Items.AddRange(tissueLov);
            tissueComboBoxEditor.Items.EndUpdate();
            col.ColumnEdit = tissueComboBoxEditor;
        }
Example #9
0
        private void addInfoToCategory(MetaDataCategory metaDataCategory, IContainer container)
        {
            metaDataCategory.ListOfValues.Add(container.Name, container.Name);

            var icon = ApplicationIcons.IconByName(container.Icon);

            if (icon != ApplicationIcons.EmptyIcon)
            {
                metaDataCategory.ListOfImages.Add(container.Name, icon);
            }
        }
Example #10
0
 public override void Edit(Individual individualToEdit)
 {
     _subPresenterItemManager.AllSubPresenters.Each(presenter => presenter.EditIndividual(individualToEdit));
     _view.ApplicationIcon = ApplicationIcons.IconByName(individualToEdit.Species.Icon);
     _view.EnableControl(IndividualItems.Settings);
     _view.EnableControl(IndividualItems.Parameters);
     _view.EnableControl(IndividualItems.Expression);
     _view.ActivateControl(IndividualItems.Parameters);
     UpdateCaption();
     _view.Display();
 }
Example #11
0
        public IMoleculeTreeNode MapFrom(TransporterMoleculeContainerDTO input)
        {
            var node = new MoleculeTreeNode(input)
            {
                Text = input.Name, Icon = ApplicationIcons.IconByName(input.Icon)
            };
            var children = input.Realizations.MapAllUsing(_activeTransportRealizationsBuilderToMolceculeTreeNodeMapper);

            children.Each(node.AddChild);
            return(node);
        }
        public ApplicationIcon IconFor(IPKSimBuildingBlock buildingBlock, IPKSimBuildingBlock emptySelection = null)
        {
            if (buildingBlock == null)
            {
                return(ApplicationIcons.EmptyIcon);
            }

            var buildingBlockIcon = ApplicationIcons.IconByName(buildingBlock.Icon);

            return(isTemplate(buildingBlock, emptySelection) ? buildingBlockIcon : ApplicationIcons.RedOverlayFor(buildingBlockIcon));
        }
Example #13
0
        public HierarchicalStructureNode MapFrom(IObjectBaseDTO objectBase)
        {
            var node = new HierarchicalStructureNode(objectBase)
            {
                Icon        = ApplicationIcons.IconByName(objectBase.Icon),
                Text        = objectBase.Name,
                GetChildren = x => _getChildren(x).MapAllUsing(this),
            };

            node.AddToolTipPart(descriptionFor(objectBase));
            return(node);
        }
Example #14
0
 private void addTemplatesTo(ITreeNode rootNode, TemplateDatabaseType templateDatabaseType)
 {
     foreach (var bb in _availableBuildingBlocks.Where(x => x.DatabaseType == templateDatabaseType).OrderBy(x => x.Name))
     {
         var node = _treeNodeFactory.CreateFor(bb).Under(rootNode);
         if (_shouldAddItemIcons)
         {
             node.WithIcon(ApplicationIcons.IconByName(bb.TemplateType.ToString()));
         }
     }
     _view.AddNode(rootNode);
 }
Example #15
0
        public IMoleculeTreeNode MapFrom(MoleculeBuilderDTO input)
        {
            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();
            children.Each(node.AddChild);
            return(node);
        }
Example #16
0
        private void mapBuildingBlocks <TBuildingBlock>(TBuildingBlock buildingBlock, IEnumerable <IBuildingBlock> allBuildingBlocks, bool shouldMergeByDefault) where TBuildingBlock : class, IBuildingBlock
        {
            var mapping = new BuildingBlockMappingDTO
            {
                AllAvailableBuildingBlocks = allBuildingBlocks,
                BuildingBlockToMerge       = buildingBlock ?? _noneBuildingBlock,
                BuildingBlockIcon          = ApplicationIcons.IconByName(_iconRepository.IconFor(buildingBlock))
            };

            mapping.ProjectBuildingBlock = shouldMergeByDefault ? mapping.AllAvailableBuildingBlocks.First() : _noneBuildingBlock;
            _allBuildingBlockMappings.Add(mapping);
        }
        private ITreeNode mapFrom(IGroup group, Func <IGroup, string> display)
        {
            ITreeNode node = _treeNodeFactory.CreateFor(group);

            node.Text = display(group);
            node.Icon = ApplicationIcons.IconByName(group.IconName);

            group.Children.Where(g => g.Visible)
            .OrderBy(g => g.Sequence)
            .ThenBy(display)
            .Each(childGroup => node.AddChild(mapFrom(childGroup, display)));

            return(node);
        }
Example #18
0
        private void updateIcon(TemplateType templateType)
        {
            if (!_shouldAddItemIcons)
            {
                return;
            }

            var icon = ApplicationIcons.IconByName(templateType.ToString());

            if (icon != ApplicationIcons.EmptyIcon)
            {
                _view.SetIcon(icon);
            }
        }
        private void addInfoToCategory(MetaDataCategory metaDataCategory, IObjectBase objectBase)
        {
            var info = _representationInfoRepository.InfoFor(objectBase);

            if (info == null)
            {
                metaDataCategory.ListOfValues.Add(objectBase.Name, objectBase.Name);
                return;
            }
            //only add with display name as information will be used in data repository as is
            metaDataCategory.ListOfValues.Add(info.DisplayName, info.DisplayName);
            var icon = ApplicationIcons.IconByName(info.IconName);

            if (icon != ApplicationIcons.EmptyIcon)
            {
                metaDataCategory.ListOfImages.Add(info.DisplayName, icon);
            }
        }
        private ITreeNode createNodeForContainer(IContainer container)
        {
            var representationInfo = _representationInfoRepository.InfoFor(container);
            var node = _treeNodeFactory.CreateFor(container, representationInfo);

            var moleculeAmount = container as IMoleculeAmount;

            if (moleculeAmount != null)
            {
                node.Icon = ApplicationIcons.IconByName(moleculeAmount.QuantityType.ToString());
            }

            var reaction = container as IReaction;

            if (reaction != null)
            {
                node.Icon = ApplicationIcons.Reaction;
            }

            return(node);
        }
        private ApplicationIcon getIconByTypeName(object objectBase)
        {
            var typeName = objectBase.GetType().Name;

            if (ApplicationIcons.HasIconNamed(typeName))
            {
                return(ApplicationIcons.IconByName(typeName));
            }

            if (typeName.StartsWith("I"))
            {
                typeName = typeName.Substring(1);
            }

            if (!ApplicationIcons.HasIconNamed(typeName))
            {
                typeName = typeName.Remove(typeName.Length - "Builder".Length);
            }

            return(ApplicationIcons.IconByName(typeName));
        }
 private ITreeNode createFor <T>(T objectBase) where T : class, IObjectBase
 {
     return(new ObjectWithIdAndNameNode <T>(objectBase)
            .WithIcon(ApplicationIcons.IconByName(objectBase.Icon)));
 }
 private ApplicationIcon retrieveIconForStatus(string iconName, BuildingBlockStatus status) => ApplicationIcons.IconByName($"{iconName}{status}");
        private void configGridColumns(DataView dataView)
        {
            var view = grdTransfer.MainView as GridView;

            if (view == null)
            {
                return;
            }

            var maxOldExpression = getPercentageMax(dataView, RelativeExpressionOldPercentage);
            var maxNewExpression = getPercentageMax(dataView, RelativeExpressionNewPercentage);

            var itemProgressBarOldExpression = initProgressBarEditor(maxOldExpression);

            itemProgressBarOldExpression.CustomDisplayText += OnProgressBarCustomDisplayText;

            var itemProgressBarNewExpression = initProgressBarEditor(maxNewExpression);

            itemProgressBarNewExpression.CustomDisplayText += OnProgressBarCustomDisplayText;

            foreach (GridColumn col in view.Columns)
            {
                col.OptionsColumn.AllowEdit = false;
                if (col.FieldName == ColumnNamesOfTransferTable.Container)
                {
                    col.Visible = true;
                    col.Caption = COL_CONTAINER;
                    var itemImageComboBox = new RepositoryItemImageComboBox {
                        ReadOnly = true
                    };
                    var smallImages = new ImageCollection();
                    itemImageComboBox.SmallImages = smallImages;
                    itemImageComboBox.Items.BeginUpdate();
                    var dv = view.DataSource as DataView;
                    if (dv != null)
                    {
                        var dt = dv.ToTable();
                        foreach (DataRow dr in dt.Rows)
                        {
                            string          container   = dr[ColumnNamesOfTransferTable.Container].ToString();
                            string          displayName = dr[DisplayName].ToString();
                            ApplicationIcon icon        = ApplicationIcons.IconByName(container);
                            if (icon != null && icon != ApplicationIcons.EmptyIcon)
                            {
                                smallImages.AddImage(icon.ToImage());
                                itemImageComboBox.Items.Add(new ImageComboBoxItem(displayName, container, smallImages.Images.Count - 1));
                            }
                            else
                            {
                                itemImageComboBox.Items.Add(new ImageComboBoxItem(displayName, container));
                            }
                        }
                    }

                    itemImageComboBox.Items.EndUpdate();
                    col.ColumnEdit = itemImageComboBox;
                    col.SortOrder  = ColumnSortOrder.Ascending;
                }
                else if (col.FieldName == DisplayName)
                {
                    col.Visible = false;
                }
                else if (col.FieldName == RelativeExpressionOld)
                {
                    col.Visible = false;
                }
                else if (col.FieldName == ExpressionValue)
                {
                    col.Visible = false;
                }
                else if (col.FieldName == Unit)
                {
                    col.Visible = false;
                }
                else if (col.FieldName == RelativeExpressionOldPercentage)
                {
                    col.Caption = COL_OLDVALUE;
                    col.Visible = _presenter.ShowOldValues;
                    col.OptionsColumn.AllowEdit = false;
                    col.ColumnEdit = itemProgressBarOldExpression;
                }
                else if (col.FieldName == RelativeExpressionNew)
                {
                    col.Visible = false;
                }
                else if (col.FieldName == RelativeExpressionNewPercentage)
                {
                    col.Caption = COL_NEWVALUE;
                    col.OptionsColumn.AllowEdit = false;
                    col.ColumnEdit = itemProgressBarNewExpression;
                }
            }
        }
Example #25
0
 private ITreeNode addIndividualToTree(Individual individual) => addBuildingBlockToTree(individual, PKSimRootNodeTypes.IndividualFolder, ApplicationIcons.IconByName(individual.Icon));
Example #26
0
        private void ConfigGridColumns()
        {
            var view = grdTransfer.MainView as GridView;

            if (view == null)
            {
                return;
            }
            var itemProgressBar = new RepositoryItemProgressBar
            {
                ReadOnly    = true,
                Enabled     = false,
                BorderStyle = BorderStyles.NoBorder,
                Maximum     = 100,
                Minimum     = 0,
                NullText    = string.Empty,
                PercentView = false,
                ShowTitle   = true
            };

            itemProgressBar.DisplayFormat.FormatType = FormatType.Numeric;
            itemProgressBar.CustomDisplayText       += OnProgressBarCustomDisplayText;

            foreach (GridColumn col in view.Columns)
            {
                col.OptionsColumn.AllowEdit = false;
                if (col.FieldName == ColumnNamesOfTransferTable.Container.ToString())
                {
                    col.Visible = true;
                    col.Caption = PKSimConstants.ProteinExpressions.ColumnCaptions.Transfer.COL_CONTAINER;
                    var itemImageComboBox = new RepositoryItemImageComboBox {
                        ReadOnly = true
                    };
                    var smallImages = new ImageCollection();
                    itemImageComboBox.SmallImages = smallImages;
                    itemImageComboBox.Items.BeginUpdate();
                    var dv = view.DataSource as DataView;
                    if (dv != null)
                    {
                        var dt = dv.ToTable();
                        foreach (DataRow dr in dt.Rows)
                        {
                            string          container   = dr[ColumnNamesOfTransferTable.Container.ToString()].ToString();
                            string          displayName = dr[ColumnNamesOfTransferTable.DisplayName.ToString()].ToString();
                            ApplicationIcon icon        = ApplicationIcons.IconByName(container);
                            if (icon != null && icon != ApplicationIcons.EmptyIcon)
                            {
                                smallImages.AddImage(icon.ToImage());
                                itemImageComboBox.Items.Add(new ImageComboBoxItem(displayName, container, smallImages.Images.Count - 1));
                            }
                            else
                            {
                                itemImageComboBox.Items.Add(new ImageComboBoxItem(displayName, container));
                            }
                        }
                    }
                    itemImageComboBox.Items.EndUpdate();
                    col.ColumnEdit = itemImageComboBox;
                    col.SortOrder  = ColumnSortOrder.Ascending;
                }
                else if (col.FieldName == ColumnNamesOfTransferTable.DisplayName.ToString())
                {
                    col.Visible = false;
                }
                else if (col.FieldName == ColumnNamesOfTransferTable.RelativeExpressionOld.ToString())
                {
                    col.Visible = false;
                }
                else if (col.FieldName == ColumnNamesOfTransferTable.ExpressionValue.ToString())
                {
                    col.Visible = false;
                }
                else if (col.FieldName == ColumnNamesOfTransferTable.Unit.ToString())
                {
                    col.Visible = false;
                }
                else if (col.FieldName == string.Concat(ColumnNamesOfTransferTable.RelativeExpressionOld.ToString(), STR_Percentage))
                {
                    col.Caption = PKSimConstants.ProteinExpressions.ColumnCaptions.Transfer.COL_OLDVALUE;
                    col.Visible = _presenter.ShowOldValues;
                    col.OptionsColumn.AllowEdit = false;
                    col.ColumnEdit = itemProgressBar;
                }
                else if (col.FieldName == ColumnNamesOfTransferTable.RelativeExpressionNew.ToString())
                {
                    col.Visible = false;
                }
                else if (col.FieldName == string.Concat(ColumnNamesOfTransferTable.RelativeExpressionNew.ToString(), STR_Percentage))
                {
                    col.Caption = PKSimConstants.ProteinExpressions.ColumnCaptions.Transfer.COL_NEWVALUE;
                    col.OptionsColumn.AllowEdit = false;
                    col.ColumnEdit = itemProgressBar;
                }
            }
        }
Example #27
0
 private ITreeNode addExpressionProfileToTree(ExpressionProfile expressionProfile) => addBuildingBlockToTree(expressionProfile, PKSimRootNodeTypes.ExpressionProfileFolder, ApplicationIcons.IconByName(expressionProfile.Icon));
 private int iconIndexFor(TransportDirection transportDirection) => ApplicationIcons.IconByName(transportDirection.Icon).Index;
 private ApplicationIcon iconByName(string iconName)
 {
     return(ApplicationIcons.HasIconNamed(iconName)
     ? ApplicationIcons.IconByName(iconName)
     : null);
 }
 private ApplicationIcon iconFor(RunStatus status) => ApplicationIcons.IconByName(status.IconName);