Clover coverage report - brownies library - 1.0-beta-1 Coverage timestamp: 月 8 16 2004 17:14:42 GMT+09:00 FRAMES NO FRAMES |
file stats: | LOC: | 96 |  | Methods: | 4
| NCLOC: | 55 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
LinkRowRenderer.java | 0% | 0% | 0% | 0% |

1 |  |
     /*
2 |  |
      * Joey and its relative products are published under the terms
3 |  |
      * of the Apache Software License.
4 |  |
      */
5 |  |
     /*
6 |  |
      * Created on 2004/01/02
7 |  |
      */
8 |  |
     package org.asyrinx.brownie.tapestry.components.link;
9 |  |
10 |  |
     import java.util.HashMap;
11 |  |
     import java.util.Map;
12 |  |
13 |  |
     import org.apache.tapestry.IMarkupWriter;
14 |  |
     import org.apache.tapestry.IRequestCycle;
15 |  |
     import org.apache.tapestry.IScript;
16 |  |
     import org.apache.tapestry.components.ILinkComponent;
17 |  |
     import org.apache.tapestry.engine.ILink;
18 |  |
     import org.apache.tapestry.html.Body;
19 |  |
     import org.apache.tapestry.link.ILinkRenderer;
20 |  |
21 |  |
     /**
22 |  |
      * @author akima
23 |  |
      */
24 |  |
     public class LinkRowRenderer extends AbstractLinkRowRenderer {
25 |  |
26 |  |
         public static final ILinkRenderer SHARED_INSTANCE = new LinkRowRenderer();
27 |  |
28 |  |
         /**
29 |  |
          *
30 |  |
          */
31 | 0 |
         public LinkRowRenderer() {
32 | 0 |
             super("LinkRowRenderer.script");
33 |  |
         }
34 |  |
35 |  |
         public static final String LINK_URL_DIV_ID = "linkUrl";
36 |  |
37 |  |
         public static final String SYM_LINK_URL_DIV_ID = "linkUrlDivId";
38 |  |
39 |  |
         public static final String SYM_METHOD_CLICK_ROW = "clickLinkRowMethodName";
40 |  |
41 |  |
         public static final String SYM_METHOD_MOSUE_OVER_ROW = "mouseOverLinkRowMethodName";
42 |  |
43 |  |
         public static final String SYM_METHOD_MOSUE_OUT_ROW = "mouseOutLinkRowMethodName";
44 |  |
45 |  |
         public static final String SYM_SELECT_BG_COLOR = "selectBgColor";
46 |  |
47 |  |
         public static final String SYM_SELECT_STYLE_CLASS = "selectStyleClass";
48 |  |
49 |  |
         public static final String SYM_RENDERER = "renderer";
50 |  |
51 |  |
         /**
52 |  |
          * @see org.asyrinx.brownie.tapestry.components.link.AbstractScriptLinkRenderer#addScript(org.apache.tapestry.IRequestCycle,
53 |  |
          *      org.apache.tapestry.IScript, org.apache.tapestry.html.Body)
54 |  |
          */
55 | 0 |
         protected void addScript(IRequestCycle cycle, IScript script, Body body) {
56 | 0 |
             if (cycle.getAttribute(getScriptId()) != null)
57 | 0 |
                 return;
58 | 0 |
             cycle.setAttribute(getScriptId(), new int[0]);
59 | 0 |
             final Map symbols = new HashMap();
60 | 0 |
             symbols.put(SYM_RENDERER, this);
61 | 0 |
             symbols.put(SYM_LINK_URL_DIV_ID, LINK_URL_DIV_ID);
62 | 0 |
             symbols.put(SYM_METHOD_CLICK_ROW, CLICK_LINK_ROW_METHOD_NAME);
63 | 0 |
             symbols.put(SYM_METHOD_MOSUE_OVER_ROW, MOSUE_OVER_LINK_ROW_METHOD_NAME);
64 | 0 |
             symbols.put(SYM_METHOD_MOSUE_OUT_ROW, MOSUE_OUT_LINK_ROW_METHOD_NAME);
65 | 0 |
             symbols.put(SYM_SELECT_BG_COLOR, getSelectBgColor());
66 | 0 |
             symbols.put(SYM_SELECT_STYLE_CLASS, getSelectStyleClass());
67 | 0 |
             script.execute(cycle, body, symbols);
68 |  |
         }
69 |  |
70 |  |
         /**
71 |  |
          * @see org.asyrinx.brownie.tapestry.components.link.AbstractScriptLinkRenderer#renderBody(org.apache.tapestry.IMarkupWriter,
72 |  |
          *      org.apache.tapestry.IRequestCycle,
73 |  |
          *      org.apache.tapestry.components.ILinkComponent)
74 |  |
          */
75 | 0 |
         protected void renderBody(IMarkupWriter bodyWriter, IRequestCycle cycle,
76 |  |
                 ILinkComponent linkComponent) {
77 | 0 |
             bodyWriter.begin("span");
78 | 0 |
             bodyWriter.attribute("id", LINK_URL_DIV_ID);
79 | 0 |
             bodyWriter.attribute("style", "display:none");
80 | 0 |
             final IMarkupWriter innerDivWriter = bodyWriter.getNestedWriter();
81 | 0 |
             final ILink l = linkComponent.getLink(cycle);
82 | 0 |
             innerDivWriter.printRaw(constructURL(l, linkComponent.getAnchor()));
83 | 0 |
             innerDivWriter.close();
84 | 0 |
             bodyWriter.end();
85 | 0 |
             linkComponent.renderBody(bodyWriter, cycle);
86 |  |
         }
87 |  |
88 |  |
         private static final String SCRIPT_ADD_FLAG_KEY = DirectLinkRow.class
89 |  |
                 .getName()
90 |  |
                 + ".added.javascript";
91 |  |
92 | 0 |
         protected String getScriptId() {
93 | 0 |
             return SCRIPT_ADD_FLAG_KEY + "." + this.hashCode();
94 |  |
         }
95 |  |
96 |  |
     }