|
Groovy example source code file (View.groovy)
The Groovy View.groovy source code/** * Created by IntelliJ IDEA. * User: Danno.Ferrin * Date: Apr 26, 2008 * Time: 8:31:21 AM */ package swing.greet import java.awt.Cursor import java.beans.PropertyChangeListener import javax.swing.* lookAndFeel('nimbus', 'mac', ['metal', [boldFonts: false]]) actions() { loginAction = action( name: 'Login', enabled: bind(source: controller, sourceProperty: 'allowLogin'), closure: controller.&login ) filterTweets = action( name: 'Filter', enabled: bind(source: controller, sourceProperty: 'allowSelection'), closure: controller.&filterTweets ) userSelected = action( name: 'Select User', enabled: bind(source: controller, sourceProperty: 'allowSelection'), closure: controller.&userSelected ) tweetAction = action( name: 'Update', enabled: bind(source: controller, sourceProperty: 'allowTweet'), closure: controller.&tweet ) } tweetLineFont = new java.awt.Font("Ariel", 0, 12) tweetLine = panel(border: emptyBorder(3), preferredSize:[250,84]) { gridBagLayout() tweetIcon = label(verticalTextPosition:SwingConstants.BOTTOM, horizontalTextPosition:SwingConstants.CENTER, //anchor: BASELINE, insets: [3, 3, 3, 3]) anchor: CENTER, insets: [3, 3, 3, 3]) tweetText = textArea(rows: 4, lineWrap: true, wrapStyleWord: true, opaque: false, editable: false, font: tweetLineFont, gridwidth: REMAINDER, weightx: 1.0, fill: BOTH, insets: [3, 3, 3, 3]) } tweetRenderer = {list, tweet, index, isSelected, isFocused -> if (tweet?.user as String) { tweetIcon.icon = controller.api.imageMap[tweet.user.profile_image_url as String] tweetIcon.text = tweet.user.screen_name tweetText.text = tweet.text } else if (tweet?.text as String) { tweetIcon.icon = controller.api.imageMap[tweet.parent().profile_image_url as String] tweetIcon.text = tweet.parent().screen_name tweetText.text = tweet.text } else { tweetIcon.icon = null tweetIcon.text = null tweetText.text = null } tweetLine } as ListCellRenderer userCell = label(border: emptyBorder(3)) userCellRenderer = {list, user, index, isSelected, isFocused -> if (user) { userCell.icon = controller.api.imageMap[user.profile_image_url as String] userCell.text = "<html>$user.screen_name Other Groovy examples (source code examples)Here is a short list of links related to this Groovy View.groovy source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.