From: <Jan...@us...> - 2007-02-14 15:48:45
|
Revision: 533 http://svn.sourceforge.net/magicmap/?rev=533&view=rev Author: Jan_fride Date: 2007-02-14 07:48:36 -0800 (Wed, 14 Feb 2007) Log Message: ----------- infoobjects Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java Removed Paths: ------------- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectNode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectTag.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/SimpleInfoObject.java trunk/magicmapclient/test/net/sf/magicmap/client/model/info/InfoObjectBuilderTest.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java 2007-02-14 10:30:38 UTC (rev 532) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java 2007-02-14 15:48:36 UTC (rev 533) @@ -139,21 +139,21 @@ if (!showLocations) { return null; } - break; + //break; // TODO: InfonodeIcon in NodeIcons behandeln - case INodeModel.NODETYPE_INFO : - if (((InfoObjectNode) node).getDepiction() != null) { - ImageIcon icon; - try { - icon = new ImageIcon(new URL(((InfoObjectNode) node).getDepiction()), "<Depiction>"); - if (icon != null && icon.getIconHeight() > 0) { - return icon; - } - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } +// case INodeModel.NODETYPE_INFO : +// if (((InfoObjectNode) node).getDepiction() != null) { +// ImageIcon icon; +// try { +// icon = new ImageIcon(new URL(((InfoObjectNode) node).getDepiction()), "<Depiction>"); +// if (icon != null && icon.getIconHeight() > 0) { +// return icon; +// } +// } catch (MalformedURLException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// } break; } log.debug("Nodename: " + node.getClass().getSimpleName()); Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectNode.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectNode.java 2007-02-14 10:30:38 UTC (rev 532) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectNode.java 2007-02-14 15:48:36 UTC (rev 533) @@ -1,190 +0,0 @@ -/** - * - */ - -package net.sf.magicmap.client.model.node; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Set; -import java.util.TreeSet; - -/** - * Wir nehmen ersteinmal NUR flickr dinger.... - * @author Johannes Zapotoczky (joh...@za...), Jan Friderici - * - */ -public class InfoObjectNode extends Node implements InfoObject { - - private String infoUrl; - private String serviceUrl; - private String infoType; - private String depiction; - private String description; - private String infoTitle; - - private transient boolean expanded; - private static Object service; - - private java.util.Set<InfoObjectTag> tags = new TreeSet<InfoObjectTag>(); - - private ArrayList neighbours = new ArrayList<InfoObjectNode>(); - - public static final InfoObjectNode EMPTY_INFO_NODE = new InfoObjectNode(null); - - public static final int UPDATE_TAG_ADDED = 23567; - public static final int UPDATE_TAG_CHANGED = InfoObjectNode.UPDATE_TAG_ADDED + 1; - public static final int UPDATE_TAG_DELETED = InfoObjectNode.UPDATE_TAG_ADDED + 2; - public static final int UPDATE_TAGS_CHANGED = InfoObjectNode.UPDATE_TAG_ADDED + 3; - - /** - * @param model - */ - public InfoObjectNode(INodeModel model) { - super(model); - this.expanded = false; - } - - public InfoObjectNode(INodeModel model, InfoObject info) { - super(model); - setName(info.getInfoUrl()); - this.expanded = false; - this.infoUrl = info.getInfoUrl(); - this.serviceUrl = info.getServiceUrl(); - this.infoType = info.getInfoType(); - this.depiction = info.getDepiction(); - this.description = info.getDepiction(); - this.infoTitle = info.getInfoTitle(); - setDisplayName(this.infoTitle); - setPhysical(false); - // Will call the update method in our model! - } - - /* (non-Javadoc) - * @see net.sf.magicmap.client.model.node.Node#getNeighbors() - */ - @Override - public ArrayList getNeighbors(){ - if (this.neighbours.size() == 0) { - - } - return this.neighbours; - } - - /* (non-Javadoc) - * @see net.sf.magicmap.client.model.node.Node#getType() - */ - @Override - public int getType(){ - return NodeModelConstants.NODETYPE_INFO; - } - - private void loadNeighbours(){ - - } - - public boolean isExpanded(){ - return this.expanded; - } - - public void setExpanded(boolean b) throws IOException{ - if (!this.expanded && b) explode(); - this.expanded = b; - - } - - public Set<InfoObjectTag> getTags(){ - return this.tags; - } - - public void addTag(InfoObjectTag tag){ - this.tags.add(tag); - getModel().updateNode(this, InfoObjectNode.UPDATE_TAG_ADDED, tag); - - } - - public Iterator<InfoObjectTag> iterator(){ - return this.tags.iterator(); - } - - protected void explode() throws IOException{ - try { - //Controller.getInstance().getInfoProviderRegistry().expandNode(this); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public String getDepiction(){ - return this.depiction; - } - - public void setDepiction(String depiction){ - this.depiction = depiction; - } - - public String getDescription(){ - return this.description; - } - - public void setDescription(String description){ - this.description = description; - } - - public String getInfoType(){ - return this.infoType; - } - - public void setInfoType(String infoType){ - this.infoType = infoType; - } - - public String getInfoUrl(){ - return this.infoUrl; - } - - public void setInfoUrl(String infoUrl){ - this.infoUrl = infoUrl; - } - - public ArrayList getNeighbours(){ - return this.neighbours; - } - - public void setNeighbours(ArrayList neighbours){ - this.neighbours = neighbours; - this.getModel().updateNode(this, NodeModelConstants.NODETYPE_INFO, neighbours); - } - - /** - * - * @param n - */ - public void addNeighbours(Node n){ - this.neighbours.add(n); - this.getModel().updateNode(this, NodeModelConstants.NODETYPE_INFO, n); - } - - public String getServiceUrl(){ - return this.serviceUrl; - } - - public void setServiceUrl(String serviceUrl){ - this.serviceUrl = serviceUrl; - } - - public void setTags(java.util.Set<InfoObjectTag> tags){ - this.tags = tags; - getModel().updateNode(this, InfoObjectNode.UPDATE_TAGS_CHANGED, tags); - } - - @Override - public String toString(){ - return super.toString() + " [depiction:" + getDepiction() + ", infoUrl" + this.infoUrl + "] "; - } - - public String getInfoTitle(){ - return this.infoTitle; - } -} Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectTag.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectTag.java 2007-02-14 10:30:38 UTC (rev 532) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectTag.java 2007-02-14 15:48:36 UTC (rev 533) @@ -1,65 +0,0 @@ - -package net.sf.magicmap.client.model.node; - -/** - * Ein Tag beschreibt eine Eigenschaft eines Informationsobjektes. - * Tags sind immutable. - * - */ -public abstract class InfoObjectTag implements Comparable { - - /** - * Der Typ... obertyp/untertyp_1/.../untertype_n - */ - public final String type; - /** - * Der Wert, eine URL, ein Schlagwort etc. - */ - public final String value; - /** - * Eine Beschreibung. - */ - public final String description; - - public InfoObjectTag(String type, String value, String description) { - this.type = type; - this.value = value; - this.description = description; - - } - - public InfoObjectTag(String type, String value) { - this(type, value, value); - } - - /** - * Two tags are equal if their type and theri value are equal. - * @param other - * @return true if other is a tag and both value und type are equal. - */ - @Override - public boolean equals(Object other){ - if (other instanceof InfoObjectTag) { - InfoObjectTag otherTag = (InfoObjectTag) other; - return (type.equals(otherTag.type) && value.equals(otherTag.value)); - } else - return super.equals(other); - } - - /** - * - * @param other - * @return 0 if both value and type are equal. - */ - public int compareTo(Object other){ - if (other instanceof InfoObjectTag) { - InfoObjectTag otherTag = (InfoObjectTag) other; - int i = type.compareTo(otherTag.type); - if (i == 0) { - return (value.compareTo(otherTag.value)); - } else - return i; - } - return 0; - } -} Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/SimpleInfoObject.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/SimpleInfoObject.java 2007-02-14 10:30:38 UTC (rev 532) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/SimpleInfoObject.java 2007-02-14 15:48:36 UTC (rev 533) @@ -1,93 +0,0 @@ - -package net.sf.magicmap.client.model.node; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -public class SimpleInfoObject implements InfoObject { - - private Set<InfoObjectTag> tags = new HashSet<InfoObjectTag>(); - private String depiction; - private String description; - private String title; - private String type; - private String url; - private String serviceUrl; - - public SimpleInfoObject() { - - } - - public void addTag(InfoObjectTag tag){ - tags.add(tag); - } - - public String getDepiction(){ - - return depiction; - } - - public String getDescription(){ - - return description; - } - - public String getInfoTitle(){ - - return title; - } - - public String getInfoType(){ - - return type; - } - - public String getInfoUrl(){ - - return url; - } - - public String getServiceUrl(){ - - return serviceUrl; - } - - public Set<InfoObjectTag> getTags(){ - - return tags; - } - - public Iterator<InfoObjectTag> iterator(){ - return tags.iterator(); - } - - public void setDepiction(String depiction){ - this.depiction = depiction; - } - - public void setDescription(String description){ - this.description = description; - } - - public void setServiceUrl(String serviceUrl){ - this.serviceUrl = serviceUrl; - } - - public void setTags(Set<InfoObjectTag> tags){ - this.tags = (tags); - } - - public void setTitle(String title){ - this.title = title; - } - - public void setType(String type){ - this.type = type; - } - - public void setUrl(String url){ - this.url = url; - } - -} Deleted: trunk/magicmapclient/test/net/sf/magicmap/client/model/info/InfoObjectBuilderTest.java =================================================================== --- trunk/magicmapclient/test/net/sf/magicmap/client/model/info/InfoObjectBuilderTest.java 2007-02-14 10:30:38 UTC (rev 532) +++ trunk/magicmapclient/test/net/sf/magicmap/client/model/info/InfoObjectBuilderTest.java 2007-02-14 15:48:36 UTC (rev 533) @@ -1,63 +0,0 @@ -package net.sf.magicmap.client.model.info; - -/** - * Created by IntelliJ IDEA. - * User: jan - * Date: 24.09.2006 - * Time: 15:30:20 - * To change this template use File | Settings | File Templates. - */ - -import junit.framework.*; -//import net.sf.magicmap.client.model.info.InfoObjectBuilder; -import net.sf.magicmap.client.model.node.InfoObject; -import net.sf.magicmap.client.model.node.InfoObjectTag; -import net.sf.magicmap.client.model.node.SimpleInfoObject; - -import java.net.URL; -import java.net.MalformedURLException; - -public class InfoObjectBuilderTest extends TestCase { -// InfoObjectBuilder infoObjectBuilder; - - /** - * Testet ob die Suche mit Google funktioniert. - * - * @throws Exception - */ - public void testCheckLinks() throws Exception { - //URL url = new URL("http://www.google.de/search?hl=de&q=related%3Ahttp%3A%2F%2Fwww.golem.de%2F&btnG=Suche&meta="); - URL url = new URL("http://www.golem.de"); -// infoObjectBuilder = new InfoObjectBuilder(); - InfoObject o = new SimpleInfoObject(); - //InfoObject o =infoObjectBuilder.buildNode(url); -// infoObjectBuilder.checkLinks(o,url); - assertTrue("Keine Related sites!", o.getTags().size() > 0); - for (InfoObjectTag infoObjectTag : o) { - assertNotNull("Wert darf nicht null sein", infoObjectTag.value); - assertNotNull("Typ darf nicht null sein", infoObjectTag.type); - - try { - URL relatedUrl = new URL(infoObjectTag.value); - } catch (MalformedURLException e) { - fail("Url nicht g\xFCltig: '" + infoObjectTag.value + "'"); - } - - System.out.println("Value: " + infoObjectTag.value); - } - assertNotNull(o); - } - - /** - * - * @throws Exception - */ - public void testBuildNode() throws Exception{ - URL url = new URL("http://www.golem.de"); -// infoObjectBuilder = new InfoObjectBuilder(); -// InfoObject infoObject = infoObjectBuilder.buildNode(url); -// assertNotNull("Infoobjekt null:", infoObject); -// assertEquals(infoObject.getInfoType(), "text/html"); -// assertEquals(infoObject.getInfoTitle(), "Golem.de: IT-News f\xFCr Profis"); - } -} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |