KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > module > builders > Urls


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.module.builders;
11
12 import org.mmbase.core.event.NodeEvent;
13 import org.mmbase.module.core.*;
14 import org.mmbase.util.logging.*;
15
16 /**
17  * @javadoc
18  * @application Tools
19  * @author Daniel Ockeloen
20  * @version $Id: Urls.java,v 1.25 2006/04/27 16:48:49 michiel Exp $
21  */

22 public class Urls extends MMObjectBuilder {
23     private static final Logger log = Logging.getLoggerInstance(Urls.class);
24
25     public String JavaDoc getGUIIndicator(MMObjectNode node) {
26         String JavaDoc str = node.getStringValue("url");
27         if (str != null) {
28             if (str.indexOf("http://") == 0) {
29                 str = str.substring(7);
30             }
31             str = org.mmbase.util.transformers.Xml.XMLEscape(str);
32         }
33         return str;
34     }
35
36     public String JavaDoc getGUIIndicator(String JavaDoc field,MMObjectNode node) {
37         if (field.equals("url")) {
38             String JavaDoc url = node.getStringValue("url");
39             if (url != null) {
40                 url = org.mmbase.util.transformers.Xml.XMLEscape(url);
41                 return "<a HREF=\"" + url + "\" class=\"mm_gui\" onclick=\"window.open(this.href); return false;\">" + url + "</a>";
42             }
43         }
44         return null;
45     }
46
47
48     public String JavaDoc getDefaultUrl(int src) {
49         MMObjectNode node = getNode(src);
50         return node.getStringValue("url");
51     }
52
53     /* (non-Javadoc)
54      * @see org.mmbase.module.core.MMObjectBuilder#notify(org.mmbase.core.event.NodeEvent)
55      */

56     public void notify(NodeEvent event) {
57          if(tableName.equals(event.getBuilderName())){
58              Jumpers jumpers = (Jumpers)mmb.getBuilder("jumpers");
59              if (jumpers == null) {
60                  log.debug("Urls builder - Could not get Jumper builder");
61              } else {
62                  jumpers.delJumpCache(""+event.getNodeNumber());
63              }
64          }
65         super.notify(event);
66     }
67 }
68
Popular Tags