4,10 → 4,10 |
* Coded by: Group 5, software practice summer 2003 |
* University of Bielefeld, Germany |
* |
* @version $Revision: 1.22 $ |
* @version $Revision: 1.23 $ |
* |
* Last modification: $Date: 2003/07/23 12:40:18 $ |
* $Id: RegionEditorPlugin.java,v 1.22 2003/07/23 12:40:18 mdonner Exp $ |
* Last modification: $Date: 2003/07/23 14:28:53 $ |
* $Id: RegionEditorPlugin.java,v 1.23 2003/07/23 14:28:53 mdonner Exp $ |
*/ |
|
package src.plugins.regionEditorPlugin; |
59,7 → 59,7 |
* |
* @author Yulia Klassen, Viktoriya Zudova |
* |
* @version $Revision: 1.22 $ Last modification: $Date: 2003/07/23 12:40:18 $ |
* @version $Revision: 1.23 $ Last modification: $Date: 2003/07/23 14:28:53 $ |
*/ |
public class RegionEditorPlugin |
extends JPanel |
209,17 → 209,15 |
} |
|
imageUrl=null; // initialised |
TreePath workingPath =elementPath; |
//TreePath workingPath =elementPath; |
|
Node root = (Node)environment.getDocumentElement(); |
|
do { |
// parent is set the parent of sleected element |
AdapterNode parent = (AdapterNode) workingPath.getLastPathComponent(); |
imageUrl = getUrlForLabel(imageName,parent); |
workingPath=workingPath.getParentPath(); |
|
imageUrl = getUrlForLabel(imageName,new AdapterNode(root)); |
|
|
} |
while(imageUrl==null && workingPath!=null); //if imageUrl can not be found on this level the search starts one level above again |
//if workingPath == null it can not be found in the whole document |
|
|
if (imageUrl==null) { |
gui.getLogInterface().log(LogInterface.TYPE_ERROR,"Picture "+"\""+imageName+"\""+" not found in document."); |
264,12 → 262,10 |
nodeList=temp.getAttributes(); |
for (int j = 0; j< nodeList.getLength();j++){ // we look at each attribute |
attribTemp=nodeList.item(j); |
if (attribTemp.getNodeValue().equals(label)) { // if an attribute contains the label |
if (attribTemp.getNodeName().equals("name") && attribTemp.getNodeValue().equals(label)) { // if an attribute is called 'name' contains the label |
for (int k = 0; k<nodeList.getLength();k++){ // we look at all attributes again and try to find image urls |
String attribute =nodeList.item(k).getNodeValue().toLowerCase(); |
if (attribute.endsWith(".jpg") || |
attribute.endsWith(".gif") || |
attribute.endsWith(".png") ) { // an image url always end with '.jpg', '.gif', or '.png' |
String attribute =nodeList.item(k).getNodeName(); |
if (attribute.equals("url")) { // an image url is always called 'url' in transformed document |
result = nodeList.item(k).getNodeValue(); |
return result; // returns the imageUrl |
|