1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
public SEDA(final Element eltProfil) {
this.eltProfil = eltProfil;
this.parent = eltProfil.getParentNode();
this.schema = null;
this.document = eltProfil.getOwnerDocument();
this.listeners = new EventListenerList();
}
private void copierElement(Object o) {
elementCopier = (SEDA) o;
}
private void collerElement(Object o) {
elementCopier.insertElement(((SEDA) o));
}
public void insertElement(SEDA _parent){
Document doc = eltProfil.getOwnerDocument();
Node node = doc.importNode(schema, true);
//_parent.eltProfil.appendChild(node);
parent.insertBefore(node, eltProfil.getNextSibling());
}
private boolean isPastable(Object o){
if(elementCopier != null){
if(((SEDA) o).getSchema().hasChildNodes()){
for(int i=0; i<((SEDA) o).getSchema().getChildNodes().getLength(); i++){
if(((SEDA) o).getSchema().getChildNodes().item(i).hasChildNodes()){
for(int j=0; j<((SEDA) o).getSchema().getChildNodes().item(i).getChildNodes().getLength(); j++){
Node nod = ((SEDA) o).getSchema().getChildNodes().item(i).getChildNodes().item(j);
if(nod.getAttributes() != null){
if(nod.getAttributes().getNamedItem("type") != null){
String type = nod.getAttributes().getNamedItem("type").getNodeValue();
if(type.equalsIgnoreCase(elementCopier.getProfil().getAttribute("type"))){
return true;
}
}
}
}
}
}
}
}
return false;
} |