示例#1
0
 protected string GetDefaultDisplayName(IBrowsable browsableObject)
 {
     // for now, return the formal name of the object
     // in future, might use some logic to determine whether to use the formal
     // name or the friendly name
     return(browsableObject.FormalName);
 }
示例#2
0
 protected string GetDefaultDisplayName(IBrowsable browsableObject)
 {
     // for now, return the formal name of the object
     // in future, might use some logic to determine whether to use the formal
     // name or the friendly name
     return browsableObject.FormalName;
 }
示例#3
0
        /// <summary>
        /// Return the raw (primitive) field values for the given doc.
        /// </summary>
        /// <param name="docid">The document id.</param>
        /// <param name="fieldname">The field name.</param>
        /// <returns>An object array of raw field values.</returns>
        public virtual object[] GetRawFieldVal(int docid, string fieldname)
        {
            int        i       = ReaderIndex(docid);
            IBrowsable browser = m_subBrowsers[i];

            return(browser.GetRawFieldVal(docid - ReaderBase(i), fieldname));
        }
示例#4
0
        /// <summary>
        /// Return the raw (primitive) field values for the given doc.
        /// </summary>
        /// <param name="docid">The document id.</param>
        /// <param name="fieldname">The field name.</param>
        /// <returns>An object array of raw field values.</returns>
        public virtual object[] GetRawFieldVal(int docid, string fieldname)
        {
            int        i       = SubSearcher(docid);
            IBrowsable browser = GetSubBrowsers()[i];

            return(browser.GetRawFieldVal(SubDoc(docid), fieldname));
        }
示例#5
0
        public FileBrowser(IBrowsable b, string path = null)
        {
            InitializeComponent();

            fb       = b;
            lastPath = path;

            Application.Idle += new EventHandler(Application_Idle);

            // Populate renderer dropdown
            Assembly assembly = Assembly.GetAssembly(typeof(ImageListView));
            int      i        = 0;

            foreach (Type t in assembly.GetTypes())
            {
                if (t.BaseType == typeof(Manina.Windows.Forms.ImageListView.ImageListViewRenderer))
                {
                    renderertoolStripComboBox.Items.Add(new RendererItem(t));
                    if (t.Name == "DefaultRenderer")
                    {
                        renderertoolStripComboBox.SelectedIndex = i;
                    }
                    i++;
                }
            }
            listView1.RetryOnError = false;

            listView1.RetrieveVirtualItemThumbnail += RetrieveVirtualItemThumbnail;
            listView1.RetrieveVirtualItemImage     += RetrieveVirtualItemImage;
            listView1.RetrieveVirtualItemDetails   += RetrieveVirtualItemDetails;

            listView1.AllowDrag = true;
        }
示例#6
0
    private static void BrowseWebSites(IBrowsable browser, string[] webSites)
    {
        StringBuilder result = new StringBuilder();

        foreach (var webSite in webSites)
        {
            result.AppendLine(browser.Browse(webSite));
        }

        Console.Write(result);
    }
示例#7
0
 public static void Browser(IBrowsable phone, string[] sites)
 {
     for (int i = 0; i < sites.Length; i++)
     {
         try
         {
             Console.WriteLine(phone.Brows(sites[i]));
         }
         catch (ArgumentException ae)
         {
             Console.WriteLine(ae.Message);
         }
     }
 }
示例#8
0
        public static SortCollector BuildSortCollector(IBrowsable browser, Query q, SortField[] sort,
                                                       int offset, int count, bool forceScoring, bool fetchStoredFields, IEnumerable <string> termVectorsToFetch,
                                                       string[] groupBy, int maxPerGroup, bool collectDocIdCache)
        {
            bool doScoring = forceScoring;

            if (sort == null || sort.Length == 0)
            {
                if (q != null && !(q is MatchAllDocsQuery))
                {
                    sort = new SortField[] { SortField.FIELD_SCORE };
                }
            }

            if (sort == null || sort.Length == 0)
            {
                sort = new SortField[] { SortField.FIELD_DOC };
            }

            IEnumerable <string> facetNames = browser.FacetNames;

            foreach (SortField sf in sort)
            {
                if (sf.Type == SortField.SCORE)
                {
                    doScoring = true;
                    break;
                }
            }

            DocComparatorSource compSource;

            if (sort.Length == 1)
            {
                SortField sf = Convert(browser, sort[0]);
                compSource = GetComparatorSource(browser, sf);
            }
            else
            {
                DocComparatorSource[] compSources = new DocComparatorSource[sort.Length];
                for (int i = 0; i < sort.Length; ++i)
                {
                    compSources[i] = GetComparatorSource(browser, Convert(browser, sort[i]));
                }
                compSource = new MultiDocIdComparatorSource(compSources);
            }
            return(new SortCollectorImpl(compSource, sort, browser, offset, count, doScoring, fetchStoredFields, termVectorsToFetch, groupBy, maxPerGroup, collectDocIdCache));
        }
