Skip to content
Browse files

Implements LayoutManipulation for card-panel

See card-panel test in test/seesaw/test/core.clj for usage.
  • Loading branch information...
1 parent f5838d7 commit 017d36e34420066a4bca386b17223c82b3112677 @daveray committed Mar 4, 2013
Showing with 19 additions and 3 deletions.
  1. +7 −1 src/seesaw/layout.clj
  2. +11 −1 test/seesaw/test/core.clj
  3. +1 −1 test/seesaw/test/layout.clj
View
8 src/seesaw/layout.clj
@@ -276,7 +276,13 @@
(add!* [layout target widget constraint]
(add-widget target widget (border-layout-dirs constraint)))
(get-constraint* [layout container widget]
- (.getConstraints layout widget)))
+ (.getConstraints layout widget))
+
+ java.awt.CardLayout
+ (add!* [layout target widget constraint]
+ (add-widget target widget (name constraint)))
+
+ (get-constraint* [layout container widget]))
;;;
View
12 test/seesaw/test/core.clj
@@ -1620,7 +1620,17 @@
(expect (instance? java.awt.CardLayout (.getLayout p)))
(expect (= 4 (.. p getLayout getHgap)))
(expect (= 3 (.. p getLayout getVgap)))
- (expect (= 2 (count (.getComponents p)))))))
+ (expect (= 2 (count (.getComponents p))))))
+ (it "supports adding cards with add!"
+ (let [p (card-panel)
+ a (text "A")
+ b (text "B")]
+ (add! p [a :a])
+ (expect (= a (first (.getComponents p))))
+ (add! p [b "b"])
+ (expect (= b (second (.getComponents p))))
+ (show-card! p "b")
+ (expect (visible? b)))))
(describe show-card!
(it "sets the visible card in a card panel"
View
2 test/seesaw/test/layout.clj
@@ -2,7 +2,7 @@
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-; which can be found in the file epl-v10.html at the root of this
+; which can be found in the file epl-v10.html at the root of this
; distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.

0 comments on commit 017d36e

Please sign in to comment.
Something went wrong with that request. Please try again.