 
 (defn- sort-lines [lines] (map (fn [l] (sort component-comparator l)) lines))
 
-(defn- group-by-lines [accepting-children]
+(fg/defaccessorfn group-by-lines [component accepting-children]
   (let [cnt (count accepting-children)]
     (loop [line-y1 []
            line-y2 []

                           (count lines))
              existing-line (< line-index (count lines))
              line (if existing-line (nth lines line-index) #{})
              cy2 (+ cy (m/y (:clip-size c)))]
          (recur
            (if existing-line line-y1 (assoc line-y1 line-index cy))
            (assoc line-y2 line-index (if existing-line (max cy2 (nth line-y2 line-index)) cy2))

           (java.util Comparator)))


(fg/defevolverfn accepts-focus-evolver :accepts-focus?
  (and
    (get-property component [:this] :visible)
    (get-property component [:this] :enabled)
    (or
      ;; If the component is focusable itself
      (get-property component [:this] :focusable)
      ;; If the component has any child to which it can pass focus
      (some
        (fn [[_ c]] (get-property component [:this (:id c)] :accepts-focus?))
        (get-property component [:this] :children)))))

(fg/defaccessorfn get-accepting-children [component]
  (let [child-map (get-property component [:this] :children)]
    (filter
      (fn [c] (get-property component [:this (:id c)] :accepts-focus?))
      (for [[_ v] child-map] v))))

(def component-comparator
  (reify Comparator
