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

KnowledgeFlowApp.java 文件源码 项目:repo.kmeanspp.silhouette_score 阅读 25 收藏 0 点赞 0 评论 0
private void addComponent(int x, int y) {
  if (m_toolBarBean instanceof MetaBean) {
    // need to add the MetaBean's internal connections
    // to BeanConnection's vector
    Vector<BeanConnection> associatedConnections = ((MetaBean) m_toolBarBean)
      .getAssociatedConnections();
    BeanConnection.getConnections(m_mainKFPerspective.getCurrentTabIndex())
      .addAll(associatedConnections);

    // ((MetaBean)m_toolBarBean).setXDrop(x);
    // ((MetaBean)m_toolBarBean).setYDrop(y);
    ((MetaBean) m_toolBarBean)
      .addPropertyChangeListenersSubFlow(KnowledgeFlowApp.this);
  }

  if (m_toolBarBean instanceof BeanContextChild) {
    m_bcSupport.add(m_toolBarBean);
  }
  BeanInstance bi = new BeanInstance(m_beanLayout, m_toolBarBean, x, y,
    m_mainKFPerspective.getCurrentTabIndex());
  // addBean((JComponent)bi.getBean());
  m_toolBarBean = null;
  addComponent(bi, true);
}
KnowledgeFlowApp.java 文件源码 项目:autoweka 阅读 28 收藏 0 点赞 0 评论 0
private void addComponent(int x, int y) {
  if (m_toolBarBean instanceof MetaBean) {
    // need to add the MetaBean's internal connections
    // to BeanConnection's vector
    Vector associatedConnections = 
      ((MetaBean)m_toolBarBean).getAssociatedConnections();
    BeanConnection.getConnections(m_mainKFPerspective.getCurrentTabIndex()).
    addAll(associatedConnections);

    //((MetaBean)m_toolBarBean).setXDrop(x);
    //((MetaBean)m_toolBarBean).setYDrop(y);
    ((MetaBean)m_toolBarBean).addPropertyChangeListenersSubFlow(KnowledgeFlowApp.this);
  }

  if (m_toolBarBean instanceof BeanContextChild) {
    m_bcSupport.add(m_toolBarBean);
  }
  BeanInstance bi = new BeanInstance(m_beanLayout, m_toolBarBean, x, y, 
      m_mainKFPerspective.getCurrentTabIndex());
  //    addBean((JComponent)bi.getBean());
  m_toolBarBean = null;
  addComponent(bi, true);
}
KnowledgeFlowApp.java 文件源码 项目:umple 阅读 29 收藏 0 点赞 0 评论 0
private void addComponent(int x, int y) {
  if (m_toolBarBean instanceof MetaBean) {
    // need to add the MetaBean's internal connections
    // to BeanConnection's vector
    Vector<BeanConnection> associatedConnections = ((MetaBean) m_toolBarBean)
      .getAssociatedConnections();
    BeanConnection.getConnections(m_mainKFPerspective.getCurrentTabIndex())
      .addAll(associatedConnections);

    // ((MetaBean)m_toolBarBean).setXDrop(x);
    // ((MetaBean)m_toolBarBean).setYDrop(y);
    ((MetaBean) m_toolBarBean)
      .addPropertyChangeListenersSubFlow(KnowledgeFlowApp.this);
  }

  if (m_toolBarBean instanceof BeanContextChild) {
    m_bcSupport.add(m_toolBarBean);
  }
  BeanInstance bi = new BeanInstance(m_beanLayout, m_toolBarBean, x, y,
    m_mainKFPerspective.getCurrentTabIndex());
  // addBean((JComponent)bi.getBean());
  m_toolBarBean = null;
  addComponent(bi, true);
}
PlugInLayer.java 文件源码 项目:passage 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Layer method, enhanced to check if the PlugIn is interested in being
 * added to the BeanContext.
 */
public boolean getAddToBeanContext() {
    boolean ret = false;
    if (plugin != null
            &&

            (plugin instanceof BeanContextChild || plugin instanceof BeanContextMembershipListener)) {

        if (plugin instanceof AbstractPlugIn) {
            ret = ((AbstractPlugIn) plugin).getAddToBeanContext();
        } else {
            ret = true;
        }

    } else {
        ret = super.getAddToBeanContext();
    }

    if (Debug.debugging("plugin")) {
        Debug.output(getName() + ".addToBeanContext is " + ret);
    }

    return ret;
}
PlugInLayer.java 文件源码 项目:passage 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Gets the current BeanContext from itself, if it's been set and the
 * provided PlugIn wants/can be added to the BeanContext, it assumes it was
 * and removes it from the BeanContext.
 */
