0.1.0-SNAPSHOT permalink Arrow_down_16x16



  • (string-ref-content str-ref)

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clj_swing/document.clj:27 top

(defn string-ref-content [str-ref]
  (let [positions (atom [])]
    (proxy [AbstractDocument$Content] []
      (createPosition [offset]
		      (let [p (atom offset)]
			(swap! positions conj p)
			(proxy [Position] []
			  (getOffset [] @p))))

      (getChars [where len txt]
		(let [s (max 0 (min where len))
		      e (max 0 (min where len (.length @str-ref)))]
		  (println "A:" @str-ref where len)
		  (set! (. txt array) (into-array Character/TYPE (seq (subs @str-ref s e))))
		  (println "B")
		  (prn (seq (. txt array)))))

      (getString [where len]
		 (let [s (max 0 (min where len))
		      e (max 0 (min where len (.length @str-ref)))]
		   (subs @str-ref s e)))

      (length []
	     (.length @str-ref))

      (insertString [where str]
		    (swap! positions update-positions where (.length str))
		     (alter str-ref str-insert where str))

      (remove [where nitems] 
	      (swap! positions update-positions where (- 0 nitems))
	       (alter str-ref str-remove where nitems))
Vars in clj-swing.document/string-ref-content: - alter conj defn dosync into-array let println prn proxy remove seq str subs swap! deref
Used in 0 other vars

Comments top

No comments for string-ref-content. Log in to add a comment.