Clojure / seeseaw.core / table lazy-seq检索失败
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Clojure / seeseaw.core / table lazy-seq检索失败相关的知识,希望对你有一定的参考价值。
我的“(list-projects)”方法从SQLITE数据库中查询出一个映射。
(doall (apply prn (pm.models.db/list-projects)))
pm.core==>{:id 1, :name "MyTestProj", :owner "mbc", :date "2017-12-19 13:12:45"} {:id 2, :name "newproject1", :owner "mbc", :date "2017-12-19 13:12:45"} {:id 3, :name "newproject1", :owner "mbc", :date "2017-12-19 13:12:45"} {:id 4, :name "abc", :owner "def", :date "2017-12-19 13:12:45"} {:id 5, :name "abc", :owner "def", :date "2017-12-19 13:12:45"} {:id 6, :name "abc", :owner "def", :date "2017-12-19 13:12:45"} {:id 7, :name "newproject1", :owner "mbc", :date "2017-12-19 13:12:45"} {:id 8, :name "", :owner "", :date strong text"2017-12-19 13:12:45"}
在构造seesaw.core / frame / mig-panel / table(JFrame / JPanel / JTable)时,我想使用:row属性填充一个seesaw.core / table(Java JTable)和那些结果。
(def main-panel
(mig-panel
:constraints ["fill, ins 0"]
:items [[(seesaw.core/table
:id :tbl1
:size [640 :by 480]
:model [:columns [:id :name :owner :date]
:rows [(doall (apply prn (pm.models.db/list-projects)))]
]) "grow"]
]))
2. Unhandled clojure.lang.Compiler$CompilerException
Error compiling form-init4108264894568019320.clj at (44:16)
ang.Thread/run
1. Caused by java.lang.IllegalArgumentException
row must be a map or vector, got null
如果我插入地图{:id 1,:name“MyTestProj”,:owner“mbc”,:date“2017-12-19 13:12:45”} {:id ........} { } {} {} {}直接,它工作正常,表中的行被正确填充,因此(doall(应用prn(pm.models.db / list-projects)))的输出格式是我需要的。
如何在seesaw.core / mig-panel的上下文中检索(我推测)lazy-seq?谢谢莫蒂默
pm.core> (pm.models.db/list-projects)
({:id 1, :name "MyTestProj", :owner "mbc", :date "2017-12-19 13:12:45"} {:id 2, :name "newproject1", :owner "mbc", :date "2017-12-19 13:12:45"} {:id 3, :name "newproject1", :owner "mbc", :date "2017-12-19 13:12:45"} {:id 4, :name "abc", :owner "def", :date "2017-12-19 13:12:45"} {:id 5, :name "abc", :owner "def", :date "2017-12-19 13:12:45"} )
pm.core>
(pm.models.db / list-projects)产生一个列表,该列表可以直接用作:rows键(无括号)的值。 :rows(pm.models.db / list-projects)
感谢Carcigenicate的建议。
以上是关于Clojure / seeseaw.core / table lazy-seq检索失败的主要内容,如果未能解决你的问题,请参考以下文章
Clojure 类型提示,无法解析类名 clojure.core$double
《Learn Clojure》直播第二期:Clojure 数据类型介绍