public void addLayer(Layer layer, int position) { if (moveLayer(layer, position)) {
public void addLayer(Layer layer) { if (allLayers == null) { addLayer(layer, 0);
    public void addLayer(Layer layer, int position) {	if (moveLayer(layer, position)) {	    return;	}      	if (allLayers == null) {	    allLayers = new Layer[0];	}      	Layer[] newLayers = new Layer[allLayers.length +1];      	if (position >= allLayers.length) {	    // Put the new layer on the bottom	    System.arraycopy(allLayers, 0, newLayers, 0, allLayers.length);	    newLayers[allLayers.length] = layer;	} else if (position <= 0) {	    // Put the new layer on top	    System.arraycopy(allLayers, 0, newLayers, 1, allLayers.length);	    newLayers[0] = layer;	} else {	    newLayers[position] = layer;	    System.arraycopy(allLayers, 0, newLayers, 0, position);	    System.arraycopy(allLayers, position, newLayers, position + 1,			     allLayers.length - position);	}	if (propertyHandler != null) {	    String pre = layer.getPropertyPrefix();	    if (pre != null && pre != "") {		propertyHandler.addUsedPrefix(layer.getPropertyPrefix());	    }	}	// Add the layer to the BeanContext, if it wants to be.		BeanContext bc = getBeanContext();	if (bc != null && layer.getAddToBeanContext()) {	    bc.add(layer);	}      	setLayers(newLayers);    }