Clojure / seeseaw.core/table lazy-seq 检索失败
Clojure / seeseaw.core/table lazy-seq retrieval failure
我的“(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"}
我想填充一个跷跷板。core/table(一个 Java JTable)在我构建跷跷板时使用 :row 属性 得到这些结果。core/frame/mig-panel/table (JFrame/JPanel/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. .........}{}{}{}{}
直接,它工作正常,table 中的行被正确填充,所以 (doall (apply prn (pm.models.db/list-projects))) 的输出格式是我需要的。
如何在跷跷板上下文中检索(我假设的)惰性序列。core/mig-panel?
谢谢
莫蒂默
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 键的值(无括号)。
:行 (pm.models.db/list-projects)
感谢 Carcigenicate 的建议。
我的“(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"}
我想填充一个跷跷板。core/table(一个 Java JTable)在我构建跷跷板时使用 :row 属性 得到这些结果。core/frame/mig-panel/table (JFrame/JPanel/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. .........}{}{}{}{} 直接,它工作正常,table 中的行被正确填充,所以 (doall (apply prn (pm.models.db/list-projects))) 的输出格式是我需要的。
如何在跷跷板上下文中检索(我假设的)惰性序列。core/mig-panel? 谢谢 莫蒂默
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 键的值(无括号)。 :行 (pm.models.db/list-projects)
感谢 Carcigenicate 的建议。