From: Johannes Z. <jza...@us...> - 2006-02-20 08:50:14
|
Update of /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/model/node In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13911/src/net/sf/magicmap/client/model/node Added Files: MapNode.java Log Message: Changes to show maps in the outline view tree Refactorings --- NEW FILE: MapNode.java --- package net.sf.magicmap.client.model.node; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import javax.swing.SwingUtilities; import net.sf.magicmap.client.interfaces.MapCallback; import net.sf.magicmap.client.meta.MapInfo; import net.sf.magicmap.server.dto.MapDTO; /** * Node type for maps * (currently only used for the outline view) * @author Johannes Zapotoczky (joh...@za...) */ public class MapNode extends Node implements MapCallback { private MapInfo mapInfo; /** * Constructor * @param model - the corresponding node model (!= null) */ public MapNode(NodeModel model) { super(model); } /* (non-Javadoc) * @see net.sf.magicmap.client.model.node.Node#getNeighbors() */ public ArrayList getNeighbors() { return new ArrayList(); } /* (non-Javadoc) * @see net.sf.magicmap.client.model.node.Node#getType() */ public int getType() { return NodeModel.NODETYPE_MAP; } /* (non-Javadoc) * @see net.sf.magicmap.client.interfaces.MapCallback#mapReceived(net.sf.magicmap.server.dto.MapDTO) */ public void mapReceived(final MapDTO mapDTO) { try{ // Mit SWING synchronisieren.... SwingUtilities.invokeAndWait(new Runnable() { public void run(){ mapInfo = new MapInfo(); mapInfo.height = mapDTO.getImageHeight().intValue(); mapInfo.width = mapDTO.getImageWidth().intValue(); mapInfo.name = mapDTO.getName(); mapInfo.imageURL = mapDTO.getImageURL().toString(); } }); } catch (InterruptedException e){ // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e){ // TODO Auto-generated catch block e.printStackTrace(); } } /* (non-Javadoc) * @see net.sf.magicmap.client.interfaces.MapCallback#getMapError(java.lang.Exception) */ public void getMapError(Exception e) { e.printStackTrace(); mapInfo = null; } public MapInfo getMapInfo() { return mapInfo; } } |