public void removePlugInFromBeanContext(PlugIn pi) {
    BeanContext bc = getBeanContext();

    if (bc != null
            && pi != null
            &&

            (pi instanceof BeanContextChild || (pi instanceof AbstractPlugIn && ((AbstractPlugIn) pi).getAddToBeanContext()))) {

        // Of course, we don't need all these conditions met to
        // order the removal, but they are the ones in place that would
        // cause it to be added, so we don't waste the effort
        // unless the same conditions are met.
        bc.remove(pi);
    }
}
BeanContextSupportTest.java 文件源码 项目:cn1 阅读 18 收藏 0 点赞 0 评论 0
public void testAdd_BCC() {
    MockBeanContextSupport support = new MockBeanContextSupport();
    MockBeanContextMembershipListener l1 = new MockBeanContextMembershipListener();
    MockPropertyChangeListener l2 = new MockPropertyChangeListener();
    MockVetoableChangeListener l3 = new MockVetoableChangeListener();
    support.addBeanContextMembershipListener(l1);
    support.addPropertyChangeListener("children", l2);
    support.addVetoableChangeListener("children", l3);

    BeanContextChild child = new MockBeanContextChild();
    support.add(child);
    support.records.assertRecord("initialize", null);
    support.records.assertRecord("validatePendingAdd", child, Boolean.TRUE);
    support.records.assertRecord("createBCSChild", child, null, support
            .children().get(child));
    support.records.assertRecord("childJustAddedHook", child, support
            .children().get(child), null);
    support.records.assertEndOfRecords();
    assertTrue(l1.lastEventAdd);
    assertMembershipEvent(l1.lastEvent, support, null, child);
    assertNull(l2.lastEvent);
    assertNull(l3.lastEvent);

    assertSame(support, child.getBeanContext());
}
BeanContextSupportTest.java 文件源码 项目:cn1 阅读 20 收藏 0 点赞 0 评论 0
public void testGetChildBeanContextChild_BeanContextChild() {
    MockBeanContextChild child = new MockBeanContextChild();
    BeanContextChild result = MockBeanContextSupport
            .publicGetChildBeanContextChild(child);
    assertSame(child, result);

    // Regression for HARMONY-1393
    class TestBeanException extends BeanContextChildSupport implements
            BeanContextProxy {
        private static final long serialVersionUID = -8544245159647566063L;
        private final BeanContextChildSupport childSupport = new BeanContextChildSupport();

        public BeanContextChild getBeanContextProxy() {
            return childSupport;
        }
    }
    TestBeanException bean = new TestBeanException();
    try {
        MockBeanContextSupport.publicGetChildBeanContextChild(bean);
        fail("IllegalArgumentException expected");
    } catch (IllegalArgumentException e) {
        // expected
    }
}
KnowledgeFlowApp.java 文件源码 项目:jbossBA 阅读 28 收藏 0 点赞 0 评论 0
private void addComponent(int x, int y) {
  if (m_toolBarBean instanceof MetaBean) {
    // need to add the MetaBean's internal connections
    // to BeanConnection's vector
    Vector associatedConnections = ((MetaBean) m_toolBarBean)
        .getAssociatedConnections();
    BeanConnection.getConnections().addAll(associatedConnections);
  }

  if (m_toolBarBean instanceof BeanContextChild) {
    m_bcSupport.add(m_toolBarBean);
  }
  BeanInstance bi = new BeanInstance(m_beanLayout, m_toolBarBean, x, y);
  // addBean((JComponent)bi.getBean());
  m_toolBarBean = null;
  addComponent(bi, true);
}
BeanContextChildSupportTest.java 文件源码 项目:freeVM 阅读 25 收藏 0 点赞 0 评论 0
public void testIsDelegated() throws Exception {
    BeanContextChildSupport support = new MockBeanContextChildSupport();
    assertFalse(support.isDelegated());

    BeanContextChild mockChild = new MockBeanContextChild();
    support = new MockBeanContextChildSupport(mockChild);
    assertTrue(support.isDelegated());

    support.beanContextChildPeer = support;
    assertFalse(support.isDelegated());

    BeanContextChildSupport sup = new BeanContextChildSupport();

    assertFalse("Child is not supposed to be delegated",
            sup.isDelegated());
}
BeanContextSupportTest.java 文件源码 项目:freeVM 阅读 23 收藏 0 点赞 0 评论 0
public void testAdd_BCC() {
    MockBeanContextSupport support = new MockBeanContextSupport();
    MockBeanContextMembershipListener l1 = new MockBeanContextMembershipListener();
    MockPropertyChangeListener l2 = new MockPropertyChangeListener();
    MockVetoableChangeListener l3 = new MockVetoableChangeListener();
    support.addBeanContextMembershipListener(l1);
    support.addPropertyChangeListener("children", l2);
    support.addVetoableChangeListener("children", l3);

    BeanContextChild child = new MockBeanContextChild();
    support.add(child);
    support.records.assertRecord("initialize", null);
    support.records.assertRecord("validatePendingAdd", child, Boolean.TRUE);
    support.records.assertRecord("createBCSChild", child, null, support
            .children().get(child));
    support.records.assertRecord("childJustAddedHook", child, support
            .children().get(child), null);
    support.records.assertEndOfRecords();
    assertTrue(l1.lastEventAdd);
    assertMembershipEvent(l1.lastEvent, support, null, child);
    assertNull(l2.lastEvent);
    assertNull(l3.lastEvent);

    assertSame(support, child.getBeanContext());
}
BeanContextSupportTest.java 文件源码 项目:freeVM 阅读 20 收藏 0 点赞 0 评论 0
public void testGetChildBeanContextChild_BeanContextChild() {
    MockBeanContextChild child = new MockBeanContextChild();
    BeanContextChild result = MockBeanContextSupport
            .publicGetChildBeanContextChild(child);
    assertSame(child, result);

    // Regression for HARMONY-1393
    class TestBeanException extends BeanContextChildSupport implements
            BeanContextProxy {
        private static final long serialVersionUID = -8544245159647566063L;
        private final BeanContextChildSupport childSupport = new BeanContextChildSupport();

        public BeanContextChild getBeanContextProxy() {
            return childSupport;
        }
    }
    TestBeanException bean = new TestBeanException();
    try {
        MockBeanContextSupport.publicGetChildBeanContextChild(bean);
        fail("IllegalArgumentException expected");
    } catch (IllegalArgumentException e) {
        // expected
    }
}
BeanContextSupportTest.java 文件源码 项目:freeVM 阅读 21 收藏 0 点赞 0 评论 0
public void testAdd_BCC() {
    MockBeanContextSupport support = new MockBeanContextSupport();
    MockBeanContextMembershipListener l1 = new MockBeanContextMembershipListener();
    MockPropertyChangeListener l2 = new MockPropertyChangeListener();
    MockVetoableChangeListener l3 = new MockVetoableChangeListener();
    support.addBeanContextMembershipListener(l1);
    support.addPropertyChangeListener("children", l2);
    support.addVetoableChangeListener("children", l3);

    BeanContextChild child = new MockBeanContextChild();
    support.add(child);
    support.records.assertRecord("initialize", null);
    support.records.assertRecord("validatePendingAdd", child, Boolean.TRUE);
    support.records.assertRecord("createBCSChild", child, null, support
            .children().get(child));
    support.records.assertRecord("childJustAddedHook", child, support
            .children().get(child), null);
    support.records.assertEndOfRecords();
    assertTrue(l1.lastEventAdd);
    assertMembershipEvent(l1.lastEvent, support, null, child);
    assertNull(l2.lastEvent);
    assertNull(l3.lastEvent);

    assertSame(support, child.getBeanContext());
}
BeanContextSupportTest.java 文件源码 项目:freeVM 阅读 18 收藏 0 点赞 0 评论 0
public void testGetChildBeanContextChild_BeanContextChild() {
    MockBeanContextChild child = new MockBeanContextChild();
    BeanContextChild result = MockBeanContextSupport
            .publicGetChildBeanContextChild(child);
    assertSame(child, result);

    // Regression for HARMONY-1393
    class TestBeanException extends BeanContextChildSupport implements
            BeanContextProxy {
        private static final long serialVersionUID = -8544245159647566063L;
        private final BeanContextChildSupport childSupport = new BeanContextChildSupport();

        public BeanContextChild getBeanContextProxy() {
            return childSupport;
        }
    }
    TestBeanException bean = new TestBeanException();
    try {
        MockBeanContextSupport.publicGetChildBeanContextChild(bean);
        fail("IllegalArgumentException expected");
    } catch (IllegalArgumentException e) {
        // expected
    }
}
TestBeanContextServicesSupportException.java 文件源码 项目:freeVM 阅读 22 收藏 0 点赞 0 评论 0
/**
 * @see java.beans.beancontext.BeanContextServicesSupport#getService()
 */
