private static void DrawDatabase(DataHelper dataHelper)
        {
            dataHelper.serializedObject.Update();
            EditorGUI.BeginChangeCheck ();
            LSEditorUtility.ListField(dataHelper.DataProperty, dataHelper.ListFlags);
            if (EditorGUI.EndChangeCheck ())
            {
                dataHelper.serializedObject.ApplyModifiedProperties ();
            }
            GUILayout.FlexibleSpace();

            EditorGUILayout.BeginHorizontal();
            //folding all
            foldAllBufferBuffer = foldAllBuffer;
            foldAllBuffer = false;
            if (GUILayout.Button("Fold All", GUILayout.MaxWidth(50)))
            {
                FoldAll();
            }
            //Search
            EditorGUILayout.LabelField("Filter: ", GUILayout.MaxWidth(35));
            searchString = EditorGUILayout.TextField(searchString, GUILayout.ExpandWidth(true));
            if (GUILayout.Button("X", GUILayout.MaxWidth(20)))
            {
                searchString = "";
            }
            if (lastSearchString != searchString)
            {
                if (string.IsNullOrEmpty(searchString) == false)
                {
                    dataHelper.FilterWithString(searchString);
                }
                lastSearchString = searchString;
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Order Alphabetically"))
            {
                dataHelper.Sort((a1, a2) => a1.Name.CompareTo(a2.Name));
            }

            SortInfo[] sorts = dataHelper.Sorts;
            for (int i = 0; i < sorts.Length; i++)
            {
                SortInfo sort = sorts [i];
                if (GUILayout.Button(sort.sortName))
                {
                    dataHelper.Sort((a1,a2) => sort.degreeGetter(a1) - sort.degreeGetter(a2));
                }
            }

            EditorGUILayout.EndHorizontal();

            dataHelper.Manage();
            dataHelper.serializedObject.Update ();

            EditorGUILayout.Space();
        }
 private DataHelper CreateDataHelper(DataItemInfo info)
 {
     DataHelper helper = new DataHelper(info.TargetType, this, Database, info.DisplayName,
                                        info.CodeName, info.FieldName, info.Sorts);
     this.DataHelpers.Add (helper);
     return helper;
 }
 private DataHelper CreateDataHelper(DataItemInfo info, out bool valid)
 {
     DataHelper helper = new DataHelper(info.TargetType, this, Database, info.DataName,info.FieldName, info.Sorts, out valid);
     this.HelperOrder.Add (info.DataName);
     this.DataHelpers.Add (info.DataName,helper);
     return helper;
 }