/// <summary>
        /// Creates a property for a "::Ferda::Modules::StringT". There can be not 
        /// only string, but also types of ComboBoxes and this method decides, which
        /// FerdaPropertySpec will be created
        /// </summary>
        /// <param name="pinfo">Information about the property</param>
        /// <param name="box">Box where it finds the other property</param>
        /// <param name="bag">Bag where to put the FerdaPropertySpec</param>
        protected void CreateStringProperty(PropertyInfo pinfo, IBoxModule box, PropertyTable bag)
        {
            FerdaPropertySpec ps;
            SelectString[] array;

            //determining the type of the property
            array = box.GetPropertyOptions(pinfo.name);

            if (array.Length == 0) //it is a normal string property
            {
                SocketInfo si = box.MadeInCreator.GetSocket(pinfo.name);

                ps = new FerdaPropertySpec(si.label, typeof(string), false);
                ps.Category = pinfo.categoryName;
                ps.Description = si.hint;
                if (box.IsPropertyReadOnly(pinfo.name) || box.GetPropertySocking(pinfo.name))
                {
                    ps.Attributes = new Attribute[]
                        {
                            ReadOnlyAttribute.Yes
                        };
                }

                bag.Properties.Add(ps);

                //adding the asynch stuff
                AddAsyncTemporary(pinfo.name, "System.String", !IsOneBoxSelected);
            }
            else //a combo-box should be used
            {
                //if there are more boxes selected, the property should not be added
                if (!IsOneBoxSelected)
                {
                    return;
                }

                if (box.ArePropertyOptionsObligatory(pinfo.name))
                //this means user cannot edit values
                {
                    SocketInfo si = box.MadeInCreator.GetSocket(pinfo.name);

                    ps = new FerdaPropertySpec(si.label, typeof(StringSequence), false);
                    ps.Category = pinfo.categoryName;
                    ps.Description = si.hint;

                    //atributes
                    if (box.IsPropertyReadOnly(pinfo.name) || box.GetPropertySocking(pinfo.name))
                    {
                        ps.Attributes = new Attribute[]
                            {
                            ReadOnlyAttribute.Yes,
                            new EditorAttribute(typeof(StringComboEditor), typeof(System.Drawing.Design.UITypeEditor)),
                            new TypeConverterAttribute(typeof(StringSequenceConverter))
                            };
                    }
                    else
                    {
                        ps.Attributes = new Attribute[]
                            {
                            new EditorAttribute(typeof(StringComboEditor), typeof(System.Drawing.Design.UITypeEditor)),
                            new TypeConverterAttribute(typeof(StringSequenceConverter))
                            };
                    }

                    //adding to the bag
                    bag.Properties.Add(ps);
                }
                else
                //user can add his own option to the string selection
                {
                    SocketInfo si = box.MadeInCreator.GetSocket(pinfo.name);

                    ps = new FerdaPropertySpec(si.label, typeof(StringSequence), false);
                    ps.Description = si.hint;
                    ps.Category = pinfo.categoryName;

                    //atributes
                    if (box.IsPropertyReadOnly(pinfo.name) || box.GetPropertySocking(pinfo.name))
                    {
                        ps.Attributes = new Attribute[]
                            {
                            ReadOnlyAttribute.Yes,
                            new EditorAttribute(typeof(StringComboAddingEditor), typeof(System.Drawing.Design.UITypeEditor)),
                            new TypeConverterAttribute(typeof(StringSequenceConverter))
                            };
                    }
                    else
                    {
                        ps.Attributes = new Attribute[]
                            {
                            new EditorAttribute(typeof(StringComboAddingEditor), typeof(System.Drawing.Design.UITypeEditor)),
                            new TypeConverterAttribute(typeof(StringSequenceConverter))
                            };
                    }

                    //adding to the bag
                    bag.Properties.Add(ps);
                }

                //adding the asynch stuff
                if (IsOneBoxSelected)
                {
                    AddAsyncTemporary(pinfo.name,
                        "Ferda.FrontEnd.Properties.StringSequence", false);
                }
            }
        }
        /// <summary>
        /// Adds the common properties of the selected boxes on the desktop
        /// to the <see cref="T:Ferda.FrontEnd.External.PropertyTable"/> 
        /// object. Common properties mean that all the boxes have the property
        /// of that name and the same type.
        /// </summary>
        /// <param name="boxes">The boxes from which the properties should 
        /// be created</param>
        /// <returns>A <see cref="T:Ferda.FrontEnd.External.PropertyTable"/>
        /// object filled with common properties</returns>
        protected PropertyTable CreatePropertiesFromMoreBoxes(IList<IBoxModule> boxes)
        {
            //structure where the common properties will be stored
            List<PropertyInfo> commonProperties = new List<PropertyInfo>();

            //initializing a new bag
            PropertyTable bag = new PropertyTable();
            bag.GetValue += new PropertySpecEventHandler(propertyBag_GetValue);
            bag.SetValue += new PropertySpecEventHandler(propertyBag_SetValue);
            //increasing the number of clicks of the user on the desktop
            bag.ClickID = IncreaseClickID();

            //first creator - properties from this creator will be
            //compared to creators from other boxes
            IBoxModuleFactoryCreator firstCreator = boxes[0].MadeInCreator;

            //iterating throutg all the properties of the first selected box
            foreach (PropertyInfo info in firstCreator.Properties)
            {
                bool contains = true;

                //all the boxes should include this property
                for (int i = 1; i < boxes.Count; i++)
                {
                    contains = ContainsPropertyInfo(boxes[i].MadeInCreator, info);
                    if (!contains)
                    {
                        break;
                    }
                }

                if (contains)
                {
                    commonProperties.Add(info);
                }
            }

            //iterating through all the common properties
            foreach (PropertyInfo pinfo in commonProperties)
            {
                FerdaPropertySpec ps;
                if (pinfo.visible)
                {
                    //two known other property types - StringSeqT and CategoriesT
                    if (pinfo.typeClassIceId == "::Ferda::Modules::StringSeqT" ||
                        pinfo.typeClassIceId == "::Ferda::Modules::CategoriesT")
                    {
                        //CreateOtherProperty(pinfo, box, bag);
                        continue;
                    }

                    //strings are also dealt with separatelly
                    if (pinfo.typeClassIceId == "::Ferda::Modules::StringT")
                    {
                        //deterimining if we can use a module to set the property
                        //bool canBeSetWithModule = true;
                        //foreach (IBoxModule box in boxes)
                        //{
                        //    canBeSetWithModule =
                        //        box.IsPropertySetWithSettingModule(pinfo.name);
                        //}
                        ////we can set the property with a module (ODBC Connection string)
                        //if (canBeSetWithModule)
                        //{
                        //    string normalType = GetNormalType(pinfo.typeClassIceId);
                        //    if (normalType != "")
                        //    {
                        //        //getting the displayable name of the property
                        //        SocketInfo si = firstCreator.GetSocket(pinfo.name);
                        //        ps = new FerdaPropertySpec(si.label, normalType, false);
                        //        ps.Category = pinfo.categoryName;
                        //        //getting the hint
                        //        ps.Description = si.hint;

                        //        //setting the attributes of the property
                        //        if (IsPropertyReadOnlyMoreBoxes(boxes, pinfo.name) ||
                        //            IsPropertySockedMoreBoxes(boxes, pinfo.name))
                        //        {
                        //            ps.Attributes = new Attribute[]
                        //            {
                        //                ReadOnlyAttribute.Yes,
                        //                new TypeConverterAttribute(typeof(OtherPropertyAddingConverter)),
                        //                new EditorAttribute(typeof(OtherPropertyEditor),
                        //                typeof(System.Drawing.Design.UITypeEditor))
                        //            };
                        //        }
                        //        else
                        //        {
                        //            ps.Attributes = new Attribute[]
                        //            {
                        //                new TypeConverterAttribute(typeof(OtherPropertyAddingConverter)),
                        //                new EditorAttribute(typeof(OtherPropertyEditor),
                        //                typeof(System.Drawing.Design.UITypeEditor))
                        //            };
                        //        }

                        //        //getting the property to the bag
                        //        bag.Properties.Add(ps);
                        //        //adding the asynchronous stuff
                        //        AddAsyncTemporary(pinfo.name, "Ferda.FrontEnd.Properties.OtherProperty", true);
                        //    }
                        //}
                        //else
                        {
                            //it is a normal string property
                            CreateStringProperty(pinfo, boxes[0], bag);
                        }
                    }
                    else
                    {
                        string normalType = GetNormalType(pinfo.typeClassIceId);

                        //This is a normal type, creating a normal property for it
                        if (normalType != "")
                        {
                            //getting the displayable name of the property
                            SocketInfo si = firstCreator.GetSocket(pinfo.name);
                            ps = new FerdaPropertySpec(si.label, normalType, false);
                            ps.Category = pinfo.categoryName;

                            //geting the socket information about the category
                            ps.Description = si.hint;

                            //it is readonly or it is already there as a socket -
                            //cannot edit "socketed" value
                            if (IsPropertyReadOnlyMoreBoxes(boxes, pinfo.name) ||
                                IsPropertySockedMoreBoxes(boxes, pinfo.name))
                            {
                                ps.Attributes = new Attribute[]
                                {
                                   ReadOnlyAttribute.Yes
                                };
                            }

                            bag.Properties.Add(ps);

                            //adding the asynchronous stuff
                            AddAsyncTemporary(pinfo.name, normalType, true);
                        }
                        else
                        {
                            throw new ApplicationException("Wierd type that we dont know!!!");
                        }
                    }
                }
            }
            return bag;
        }
        /// <summary>
        /// Creates a property for all other properties
        /// </summary>
        /// <param name="pinfo">Information about the property</param>
        /// <param name="box">Box where it finds the other property</param>
        /// <param name="bag">Bag where to put the propertyspec</param>
        protected void CreateOtherProperty(PropertyInfo pinfo, IBoxModule box, PropertyTable bag)
        {
            FerdaPropertySpec ps;

            SocketInfo si = box.MadeInCreator.GetSocket(pinfo.name);

            ps = new FerdaPropertySpec(si.label, typeof(OtherProperty), false);
            ps.Description = si.hint;
            ps.Category = pinfo.categoryName;

            //properties that user can set without executing the module (ODBC Connection string)
            if (box.IsPossibleToSetWithAbout(pinfo.name))
            //using a OtherPropertyAddingConverter
            {
                if (box.IsPropertyReadOnly(pinfo.name) || box.GetPropertySocking(pinfo.name))
                {
                    ps.Attributes = new Attribute[]
                    {
                        ReadOnlyAttribute.Yes,
                        new TypeConverterAttribute(typeof(OtherPropertyAddingConverter)),
                        new EditorAttribute(typeof(OtherPropertyEditor), typeof(System.Drawing.Design.UITypeEditor))
                    };
                }
                else
                {
                    ps.Attributes = new Attribute[]
                    {
                        new TypeConverterAttribute(typeof(OtherPropertyAddingConverter)),
                        new EditorAttribute(typeof(OtherPropertyEditor), typeof(System.Drawing.Design.UITypeEditor))
                    };
                }
            }
            else //using a OtherPropertyConverter
            {
                if (box.IsPropertyReadOnly(pinfo.name) || box.GetPropertySocking(pinfo.name))
                {
                    ps.Attributes = new Attribute[]
                    {
                        ReadOnlyAttribute.Yes,
                        new TypeConverterAttribute(typeof(OtherPropertyConverter)),
                        new EditorAttribute(typeof(OtherPropertyEditor), typeof(System.Drawing.Design.UITypeEditor))
                    };
                }
                else
                {
                    ps.Attributes = new Attribute[]
                    {
                        new TypeConverterAttribute(typeof(OtherPropertyConverter)),
                        new EditorAttribute(typeof(OtherPropertyEditor), typeof(System.Drawing.Design.UITypeEditor))
                    };
                }
            }
            if (IsOneBoxSelected)
            {
                AddAsyncTemporary(pinfo.name, "Ferda.FrontEnd.Properties.OtherProperty", false);
            }
            bag.Properties.Add(ps);
        }
        /// <summary>
        /// Adds the properties of the selectedBox to the bag
        /// </summary>
        /// <param name="box">Box from where the properties should be
        /// loaded</param>
        /// <returns>A bag full of properties from the box</returns>
        protected PropertyTable CreatePropertiesFromBox(IBoxModule box)
        {
            //initializing a new bag
            PropertyTable bag = new PropertyTable();
            //increasing the number of clicks of the user on the desktop
            bag.ClickID = IncreaseClickID();
            IBoxModuleFactoryCreator creator = box.MadeInCreator;

            FerdaPropertySpec ps;
            bag.GetValue += new PropertySpecEventHandler(propertyBag_GetValue);
            bag.SetValue += new PropertySpecEventHandler(propertyBag_SetValue);

            //iterating through all the properties
            foreach (PropertyInfo pinfo in creator.Properties)
            {
                if (pinfo.visible)
                {
                    if (box.IsPropertySetWithSettingModule(pinfo.name))
                    { //creating the "other" property
                        if (IsOneBoxSelected)
                        {
                            CreateOtherProperty(pinfo, box, bag);
                        }
                    }
                    else
                    { //creating normal property
                        //two known other property types - StringSeqT and CategoriesT
                        if (pinfo.typeClassIceId == "::Ferda::Modules::StringSeqT" ||
                            pinfo.typeClassIceId == "::Ferda::Modules::CategoriesT")
                        {
                            CreateOtherProperty(pinfo, box, bag);
                            continue;
                        }

                        //strings are also dealt with separatelly
                        if (pinfo.typeClassIceId == "::Ferda::Modules::StringT")
                        {
                            CreateStringProperty(pinfo, box, bag);
                        }
                        else
                        {
                            string normalType = GetNormalType(pinfo.typeClassIceId);

                            //This is a normal type, creating a normal property for it
                            if (normalType != "")
                            {
                                //getting the displayable name of the property
                                SocketInfo si = creator.GetSocket(pinfo.name);
                                ps = new FerdaPropertySpec(si.label, normalType, false);
                                ps.Category = pinfo.categoryName;

                                //geting the socket information about the category
                                ps.Description = si.hint;

                                //it is readonly or it is already there as a socket -
                                //cannot edit "socketed" value
                                if (box.IsPropertyReadOnly(pinfo.name) ||
                                    box.GetPropertySocking(pinfo.name))
                                {
                                    ps.Attributes = new Attribute[]
                                    {
                                       ReadOnlyAttribute.Yes
                                    };
                                }

                                bag.Properties.Add(ps);
                                AddAsyncTemporary(pinfo.name, normalType, false);
                            }
                            else
                            {
                                //throw new ApplicationException("Wierd type that we dont know!!!");
                            }
                        }
                    }
                }
            }
            return bag;
        }
        /// <summary>
        /// Adds to the <see cref="T:Ferda.FrontEnd.External.PropertyTable"/> table
        /// information about sockets of the box
        /// </summary>
        /// <param name="propertyTable">Table to put the properties</param>
        /// <param name="box">Box from where to get the properties</param>
        protected PropertyTable AddSocketProperties(PropertyTable propertyTable, IBoxModule box)
        {
            IBoxModuleFactoryCreator creator = box.MadeInCreator;
            FerdaPropertySpec ps;

            foreach (PropertyInfo pinfo in creator.Properties)
            {
                //we are not adding the visible and readonly properties
                if (pinfo.visible && !pinfo.readOnly)
                {
                    //getting the displayable name of the property
                    SocketInfo si = creator.GetSocket(pinfo.name);

                    //zatim je to udelane takhle
                    if (si.label != "")
                    {
                        ps = new FerdaPropertySpec(si.label, "System.Boolean", true);
                        ps.Category = ResManager.GetString("PropertySocketName");
                        ps.Description = ResManager.GetString("PropertySocketHint");
                        propertyTable.Properties.Add(ps);
                    }
                    else
                    {
                        throw new ApplicationException("A not read-only, visible property does not have a label.");
                    }
                }
            }

            return propertyTable;
        }