public Result testGetServiceException()    throws Exception {

    BeanContextChild child = null;
    Object requestor = null;
    Class serviceClass = null;
    Object serviceSelector = null;
    BeanContextServiceRevokedListener bcsrl = null;
    BeanContextServicesSupport context = new BeanContextServicesSupport();
    serviceBean = null;

    try {
        context.getService(child, requestor ,serviceClass,serviceSelector,bcsrl);
    } catch (NullPointerException e) {

        return passed();
    }
    return failed("testGetServiceException");
}
TestBeanContextServicesSupportException.java 文件源码 项目:freeVM 阅读 20 收藏 0 点赞 0 评论 0
/**
 * @see java.beans.beancontext.BeanContextServicesSupport#releaseService()
 */
public Result testReleaseServiceException()    throws Exception {

    BeanContextChild child = null;
    Object requestor = null;
    Object service = null;
    BeanContextServicesSupport context = new BeanContextServicesSupport();
    serviceBean = null;

    try {
        context.releaseService(child, requestor ,service);
    } catch (NullPointerException e) {

        return passed();
    }
    return failed("testGetServiceException");
}
CurrentThreadAnnotationListener.java 文件源码 项目:incubator-netbeans 阅读 17 收藏 0 点赞 0 评论 0
private void annotateCurrentPosition(final JPDAThread currentThread,
                                     final SourcePath sourcePath,
                                     final CallStackFrame csf, final String language,
                                     final String url, final int lineNumber) {
    final Runnable updateCurrentAnnotation = new Runnable () {
        @Override
        public void run () {
            // show current line
            synchronized (currentPCLock) {
                if (currentPC != null)
                    EditorContextBridge.getContext().removeAnnotation (currentPC);
                if (csf != null && sourcePath != null && currentThread != null && url != null && lineNumber >= 0) {
                    // annotate current line
                    currentPC = sourcePath.annotate (currentThread, language, url, lineNumber);
                } else {
                    currentPC = null;
                }
            }
        }
    };
    PropertyChangeListener operationsUpdateListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (PROP_OPERATIONS_UPDATE.equals(name)) {
                SwingUtilities.invokeLater (updateCurrentAnnotation);
            }
            if (PROP_OPERATIONS_SET.equals(name)) {
                ((BeanContextChild) currentThread).removePropertyChangeListener(PROP_OPERATIONS_UPDATE, this);
                ((BeanContextChild) currentThread).removePropertyChangeListener(PROP_OPERATIONS_SET, this);
            }
        }
    };
    ((BeanContextChild) currentThread).addPropertyChangeListener(PROP_OPERATIONS_UPDATE, operationsUpdateListener);
    ((BeanContextChild) currentThread).addPropertyChangeListener(PROP_OPERATIONS_SET, operationsUpdateListener);
    SwingUtilities.invokeLater (updateCurrentAnnotation);
}
BeanNode.java 文件源码 项目:incubator-netbeans 阅读 21 收藏 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;
}
Test4328406.java 文件源码 项目:jdk8u-jdk 阅读 24 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        BeanContextServices container = new BeanContextServicesSupport();
        BeanContextChild ms1 = new MyService1();
        BeanContextServices ms2 = new MyService2();
        BeanContextChild mb = new MyBean();

        container.add(ms1);
        container.add(ms2);
        ms2.add(mb);

        // exception thrown here
        container.remove(ms2);
    }
}
Test4328406.java 文件源码 项目:openjdk-jdk10 阅读 66 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        BeanContextServices container = new BeanContextServicesSupport();
        BeanContextChild ms1 = new MyService1();
        BeanContextServices ms2 = new MyService2();
        BeanContextChild mb = new MyBean();

        container.add(ms1);
        container.add(ms2);
        ms2.add(mb);

        // exception thrown here
        container.remove(ms2);
    }
}
Test4328406.java 文件源码 项目:openjdk9 阅读 31 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        BeanContextServices container = new BeanContextServicesSupport();
        BeanContextChild ms1 = new MyService1();
        BeanContextServices ms2 = new MyService2();
        BeanContextChild mb = new MyBean();

        container.add(ms1);
        container.add(ms2);
        ms2.add(mb);

        // exception thrown here
        container.remove(ms2);
    }
}
Test4328406.java 文件源码 项目:jdk8u_jdk 阅读 19 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        BeanContextServices container = new BeanContextServicesSupport();
        BeanContextChild ms1 = new MyService1();
        BeanContextServices ms2 = new MyService2();
        BeanContextChild mb = new MyBean();

        container.add(ms1);
        container.add(ms2);
        ms2.add(mb);

        // exception thrown here
        container.remove(ms2);
    }
}
Test4328406.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 21 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        BeanContextServices container = new BeanContextServicesSupport();
        BeanContextChild ms1 = new MyService1();
        BeanContextServices ms2 = new MyService2();
        BeanContextChild mb = new MyBean();

        container.add(ms1);
        container.add(ms2);
        ms2.add(mb);

        // exception thrown here
        container.remove(ms2);
    }
}
Test4328406.java 文件源码 项目:infobip-open-jdk-8 阅读 25 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        BeanContextServices container = new BeanContextServicesSupport();
        BeanContextChild ms1 = new MyService1();
        BeanContextServices ms2 = new MyService2();
        BeanContextChild mb = new MyBean();

        container.add(ms1);
        container.add(ms2);
        ms2.add(mb);

        // exception thrown here
        container.remove(ms2);
    }
}
Test4328406.java 文件源码 项目:jdk8u-dev-jdk 阅读 18 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        BeanContextServices container = new BeanContextServicesSupport();
        BeanContextChild ms1 = new MyService1();
        BeanContextServices ms2 = new MyService2();
        BeanContextChild mb = new MyBean();

        container.add(ms1);
        container.add(ms2);
        ms2.add(mb);

        // exception thrown here
        container.remove(ms2);
    }
}
Test4328406.java 文件源码 项目:jdk7-jdk 阅读 27 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        BeanContextServices container = new BeanContextServicesSupport();
        BeanContextChild ms1 = new MyService1();
        BeanContextServices ms2 = new MyService2();
        BeanContextChild mb = new MyBean();

        container.add(ms1);
        container.add(ms2);
        ms2.add(mb);

        // exception thrown here
        container.remove(ms2);
    }
}
Test4328406.java 文件源码 项目:openjdk-source-code-learn 阅读 26 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        BeanContextServices container = new BeanContextServicesSupport();
        BeanContextChild ms1 = new MyService1();
        BeanContextServices ms2 = new MyService2();
        BeanContextChild mb = new MyBean();

        container.add(ms1);
        container.add(ms2);
        ms2.add(mb);

        // exception thrown here
        container.remove(ms2);
    }
}
PlugInLayer.java 文件源码 项目:passage 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Gets the current BeanContext from itself, if it's been set and the
 * provided PlugIn wants/can be added to the BeanContext, it will be added..
 */
