Java 类java.beans.Beans 实例源码

项目:incubator-netbeans    文件:PropertySupport.java   
public void setValue(T val)
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    if (setter == null) {
        throw new IllegalAccessException();
    }

    Object valideInstance = Beans.getInstanceOf(instance, setter.getDeclaringClass());

    try {
        setter.invoke(valideInstance, val);
    } catch (IllegalAccessException ex) {
        try {
            setter.setAccessible(true);
            setter.invoke(valideInstance, val);
        } finally {
            setter.setAccessible(false);
        }
    }
}
项目:incubator-netbeans    文件:IndexedPropertySupport.java   
public void setValue(T val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    if (!canWrite()) {
        throw new IllegalAccessException();
    }

    Object validInstance = Beans.getInstanceOf(instance, setter.getDeclaringClass());

    Object value = val;
    if (
        (val != null) && (setter.getParameterTypes()[0].getComponentType().isPrimitive()) &&
            (!val.getClass().getComponentType().isPrimitive())
    ) {
        value = Utilities.toPrimitiveArray((Object[]) val);
    }

    setter.invoke(validInstance, value);
}
项目:Pogamut3    文件:MVMapElement.java   
MVMapElement(TLDataObject dataObject) {
    // Hack
    if (Beans.isDesignTime()) {
        Beans.setDesignTime(false);
    }
    this.dataObject = dataObject;

    glPanel = new TLMapGLPanel(dataObject.getDatabase().getMap(), dataObject.getDatabase());

    slider = new TLSlider(dataObject.getDatabase());

    elementPanel = new JPanel(new BorderLayout());
    elementPanel.add(glPanel, BorderLayout.CENTER);
    elementPanel.add(slider, BorderLayout.PAGE_END);

    ActionMap map = new ActionMap();
    map.put("save", SystemAction.get(SaveAction.class));
    elementPanel.setActionMap(map);

    lookupContent = new InstanceContent();
    lookup = new ProxyLookup(dataObject.getLookup(), new AbstractLookup(lookupContent));
}
项目:javify    文件:CommandInfo.java   
/**
 * Returns the instantiated bean.
 * If the bean implements <code>CommandObject</code>, its
 * <code>setCommandContext</code> method will be called.
 * @param dh the data handler describing the command data
 * @param loader the class loader used to instantiate the bean
 */
public Object getCommandObject(DataHandler dh, ClassLoader loader)
  throws IOException, ClassNotFoundException
{
  Object object = Beans.instantiate(loader, className);
  if (object != null)
    {
      if (object instanceof CommandObject)
        {
          CommandObject command = (CommandObject)object;
          command.setCommandContext(verb, dh);
        }
      else if (dh != null && (object instanceof Externalizable))
        {
          InputStream in = dh.getInputStream();
          if (in != null)
            {
              Externalizable externalizable = (Externalizable)object;
              externalizable.readExternal(new ObjectInputStream(in));
            }
        }
    }
  return object;
}
项目:repo.kmeanspp.silhouette_score    文件:BeanInstance.java   
/**
 * Adds all beans to the supplied component
 * 
 * @param container a <code>JComponent</code> value
 */
public static void addAllBeansToContainer(JComponent container,
  Integer... tab) {
  int index = 0;
  if (tab.length > 0) {
    index = tab[0].intValue();
  }

  Vector<Object> components = null;
  if (TABBED_COMPONENTS.size() > 0 && index < TABBED_COMPONENTS.size()) {
    components = TABBED_COMPONENTS.get(index);
  }

  if (container != null) {
    if (components != null) {
      for (int i = 0; i < components.size(); i++) {
        BeanInstance tempInstance = (BeanInstance) components.elementAt(i);
        Object tempBean = tempInstance.getBean();
        if (Beans.isInstanceOf(tempBean, JComponent.class)) {
          container.add((JComponent) tempBean);
        }
      }
    }
    container.revalidate();
  }
}
项目:repo.kmeanspp.silhouette_score    文件:BeanInstance.java   
/**
 * Adds the supplied collection of beans to the end of the list of collections
 * and to the JComponent container (if not null)
 * 
 * @param beanInstances the vector of bean instances to add
 * @param container
 */
