Ejemplo n.º 1
0
        /// <summary>
        /// 设置CSS样式
        /// </summary>
        /// <param name="style">样式</param>
        /// <param name="control">控件</param>
        public virtual void setStyle(String style, FCProperty control)
        {
            bool   isStr = false;
            String str   = "";

            foreach (char ch in style)
            {
                if (ch == '\'')
                {
                    isStr = !isStr;
                }
                if (!isStr)
                {
                    if (ch == ';')
                    {
                        int    idx    = str.IndexOf(':');
                        String pName  = str.Substring(0, idx);
                        String pValue = str.Substring(idx + 1);
                        control.setProperty(pName.ToLower(), pValue);
                        str = "";
                        continue;
                    }
                    else if (ch == ' ')
                    {
                        continue;
                    }
                }
                str += ch.ToString();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 读取样式
        /// </summary>
        /// <param name="node">XML节点</param>
        /// <param name="control">属性对象</param>
        public virtual void readStyle(XmlNode node, FCProperty control)
        {
            String styles = node.InnerText;
            bool   isStr  = false;
            String str    = "";

            foreach (char ch in styles)
            {
                if (ch == '\'')
                {
                    isStr = !isStr;
                }
                if (!isStr)
                {
                    if (ch == '}')
                    {
                        int    idx       = str.IndexOf('{');
                        String className = str.Substring(1, idx - 1).ToLower();
                        String style     = str.Substring(idx + 1);
                        m_styles.put(className, style);
                        continue;
                    }
                    else if (ch == ' ' || ch == '\r' || ch == '\n' || ch == '\t')
                    {
                        continue;
                    }
                }
                str += ch.ToString();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 后设置属性
        /// </summary>
        /// <param name="node">XML节点</param>
        /// <param name="control">属性对象</param>
        public virtual void setAttributesAfter(XmlNode node, FCProperty control)
        {
            HashMap <String, String> attributes = getAttributes(node);

            //读取属性
            foreach (String name in attributes.Keys)
            {
                if (isAfterSetingAttribute(name))
                {
                    control.setProperty(name, attributes.get(name));
                }
                else if (name == "class")
                {
                    if (m_styles.containsKey(attributes.get(name)))
                    {
                        setStyle(m_styles.get(attributes.get(name)), control);
                    }
                }
                else if (name == "style")
                {
                    setStyle(attributes.get(name), control);
                }
            }
            attributes.clear();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 设置事件
        /// </summary>
        /// <param name="node">XML节点</param>
        /// <param name="control">属性对象</param>
        public virtual void setEvents(XmlNode node, FCProperty control)
        {
            FCView baseControl = control as FCView;

            if (baseControl != null)
            {
                HashMap <String, String> attributes = getAttributes(node);
                foreach (String strEvent in attributes.Keys)
                {
                    m_event.registerEvent(baseControl, strEvent, attributes.get(strEvent));
                }
                attributes.clear();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 前设置属性
        /// </summary>
        /// <param name="node">XML节点</param>
        /// <param name="control">属性对象</param>
        public virtual void setAttributesBefore(XmlNode node, FCProperty control)
        {
            HashMap <String, String> attributes = getAttributes(node);

            //读取属性
            foreach (String name in attributes.Keys)
            {
                if (!isAfterSetingAttribute(name))
                {
                    control.setProperty(name, attributes.get(name));
                }
            }
            attributes.clear();
        }