01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10: package org.mmbase.util.functions;
11:
12: import org.mmbase.module.core.MMObjectNode;
13: import org.mmbase.bridge.*;
14: import org.mmbase.util.logging.Logger;
15: import org.mmbase.util.logging.Logging;
16:
17: /**
18: * The gui function of MMObjectBuilder
19: *
20: * @author Michiel Meeuwissen
21: * @version $Id: GuiFunction.java,v 1.5 2007/11/25 18:25:49 nklasens Exp $
22: * @since MMBase-1.9
23: */
24: public class GuiFunction extends NodeFunction<String> {
25:
26: private static final Logger log = Logging
27: .getLoggerInstance(GuiFunction.class);
28: public static final Parameter<?>[] PARAMETERS = { Parameter.FIELD,
29: Parameter.LANGUAGE,
30: new Parameter<String>("session", String.class),
31: Parameter.RESPONSE, Parameter.REQUEST, Parameter.LOCALE,
32: new Parameter<String>("stringvalue", String.class)
33: //new Parameter("length", Integer.class),
34: // field, language, session, response, request) Returns a (XHTML) gui representation of the node (if field is '') or of a certain field. It can take into consideration a http session variable name with loging information and a language");
35:
36: };
37:
38: public GuiFunction() {
39: super ("gui", PARAMETERS);
40: }
41:
42: protected String getFunctionValue(Node node, Parameters parameters) {
43: if (log.isDebugEnabled()) {
44: log.debug("GUI of builder with " + parameters);
45: }
46: String fieldName = parameters.get(Parameter.FIELD);
47: if (fieldName != null && (!fieldName.equals(""))
48: && parameters.get("stringvalue") == null) {
49: if (node.getSize(fieldName) < 2000) {
50: parameters.set("stringvalue", node
51: .getStringValue(fieldName));
52: }
53: }
54: MMObjectNode n = (MMObjectNode) parameters
55: .get(Parameter.CORENODE);
56: return n.getBuilder().getGUIIndicator(n, parameters);
57: }
58:
59: }
|