public static void addBeanInstances(Vector<Object> beanInstances,
  JComponent container) {
  // reset(container);

  if (container != null) {
    for (int i = 0; i < beanInstances.size(); i++) {
      Object bean = ((BeanInstance) beanInstances.elementAt(i)).getBean();
      if (Beans.isInstanceOf(bean, JComponent.class)) {
        container.add((JComponent) bean);
      }
    }
    container.revalidate();
    container.repaint();
  }

  TABBED_COMPONENTS.add(beanInstances);
}
项目:repo.kmeanspp.silhouette_score    文件:BeanInstance.java   
/**
 * Creates a new <code>BeanInstance</code> instance given the fully qualified
 * name of the bean
 * 
 * @param container a <code>JComponent</code> to add the bean to
 * @param beanName the fully qualified name of the bean
 * @param x the x coordinate of the bean
 * @param y th y coordinate of the bean
 */
public BeanInstance(JComponent container, String beanName, int x, int y,
  Integer... tab) {
  m_x = x;
  m_y = y;

  // try and instantiate the named component
  try {
    m_bean = Beans.instantiate(null, beanName);
  } catch (Exception ex) {
    ex.printStackTrace();
    return;
  }

  addBean(container, tab);
}
项目:repo.kmeanspp.silhouette_score    文件:BeanInstance.java   
public static void appendBeans(JComponent container, Vector<Object> beans,
  int tab) {
  if (TABBED_COMPONENTS.size() > 0 && tab < TABBED_COMPONENTS.size()) {
    Vector<Object> components = TABBED_COMPONENTS.get(tab);
    //

    for (int i = 0; i < beans.size(); i++) {
      components.add(beans.get(i));
      if (container != null) {
        Object bean = ((BeanInstance) beans.elementAt(i)).getBean();
        if (Beans.isInstanceOf(bean, JComponent.class)) {
          container.add((JComponent) bean);
        }
      }
    }

    if (container != null) {
      container.revalidate();
      container.repaint();
    }
  }
}
项目:jvm-stm    文件:CommandInfo.java   
/**
 * Returns the instantiated bean.
 * If the bean implements <code>CommandObject</code>, its
 * <code>setCommandContext</code> method will be called.
 * @param dh the data handler describing the command data
 * @param loader the class loader used to instantiate the bean
 */
public Object getCommandObject(DataHandler dh, ClassLoader loader)
  throws IOException, ClassNotFoundException
{
  Object object = Beans.instantiate(loader, className);
  if (object != null)
    {
      if (object instanceof CommandObject)
        {
          CommandObject command = (CommandObject)object;
          command.setCommandContext(verb, dh);
        }
      else if (dh != null && (object instanceof Externalizable))
        {
          InputStream in = dh.getInputStream();
          if (in != null)
            {
              Externalizable externalizable = (Externalizable)object;
              externalizable.readExternal(new ObjectInputStream(in));
            }
        }
    }
  return object;
}
项目:autoweka    文件:BeanInstance.java   
/**
  * Adds all beans to the supplied component
  *
  * @param container a <code>JComponent</code> value
  */
 public static void addAllBeansToContainer(JComponent container, Integer... tab) {
   int index = 0;
   if (tab.length > 0) {
     index = tab[0].intValue();
   }

   Vector components = null;
   if (TABBED_COMPONENTS.size() > 0 && index < TABBED_COMPONENTS.size()) {
     components = TABBED_COMPONENTS.get(index);
   }

   if (container != null) {
     if (components != null) {
for (int i = 0; i < components.size(); i++) {
  BeanInstance tempInstance = (BeanInstance)components.elementAt(i);
  Object tempBean = tempInstance.getBean();
  if (Beans.isInstanceOf(tempBean, JComponent.class)) {
    container.add((JComponent)tempBean);
  }
}
     }
     container.revalidate();
   }
 }
项目:autoweka    文件:BeanInstance.java   
/**
 * Adds the supplied collection of beans to the end of the list
 * of collections and to the JComponent container (if not null)
 * 
 * @param beanInstances the vector of bean instances to add
 * @param container
 */
public static void addBeanInstances(Vector beanInstances, JComponent container) {
  // reset(container);

  if (container != null) {
    for (int i = 0; i < beanInstances.size(); i++) {
      Object bean = ((BeanInstance)beanInstances.elementAt(i)).getBean();
      if (Beans.isInstanceOf(bean, JComponent.class)) {
        container.add((JComponent)bean);
      }
    }
    container.revalidate();
    container.repaint();
  }

  TABBED_COMPONENTS.add(beanInstances);    
}
项目:autoweka    文件:BeanInstance.java   
public static void appendBeans(JComponent container, Vector beans, int tab) {
  if (TABBED_COMPONENTS.size() > 0 && tab < TABBED_COMPONENTS.size()) {
    Vector components = TABBED_COMPONENTS.get(tab);
    //

    for (int i = 0; i < beans.size(); i++) {
      components.add(beans.get(i));
      if (container != null) {
        Object bean = ((BeanInstance)beans.elementAt(i)).getBean();
        if (Beans.isInstanceOf(bean, JComponent.class)) {
          container.add((JComponent)bean);
        }
      }        
    }

    if (container != null) {
      container.revalidate();
      container.repaint();
    }      
  }
}
项目:umple    文件:BeanInstance.java   
/**
 * Adds all beans to the supplied component
 * 
 * @param container a <code>JComponent</code> value
 */