示例#9
0
        private static SortField Convert(IBrowsable browser, SortField sort)
        {
            string field        = sort.Field;
            var    facetHandler = browser.GetFacetHandler(field);

            if (facetHandler != null)
            {
                //browser.GetFacetHandler(field); // BUG? this does nothing with the result.
                BoboCustomSortField sortField = new BoboCustomSortField(field, sort.Reverse, facetHandler.GetDocComparatorSource());
                return(sortField);
            }
            else
            {
                return(sort);
            }
        }
示例#10
0
        private static DocComparatorSource GetComparatorSource(IBrowsable browser, SortField sf)
        {
            DocComparatorSource compSource = null;

            if (SortField.FIELD_DOC.Equals(sf))
            {
                compSource = new DocComparatorSource.DocIdDocComparatorSource();
            }
            else if (SortField.FIELD_SCORE.Equals(sf) || sf.Type == SortField.SCORE)
            {
                // we want to do reverse sorting regardless for relevance
                compSource = new ReverseDocComparatorSource(new DocComparatorSource.RelevanceDocComparatorSource());
            }
            else if (sf is BoboCustomSortField)
            {
                BoboCustomSortField custField = (BoboCustomSortField)sf;
                DocComparatorSource src       = custField.GetCustomComparatorSource();
                Debug.Assert(src != null);
                compSource = src;
            }
            else
            {
                IEnumerable <string> facetNames = browser.FacetNames;
                string sortName = sf.Field;
                if (facetNames.Contains(sortName))
                {
                    var handler = browser.GetFacetHandler(sortName);
                    Debug.Assert(handler != null);
                    compSource = handler.GetDocComparatorSource();
                }
                else
                {
                    // default lucene field
                    logger.Info("doing default lucene sort for: " + sf);
                    compSource = GetNonFacetComparatorSource(sf);
                }
            }
            bool reverse = sf.Reverse;

            if (reverse)
            {
                compSource = new ReverseDocComparatorSource(compSource);
            }
            compSource.IsReverse = reverse;
            return(compSource);
        }
