Exemple #1
0
 internal virtual void AddEventFilter(EventFilter filter)
 {
     if (EventLog.isLoggable(PlatformLogger.Level.FINEST))
     {
         EventLog.finest("adding the event filter: " + filter);
     }
     lock (EventFilters)
     {
         if (!EventFilters.Contains(filter))
         {
             if (filter is ModalEventFilter)
             {
                 ModalEventFilter newFilter = (ModalEventFilter)filter;
                 int k = 0;
                 for (k = 0; k < EventFilters.Count; k++)
                 {
                     EventFilter f = EventFilters[k];
                     if (f is ModalEventFilter)
                     {
                         ModalEventFilter cf = (ModalEventFilter)f;
                         if (cf.CompareTo(newFilter) > 0)
                         {
                             break;
                         }
                     }
                 }
                 EventFilters.Insert(k, filter);
             }
             else
             {
                 EventFilters.Add(filter);
             }
         }
     }
 }
        internal virtual int CompareTo(ModalEventFilter another)
        {
            Dialog anotherDialog = another.ModalDialog;
            // check if modalDialog is from anotherDialog's hierarchy
            //   or vice versa
            Component c = ModalDialog_Renamed;

            while (c != null)
            {
                if (c == anotherDialog)
                {
                    return(1);
                }
                c = c.Parent_NoClientCode;
            }
            c = anotherDialog;
            while (c != null)
            {
                if (c == ModalDialog_Renamed)
                {
                    return(-1);
                }
                c = c.Parent_NoClientCode;
            }
            // check if one dialog blocks (directly or indirectly) another
            Dialog blocker = ModalDialog_Renamed.ModalBlocker;

            while (blocker != null)
            {
                if (blocker == anotherDialog)
                {
                    return(-1);
                }
                blocker = blocker.ModalBlocker;
            }
            blocker = anotherDialog.ModalBlocker;
            while (blocker != null)
            {
                if (blocker == ModalDialog_Renamed)
                {
                    return(1);
                }
                blocker = blocker.ModalBlocker;
            }
            // compare modality types
            return(ModalDialog_Renamed.ModalityType.CompareTo(anotherDialog.ModalityType));
        }