当前位置: 首页>>代码示例>>Java>>正文


Java BeanContextMembershipEvent类代码示例

本文整理汇总了Java中java.beans.beancontext.BeanContextMembershipEvent的典型用法代码示例。如果您正苦于以下问题:Java BeanContextMembershipEvent类的具体用法?Java BeanContextMembershipEvent怎么用?Java BeanContextMembershipEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BeanContextMembershipEvent类属于java.beans.beancontext包,在下文中一共展示了BeanContextMembershipEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: assertEqualsSerially

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
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);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:BeanContextMembershipEventTest.java

示例2: assertMembershipEvent

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
private void assertMembershipEvent(BeanContextMembershipEvent evt,
        BeanContext ctx, BeanContext pFrom, Object changes) {
    assertSame(ctx, evt.getSource());
    assertSame(ctx, evt.getBeanContext());
    assertSame(pFrom, evt.getPropagatedFrom());
    if (changes instanceof Collection) {
        Collection changeCollection = (Collection) changes;
        assertEquals(changeCollection.size(), evt.size());
        for (Iterator iter = changeCollection.iterator(); iter.hasNext();) {
            assertTrue(evt.contains(iter.next()));
        }
    } else {
        assertEquals(1, evt.size());
        assertTrue(evt.contains(changes));
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:BeanContextSupportTest.java

示例3: testNullPointerException1

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
/**
 * @see java.beans.beancontext.BeanContextMembershipEvent
 */
public Result testNullPointerException1() throws Exception {

    context = new BeanContextSupport();
    
    bean = new BeanContextChildSupport();

    // Adding the component
    context.add(bean);

    Object[] array = null;
    try {
        event = new BeanContextMembershipEvent(bean.getBeanContext(), array);
    } catch (java.lang.NullPointerException e) {
        return passed();
    }
    return failed("testNullPointerException1");
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:21,代码来源:TestBeanContextMembershipEvent.java

示例4: testNullPointerException2

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
/**
 * @see java.beans.beancontext.BeanContextMembershipEvent
 */
public Result testNullPointerException2() throws Exception {

    context = new BeanContextSupport();
    bean = new BeanContextChildSupport();

    // Adding the component
    context.add(bean);

    Collection[] array = null;
    try {
        event = new BeanContextMembershipEvent(bean.getBeanContext(), array);
    } catch (java.lang.NullPointerException e) {

        return passed();
    }
    return failed("testNullPointerException2");
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:21,代码来源:TestBeanContextMembershipEvent.java

示例5: testContainsBeanContextMembershipEvent

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
/**
 * @see java.beans.beancontext.BeanContextMembershipEvent#contains()
 */
public Result testContainsBeanContextMembershipEvent() throws Exception {

    context = new BeanContextSupport();
    bean = new BeanContextChildSupport();
    sBean = new ServiceBean();

    // Adding the component
    context.add(bean);
    context.add(sBean);

    event = new BeanContextMembershipEvent(bean.getBeanContext(), context
            .toArray());

    if ((event.contains(sBean)) || !(event.contains(context)))
        return passed();
    else
        return failed("testContainsBeanContextMembershipEvent");
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:22,代码来源:TestBeanContextMembershipEvent.java

示例6: testIteratorBeanContextMembershipEvent

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
/**
 * @see java.beans.beancontext.BeanContextSupport#iterator()
 */
public Result testIteratorBeanContextMembershipEvent() throws Exception {

    context = new BeanContextSupport();
    bean = new BeanContextChildSupport();
    sBean = new ServiceBean();

    // Adding the component
    context.add(bean);
    context.add(sBean);

    event = new BeanContextMembershipEvent(bean.getBeanContext(), context
            .toArray());

    if ((event.iterator() instanceof java.util.Iterator))
        return passed();
    else
        return failed("testIteratorBeanContextMembershipEvent");
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:22,代码来源:TestBeanContextMembershipEvent.java

示例7: testSizeBeanContextMembershipEvent

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
/**
 * @see java.beans.beancontext.BeanContextSupport#size()
 */
public Result testSizeBeanContextMembershipEvent() throws Exception {

    context = new BeanContextSupport();
    bean = new BeanContextChildSupport();
    sBean = new ServiceBean();

    // Adding the component
    context.add(bean);
    context.add(sBean);

    event = new BeanContextMembershipEvent(bean.getBeanContext(), context
            .toArray());
    // System.out.println(event.size());
    if (event.size() == 2)
        return passed();
    else
        return failed("testSizeBeanContextMembershipEvent");
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:22,代码来源:TestBeanContextMembershipEvent.java

示例8: childrenAdded

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
/** Listener method that is called when a bean is added to
* the bean context.
* @param bcme event describing the action
*/
public void childrenAdded (BeanContextMembershipEvent bcme) {
    InstanceChildren bc = ref.get ();
    if (bc != null) {
        bc.updateKeys();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:SerialDataNode.java

示例9: childrenRemoved

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
/** Listener method that is called when a bean is removed to
* the bean context.
* @param bcme event describing the action
*/
public void childrenRemoved (BeanContextMembershipEvent bcme) {
    InstanceChildren bc = ref.get ();
    if (bc != null) {
        bc.updateKeys ();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:SerialDataNode.java

示例10: childrenRemoved

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
/** Method for BeanContextMembership interface */
public void childrenRemoved(BeanContextMembershipEvent bcme) {
    Iterator it = bcme.iterator();
    while (it.hasNext()) {
        findAndUndo(it.next());
    }
}
 
开发者ID:d2fn,项目名称:passage,代码行数:8,代码来源:MenuBar.java

示例11: childrenRemoved

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
/**
 * BeanContextMembershipListener method. Called when objects have been
 * removed from the parent BeanContext. If the ToolPanel finds a Tool in the
 * list, it removes it from the ToolPanel.
 * 
 * @param bcme the event containing the iterator with removed objects.
 */
public void childrenRemoved(BeanContextMembershipEvent bcme) {
   Iterator<Object> it = bcme.iterator();
   Object someObj;
   while (it.hasNext()) {
      someObj = it.next();
      if (someObj instanceof Tool) {
         // do the initializing that need to be done here
         Debug.message("toolpanel", "ToolPanel removing tool Object");
         remove(((Tool) someObj).getKey());
      }
   }
}
 
开发者ID:d2fn,项目名称:passage,代码行数:20,代码来源:ToolPanel.java

示例12: testSerialization

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
public void testSerialization() throws IOException, ClassNotFoundException {
    ArrayList<String> things = new ArrayList<String>();
    things.add("1");
    things.add("2");
    things.add("3");
    BeanContextMembershipEvent event = new BeanContextMembershipEvent(
            new MockBeanContext(), things);
    event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));

    assertEqualsSerially(event,
            (BeanContextMembershipEvent) SerializationTester
                    .getDeserilizedObject(event));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:14,代码来源:BeanContextMembershipEventTest.java

示例13: testSerialization_Compatibility

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
public void testSerialization_Compatibility() throws Exception {
    ArrayList<String> things = new ArrayList<String>();
    things.add("1");
    things.add("2");
    things.add("3");
    BeanContextMembershipEvent event = new BeanContextMembershipEvent(
            new MockBeanContext(), things);
    event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
    SerializationTest.verifyGolden(this, event, new SerializableAssert(){
        public void assertDeserialized(Serializable orig, Serializable ser) {
            assertEqualsSerially((BeanContextMembershipEvent) orig,
                    (BeanContextMembershipEvent) ser);
        }
    });
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:BeanContextMembershipEventTest.java

示例14: childrenAdded

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
/** Listener method that is called when a bean is added to
* the bean context.
* @param bcme event describing the action
*/
public void childrenAdded (BeanContextMembershipEvent bcme) {
    InstanceChildren bc = (InstanceChildren)ref.get ();
    if (bc != null) {
        bc.updateKeys();
    }
}
 
开发者ID:CharlesSkelton,项目名称:studio,代码行数:11,代码来源:InstanceNode.java

示例15: childrenRemoved

import java.beans.beancontext.BeanContextMembershipEvent; //导入依赖的package包/类
/** Listener method that is called when a bean is removed to
* the bean context.
* @param bcme event describing the action
*/
public void childrenRemoved (BeanContextMembershipEvent bcme) {
    InstanceChildren bc = (InstanceChildren)ref.get ();
    if (bc != null) {
        bc.updateKeys ();
    }
}
 
开发者ID:CharlesSkelton,项目名称:studio,代码行数:11,代码来源:InstanceNode.java


注:本文中的java.beans.beancontext.BeanContextMembershipEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。