public void addPlugInToBeanContext(PlugIn pi) {
    BeanContext bc = getBeanContext();

    if (bc != null
            && pi != null
            &&

            (pi instanceof BeanContextChild || (pi instanceof AbstractPlugIn && ((AbstractPlugIn) pi).getAddToBeanContext()))) {

        bc.add(pi);
    }
}
Test4328406.java 文件源码 项目:OLD-OpenJDK8 阅读 18 收藏 0 点赞 0 评论 0
public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
        BeanContextServices container = new BeanContextServicesSupport();
        BeanContextChild ms1 = new MyService1();
        BeanContextServices ms2 = new MyService2();
        BeanContextChild mb = new MyBean();

        container.add(ms1);
        container.add(ms2);
        ms2.add(mb);

        // exception thrown here
        container.remove(ms2);
    }
}
BeanContextChildSupportTest.java 文件源码 项目:cn1 阅读 22 收藏 0 点赞 0 评论 0
/**
 * @param bcc
 */
public MockBeanContextChildSupport(BeanContextChild bcc) {
    super(bcc);
    assertNull(this.beanContext);
    assertSame(bcc, this.beanContextChildPeer);
    assertFalse(this.rejectedSetBCOnce);
}
BeanContextChildSupportTest.java 文件源码 项目:cn1 阅读 24 收藏 0 点赞 0 评论 0
public void testGetBeanContextChildPeer() throws Exception {
    BeanContextChildSupport support = new MockBeanContextChildSupport();
    assertSame(support, support.beanContextChildPeer);
    assertSame(support, support.getBeanContextChildPeer());

    BeanContextChild mockChild = new MockBeanContextChild();
    support = new MockBeanContextChildSupport(mockChild);
    assertSame(mockChild, support.beanContextChildPeer);
    assertSame(mockChild, support.getBeanContextChildPeer());

    BeanContextChildSupport sup = new BeanContextChildSupport();

    assertEquals(sup, sup.getBeanContextChildPeer());
}


问题


面经


文章

微信
公众号

扫码关注公众号