public static void addAllBeansToContainer(JComponent container,
  Integer... tab) {
  int index = 0;
  if (tab.length > 0) {
    index = tab[0].intValue();
  }

  Vector<Object> components = null;
  if (TABBED_COMPONENTS.size() > 0 && index < TABBED_COMPONENTS.size()) {
    components = TABBED_COMPONENTS.get(index);
  }

  if (container != null) {
    if (components != null) {
      for (int i = 0; i < components.size(); i++) {
        BeanInstance tempInstance = (BeanInstance) components.elementAt(i);
        Object tempBean = tempInstance.getBean();
        if (Beans.isInstanceOf(tempBean, JComponent.class)) {
          container.add((JComponent) tempBean);
        }
      }
    }
    container.revalidate();
  }
}
项目:umple    文件:BeanInstance.java   
/**
 * Adds the supplied collection of beans to the end of the list of collections
 * and to the JComponent container (if not null)
 * 
 * @param beanInstances the vector of bean instances to add
 * @param container
 */
public static void addBeanInstances(Vector<Object> beanInstances,
  JComponent container) {
  // reset(container);

  if (container != null) {
    for (int i = 0; i < beanInstances.size(); i++) {
      Object bean = ((BeanInstance) beanInstances.elementAt(i)).getBean();
      if (Beans.isInstanceOf(bean, JComponent.class)) {
        container.add((JComponent) bean);
      }
    }
    container.revalidate();
    container.repaint();
  }

  TABBED_COMPONENTS.add(beanInstances);
}
项目:umple    文件:BeanInstance.java   
/**
 * Creates a new <code>BeanInstance</code> instance given the fully qualified
 * name of the bean
 * 
 * @param container a <code>JComponent</code> to add the bean to
 * @param beanName the fully qualified name of the bean
 * @param x the x coordinate of the bean
 * @param y th y coordinate of the bean
 */
public BeanInstance(JComponent container, String beanName, int x, int y,
  Integer... tab) {
  m_x = x;
  m_y = y;

  // try and instantiate the named component
  try {
    m_bean = Beans.instantiate(null, beanName);
  } catch (Exception ex) {
    ex.printStackTrace();
    return;
  }

  addBean(container, tab);
}
项目:umple    文件:BeanInstance.java   
public static void appendBeans(JComponent container, Vector<Object> beans,
  int tab) {
  if (TABBED_COMPONENTS.size() > 0 && tab < TABBED_COMPONENTS.size()) {
    Vector<Object> components = TABBED_COMPONENTS.get(tab);
    //

    for (int i = 0; i < beans.size(); i++) {
      components.add(beans.get(i));
      if (container != null) {
        Object bean = ((BeanInstance) beans.elementAt(i)).getBean();
        if (Beans.isInstanceOf(bean, JComponent.class)) {
          container.add((JComponent) bean);
        }
      }
    }

    if (container != null) {
      container.revalidate();
      container.repaint();
    }
  }
}
项目:dhcalc    文件:SavePanel.java   
@Override
public void onLoad() {
    tabPanel.selectTab(0);

    if (!Beans.isDesignTime()) {
        Storage s = Storage.getLocalStorageIfSupported();

        if (s != null) {

            for (int i = 0; i < s.getLength(); i++) {
                String key = s.key(i);

                if ((key != null) && key.startsWith(STORAGE_KEY)) {
                    String name = key.substring(STORAGE_KEY.length());
                    storageList.addItem(name, key);
                }
            }
        }
    }
}
项目:passage    文件:JarInfo.java   
/**
 * Get a new Bean instance given its name
 */
