Search in sources :

Example 21 with BeanDescriptor

use of java.beans.BeanDescriptor in project ACS by ACS-Community.

the class BeanTagger method setDefaultAction.

/**
   * Sets the default action qualified name for this <code>BeanInfo</code>
   * @param beanInfo the <code>BeanInfo</code> to tag with the default action.
   * @param defaultAction the qualified name of the default action
   */
public static void setDefaultAction(BeanInfo beanInfo, String defaultAction) {
    BeanDescriptor descriptor = beanInfo.getBeanDescriptor();
    if (descriptor == null)
        return;
    setDefaultAction(descriptor, defaultAction);
}
Also used : BeanDescriptor(java.beans.BeanDescriptor)

Example 22 with BeanDescriptor

use of java.beans.BeanDescriptor in project jdk8u_jdk by JetBrains.

the class ComponentBeanInfo method getBeanDescriptor.

public BeanDescriptor getBeanDescriptor() {
    BeanDescriptor bd = new BeanDescriptor(Component.class);
    // set a value to ensure that it's unique
    bd.setValue("test", Boolean.TRUE);
    return bd;
}
Also used : BeanDescriptor(java.beans.BeanDescriptor)

Example 23 with BeanDescriptor

use of java.beans.BeanDescriptor in project jdk8u_jdk by JetBrains.

the class FooBarBeanInfo method getBeanDescriptor.

public BeanDescriptor getBeanDescriptor() {
    BeanDescriptor bd = new BeanDescriptor(FooBar.class);
    // set a value to ensure that it's unique
    bd.setValue("test", Boolean.TRUE);
    return bd;
}
Also used : BeanDescriptor(java.beans.BeanDescriptor)

Example 24 with BeanDescriptor

use of java.beans.BeanDescriptor in project jdk8u_jdk by JetBrains.

the class Test4498236 method main.

public static void main(String[] args) throws Exception {
    PropertyChangeEvent event = new PropertyChangeEvent("source", null, null, null);
    event.setPropagationId("id");
    test("[propertyName=null; oldValue=null; newValue=null; propagationId=id; source=source]", event);
    test("[propertyName=name; oldValue=old; newValue=new; propagationId=null; source=source]", new PropertyChangeEvent("source", "name", "old", "new"));
    test("[propertyName=array; index=5; oldValue=old; newValue=new; propagationId=null; source=source]", new IndexedPropertyChangeEvent("source", "array", "old", "new", 5));
    FeatureDescriptor fd = new FeatureDescriptor();
    fd.setName("n");
    fd.setDisplayName("dn");
    fd.setShortDescription("sd");
    fd.setPreferred(true);
    fd.setHidden(true);
    fd.setExpert(true);
    fd.setValue("first", "value");
    test("[name=n; displayName=dn; shortDescription=sd; preferred; hidden; expert; values={first=value}]", fd);
    test("[name=String; beanClass=class java.lang.String]", new BeanDescriptor(String.class));
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]", new BeanDescriptor(Object.class, String.class));
    test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]", new BeanDescriptor(Object.class, String.class));
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object)]", new MethodDescriptor(Object.class.getMethod("equals", Object.class)));
    test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object); parameterDescriptors={java.beans.ParameterDescriptor[name=null]}]", new MethodDescriptor(Object.class.getMethod("equals", Object.class), new ParameterDescriptor[] { new ParameterDescriptor() }));
    Class type = KeyListener.class;
    String[] names = { "keyTyped", "keyPressed", "keyReleased" };
    Method[] methods = new Method[names.length];
    for (int i = 0; i < names.length; i++) {
        methods[i] = type.getMethod(names[i], KeyEvent.class);
    }
    test("[name=key; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.getKeyListeners(); addListenerMethod=public void Test4498236.addKeyListener(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.removeKeyListener(java.awt.event.KeyListener)]", new EventSetDescriptor(Test4498236.class, "key", type, names[0]));
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]", new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove"));
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]", new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove", "get"));
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]", new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type)));
    test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]", new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type), Test4498236.class.getMethod("get")));
    test("[name=value; propertyType=boolean; readMethod=public boolean Test4498236.isValue(); writeMethod=public void Test4498236.setValue(boolean)]", new PropertyDescriptor("value", Test4498236.class));
    test("[name=$$$]", new PropertyDescriptor("$$$", Test4498236.class, null, null));
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]", new PropertyDescriptor("$$$", Test4498236.class, "getValue", null));
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]", new PropertyDescriptor("$$$", Test4498236.class, "getValue", "setValue"));
    test("[name=$$$]", new PropertyDescriptor("$$$", null, null));
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]", new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), null));
    test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]", new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), Test4498236.class.getMethod("setValue", boolean.class)));
    test("[name=index; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]", new IndexedPropertyDescriptor("index", Test4498236.class));
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]", new IndexedPropertyDescriptor("$$$", Test4498236.class, "getIndex", "setIndex", "getIndex", "setIndex"));
    test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]", new IndexedPropertyDescriptor("$$$", Test4498236.class.getMethod("getIndex"), Test4498236.class.getMethod("setIndex", new int[0].getClass()), Test4498236.class.getMethod("getIndex", int.class), Test4498236.class.getMethod("setIndex", int.class, int.class)));
}
Also used : IndexedPropertyChangeEvent(java.beans.IndexedPropertyChangeEvent) PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyDescriptor(java.beans.PropertyDescriptor) IndexedPropertyDescriptor(java.beans.IndexedPropertyDescriptor) ParameterDescriptor(java.beans.ParameterDescriptor) Method(java.lang.reflect.Method) MethodDescriptor(java.beans.MethodDescriptor) EventSetDescriptor(java.beans.EventSetDescriptor) KeyEvent(java.awt.event.KeyEvent) FeatureDescriptor(java.beans.FeatureDescriptor) BeanDescriptor(java.beans.BeanDescriptor) IndexedPropertyChangeEvent(java.beans.IndexedPropertyChangeEvent) KeyListener(java.awt.event.KeyListener) IndexedPropertyDescriptor(java.beans.IndexedPropertyDescriptor)

Aggregations

BeanDescriptor (java.beans.BeanDescriptor)24 BeanInfo (java.beans.BeanInfo)9 SimpleBeanInfo (java.beans.SimpleBeanInfo)8 FakeFox01BeanInfo (org.apache.harmony.beans.tests.support.mock.FakeFox01BeanInfo)8 IndexedPropertyDescriptor (java.beans.IndexedPropertyDescriptor)5 PropertyDescriptor (java.beans.PropertyDescriptor)5 MethodDescriptor (java.beans.MethodDescriptor)3 MockJavaBean (org.apache.harmony.beans.tests.support.mock.MockJavaBean)3 IntrospectionException (java.beans.IntrospectionException)2 Method (java.lang.reflect.Method)2 KeyEvent (java.awt.event.KeyEvent)1 KeyListener (java.awt.event.KeyListener)1 EventSetDescriptor (java.beans.EventSetDescriptor)1 FeatureDescriptor (java.beans.FeatureDescriptor)1 IndexedPropertyChangeEvent (java.beans.IndexedPropertyChangeEvent)1 ParameterDescriptor (java.beans.ParameterDescriptor)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 ArrayList (java.util.ArrayList)1 Enumeration (java.util.Enumeration)1 LinkedList (java.util.LinkedList)1