示例#11
0
        private IBrowsable DrawBrowser(List <IBrowsable> allItems, IBrowsable currentItem)
        {
            var selected = default(IBrowsable);
            var columns  = Mathf.FloorToInt((position.width - 28) / Settings.IconSize);

            if (columns > 0)
            {
                var rows  = Mathf.CeilToInt(allItems.Count / (float)columns);
                var index = 0;

                for (var r = 0; r < rows; r++)
                {
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    for (var c = 0; c < columns; c++)
                    {
                        if (index < allItems.Count)
                        {
                            var item = allItems[index++];

                            if (item != null)
                            {
                                var rect = DrawIcon(Settings.IconSize, item.GetIcon(), item.GetTitle(), item == currentItem);

                                if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition) == true)
                                {
                                    if (Event.current.button == 0)
                                    {
                                        selected = item;
                                    }
                                    else
                                    {
                                        P3dHelper.SelectAndPing(item.GetObject());
                                    }
                                }
                            }
                            GUILayout.FlexibleSpace();
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }

            return(selected);
        }
        protected override void OnPostRegister()
        {
            foreach (IBrowsable browser in Model.BrowserManagers.Distinct())
            {
                var itm = new ToolStripMenuItem(browser.Name);
                itm.Tag    = browser;
                itm.Click += delegate(object sender, EventArgs e)
                {
                    IBrowsable b = (sender as ToolStripItem).Tag as IBrowsable;
                    try
                    {
                        Form form = b.Open();
                        if (form != null)
                        {
                            if (b.Modal)
                            {
                                form.ShowDialog(Model.Window);
                            }
                            else
                            {
                                form.Show();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        //Logger.DebugException(ex.Message, ex);
                        MessageBox.Show(string.Format("'{0}' could not be opened by '{1}'"
                                                      + "\n\n'{2}'"
                                                      + "\nStacktrace\n{3}", SelectedFiles.FirstOrDefault().Path, b.Name,
                                                      ex.Message, ex.StackTrace), ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                };

                openWith.DropDownItems.Add(itm);
            }
        }
        /// <summary>
        /// View a file using a browser
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolShowBtn_Click(object sender, EventArgs e)
        {
            IPhoneFile   file   = (IPhoneFile)fileList.FocusedItem.Tag;
            IPhoneBackup backup = Model.Backup;

            FileManager filemanager = FileManager.Current;
            FileInfo    dest        = filemanager.GetWorkingFile(backup, file);

            IBrowsable browser = _browserManger.Get(dest.Extension);

            try
            {
                if (browser != null)
                {
                    Form form = browser.Open();
                    if (form != null)
                    {
                        if (browser.Modal)
                        {
                            form.ShowDialog(this);
                        }
                        else
                        {
                            form.Show();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.DebugException(ex.Message, ex);
                MessageBox.Show(string.Format("'{0}' could not be opened by '{1}'"
                                              + "\n\n'{2}'"
                                              + "\nStacktrace\n{3}", dest.Name, browser.Name,
                                              ex.Message, ex.StackTrace), ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#14
0
        public static SortCollector BuildSortCollector(IBrowsable browser, Query q, SortField[] sort,
            int offset, int count, bool forceScoring, bool fetchStoredFields, IEnumerable<string> termVectorsToFetch,
            string[] groupBy, int maxPerGroup, bool collectDocIdCache)
        {
            bool doScoring = forceScoring;
            if (sort == null || sort.Length == 0)
            {
                if (q != null && !(q is MatchAllDocsQuery))
                {
                    sort = new SortField[] { SortField.FIELD_SCORE };
                }
            }

            if (sort == null || sort.Length == 0)
            {
                sort = new SortField[] { SortField.FIELD_DOC };
            }

            IEnumerable<string> facetNames = browser.FacetNames;
            foreach (SortField sf in sort)
            {
                if (sf.Type == SortField.SCORE)
                {
                    doScoring = true;
                    break;
                }
            }

            DocComparatorSource compSource;
            if (sort.Length == 1)
            {
                SortField sf = Convert(browser, sort[0]);
                compSource = GetComparatorSource(browser, sf);
            }
            else
            {
                DocComparatorSource[] compSources = new DocComparatorSource[sort.Length];
                for (int i = 0; i < sort.Length; ++i)
                {
                    compSources[i] = GetComparatorSource(browser, Convert(browser, sort[i]));
                }
                compSource = new MultiDocIdComparatorSource(compSources);
            }
            return new SortCollectorImpl(compSource, sort, browser, offset, count, doScoring, fetchStoredFields, termVectorsToFetch, groupBy, maxPerGroup, collectDocIdCache);
        }
示例#15
0
 private static SortField Convert(IBrowsable browser, SortField sort)
 {
     string field = sort.Field;
     var facetHandler = browser.GetFacetHandler(field);
     if (facetHandler != null)
     {
         //browser.GetFacetHandler(field); // BUG? this does nothing with the result.
         BoboCustomSortField sortField = new BoboCustomSortField(field, sort.Reverse, facetHandler.GetDocComparatorSource());
         return sortField;
     }
     else
     {
         return sort;
     }
 }
示例#16
0
 private static DocComparatorSource GetComparatorSource(IBrowsable browser, SortField sf)
 {
     DocComparatorSource compSource = null;
     if (SortField.FIELD_DOC.Equals(sf))
     {
         compSource = new DocComparatorSource.DocIdDocComparatorSource();
     }
     else if (SortField.FIELD_SCORE.Equals(sf) || sf.Type == SortField.SCORE)
     {
         // we want to do reverse sorting regardless for relevance
         compSource = new ReverseDocComparatorSource(new DocComparatorSource.RelevanceDocComparatorSource());
     }
     else if (sf is BoboCustomSortField)
     {
         BoboCustomSortField custField = (BoboCustomSortField)sf;
         DocComparatorSource src = custField.GetCustomComparatorSource();
         Debug.Assert(src != null);
         compSource = src;
     }
     else
     {
         IEnumerable<string> facetNames = browser.FacetNames;
         string sortName = sf.Field;
         if (facetNames.Contains(sortName))
         {
             var handler = browser.GetFacetHandler(sortName);
             Debug.Assert(handler != null);
             compSource = handler.GetDocComparatorSource();
         }
         else
         {
             // default lucene field
             logger.Info("doing default lucene sort for: " + sf);
             compSource = GetNonFacetComparatorSource(sf);
         }
     }
     bool reverse = sf.Reverse;
     if (reverse)
     {
         compSource = new ReverseDocComparatorSource(compSource);
     }
     compSource.IsReverse = reverse;
     return compSource;
 }
示例#17
0
 protected string GetDefaultDetails(IBrowsable browsableObject)
 {
     // for now, return the description of the object
     // although a given node class may wish to provide other details
     return browsableObject.Description == null ? "" : browsableObject.Description;
 }
        public string ShowBrowsableInView(IBrowsable browsable)
        {
            var result = NavigationTreeView.ShowBrowsableInView(browsable);

            return(result.ToString());
        }
        public string ShowParentOfBrowsableInView(IBrowsable browsable, out IBrowsable[] path)
        {
            var result = NavigationTreeView.ShowParentOfBrowsableInView(browsable, out path);

            return(result.ToString());
        }
 public bool ContainsBrowsable(IBrowsable browsable)
 {
     return(NavigationTreeView.ContainsBrowsable(browsable));
 }
示例#21
0
 public RegisterEventArgs(IBrowsable browser)
 {
     Browser = browser;
 }
示例#22
0
 protected string GetDefaultDetails(IBrowsable browsableObject)
 {
     // for now, return the description of the object
     // although a given node class may wish to provide other details
     return(browsableObject.Description == null ? "" : browsableObject.Description);
 }
示例#23
0
 internal ColumnsCollection([NotNull] IBrowsable owner)
     : base(StringComparer.OrdinalIgnoreCase)
 {
     Owner = owner ?? throw new ArgumentNullException(nameof(owner));
 }
 public Engine(ICallable caller, IBrowsable browser)
 {
     this.caller  = caller;
     this.browser = browser;
 }
示例#25
0
        public SortCollectorImpl(
            DocComparatorSource compSource,
            SortField[] sortFields,
            IBrowsable boboBrowser,
            int offset,
            int count,
            bool doScoring,
            bool fetchStoredFields,
            IEnumerable <string> termVectorsToFetch,
            string[] groupBy,
            int maxPerGroup,
            bool collectDocIdCache)
            : base(sortFields, fetchStoredFields)
        {
            Debug.Assert(offset >= 0 && count >= 0);
            _boboBrowser        = boboBrowser;
            _compSource         = compSource;
            _pqList             = new List <DocIDPriorityQueue>();
            _numHits            = offset + count;
            _offset             = offset;
            _count              = count;
            _totalHits          = 0;
            _totalGroups        = 0;
            _queueFull          = false;
            _doScoring          = doScoring;
            _tmpScoreDoc        = new MyScoreDoc();
            _termVectorsToFetch = termVectorsToFetch;

            // NightOwl888: The _collectDocIdCache setting seems to put arrays into
            // memory, but then do nothing with the arrays. Seems wasteful and unnecessary.
            //_collectDocIdCache = collectDocIdCache || groupBy != null;

            if (groupBy != null && groupBy.Length != 0)
            {
                var groupByList = new List <IFacetHandler>(groupBy.Length);
                foreach (string field in groupBy)
                {
                    IFacetHandler handler = boboBrowser.GetFacetHandler(field);
                    if (handler != null)
                    {
                        groupByList.Add(handler);
                    }
                }
                if (groupByList.Count > 0)
                {
                    this.groupByMulti = groupByList.ToArray();
                    this.groupBy      = groupByMulti[0];
                }
                if (this.groupBy != null && _count > 0)
                {
                    if (groupByMulti.Length == 1)
                    {
                        //_currentValueDocMaps = new Int2ObjectOpenHashMap<ScoreDoc>(_count);
                        _currentValueDocMaps  = new Dictionary <int, ScoreDoc>(_count);
                        _facetAccessibleLists = null;
                    }
                    else
                    {
                        _currentValueDocMaps      = null;
                        _facetCountCollectorMulti = new IFacetCountCollector[groupByList.Count - 1];
                        _facetAccessibleLists     = new List <IFacetAccessible> [_facetCountCollectorMulti.Length];
                        for (int i = 0; i < _facetCountCollectorMulti.Length; ++i)
                        {
                            _facetAccessibleLists[i] = new List <IFacetAccessible>();
                        }
                    }

                    // NightOwl888: The _collectDocIdCache setting seems to put arrays into
                    // memory, but then do nothing with the arrays. Seems wasteful and unnecessary.
                    //if (_collectDocIdCache)
                    //{
                    //    contextList = new List<CollectorContext>();
                    //    docidarraylist = new List<int[]>();
                    //    if (doScoring)
                    //        scorearraylist = new List<float[]>();
                    //}
                }
                else
                {
                    _currentValueDocMaps  = null;
                    _facetAccessibleLists = null;
                }
            }
            else
            {
                _currentValueDocMaps  = null;
                _facetAccessibleLists = null;
            }
        }
示例#26
0
 public Engine()
 {
     this.caller  = new Smartphone();
     this.browser = new Smartphone();
 }