Ejemplo n.º 1
0
        public static AttrGroup load(String data)
        {
            List <String> attrs         = new List <String>();
            bool          includeStates = true;
            int           sortMode      = MXMLPrettyPrinter.MXML_Sort_AscByCase;
            int           wrapMode      = MXMLPrettyPrinter.MXML_ATTR_WRAP_DEFAULT;
            String        name          = getValue(data, Tag_name);

            if (name == null)
            {
                return(null);
            }
            String num = getValue(data, Tag_sort);

            if (num != null)
            {
                try { sortMode = Int32.Parse(num); }
                catch {}
            }
            num = getValue(data, Tag_wrap);
            if (num != null)
            {
                try { wrapMode = Int32.Parse(num); }
                catch {}
            }
            int wrapData = Wrap_Data_Use_Default;

            num = getValue(data, Tag_data);
            if (num != null)
            {
                try { wrapData = Int32.Parse(num); }
                catch {}
            }
            String attrString = getValue(data, Tag_attrs);

            if (attrString != null)
            {
                String[] atts = attrString.Split(new string[] { GroupingSplitter }, StringSplitOptions.RemoveEmptyEntries);
                foreach (String attr in atts)
                {
                    String attr2 = AntlrUtilities.asTrim(attr);
                    if (attr2.Length > 0)
                    {
                        attrs.Add(attr2);
                    }
                }
            }
            String includeStatesData = getValue(data, Tag_includeStates);

            if (includeStatesData != null)
            {
                includeStates = Boolean.Parse(includeStatesData);
            }
            AttrGroup group = new AttrGroup(name, attrs, sortMode, wrapMode, includeStates);

            group.setData(wrapData);
            return(group);
        }