|
What this is
Other links
The source codepackage org.bookmodule; import org.openide.cookies.InstanceCookie; import org.openide.filesystems.FileObject; import org.openide.loaders.DataObject; import org.openide.loaders.Environment; import org.openide.util.Lookup; import org.openide.util.lookup.Lookups; import java.io.IOException; public class BookFactory implements Environment.Provider { public BookFactory() { } public static Book createBook() { return new Book(); } public static Book createBookWithParams(FileObject fo) { String author = (String) fo.getAttribute("author"); String title = (String) fo.getAttribute("title"); return new Book(author, title); } public Lookup getEnvironment(DataObject obj) { return Lookups.fixed(new Object[]{new InstanceCookie() { Book book = new Book(); public String instanceName() { return book.getClass().getName(); } public Class instanceClass() throws IOException, ClassNotFoundException { return book.getClass(); } public Object instanceCreate() throws IOException, ClassNotFoundException { return book; } }}); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 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.