Example #1
0
        /// <summary> Clones this element, not copying the actual data
        /// in the fields, but all other values. </summary>
        /// <returns>Clone of this element</returns>
        public override abstract_Element Clone()
        {
            // Get the new element
            fileChooser_Element2 newElement = (fileChooser_Element2)Element_Factory.getElement(this.Type, this.Display_SubType);

            newElement.Location     = this.Location;
            newElement.Language     = this.Language;
            newElement.Title_Length = this.Title_Length;
            newElement.Height       = this.Height;
            newElement.Font         = this.Font;
            newElement.Set_Width(this.Width);
            newElement.Index = this.Index + 1;

            return(newElement);
        }
Example #2
0
        /// <summary> Clones this element, not copying the actual data
        /// in the fields, but all other values. </summary>
        /// <returns>Clone of this element</returns>
        public override abstract_Element Clone()
        {
            // Get the new element
            multiple_textBox_Element newElement = (multiple_textBox_Element)Element_Factory.getElement(this.Type, this.Display_SubType);

            newElement.Location        = this.Location;
            newElement.Language        = this.Language;
            newElement.Title_Length    = this.Title_Length;
            newElement.Text_Box_Length = this.Text_Box_Length;
            newElement.Height          = this.Height;
            newElement.Font            = this.Font;
            newElement.Set_Width(this.Width);
            newElement.Index = this.Index + 1;
            return((abstract_Element)newElement);
        }
        /// <summary> Clones this element, not copying the actual data
        /// in the fields, but all other values. </summary>
        /// <returns>Clone of this element</returns>
        public override abstract_Element Clone()
        {
            // Get the new element
            keywordScheme_Element newElement = (keywordScheme_Element)Element_Factory.getElement(this.Type, this.Display_SubType);

            newElement.Location     = this.Location;
            newElement.Language     = this.Language;
            newElement.Title_Length = this.Title_Length;
            newElement.Height       = this.Height;
            newElement.Font         = this.Font;
            newElement.Set_Width(this.Width);
            newElement.Index = this.Index + 1;

            // Copy the combo box specific values
            foreach (string thisItem in thisSchemeBox.Items)
            {
                newElement.Add_Scheme(thisItem);
            }

            return(newElement);
        }
Example #4
0
        private abstract_Element process_element(XmlNodeReader nodeReader, int current_page_count)
        {
            string type    = String.Empty;
            string subtype = String.Empty;

            // Step through all the attributes until the type is found
            nodeReader.MoveToFirstAttribute();
            do
            {
                // Get the type attribute
                if (nodeReader.Name.ToUpper().Trim() == "TYPE")
                {
                    type = nodeReader.Value;
                }

                // Get the subtype attribute
                if (nodeReader.Name.ToUpper().Trim() == "SUBTYPE")
                {
                    subtype = nodeReader.Value;
                }
            } while (nodeReader.MoveToNextAttribute());

            // Make sure a type was specified
            if (type == String.Empty)
            {
                return(null);
            }

            // Build the element
            abstract_Element newElement = Element_Factory.getElement(type, subtype);

            // If thie element was null, return null
            if (newElement == null)
            {
                return(null);
            }

            // Set the page number for post back reasons
            newElement.Template_Page = current_page_count;

            // Some special logic here
            if ((newElement.Type == Element_Type.Type) && (newElement.Display_SubType == "form"))
            {
                (( Type_Format_Form_Element )newElement).Set_Postback("javascript:__doPostBack('newpagebutton" + current_page_count + "','')");
            }


            if ((newElement.Type == Element_Type.Title) && (newElement.Display_SubType == "form"))
            {
                complexMainTitleExists = true;
            }

            if ((newElement.Type == Element_Type.Note) && (newElement.Display_SubType == "complex"))
            {
                ((Note_Complex_Element)newElement).Include_Statement_Responsibility = !complexMainTitleExists;
            }

            // Now, step through all the attributes again
            nodeReader.MoveToFirstAttribute();
            do
            {
                switch (nodeReader.Name.ToUpper().Trim())
                {
                case "REPEATABLE":
                    bool repeatable;
                    if (Boolean.TryParse(nodeReader.Value, out repeatable))
                    {
                        newElement.Repeatable = repeatable;
                    }
                    break;

                case "MANDATORY":
                    bool mandatory;
                    if (Boolean.TryParse(nodeReader.Value, out mandatory))
                    {
                        newElement.Mandatory = mandatory;
                    }
                    break;

                case "READONLY":
                    bool isReadOnly;
                    if (Boolean.TryParse(nodeReader.Value, out isReadOnly))
                    {
                        newElement.Read_Only = isReadOnly;
                    }
                    break;

                case "ACRONYM":
                    newElement.Acronym = nodeReader.Value;
                    break;
                }
            } while (nodeReader.MoveToNextAttribute());

            // Move back to the element, if there were attributes (should be)
            nodeReader.MoveToElement();

            // Is there element_data?
            if (!nodeReader.IsEmptyElement)
            {
                nodeReader.Read();
                if ((nodeReader.NodeType == XmlNodeType.Element) && (nodeReader.Name.ToLower() == "element_data"))
                {
                    // Create the new tree
                    StringWriter  sw = new StringWriter();
                    XmlTextWriter tw = new XmlTextWriter(sw);
                    tw.WriteNode(nodeReader, true);
                    tw.Close();

                    // Let the element process this inner data
                    newElement.Read_XML(new XmlTextReader(new StringReader(sw.ToString())));
                }
            }

            // Return this built element
            return(newElement);
        }
Example #5
0
        private abstract_Element process_element(XmlNodeReader nodeReader, int current_page_count)
        {
            string type    = String.Empty;
            string subtype = String.Empty;

            // Step through all the attributes until the type is found
            nodeReader.MoveToFirstAttribute();
            do
            {
                // Get the type attribute
                if (nodeReader.Name.ToUpper().Trim() == "TYPE")
                {
                    type = nodeReader.Value;
                }

                // Get the subtype attribute
                if (nodeReader.Name.ToUpper().Trim() == "SUBTYPE")
                {
                    subtype = nodeReader.Value;
                }
            } while (nodeReader.MoveToNextAttribute());

            // Make sure a type was specified
            if (type == String.Empty)
            {
                return(null);
            }

            // Build the element
            abstract_Element newElement = Element_Factory.getElement(type, subtype);

            // If thie element was null, return null
            if (newElement == null)
            {
                return(null);
            }

            // Set the page number for post back reasons
            newElement.Template_Page = current_page_count;

            // Now, step through all the attributes again
            nodeReader.MoveToFirstAttribute();
            do
            {
                switch (nodeReader.Name.ToUpper().Trim())
                {
                case "REPEATABLE":
                    bool repeatable;
                    if (Boolean.TryParse(nodeReader.Value, out repeatable))
                    {
                        newElement.Repeatable = repeatable;
                    }
                    break;

                case "MANDATORY":
                    bool mandatory;
                    if (Boolean.TryParse(nodeReader.Value, out mandatory))
                    {
                        newElement.Mandatory = mandatory;
                    }
                    break;

                case "READONLY":
                    bool isReadOnly;
                    if (Boolean.TryParse(nodeReader.Value, out isReadOnly))
                    {
                        newElement.Read_Only = isReadOnly;
                    }
                    break;

                case "ACRONYM":
                    newElement.Acronym = nodeReader.Value;
                    break;
                }
            } while (nodeReader.MoveToNextAttribute());

            // Move back to the element, if there were attributes (should be)
            nodeReader.MoveToElement();

            // Is there element_data?
            if (!nodeReader.IsEmptyElement)
            {
                nodeReader.Read();
                if ((nodeReader.NodeType == XmlNodeType.Element) && (nodeReader.Name.ToLower() == "element_data"))
                {
                    // Let the element process this inner data
                    newElement.Read_XML(nodeReader.ReadSubtree());
                }
            }

            // Return this built element
            return(newElement);
        }
        private abstract_Element process_element(XmlNodeReader nodeReader)
        {
            string type    = String.Empty;
            string subtype = String.Empty;

            // Step through all the attributes until the type is found
            nodeReader.MoveToFirstAttribute();
            do
            {
                // Get the type attribute
                if (nodeReader.Name.ToUpper().Trim() == "TYPE")
                {
                    type = nodeReader.Value;
                }

                // Get the subtype attribute
                if (nodeReader.Name.ToUpper().Trim() == "SUBTYPE")
                {
                    subtype = nodeReader.Value;
                }
            } while (nodeReader.MoveToNextAttribute());

            // Make sure a type was specified
            if (type == String.Empty)
            {
                return(null);
            }

            // Build the element
            abstract_Element newElement = Element_Factory.getElement(type, subtype);

            // Some special code to make the creator element aware if there is a contributor element
            if ((newElement.Type == Element_Type.Creator) && (newElement.Display_SubType == "simple"))
            {
                creatorSimpleElement = (Creator_Simple_Element)newElement;
            }
            if ((newElement.Type == Element_Type.Contributor) && (creatorSimpleElement != null))
            {
                creatorSimpleElement.Contributor_Exists = true;
            }

            // Some special code to let the simple subject element know if there is a simple spatial element
            if ((newElement.Type == Element_Type.Subject) && ((newElement.Display_SubType == "simple") || (newElement.Display_SubType == "dublincore")))
            {
                if (spatialSimpleElement != null)
                {
                    ((Subject_Simple_Element)newElement).Seperate_Dublin_Core_Spatial_Exists = true;
                }
                else
                {
                    subjectSimpleElement = (Subject_Simple_Element)newElement;
                }
            }
            if ((newElement.Type == Element_Type.Spatial) && (newElement.Display_SubType == "dublincore"))
            {
                if (subjectSimpleElement != null)
                {
                    subjectSimpleElement.Seperate_Dublin_Core_Spatial_Exists = true;
                }
                else
                {
                    spatialSimpleElement = (Spatial_Simple_Element)newElement;
                }
            }

            // Now, step through all the attributes again
            nodeReader.MoveToFirstAttribute();
            do
            {
                try
                {
                    switch (nodeReader.Name.ToUpper().Trim())
                    {
                    case "X":
                        newElement.Location = new Point(Convert.ToInt16(nodeReader.Value), newElement.Location.Y);
                        break;

                    case "Y":
                        newElement.Location = new Point(newElement.Location.X, Convert.ToInt16(nodeReader.Value));
                        break;

                    case "HEIGHT":
                        newElement.Height = Convert.ToInt16(nodeReader.Value);
                        break;

                    case "WIDTH":
                        newElement.Width = Convert.ToInt16(nodeReader.Value);
                        break;

                    case "REPEATABLE":
                        newElement.Repeatable = Convert.ToBoolean(nodeReader.Value);
                        break;

                    case "MANDATORY":
                        newElement.Mandatory = Convert.ToBoolean(nodeReader.Value);
                        break;
                    }
                }
                catch { }
            } while (nodeReader.MoveToNextAttribute());

            // Move back to the element, if there were attributes (should be)
            nodeReader.MoveToElement();

            // Is there element_data?
            if (!nodeReader.IsEmptyElement)
            {
                nodeReader.Read();
                if ((nodeReader.NodeType == XmlNodeType.Element) && (nodeReader.Name.ToLower() == "element_data"))
                {
                    // Create the new tree
                    StringWriter  sw = new StringWriter();
                    XmlTextWriter tw = new XmlTextWriter(sw);
                    tw.WriteNode(nodeReader, true);
                    tw.Close();

                    // Let the element process this inner data
                    newElement.Read_XML(new XmlTextReader(new StringReader(sw.ToString())));
                }
            }

            // If this is the METS ObjectID, suppress it if the SobekCM add-on is enabled
            if ((newElement.Type == Element_Type.METS_ObjectID) && (addonsEnabled.Contains("SOBEKCM")))
            {
                return(null);
            }

            // Return this built element
            return(newElement);
        }