Created
August 27, 2010 20:20
-
-
Save aalmiray/554123 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import griffon.presentation.Scaffold | |
class Book { | |
String title | |
String author | |
} | |
@Scaffold(Book) | |
class BookBeanModel {} | |
// @Scaffold AST xform generates | |
//class BookBeanModel extends AbstractBeanModel { | |
// final Model title | |
// final Model author | |
// | |
// BookBeanModel() { | |
// super(Book) | |
// title = ModelUtils.makeModelFor(Book, this, 'title') | |
// author = ModelUtils.makeModelFor(Book, this, 'author') | |
// } | |
// | |
// List<Model<?>> getModelAttributes() { | |
// Arrays.asList(title, author) | |
// } | |
// } | |
// Model classes are fully observable | |
Model model = new BookBeanModel() | |
assert !model.value | |
assert !model.title.value | |
assert !model.author.value | |
Book book = new Book(title: 'Title1', author: 'Author1') | |
model.value = book | |
assert model.title.value == book.title | |
assert model.author.value == book.author | |
model.title.value = 'Title Changed' | |
assert book.title == 'Title Changed' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment