java类java.beans.beancontext.BeanContext的实例源码

SerialDataNode.java 文件源码 项目:incubator-netbeans 阅读 22 收藏 0 点赞 0 评论 0
private static Children getChildren(DataObject dobj, boolean noBeanInfo) {
    if (noBeanInfo) {
        return Children.LEAF;
    }
    InstanceCookie inst = (InstanceCookie)dobj.getCookie(InstanceCookie.class);
    if (inst == null) return Children.LEAF;
    try {
        Class clazz = inst.instanceClass();
        if (BeanContext.class.isAssignableFrom(clazz) ||
            BeanContextProxy.class.isAssignableFrom(clazz)) {
            return new InstanceChildren ();
        } else {
            return Children.LEAF;
        }
    } catch (Exception ex) {
        return Children.LEAF;
    }
}
SerialDataNode.java 文件源码 项目:incubator-netbeans 阅读 31 收藏 0 点赞 0 评论 0
private void init() {
    try {
        InstanceCookie ic = (InstanceCookie) dobj.getCookie(InstanceCookie.class);
        if (ic == null) {
            bean = null;
            return;
        }
        Class clazz = ic.instanceClass();
        if (BeanContext.class.isAssignableFrom(clazz)) {
            bean = ic.instanceCreate();
        } else if (BeanContextProxy.class.isAssignableFrom(clazz)) {
            bean = ((BeanContextProxy) ic.instanceCreate()).getBeanContextProxy();
        } else {
            bean = null;
        }
    } catch (Exception ex) {
        bean = null;
        Exceptions.printStackTrace(ex);
    }
    if (bean != null) {
        // attaches a listener to the bean
        ((BeanContext) bean).addBeanContextMembershipListener (contextL);
    }
    updateKeys();
}
SerialDataNode.java 文件源码 项目:incubator-netbeans 阅读 22 收藏 0 点赞 0 评论 0
/** Create nodes for a given key.
 * @param key the key
 * @return child nodes for this key or null if there should be no
 *   nodes for this key
 */
protected Node[] createNodes(Object key) {
    Object ctx = bean;
    if (bean == null) return new Node[0];

    try {
        if (key instanceof BeanContextSupport) {
            BeanContextSupport bcs = (BeanContextSupport)key;

            if (((BeanContext) ctx).contains (bcs.getBeanContextPeer())) {
                // sometimes a BeanContextSupport occures in the list of
                // beans children even there is its peer. we think that
                // it is desirable to hide the context if the peer is
                // also present
                return new Node[0];
            }
        }

        return new Node[] { new BeanContextNode (key, task) };
    } catch (IntrospectionException ex) {
        // ignore the exception
        return new Node[0];
    }
}
Beans.java 文件源码 项目:fiscevm 阅读 23 收藏 0 点赞 0 评论 0
@SuppressWarnings("unchecked")
private static Object internalInstantiate(ClassLoader cls, String beanName,
        BeanContext context, Object initializer) throws IOException,
        ClassNotFoundException {
    // First try to load it from a serialization file.

    Object result = null;

    // If it didn't work, try to instantiate it from the given classloader
    ClassLoader classLoader = cls == null ? ClassLoader
            .getSystemClassLoader() : cls;
    try {
        result = Class.forName(beanName, true, classLoader).newInstance();
    } catch (Exception e) {
        throw new ClassNotFoundException(e.getClass() + ": " //$NON-NLS-1$
                + e.getMessage());
    }

    if (result != null) {
        if (null != context) {
            context.add(result);
        }
    }
    return result;
}
BeanContextServiceAvailableEventTest.java 文件源码 项目:cn1 阅读 24 收藏 0 点赞 0 评论 0
private void assertEqualsSerially(BeanContextServiceAvailableEvent orig,
        BeanContextServiceAvailableEvent ser) {
    assertNull(ser.getSource());

    // check propagatedFrom
    if (orig.getPropagatedFrom() instanceof Serializable) {
        BeanContext origFrom = orig.getPropagatedFrom();
        BeanContext serFrom = ser.getPropagatedFrom();
        assertEquals(origFrom.getClass(), serFrom.getClass());
        if (origFrom instanceof MockBeanContextDelegateS) {
            assertEquals(((MockBeanContextDelegateS) origFrom).id,
                    ((MockBeanContextDelegateS) serFrom).id);
        }
    }

    // check serviceClass
    assertEquals(orig.getServiceClass(), ser.getServiceClass());
}
BeanContextMembershipEventTest.java 文件源码 项目:cn1 阅读 20 收藏 0 点赞 0 评论 0
private void assertEqualsSerially(BeanContextMembershipEvent orig,
        BeanContextMembershipEvent ser) {
    assertNull(ser.getSource());

    // check propagatedFrom
    if (orig.getPropagatedFrom() instanceof Serializable) {
        BeanContext origFrom = orig.getPropagatedFrom();
        BeanContext serFrom = ser.getPropagatedFrom();
        assertEquals(origFrom.getClass(), serFrom.getClass());
        if (origFrom instanceof MockBeanContextDelegateS) {
            assertEquals(((MockBeanContextDelegateS) origFrom).id,
                    ((MockBeanContextDelegateS) serFrom).id);
        }
    }

    // check children
    Collection origChildren = (Collection) Utils.getField(orig, "children");
    Collection serChildren = (Collection) Utils.getField(ser, "children");
    assertEquals(origChildren, serChildren);
}
InstanceNode.java 文件源码 项目:studio 阅读 23 收藏 0 点赞 0 评论 0
private static Children getChildren(DataObject dobj, boolean noBeanInfo) {
    if (noBeanInfo) {
        return Children.LEAF;
    }
    InstanceCookie inst = (InstanceCookie)dobj.getCookie(InstanceCookie.class);
    if (inst == null) return Children.LEAF;
    try {
        Class clazz = inst.instanceClass();
        if (BeanContext.class.isAssignableFrom(clazz) ||
            BeanContextProxy.class.isAssignableFrom(clazz)) {
            return new InstanceChildren ((InstanceDataObject) dobj);
        } else {
            return Children.LEAF;
        }
    } catch (Exception ex) {
        return Children.LEAF;
    }
}
BeanNode.java 文件源码 项目:incubator-netbeans 阅读 20 收藏 0 点赞 0 评论 0
private static Children getChildren(Object bean) {
    if (bean instanceof BeanContext) {
        return new BeanChildren((BeanContext) bean);
    }

    if (bean instanceof BeanContextProxy) {
        BeanContextChild bch = ((BeanContextProxy) bean).getBeanContextProxy();

        if (bch instanceof BeanContext) {
            return new BeanChildren((BeanContext) bch);
        }
    }

    return Children.LEAF;
}
SerialDataNode.java 文件源码 项目:incubator-netbeans 阅读 19 收藏 0 点赞 0 评论 0
protected void removeNotify () {
    if (contextL != null && bean != null)
        ((BeanContext) bean).removeBeanContextMembershipListener (contextL);
    contextL = null;

    setKeys(Collections.emptySet());
}
SerialDataNode.java 文件源码 项目:incubator-netbeans 阅读 18 收藏 0 点赞 0 评论 0
private void updateKeys() {
    if (bean == null) {
        setKeys(Collections.emptySet());
    } else {
        setKeys(((BeanContext) bean).toArray());
    }
}
SerialDataNode.java 文件源码 项目:incubator-netbeans 阅读 20 收藏 0 点赞 0 评论 0
private static Children getChildren (Object bean, SerialDataNode task) {
    if (bean instanceof BeanContext)
        return new BeanChildren ((BeanContext)bean, new BeanFactoryImpl(task));
    if (bean instanceof BeanContextProxy) {
        java.beans.beancontext.BeanContextChild bch = ((BeanContextProxy)bean).getBeanContextProxy();
        if (bch instanceof BeanContext)
            return new BeanChildren ((BeanContext)bch, new BeanFactoryImpl(task));
    }
    return Children.LEAF;
}
BeanContextMembershipEvent.java 文件源码 项目:OpenJSharp 阅读 51 收藏 0 点赞 0 评论 0
/**
 * Contruct a BeanContextMembershipEvent
 *
 * @param bc        The BeanContext source
 * @param changes   The Children affected
 * @throws NullPointerException if <CODE>changes</CODE> is <CODE>null</CODE>
 */

@SuppressWarnings("rawtypes")
public BeanContextMembershipEvent(BeanContext bc, Collection changes) {
    super(bc);

    if (changes == null) throw new NullPointerException(
        "BeanContextMembershipEvent constructor:  changes is null.");

    children = changes;
}
BeanContextMembershipEvent.java 文件源码 项目:jdk8u-jdk 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Contruct a BeanContextMembershipEvent
 *
 * @param bc        The BeanContext source
 * @param changes   The Children affected
 * @throws NullPointerException if <CODE>changes</CODE> is <CODE>null</CODE>
 */

@SuppressWarnings("rawtypes")
public BeanContextMembershipEvent(BeanContext bc, Collection changes) {
    super(bc);

    if (changes == null) throw new NullPointerException(
        "BeanContextMembershipEvent constructor:  changes is null.");

    children = changes;
}
Test4652928.java 文件源码 项目:jdk8u-jdk 阅读 18 收藏 0 点赞 0 评论 0
private static BeanContext fill(BeanContext context) {
    context.add(new JLabel("label"));
    context.add(new JButton("button"));

    JButton button = new JButton();
    button.setText("another button");
    context.add(button);

    return context;
}
BeanContextMembershipEvent.java 文件源码 项目:openjdk-jdk10 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Contruct a BeanContextMembershipEvent
 *
 * @param bc        The BeanContext source
 * @param changes   The Children affected
 * @throws NullPointerException if {@code changes} is {@code null}
 */

@SuppressWarnings("rawtypes")
public BeanContextMembershipEvent(BeanContext bc, Collection changes) {
    super(bc);

    if (changes == null) throw new NullPointerException(
        "BeanContextMembershipEvent constructor:  changes is null.");

    children = changes;
}
Test4652928.java 文件源码 项目:openjdk-jdk10 阅读 19 收藏 0 点赞 0 评论 0
private static BeanContext fill(BeanContext context) {
    context.add(new JLabel("label"));
    context.add(new JButton("button"));

    JButton button = new JButton();
    button.setText("another button");
    context.add(button);

    return context;
}
BeanContextMembershipEvent.java 文件源码 项目:openjdk9 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Contruct a BeanContextMembershipEvent
 *
 * @param bc        The BeanContext source
 * @param changes   The Children affected
 * @throws NullPointerException if {@code changes} is {@code null}
 */

@SuppressWarnings("rawtypes")
public BeanContextMembershipEvent(BeanContext bc, Collection changes) {
    super(bc);

    if (changes == null) throw new NullPointerException(
        "BeanContextMembershipEvent constructor:  changes is null.");

    children = changes;
}
Test4652928.java 文件源码 项目:openjdk9 阅读 18 收藏 0 点赞 0 评论 0
private static BeanContext fill(BeanContext context) {
    context.add(new JLabel("label"));
    context.add(new JButton("button"));

    JButton button = new JButton();
    button.setText("another button");
    context.add(button);

    return context;
}
BeanContextMembershipEvent.java 文件源码 项目:Java8CN 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Contruct a BeanContextMembershipEvent
 *
 * @param bc        The BeanContext source
 * @param changes   The Children affected
 * @throws NullPointerException if <CODE>changes</CODE> is <CODE>null</CODE>
 */

@SuppressWarnings("rawtypes")
public BeanContextMembershipEvent(BeanContext bc, Collection changes) {
    super(bc);

    if (changes == null) throw new NullPointerException(
        "BeanContextMembershipEvent constructor:  changes is null.");

    children = changes;
}
BeanContextMembershipEvent.java 文件源码 项目:jdk8u_jdk 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Contruct a BeanContextMembershipEvent
 *
 * @param bc        The BeanContext source
 * @param changes   The Children affected
 * @throws NullPointerException if <CODE>changes</CODE> is <CODE>null</CODE>
 */

@SuppressWarnings("rawtypes")
public BeanContextMembershipEvent(BeanContext bc, Collection changes) {
    super(bc);

    if (changes == null) throw new NullPointerException(
        "BeanContextMembershipEvent constructor:  changes is null.");

    children = changes;
}
Test4652928.java 文件源码 项目:jdk8u_jdk 阅读 18 收藏 0 点赞 0 评论 0
private static BeanContext fill(BeanContext context) {
    context.add(new JLabel("label"));
    context.add(new JButton("button"));

    JButton button = new JButton();
    button.setText("another button");
    context.add(button);

    return context;
}
BeanContextMembershipEvent.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Contruct a BeanContextMembershipEvent
 *
 * @param bc        The BeanContext source
 * @param changes   The Children affected
 * @throws NullPointerException if <CODE>changes</CODE> is <CODE>null</CODE>
 */