public Object getInstance(String name) {
    try {
        return Beans.instantiate(null, name);
    } catch (Throwable th) {
        if (com.bbn.openmap.util.Debug.debugging("beanbox")) {
            System.err.println(th);
            th.printStackTrace();
            if (name.indexOf('\\') >= 0) {
                System.err.println("    Note that file names in manifests must use forward "
                        + "slashes \"/\" \n    rather than back-slashes \"\\\"");
            }
        }
        return null;
    }
}
项目:jbossBA    文件:BeanInstance.java   
/**
  * Describe <code>setBeanInstances</code> method here.
  *
  * @param beanInstances a <code>Vector</code> value
  * @param container a <code>JComponent</code> value
  */
 public static void setBeanInstances(Vector beanInstances, 
                  JComponent container) {
   reset(container);

   if (container != null) {
     for (int i = 0; i < beanInstances.size(); i++) {
Object bean = ((BeanInstance)beanInstances.elementAt(i)).getBean();
if (Beans.isInstanceOf(bean, JComponent.class)) {
  container.add((JComponent)bean);
}
     }
     container.revalidate();
     container.repaint();
   }
   COMPONENTS = beanInstances;
 }
项目:JamVM-PH    文件:CommandInfo.java   
/**
 * Returns the instantiated bean.
 * If the bean implements <code>CommandObject</code>, its
 * <code>setCommandContext</code> method will be called.
 * @param dh the data handler describing the command data
 * @param loader the class loader used to instantiate the bean
 */
public Object getCommandObject(DataHandler dh, ClassLoader loader)
  throws IOException, ClassNotFoundException
{
  Object object = Beans.instantiate(loader, className);
  if (object != null)
    {
      if (object instanceof CommandObject)
        {
          CommandObject command = (CommandObject)object;
          command.setCommandContext(verb, dh);
        }
      else if (dh != null && (object instanceof Externalizable))
        {
          InputStream in = dh.getInputStream();
          if (in != null)
            {
              Externalizable externalizable = (Externalizable)object;
              externalizable.readExternal(new ObjectInputStream(in));
            }
        }
    }
  return object;
}
项目:mychart    文件:LoadingDialog.java   
@PostConstruct
protected void init() throws IOException {
    dialog = new JDialog(mainWindow != null ? mainWindow.getFrame() : null, true);
    dialog.setUndecorated(true);
    dialog.setPreferredSize(new Dimension(200, 230));
    dialog.setResizable(false);
    dialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    dialog.setLocationRelativeTo(mainWindow != null ? mainWindow.getFrame() : null);

    dialog.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent event) {
            if (event.getKeyCode() == KeyEvent.VK_ESCAPE) {
                dialog.setVisible(false);
            }
        }
    });

    JLabel imagemLabel = new JLabel();
    imagemLabel.setIcon(Beans.isDesignTime() ? null : images.loading());
    dialog.getContentPane().add(imagemLabel, BorderLayout.CENTER);

    dialog.pack();
}
项目:classpath    文件:CommandInfo.java   
/**
 * Returns the instantiated bean.
 * If the bean implements <code>CommandObject</code>, its
 * <code>setCommandContext</code> method will be called.
 * @param dh the data handler describing the command data
 * @param loader the class loader used to instantiate the bean
 */
public Object getCommandObject(DataHandler dh, ClassLoader loader)
  throws IOException, ClassNotFoundException
{
  Object object = Beans.instantiate(loader, className);
  if (object != null)
    {
      if (object instanceof CommandObject)
        {
          CommandObject command = (CommandObject)object;
          command.setCommandContext(verb, dh);
        }
      else if (dh != null && (object instanceof Externalizable))
        {
          InputStream in = dh.getInputStream();
          if (in != null)
            {
              Externalizable externalizable = (Externalizable)object;
              externalizable.readExternal(new ObjectInputStream(in));
            }
        }
    }
  return object;
}
项目:incubator-netbeans    文件:ManifestSection.java   
/** Create a fresh instance.
 * @return the instance
 * @exception Exception if there is an error
 */
