本文整理汇总了Java中java.beans.beancontext.BeanContext.add方法的典型用法代码示例。如果您正苦于以下问题:Java BeanContext.add方法的具体用法?Java BeanContext.add怎么用?Java BeanContext.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.beancontext.BeanContext
的用法示例。
在下文中一共展示了BeanContext.add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: addLayersToBeanContext
import java.beans.beancontext.BeanContext; //导入方法依赖的package包/类
/**
* Add layers to the BeanContext, if they want to be. Since the BeanContext
* is a Collection, it doesn't matter if a layer is already there because
* duplicates aren't allowed.
*
* @param layers layers to add, if they want to be.
*/
public void addLayersToBeanContext(List<Layer> layers) {
BeanContext bc = getBeanContext();
if (bc == null || layers == null) {
return;
}
for (Layer layer : layers) {
if (layer.getAddToBeanContext() && layer.getBeanContext() == null) {
bc.add(layer);
}
}
}
示例4: addPlugInToBeanContext
import java.beans.beancontext.BeanContext; //导入方法依赖的package包/类
/**
* 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);
}
}
示例5: setBeanContext
import java.beans.beancontext.BeanContext; //导入方法依赖的package包/类
/**
* Method for BeanContextChild interface. Adds this object as a
* BeanContextMembership listener, set the BeanContext in this
* objects BeanContextSupport, and receives the initial list of
* objects currently contained in the BeanContext.
*/
public void setBeanContext(BeanContext in_bc) throws PropertyVetoException {
super.setBeanContext(in_bc);
if (in_bc != null && needToAddGraphicLoaderToMapHandler
&& getGraphicLoader() != null) {
in_bc.add(getGraphicLoader());
needToAddGraphicLoaderToMapHandler = false;
}
}
示例6: setBeanContext
import java.beans.beancontext.BeanContext; //导入方法依赖的package包/类
/**
* Called when the MenuList is added to the MapHandler/BeanContext. The
* MenuList will add its menus to the BeanContext.
*/
public void setBeanContext(BeanContext bc) throws PropertyVetoException {
super.setBeanContext(bc);
Iterator it = menus.iterator();
while (bc != null && it.hasNext()) {
bc.add(it.next());
}
}
示例7: unsafeBeanContextAdd
import java.beans.beancontext.BeanContext; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static void unsafeBeanContextAdd(BeanContext beanContext, Object res) {
beanContext.add(res);
}
示例8: addLayer
import java.beans.beancontext.BeanContext; //导入方法依赖的package包/类
/**
* Add a layer to a certain position in the layer array. If the position is
* 0 or less, the layer is put up front (on top). If the position is greater
* than the length of the current array, the layer is put at the end, (on
* the bottom). A Layer can only be added once. If you add a layer that is
* already added to the LayerHandler, it will be moved to the requested
* position.
*
* @param layer the layer to add.
* @param position the array index to place it.
*/
public void addLayer(Layer layer, int position) {
// Working copy
List<Layer> currentLayers = getLayerList();
// If it is already part of the list, we're going to move it to the new
// position. Remove it from the current position. If it's not on the
// list this call is a NO-OP.
currentLayers.remove(layer);
if (position > allLayers.size()) {
currentLayers.add(layer);
} else {
if (position < 0) {
position = 0;
}
currentLayers.add(position, layer);
}
if (propertyHandler != null) {
String pre = layer.getPropertyPrefix();
if (pre != null && pre.length() > 0) {
propertyHandler.addUsedPrefix(pre);
}
}
// Need to make this call before thinking about adding the Layer to the
// BeanContext, so when the Layer shows up in the findAndInit() method,
// it's already a part of the Layer list. One potential problem that may
// occur is that the Layer might not be ready to be added to the map and
// to other application components that get LayerEvents from the
// LayerHandler, and they will all know about the layer being in the
// stack after the setLayers() call.
setLayerList(currentLayers);
// Add the layer to the BeanContext, if it wants to be and it's not
// already in a BeanContext. Thought about making the BC check look for
// the same BC as the LayerHandler is a part of, but it's probably
// better just to do a null check in case the Layer is a member of a
// more restricted BeanContext with limited access.
BeanContext bc = getBeanContext();
if (bc != null && layer.getAddToBeanContext() && layer.getBeanContext() == null) {
bc.add(layer);
}
}