@SuppressWarnings("rawtypes")
public BeanContextMembershipEvent(BeanContext bc, Collection changes) {
    super(bc);

    if (changes == null) throw new NullPointerException(
        "BeanContextMembershipEvent constructor:  changes is null.");

    children = changes;
}
Test4652928.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 21 收藏 0 点赞 0 评论 0
private static BeanContext fill(BeanContext context) {
    context.add(new JLabel("label"));
    context.add(new JButton("button"));

    JButton button = new JButton();
    button.setText("another button");
    context.add(button);

    return context;
}
DataVisualizer.java 文件源码 项目:repo.kmeanspp.silhouette_score 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Set a bean context for this bean
 * 
 * @param bc a <code>BeanContext</code> value
 */
@Override
public void setBeanContext(BeanContext bc) {
  m_beanContext = bc;
  m_design = m_beanContext.isDesignTime();
  if (m_design) {
    appearanceDesign();
  } else {
    java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!GraphicsEnvironment.isHeadless()) {
      appearanceFinal();
    }
  }
}
Loader.java 文件源码 项目:repo.kmeanspp.silhouette_score 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Set a bean context for this bean
 * 
 * @param bc a <code>BeanContext</code> value
 */
@Override
public void setBeanContext(BeanContext bc) {
  super.setBeanContext(bc);
  if (m_design) {
    appearanceDesign();
  } else {
    appearanceFinal();
  }
}
CostBenefitAnalysis.java 文件源码 项目:repo.kmeanspp.silhouette_score 阅读 17 收藏 0 点赞 0 评论 0
@Override
public void setBeanContext(BeanContext bc) throws PropertyVetoException {
  m_beanContext = bc;
  m_design = m_beanContext.isDesignTime();
  if (m_design) {
    appearanceDesign();
  } else {
    if (!GraphicsEnvironment.isHeadless()) {
      appearanceFinal();
    }
  }
}
GraphViewer.java 文件源码 项目:repo.kmeanspp.silhouette_score 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Set a bean context for this bean
 * 
 * @param bc a <code>BeanContext</code> value
 */
@Override
public void setBeanContext(BeanContext bc) {
  m_beanContext = bc;
  m_design = m_beanContext.isDesignTime();
  if (m_design) {
    appearanceDesign();
  } else {
    if (!GraphicsEnvironment.isHeadless()) {
      appearanceFinal();
    }
  }
}
ModelPerformanceChart.java 文件源码 项目:repo.kmeanspp.silhouette_score 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Set a bean context for this bean
 * 
 * @param bc a <code>BeanContext</code> value
 */
@Override
public void setBeanContext(BeanContext bc) {
  m_beanContext = bc;
  m_design = m_beanContext.isDesignTime();
  if (m_design) {
    appearanceDesign();
  } else {
    if (!GraphicsEnvironment.isHeadless()) {
      appearanceFinal();
    }
  }
}
TextViewer.java 文件源码 项目:repo.kmeanspp.silhouette_score 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Set a bean context for this bean
 * 
 * @param bc a <code>BeanContext</code> value
 */
@Override
public void setBeanContext(BeanContext bc) {
  m_beanContext = bc;
  m_design = m_beanContext.isDesignTime();
  if (m_design) {
    appearanceDesign();
  } else {
    java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!GraphicsEnvironment.isHeadless()) {
      appearanceFinal();
    }
  }
}
DataVisualizer.java 文件源码 项目:autoweka 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Set a bean context for this bean
 *
 * @param bc a <code>BeanContext</code> value
 */
public void setBeanContext(BeanContext bc) {
  m_beanContext = bc;
  m_design = m_beanContext.isDesignTime();
  if (m_design) {
    appearanceDesign();
  } else {
    java.awt.GraphicsEnvironment ge = 
      java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(); 
    if (!ge.isHeadless()) {
      appearanceFinal();
    }
  }
}


问题


面经


文章

微信
公众号

扫码关注公众号