1 |
|
|
2 |
|
package net.wotonomy.web; |
3 |
|
|
4 |
|
import net.wotonomy.foundation.NSArray; |
5 |
|
import net.wotonomy.foundation.NSDictionary; |
6 |
|
|
7 |
|
public class WOFrame extends WODynamicElement { |
8 |
|
|
9 |
|
public WOFrame() { |
10 |
0 |
super(); |
11 |
0 |
} |
12 |
|
|
13 |
|
public WOFrame(String aName, NSDictionary assocs, WOElement template) { |
14 |
0 |
super(aName, assocs, template); |
15 |
0 |
} |
16 |
|
|
17 |
|
public String frameName(WOContext c) { |
18 |
0 |
String x = (String)valueForProperty("name", c.component()); |
19 |
0 |
if (x != null) |
20 |
0 |
return x; |
21 |
0 |
return c.elementID(); |
22 |
|
} |
23 |
|
|
24 |
|
public String url(WOContext c) { |
25 |
|
|
26 |
0 |
String href = stringForProperty("href", c.component()); |
27 |
0 |
if (href != null) |
28 |
0 |
return href; |
29 |
0 |
href = stringForProperty("pageName", c.component()); |
30 |
0 |
if (href != null || associations.objectForKey("action") != null) { |
31 |
0 |
return c.componentActionURL(); |
32 |
|
} |
33 |
0 |
href = stringForProperty("directActionName", c.component()); |
34 |
0 |
if (href != null) { |
35 |
0 |
String fullActionName = stringForProperty("actionClass", c.component()); |
36 |
0 |
if (fullActionName != null) |
37 |
0 |
fullActionName = fullActionName + "/" + href; |
38 |
|
else |
39 |
0 |
fullActionName = href; |
40 |
0 |
return c.directActionURLForActionNamed(fullActionName, |
41 |
0 |
urlFields(c.component())); |
42 |
|
} |
43 |
|
|
44 |
0 |
return null; |
45 |
|
} |
46 |
|
|
47 |
|
public void appendToResponse(WOResponse r, WOContext c) { |
48 |
0 |
r.appendContentString("<FRAME NAME=\""); |
49 |
0 |
r.appendContentString(frameName(c)); |
50 |
0 |
r.appendContentString("\" SRC=\""); |
51 |
0 |
r.appendContentString(url(c)); |
52 |
0 |
r.appendContentString("\""); |
53 |
0 |
String moreFields = additionalHTMLProperties(c.component(), new NSArray(new Object[]{ |
54 |
0 |
"name", "href", "pageName", "directActionName", "actionClass" })); |
55 |
0 |
if (moreFields != null && moreFields.length() > 0) |
56 |
0 |
r.appendContentString(moreFields); |
57 |
0 |
r.appendContentString(">"); |
58 |
0 |
} |
59 |
|
|
60 |
|
} |