protected final Object createInstance() throws Exception {
    if (! isDefaultInstance()) {
        try {
            Object o = Beans.instantiate(getClassLoader(), className);
            clazz = o.getClass();
            if (! getSectionClass().isAssignableFrom(clazz)) {
                throw new ClassCastException("Class " + clazz.getName() + " is not a subclass of " + getSuperclass().getName()); // NOI18N
            }
            return o;
        } catch (ClassNotFoundException cnfe) {
            Exceptions.attachMessage(cnfe,
                                     "Loader for ClassNotFoundException: " +
                                     getClassLoader());
            throw cnfe;
        } catch (LinkageError le) {
            throw new ClassNotFoundException(le.toString(), le);
        }
    } else {
        getSectionClass(); // might throw some exceptions
        if (SharedClassObject.class.isAssignableFrom(clazz)) {
            return SharedClassObject.findObject(clazz.asSubclass(SharedClassObject.class), true);
        } else {
            return clazz.newInstance();
        }
    }
}
项目:incubator-netbeans    文件:PropertySupport.java   
public T getValue() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    if (getter == null) {
        throw new IllegalAccessException();
    }

    Object valideInstance = Beans.getInstanceOf(instance, getter.getDeclaringClass());

    try {
        try {
            return cast(getValueType(), getter.invoke(valideInstance));
        } catch (IllegalAccessException ex) {
            try {
                getter.setAccessible(true);

                return cast(getValueType(), getter.invoke(valideInstance));
            } finally {
                getter.setAccessible(false);
            }
        }
    } catch (IllegalArgumentException iae) {
        //Provide a better message for debugging
        StringBuffer sb = new StringBuffer("Attempted to invoke method ");
        sb.append(getter.getName());
        sb.append(" from class ");
        sb.append(getter.getDeclaringClass().getName());
        sb.append(" on an instance of ");
        sb.append(valideInstance.getClass().getName());
        sb.append(" Problem:");
        sb.append(iae.getMessage());
        throw (IllegalArgumentException) new IllegalArgumentException(sb.toString()).initCause(iae);
    }
}
项目:incubator-netbeans    文件:BeanNode.java   
/** Detaches all listeners from the bean and destroys it.
* @throws IOException if there was a problem
*/
@Override
public void destroy() throws IOException {
    if (removePCLMethod != null) {
        try {
            Object o = Beans.getInstanceOf(bean, removePCLMethod.getDeclaringClass());
            removePCLMethod.invoke(o, new Object[] { propertyChangeListener });
        } catch (Exception e) {
            NodeOp.exception(e);
        }
    }

    super.destroy();
}
项目:incubator-netbeans    文件:IndexedPropertySupport.java   
public T getValue() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    if (!canRead()) {
        throw new IllegalAccessException();
    }

    Object validInstance = Beans.getInstanceOf(instance, getter.getDeclaringClass());

    return PropertySupport.cast(getValueType(), getter.invoke(validInstance));
}
项目:incubator-netbeans    文件:IndexedPropertySupport.java   
public E getIndexedValue(int index)
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    if (!canIndexedRead()) {
        throw new IllegalAccessException();
    }

    Object validInstance = Beans.getInstanceOf(instance, indexedGetter.getDeclaringClass());

    return PropertySupport.cast(getElementType(), indexedGetter.invoke(validInstance, index));
}
项目:incubator-netbeans    文件:IndexedPropertySupport.java   
public void setIndexedValue(int index, E val)
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    if (!canIndexedWrite()) {
        throw new IllegalAccessException();
    }

    Object validInstance = Beans.getInstanceOf(instance, indexedSetter.getDeclaringClass());
    indexedSetter.invoke(validInstance, new Object[] { new Integer(index), val });
}
项目:Pogamut3    文件:MapGLPanel.java   
/**
 * Create a panel for 
 * @param caps
 * @param map
 * @param log
 */
