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


Java BeanContext类代码示例

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


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

示例1: getChildren

import java.beans.beancontext.BeanContext; //导入依赖的package包/类
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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:SerialDataNode.java

示例2: init

import java.beans.beancontext.BeanContext; //导入依赖的package包/类
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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:SerialDataNode.java

示例3: createNodes

import java.beans.beancontext.BeanContext; //导入依赖的package包/类
/** 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];
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:SerialDataNode.java

示例4: internalInstantiate

import java.beans.beancontext.BeanContext; //导入依赖的package包/类
@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;
}
 
开发者ID:cloudeecn,项目名称:fiscevm,代码行数:26,代码来源:Beans.java

示例5: assertEqualsSerially

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

示例6: assertEqualsSerially

import java.beans.beancontext.BeanContext; //导入依赖的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

示例7: getChildren

import java.beans.beancontext.BeanContext; //导入依赖的package包/类
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;
    }
}
 
开发者ID:CharlesSkelton,项目名称:studio,代码行数:19,代码来源:InstanceNode.java

示例8: getChildren

import java.beans.beancontext.BeanContext; //导入依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:BeanNode.java

示例9: removeNotify

import java.beans.beancontext.BeanContext; //导入依赖的package包/类
protected void removeNotify () {
    if (contextL != null && bean != null)
        ((BeanContext) bean).removeBeanContextMembershipListener (contextL);
    contextL = null;
    
    setKeys(Collections.emptySet());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:SerialDataNode.java

示例10: updateKeys

import java.beans.beancontext.BeanContext; //导入依赖的package包/类
private void updateKeys() {
    if (bean == null) {
        setKeys(Collections.emptySet());
    } else {
        setKeys(((BeanContext) bean).toArray());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:SerialDataNode.java

示例11: BeanContextMembershipEvent

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

示例12: fill

import java.beans.beancontext.BeanContext; //导入依赖的package包/类
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;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:Test4652928.java

示例13: BeanContextMembershipEvent

import java.beans.beancontext.BeanContext; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:BeanContextMembershipEvent.java

示例14: setBeanContext

import java.beans.beancontext.BeanContext; //导入依赖的package包/类
/**
 * 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();
    }
  }
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:19,代码来源:DataVisualizer.java

示例15: setBeanContext

import java.beans.beancontext.BeanContext; //导入依赖的package包/类
/**
 * 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();
  }
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:15,代码来源:Loader.java


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