# HG changeset patch # User Jaroslav Tulach # Date 1213430022 -7200 # Node ID 1a89c6d914f6f5aeec7b435ea70d35fdb82a1b11 # Parent 76b5dfab3745a49228eae538375accec0a10dc3f Project to show usage of lookup diff -r 76b5dfab3745 -r 1a89c6d914f6 samples/componentinjection/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/componentinjection/build.xml Sat Jun 14 09:53:42 2008 +0200 @@ -0,0 +1,69 @@ + + + + + + Builds, tests, and runs the project componentinjection. + + + diff -r 76b5dfab3745 -r 1a89c6d914f6 samples/componentinjection/nbproject/build-impl.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/componentinjection/nbproject/build-impl.xml Sat Jun 14 09:53:42 2008 +0200 @@ -0,0 +1,627 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + + + + + + java -cp "${run.classpath.with.dist.jar}" ${main.class} + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + diff -r 76b5dfab3745 -r 1a89c6d914f6 samples/componentinjection/nbproject/genfiles.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/componentinjection/nbproject/genfiles.properties Sat Jun 14 09:53:42 2008 +0200 @@ -0,0 +1,8 @@ +build.xml.data.CRC32=72cbbae6 +build.xml.script.CRC32=72ca7645 +build.xml.stylesheet.CRC32=be360661 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=72cbbae6 +nbproject/build-impl.xml.script.CRC32=a1a473ce +nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08 diff -r 76b5dfab3745 -r 1a89c6d914f6 samples/componentinjection/nbproject/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/componentinjection/nbproject/project.properties Sat Jun 14 09:53:42 2008 +0200 @@ -0,0 +1,59 @@ +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/componentinjection.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +file.reference.junit-4.4.jar=../libs/dist/junit-4.4.jar +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.source=1.5 +javac.target=1.5 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${libs.junit.classpath}:\ + ${libs.junit_4.classpath}:\ + ${file.reference.junit-4.4.jar} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +meta.inf.dir=${src.dir}/META-INF +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff -r 76b5dfab3745 -r 1a89c6d914f6 samples/componentinjection/nbproject/project.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/componentinjection/nbproject/project.xml Sat Jun 14 09:53:42 2008 +0200 @@ -0,0 +1,16 @@ + + + org.netbeans.modules.java.j2seproject + + + componentinjection + 1.6.5 + + + + + + + + + diff -r 76b5dfab3745 -r 1a89c6d914f6 samples/componentinjection/src/org/apidesign/component/property/ToolkitFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/componentinjection/src/org/apidesign/component/property/ToolkitFactory.java Sat Jun 14 09:53:42 2008 +0200 @@ -0,0 +1,320 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package org.apidesign.component.property; + +import java.awt.Button; +import java.awt.Canvas; +import java.awt.Checkbox; +import java.awt.CheckboxMenuItem; +import java.awt.Choice; +import java.awt.Desktop; +import java.awt.Dialog; +import java.awt.Dialog.ModalExclusionType; +import java.awt.Dialog.ModalityType; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FileDialog; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Frame; +import java.awt.HeadlessException; +import java.awt.Image; +import java.awt.Label; +import java.awt.List; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.PopupMenu; +import java.awt.PrintJob; +import java.awt.ScrollPane; +import java.awt.Scrollbar; +import java.awt.TextArea; +import java.awt.TextField; +import java.awt.Toolkit; +import java.awt.Window; +import java.awt.datatransfer.Clipboard; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.InvalidDnDOperationException; +import java.awt.dnd.peer.DragSourceContextPeer; +import java.awt.font.TextAttribute; +import java.awt.im.InputMethodHighlight; +import java.awt.image.ColorModel; +import java.awt.image.ImageObserver; +import java.awt.image.ImageProducer; +import java.awt.peer.ButtonPeer; +import java.awt.peer.CanvasPeer; +import java.awt.peer.CheckboxMenuItemPeer; +import java.awt.peer.CheckboxPeer; +import java.awt.peer.ChoicePeer; +import java.awt.peer.DesktopPeer; +import java.awt.peer.DialogPeer; +import java.awt.peer.FileDialogPeer; +import java.awt.peer.FontPeer; +import java.awt.peer.FramePeer; +import java.awt.peer.LabelPeer; +import java.awt.peer.ListPeer; +import java.awt.peer.MenuBarPeer; +import java.awt.peer.MenuItemPeer; +import java.awt.peer.MenuPeer; +import java.awt.peer.PanelPeer; +import java.awt.peer.PopupMenuPeer; +import java.awt.peer.ScrollPanePeer; +import java.awt.peer.ScrollbarPeer; +import java.awt.peer.TextAreaPeer; +import java.awt.peer.TextFieldPeer; +import java.awt.peer.WindowPeer; +import java.net.URL; +import java.util.Map; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class ToolkitFactory { + private static Logger LOG = Logger.getLogger(ToolkitFactory.class.getName()); + + // BEGIN: lookup.init.toolkit + public Toolkit getDefaultToolkit () { + java.awt.Toolkit t = null; + String classname = System.getProperty ("java.awt.Toolkit"); + if (classname != null) { + try { + Class c = Class.forName (classname); + t = (java.awt.Toolkit)c.newInstance (); + } catch (Exception ex) { + LOG.log(Level.WARNING, "Cannot initialize toolkit: " + classname, ex); + } + } + // fallback + if (t == null) { + t = new GenericAWTToolkit (); + } + return t; + } + // END: lookup.init.toolkit + + private static final class GenericAWTToolkit extends Toolkit { + @Override + protected DesktopPeer createDesktopPeer(Desktop target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected ButtonPeer createButton(Button target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected TextFieldPeer createTextField(TextField target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected LabelPeer createLabel(Label target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected ListPeer createList(List target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected CheckboxPeer createCheckbox(Checkbox target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected ScrollbarPeer createScrollbar(Scrollbar target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected ScrollPanePeer createScrollPane(ScrollPane target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected TextAreaPeer createTextArea(TextArea target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected ChoicePeer createChoice(Choice target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected FramePeer createFrame(Frame target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected CanvasPeer createCanvas(Canvas target) { + throw new UnsupportedOperationException(); + } + + @Override + protected PanelPeer createPanel(Panel target) { + throw new UnsupportedOperationException(); + } + + @Override + protected WindowPeer createWindow(Window target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected DialogPeer createDialog(Dialog target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected MenuBarPeer createMenuBar(MenuBar target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected MenuPeer createMenu(Menu target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected PopupMenuPeer createPopupMenu(PopupMenu target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected MenuItemPeer createMenuItem(MenuItem target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected FileDialogPeer createFileDialog(FileDialog target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected FontPeer getFontPeer(String name, int style) { + throw new UnsupportedOperationException(); + } + + @Override + public Dimension getScreenSize() throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + public int getScreenResolution() throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + public ColorModel getColorModel() throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + public String[] getFontList() { + throw new UnsupportedOperationException(); + } + + @Override + public FontMetrics getFontMetrics(Font font) { + throw new UnsupportedOperationException(); + } + + @Override + public void sync() { + throw new UnsupportedOperationException(); + } + + @Override + public Image getImage(String filename) { + throw new UnsupportedOperationException(); + } + + @Override + public Image getImage(URL url) { + throw new UnsupportedOperationException(); + } + + @Override + public Image createImage(String filename) { + throw new UnsupportedOperationException(); + } + + @Override + public Image createImage(URL url) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean prepareImage(Image image, int width, int height, ImageObserver observer) { + throw new UnsupportedOperationException(); + } + + @Override + public int checkImage(Image image, int width, int height, ImageObserver observer) { + throw new UnsupportedOperationException(); + } + + @Override + public Image createImage(ImageProducer producer) { + throw new UnsupportedOperationException(); + } + + @Override + public Image createImage(byte[] imagedata, int imageoffset, int imagelength) { + throw new UnsupportedOperationException(); + } + + @Override + public PrintJob getPrintJob(Frame frame, String jobtitle, Properties props) { + throw new UnsupportedOperationException(); + } + + @Override + public void beep() { + throw new UnsupportedOperationException(); + } + + @Override + public Clipboard getSystemClipboard() throws HeadlessException { + throw new UnsupportedOperationException(); + } + + @Override + protected EventQueue getSystemEventQueueImpl() { + throw new UnsupportedOperationException(); + } + + @Override + public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isModalityTypeSupported(ModalityType modalityType) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isModalExclusionTypeSupported(ModalExclusionType modalExclusionType) { + throw new UnsupportedOperationException(); + } + + @Override + public Map mapInputMethodHighlight(InputMethodHighlight highlight) throws HeadlessException { + throw new UnsupportedOperationException(); + } + } +}