protected MapGLPanel(GLCapabilities caps, IUnrealMap map, Logger log) {
    super(caps);

    if (Beans.isDesignTime()) {
        Beans.setDesignTime(false);
    }

    this.map = map;
    this.logger = log;

    Location mapFocus = new Location(
            map.getBox().getCenterX(),
            map.getBox().getCenterY(),
            map.getBox().getCenterZ());
    // Stuff for controlling viewpoint in map
    mapViewpoint = new MapViewpoint();
    mapController = new MapController(this, mapViewpoint, mapFocus);
    mapController.registerListeners();

    // Create renderers
    mapRenderer = new MapRenderer(map, lastGLName++);
    agentRenderes = new GLRendererCollection<IRenderableUTAgent>();
    environmentRenderer = new EnvironmentRenderer(mapViewpoint, agentRenderes, mapRenderer);

    // Add listener so this level is rendered
    this.addGLEventListener(environmentRenderer);

    // Listen for changes in viewpoint
    mapViewpoint.addViewpointListener(this);

    // Set initial position of view + thanks to listener display
    mapViewpoint.setFromViewedBox(map.getBox());

}
项目:myfaces-trinidad    文件:TrinidadConverterHandler.java   
@Override
protected MetaRuleset createMetaRuleset(Class type)
{
  MetaRuleset m = super.createMetaRuleset(type);
  // Trinidad-2014 : Converters may have id specified in the tld, but it isn't supported
  if (Beans.isDesignTime())
    m.ignore("id");
  m.addRule(StringArrayPropertyTagRule.Instance);
  m.addRule(ValueExpressionTagRule.Instance);
  m.addRule(LocalePropertyTagRule.Instance);
  m.addRule (TimezonePropertyTagRule.Instance);
  return m;
}
项目:myfaces-trinidad    文件:SkinPregenerationUtils.java   
private static SkinPregenerator _getSkinPregenerator()
{
  if (Beans.isDesignTime())
  {
    return _NOOP_PREGENERATOR;
  }

  return new AllVariantsSkinPregenerator();
}
项目:jdk8u-jdk    文件:Test4080522.java   
private static void test(String[] path) {
    try {
        Beans.setDesignTime(true);
        Beans.setGuiAvailable(true);
        Introspector.setBeanInfoSearchPath(path);
        PropertyEditorManager.setEditorSearchPath(path);
    } catch (SecurityException exception) {
        throw new Error("unexpected security exception", exception);
    }
}
项目:jdk8u-jdk    文件:TestGuiAvailable.java   
public static void main(String[] args) throws InterruptedException {
    if (Beans.isGuiAvailable() == GraphicsEnvironment.isHeadless()) {
        throw new Error("unexpected GuiAvailable property");
    }
    Beans.setGuiAvailable(!Beans.isGuiAvailable());
    ThreadGroup group = new ThreadGroup("$$$");
    Thread thread = new Thread(group, new TestGuiAvailable());
    thread.start();
    thread.join();
}
项目:jdk8u-jdk    文件:TestDesignTime.java   
public static void main(String[] args) throws InterruptedException {
    if (Beans.isDesignTime()) {
        throw new Error("unexpected DesignTime property");
    }
    Beans.setDesignTime(!Beans.isDesignTime());
    ThreadGroup group = new ThreadGroup("$$$");
    Thread thread = new Thread(group, new TestDesignTime());
    thread.start();
    thread.join();
}
项目:jdk8u-jdk    文件:Test4144543.java   
public static void main(String[] args) throws Exception {
    Class type = Beans.instantiate(null, "Test4144543").getClass();

    // try all the various places that this would break before

    Introspector.getBeanInfo(type);
    new PropertyDescriptor("value", type);
    new PropertyDescriptor("value", type, "getValue", "setValue");
}
项目:openjdk-jdk10    文件:Test4080522.java   
private static void test(String[] path) {
    try {
        Beans.setDesignTime(true);
        Beans.setGuiAvailable(true);
        Introspector.setBeanInfoSearchPath(path);
        PropertyEditorManager.setEditorSearchPath(path);
    } catch (SecurityException exception) {
        throw new Error("unexpected security exception", exception);
    }
}
项目:openjdk-jdk10    文件:TestGuiAvailable.java   
public static void main(String[] args) throws InterruptedException {
    if (Beans.isGuiAvailable() == GraphicsEnvironment.isHeadless()) {
        throw new Error("unexpected GuiAvailable property");
    }
    Beans.setGuiAvailable(!Beans.isGuiAvailable());
    ThreadGroup group = new ThreadGroup("$$$");
    Thread thread = new Thread(group, new TestGuiAvailable());
    thread.start();
    thread.join();
}
项目:openjdk-jdk10    文件:TestDesignTime.java   
public static void main(String[] args) throws InterruptedException {
    if (Beans.isDesignTime()) {
        throw new Error("unexpected DesignTime property");
    }
    Beans.setDesignTime(!Beans.isDesignTime());
    ThreadGroup group = new ThreadGroup("$$$");
    Thread thread = new Thread(group, new TestDesignTime());
    thread.start();
    thread.join();
}
项目:openjdk-jdk10    文件:Test4144543.java   
public static void main(String[] args) throws Exception {
    Class type = Beans.instantiate(null, "Test4144543").getClass();

    // try all the various places that this would break before

    Introspector.getBeanInfo(type);
    new PropertyDescriptor("value", type);
    new PropertyDescriptor("value", type, "getValue", "setValue");
}
项目:openjdk9    文件:Test4080522.java   
private static void test(String[] path) {
    try {
        Beans.setDesignTime(true);
        Beans.setGuiAvailable(true);
        Introspector.setBeanInfoSearchPath(path);
        PropertyEditorManager.setEditorSearchPath(path);
    } catch (SecurityException exception) {
        throw new Error("unexpected security exception", exception);
    }
}