[Tapestry-commits] CVS: Tapestry/contrib/src/net/sf/tapestry/contrib/inspector Engine_NRp2.gif,NONE,
Brought to you by:
hship
Update of /cvsroot/tapestry/Tapestry/contrib/src/net/sf/tapestry/contrib/inspector
In directory sc8-pr-cvs1:/tmp/cvs-serv14897/contrib/src/net/sf/tapestry/contrib/inspector
Added Files:
Tag: hship-2-3
Engine_NRp2.gif Inspector.java Restart_Np1.gif
Specification_NBanner.gif package.html Properties_HRp4.gif
Template_NBanner.gif Specification_Np1.gif Selector.jwc
Inspector.page Specification_Hp3.gif ShowTemplate.html
Template_Np1.gif inspector-rollover.gif Template_Hp3.gif
ShowEngine.html ShowTemplate.java Specification_NRp2.gif
ShowSpecification.html ShowEngine.java Restart_NRp2.gif
Inspector.css ViewTabs.jwc ShowSpecification.java
ShowDescription.jwc tapestry-logo.gif Template_NRp2.gif
Engine_HRp4.gif InspectorValidationDelegate.java
ShowDescription.html ViewTabs.html Reset_Np1.gif
Engine_NBanner.gif Reset_Np1_disabled.gif InspectorButton.html
ViewTabs.java Properties_NRp2.gif Engine_Np1.gif
InspectorButton.java ShowEngine.jwc info.gif
Properties_NBanner.gif Engine_Hp3.gif Specification_HRp4.gif
ShowTemplate.jwc Selector.html Properties_Np1.gif
ShowProperties.jwc Properties_Hp3.gif InspectorButton.jwc
Selector.java InspectorButton.script ShowSpecification.jwc
Reset_NRp2.gif View.java ShowProperties.html Template_HRp4.gif
Inspector.library Inspector.html ShowProperties.java
Log Message:
Move the Inspector into the contrib library.
--- NEW FILE: Engine_NRp2.gif ---
GIF89ax
--- NEW FILE: Inspector.java ---
package net.sf.tapestry.contrib.inspector;
import java.util.HashMap;
import java.util.Map;
import net.sf.tapestry.IComponent;
import net.sf.tapestry.IPage;
import net.sf.tapestry.IPageLoader;
import net.sf.tapestry.IRequestCycle;
import net.sf.tapestry.PageLoaderException;
import net.sf.tapestry.components.Block;
import net.sf.tapestry.html.BasePage;
import net.sf.tapestry.spec.ComponentSpecification;
/**
* The Tapestry Inspector page.
*
* @author Howard Lewis Ship
* @version $Id: Inspector.java,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $
**/
public class Inspector extends BasePage
{
private View _view = View.SPECIFICATION;
private String _inspectedPageName;
private String _inspectedIdPath;
private static final int MAP_SIZE = 7;
private Map _blocks;
public void detach()
{
_view = View.SPECIFICATION;
_inspectedPageName = null;
_inspectedIdPath = null;
super.detach();
}
public void finishLoad()
{
_blocks = new HashMap(MAP_SIZE);
_blocks.put(View.TEMPLATE, getComponent("templateBlock"));
_blocks.put(View.SPECIFICATION, getComponent("specificationBlock"));
_blocks.put(View.ENGINE, getComponent("engineBlock"));
_blocks.put(View.PROPERTIES, getComponent("propertiesBlock"));
}
public View getView()
{
return _view;
}
public void setView(View value)
{
_view = value;
fireObservedChange("view", value);
}
public String getInspectedPageName()
{
return _inspectedPageName;
}
public void setInspectedPageName(String value)
{
_inspectedPageName = value;
fireObservedChange("inspectedPageName", value);
}
public String getInspectedIdPath()
{
return _inspectedIdPath;
}
public void setInspectedIdPath(String value)
{
_inspectedIdPath = value;
fireObservedChange("inspectedIdPath", value);
}
/**
* Invoked to change the component being inspected within the current
* page.
*
* @since 1.0.6
**/
public void selectComponent(String idPath)
{
setInspectedIdPath(idPath);
}
/**
* Method invoked by the {@link InspectorButton} component,
* to begin inspecting a page.
*
**/
public void inspect(String pageName, IRequestCycle cycle)
{
setInspectedPageName(pageName);
selectComponent((String) null);
cycle.setPage(this);
}
/**
* Listener for the component selection, which allows a particular component.
*
* <p>The context is a single string,
* the id path of the component to be selected (or null to inspect
* the page itself). This invokes
* {@link #selectComponent(String)}.
*
**/
public void selectComponent(IRequestCycle cycle)
{
Object[] parameters = cycle.getServiceParameters();
String newIdPath;
// The up button may generate a null context.
if (parameters == null)
newIdPath = null;
else
newIdPath = (String) parameters[0];
selectComponent(newIdPath);
}
/**
* Returns the {@link IPage} currently inspected by the Inspector, as determined
* from the inspectedPageName property.
*
**/
public IPage getInspectedPage()
{
return getRequestCycle().getPage(_inspectedPageName);
}
/**
* Returns the {@link IComponent} current inspected; this is determined
* from the inspectedPageName and inspectedIdPath properties.
*
**/
public IComponent getInspectedComponent()
{
return getInspectedPage().getNestedComponent(_inspectedIdPath);
}
public String getInspectorTitle()
{
return "Tapestry Inspector: " + getEngine().getSpecification().getName();
}
/**
* Returns the {@link Block} for the currently selected view.
*
**/
public Block getBlockForView()
{
return (Block) _blocks.get(_view);
}
}
--- NEW FILE: Restart_Np1.gif ---
GIF89ax
RêШ°êÔº«ÕTc~í5ªÄgf6ëZ¶cÁ*»µmY·4½â
.ϰ~·}W«áÁÿ«¸¦YzïBnÛ·rc/;¶Kyr_É5ßÌ,ÚódÄ|×BFìXïeÒ¥cË {¶í×oëö[{·o«a
N¼¸q+_μyÆ
--- NEW FILE: Specification_NBanner.gif ---
GIF89aX
J´¨Ñ£(KÉ´©Ó§P£JJµªÕ«X!*Íʵ«×¯`ÃK¶ìÀ¨]˶۷pãÊK·®Ý»xóêÝË·¯ß¿L¸°áÃ#V±ãÇ#KL¹²åË3kÌØ¤À¸' 0Z
ZÈ`|-ÈV1Òxa:ÊHã0cDö&¢\ç©dd+æè¢;FiáNÚxãRÙ?RÈe].)&jG®ÑhÊge<~Y¥[¾ >R'Mò¨'iöyYjfâ äç¡z= §¢{Ò§vº gr*
&fê¡VZW&÷©¦¤Îiã>8!«²f±8ÆZi²Nê¥æ:§É
¨öú«®ÄòUdÇ«lz"öª\j9;ê²ÔÎ,d×V«p"ç«yÀªåí°Ûkî¹èº%"ênºðÆ+/¢"zb[ö8ï¾üöK$ þ,ðÀcÎÔÁ'¬ðÂ7ìðÃG,ñÄ3ufÖÅg¬ñÆwì±Eù,òÈ$lòÉ(§¬òÊ,·ìòË0Ç,óÌ4×lóÍ8笳Î
--- NEW FILE: package.html ---
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- $Id: package.html,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $ -->
<html>
<head>
<title>Tapestry: Web Application Framework</title>
</head>
<body>
<p>Implementation of the Tapestry <em>Inspector</em>, a specialized page
used to dynamically introspect the construction of an application while
it runs. The {@link net.sf.tapestry.contrib.inspector.ShowInspector} component
creates an icon on the page that raises the Inspector in a seperate window.
@author Howard Lewis Ship <a href="mailto:hs...@us...">hs...@us...</a>
</body>
</html>
--- NEW FILE: Properties_HRp4.gif ---
GIF89ax
--- NEW FILE: Template_NBanner.gif ---
GIF89aX
J´¨Ñ£(KÉ´©Ó§P£JJµªÕ«X!*Íʵ«×¯`ÃK¶ìÀ¨]˶۷pãÊK·®Ý»xóêÝË·¯ß¿L¸°áÃ#V±ãÇ#KL¹²åË3kÌØ¤À¸' 0Z
--- NEW FILE: Specification_Np1.gif ---
GIF89ax
--- NEW FILE: Selector.jwc ---
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: Selector.jwc,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $ -->
<!DOCTYPE component-specification PUBLIC
"-//Howard Lewis Ship//Tapestry Specification 1.3//EN"
"http://tapestry.sf.net/dtd/Tapestry_1_3.dtd">
<component-specification class="net.sf.tapestry.contrib.inspector.Selector">
<component id="form" type="Form">
<binding name="listener" expression="listeners.formSubmit"/>
</component>
<component id="selectPage" type="PropertySelection">
<binding name="value" expression="page.inspectedPageName"/>
<binding name="model" expression="pageModel"/>
<binding name="submitOnChange" expression="true"/>
</component>
<component id="page" type="DirectLink">
<binding name="listener" expression="page.listeners.selectComponent"/>
</component>
<component id="e" type="Foreach">
<binding name="source" expression="crumbTrail"/>
</component>
<component id="component" type="DirectLink">
<binding name="parameters" expression="components.e.value.idPath"/>
<binding name="listener" expression="page.listeners.selectComponent"/>
</component>
<component id="insertId" type="Insert">
<binding name="value" expression="components.e.value.id"/>
</component>
<component id="renderBody" type="RenderBody"/>
</component-specification>
--- NEW FILE: Inspector.page ---
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: Inspector.page,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $ -->
<!DOCTYPE page-specification PUBLIC
"-//Howard Lewis Ship//Tapestry Specification 1.3//EN"
"http://tapestry.sf.net/dtd/Tapestry_1_3.dtd">
<page-specification class="net.sf.tapestry.contrib.inspector.Inspector">
<component id="shell" type="Shell">
<binding name="title" expression="inspectorTitle"/>
<binding name="stylesheet" expression="assets.stylesheet"/>
</component>
<component id="body" type="Body"/>
<component id="selector" type="inspector:Selector"/>
<component id="viewTabs" type="inspector:ViewTabs"/>
<component id="renderBlockForView" type="RenderBlock">
<binding name="block" expression="blockForView"/>
</component>
<component id="specificationBlock" type="Block"/>
<component id="showSpecification" type="inspector:ShowSpecification"/>
<component id="templateBlock" type="Block"/>
<component id="showTemplate" type="inspector:ShowTemplate"/>
<component id="propertiesBlock" type="Block"/>
<component id="showProperties" type="inspector:ShowProperties"/>
<component id="engineBlock" type="Block"/>
<component id="showEngine" type="inspector:ShowEngine"/>
<private-asset name="stylesheet" resource-path="/net/sf/tapestry/contrib/inspector/Inspector.css"/>
</page-specification>
--- NEW FILE: Specification_Hp3.gif ---
GIF89ax
--- NEW FILE: ShowTemplate.html ---
<!-- $Id: ShowTemplate.html,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $ -->
<span jwcid="ifNoTemplate">
<span class="message">Component does not have a template.
</span>
</span>
<span jwcid="ifTemplate">
<table class="template">
<tr>
<td><span jwcid="insertTemplate"/></td>
</tr>
</table>
</span>
--- NEW FILE: Template_Np1.gif ---
GIF89ax
RªÏ¨N¡ZEJ5æÖXHYìX±f£NLûg×¶:±ÊEK÷éܰugÎ
ó-ßrת%KÚ³Ïþéw1ͽz l7ra¼i6Î|²äÊAç\óæÌa«uD½1;>Íy¨ìÚEiãfº[ªîÞÀg+
N<s×È+_ÎáÇçУK1
--- NEW FILE: inspector-rollover.gif ---
GIF89a4
$* #")
$!+$)%4&1%6) :, 1*"##"$,(&!-*"-*$/,#,,,"%1%(5)+3),:/161/+41)54/33324978;:82<<<,1B14B27H48G49K9<C<=@6;P>CM;@U=C[G5 J7
M:
M;O<P; C>3U@
[C
XB
\E
DA9`GaH
`HdJgM
hLnQjPmR}\
BBC@CMBFMEFHDFMGHIIIIHJLJLMLLLAES@F_GJSDJVEI\HJRNR^OT^SSSRT[[[\AG`CJdGMhHNgHOiKTeNRcOVcMVfJQmOXjMTqMXpQUgUZbT[l[]cQWrR[sS\z[co_ci_boWavTa|Zbr[du\aqccc`bjghmjjj`e{klrnpxrrr{{{W`Yc]f^k^m`jcmfrku`qfqetbtevjtn{k|l{z|fy¡kz¢l¨p{¥r}¨o¦k«oªm¬n°ut
±r¶u´uºv¼y
²{¶|¹yÂ|Æ|Æ~Ébeh
dflkqs£x¥y¨|®µºÁÅËÓڡܢߤà¥å©è«é¬ì®
½ ¤¤¤ª««³³³»»»À
ÅÍÉÍÐÑÑÄÄÄËËËÒÒÒÙÙÙäääìììóóóþþþÑ
cض[Ê´i·lÎ,èêÝÉ µ¬òLiÓ¯`»Mûò¡L¯«Xò¢ÁÙ7°pãR[Á¢UÚ§L¬ ö6®ß¯Ø°8ñ.©X°ý]üµ±
%å 7Æ~S rÐS/g½Ù@"ÉuÀâu4ieJ¡|w%
b׸»YyÑ«â¨ÑpwÄ´}ðÒ)çУK.¬³ ¯äávSêàÃþ?û¤ÕÂJ+¾}u°ÒÄüSkìÝë«
ÄòÑ7ùé×^\a A»0ÐL\º5
B(
\aâÅÕÍ
o4
¢Åaqm¡CaòüÅp0~ÕÌÂ4ÌÌĨ#8Õ(@¸00Í1fÃA'½²
0bÊAíBÆðÏ+Ð+Dß%-jàÍTÍËÜX*0pDUQÛ,P/ì@@aE2Ë1E
<÷mvAïÃJ$s!¸q,rJ/ß
cضý[Ȱa·lÎ,ðªØ¼y
cÜ
í9Ú
@*ï£Im:eI^D©©Þz
^#1æ@_'¼øMÒÙW¶çò·ÍnOz¼û7OX0ÆJ;ËktÅò
ÁnóÀéGí¥L-aû6p'AjØ@z÷³bËy·TýhìÀ¡M>ò2#fùô§×DX³>eùsmÙ¦o?ºõøog7+/zGê¶;¾7&KR²=î9b²|
Ûâ
@
¥àyÝV¼ñ8o
ËMëßÏâï$ôbïÉÔÌá
ÆH¤Qß¾íè±iA),N¤ZÕêU¦[Á´âËëÀy§V<<¨fÍÝÈvÜñ¶®YñìvmÎCE#ÊbößWõRìèÛK
>HÑaÄ,þ-¬ÈbBpåÉÛØ±$AXEg²¥ÆÝ$é#ÈÊÞ¬ Qà·/ôÅ!K)ßJ\7+DÕPAL
|:gæTW Ôൠ¯¼äBk*$õ]ÿ¤)"V°
`ïʾ^IAu^¬W6m¦0¿
SÅÛP¢]
+q»bèiH*ÜÅ YÁîç¿7
Ï+.ÓRp-½@ÂÞÕëÏÆ¡Ó¿÷ñÍ3
Ü|ÅAÉóÃcr¤È_
F(!GxPàS
ÿ
ã³èIàN(ÖÔéÀ|¨U(
TÚѯÿvþÓ:\Ó¤%ûOiC
CS}
]Ó@È ÅÀ7
Û`[*4£iÈ@<
ÒA4ÂÎ5â<4 MªÿLj«O^³Å<$ÌJ+ º^ALEÅ,·M§«¾úé´ÓÎ#mB
#Jø°"Ä3,xÑ༠9Ò3Ø1â¼'S¦¹`Éñ)i9Ò£Ê*Z48KQt(Ê¥³eA%VS(\ºuzÔô/¼Cbm(Ç\>~ø*Щãã_<{T]ÝúR)CNÀâå"įÌ:@þ
ðFNñ6Ù@ñã÷¯ÁyvþYja!`ZÆ«SB8u¦Ûwô¤ªvlkfþÇnÓ×Ð/üøæBÌ«
ÂÖÍOÌl&ÍócÞ3,i1Ë(qÁúvÿ[|Ó!ÍOß¿5þY#æBvíX/,^{Þ:3Go0ÈâqÁ}Wd>ý°Ø&ûäjÿéÆÃ-ØàDû,¶<9=(Ñ<©S
ZÐJMÊJàlã¡p
ÍD¬D׬ F1¬ªJM«PµWsÒ£ó¬ÒA4»ç·+Èà¡1¢)!$H ÊcGöªºê¿ñF$¿ÖxR½hU!DqÍ7K
6^ /ß
$)&l`6s¾Zb3+0ÀÈ;òÒ.d ÁÇwÔæ6$Ð+*¯&-jàÍT
Ämrc
4^¨ÀÀ© `/ì@@aE2Ë1E
<֊Q@
®ºtèçFXî:]ié@SrÌåã7°Ì:%XêA£'`HÅ>Õ«ñÞÊñ3IÐνuZXðª*!Φ5ÿqR®CëØþËWeIÇ{*ýE¤EÔéÓ\pÝ>Öÿ<®HPuázãû ¿}vfH0x²ãDzèÖö6ȯKt
-±ô6 eI«B$ìfI~0®
]#<«VdÒ-+äxÍ
ÄûÐ<]ôN0Þ{
¾
ÄB¿Î*ÀÂ
/¿9Dcļ®b Ò@$¦AbjãeôÒ¼vdÀ.#ÍS·3+0ÀH1ØVT!DqÍ7Ñ,@¬Ì³DòbÂÆ`Ó4Ð1pD*ïÄã.d `ÑL5Ù@Ð-FW)-jôâÈ VH\Q@
áÍRTä:pÜ"àUð22,YBáÒÕSw3ÞD¹ÐsùøñÃWæ5Û)ÄÒãÀs=Î*'v]»ïêÕkðã@NÀÚÅ£÷KÐ:±óÕªN༬ZCQ²"Dô=ä'p5HW§=ÂÙãì3IvÌ
=°RïÆß%ÈmÃÀ&Û®<¤`6C·|5Ðx¡Â-3Óñ<» `ѯ@É,Æ<Ã>h-jôâÈ
ÆùOݺ}K÷Ù1Cfí)hANJ
bN5A}áx9Èo%1¸]P*Á¸óE<å}ÿì³üÜ>åL"ÒWñtÇeÓýcÉ<.µ&ì¬3 ¢pøÐG²X fçýÃOrÅdÏ&êàÃN%{¸8Q3Tcv&u7>öDQò 'ÐHÆôàròDSTVIÎ>kÔÃwYD9K ?ù
TÇRùüC¢1á3
`<k¬É#Æ7
yÁÀ©|Jr½mM·`¼+kd`6XTÍ@S¤ðË7Ëcì`
ÕNvlÑüþBß˾rê#7 (ï?EçÁ×d¾yÐù®Ó>vì_rÉòÏùÔW^4Ù<BÈ=ã=â!ÒRɲú(H$WP(7Ð!þµà?
RÆ×>û¬ÁcO=
(ã=ä¬
¥8ÒÎéÃè'¨1Ñ©Åó°Á$/,±*«$å""ÍPI·âJÞ_Èüb-䥰âSlÿȲ,³Ñi2R#?k"´ÚB<
àß¼ÇIK,aawÈåSÜqÞyZµÇ9¡=¸ï"»zõÒ1Ò@Ò¦Mf¨:)¿|äÖT
´j.QV&9ÌÐÂAIdllæbAö¤SzÅÙ{¥Øå´9
A6&ñ³&ùØS=°¬9æ<ü³& <ÉÙ9¡d@TàCep)¨~ºà .y¨¤/Möa>v)¦
ÃùÝ#·F@
¦<r´-a 0°[zëW£Ëó2óÓ.ÇÎê|@3ÉÒ¤3är¹°ïÀNâð½8oa}õ4ý1ct²+4.Ø%teþfÙ¼|ó}ÆÛIéøËÑ¢w8Àï;;D7Î=ùÛå^~
Í=ØO:áÀvh+üß@ëб&ùlr9A<jE¸<JäSAÿü÷OlÿÑlÂÃnÀ!{q¹lRÿØñ?0×\.ÑÉ,î¨Ò£ÕP 4q¤& !@æ7%©2Ü?ª®LbGWGæ|#R8<ÐqÄ9'C}©I
ÜÀ¤÷'D5DðüXâ¢zedRªÚ^r§iqÆÉÉWjVªs¥¦åiªªf*T@
ɥУ êö©\âÊfðÈѨ%ÀÚLx\>%MöÜiRb&YtæBÿ>~ôTgÒ5ì "T©/\#T%ê«tÆ¢-,È(0ìR
ð:¥uå¼Ã+§ô¯B`âðŨ¶òO %Æ»NßäËP÷¡£CνpBTeö+vi.=^¨É\¾|ö&iª/AðV/lý8ϳî[·¦¥MìC§é`bW(2¿{áÛ+ä§ÏÜ -*´ðÁN8T±î9û@xl6å#WÁ»zû$´b.±'²¸Ãp5µÖ(Jl"z@¬QÏD´ Ðâ%×X¹ÔàÂ?8Ð%iÂvhb
)æa}©J.ñÄDèäà&a'öͨ]k
tÁ>ùÔNtáx2F:8bÿãF
AÜP"
&µ 3j)`Á¢ ùa1r9'}r%ÿÈXd4Ö'ÑafÉ'k
&Ê&ähJ
<^(%èVsdzÇ5ñ@cGÓ&;685nÈ<j.=6\ÔB#KÇÑy×43'¯W`;U¡ä*Á¨@÷ÔtáJpAQ)YA°IÌaâF
8ÜP"²¸P
õlíââ
ÑvYü©bB6r¤ã2*7cA
yÐxÒh$F?
µÜpÀy¨Q²GeºEÏÝvêÛ¸sÇþQ®ÁÜ©wû¾vEÒÄÓ&¾Ñ1Çߦ)"~whÞ
/Z
--- NEW FILE: Template_Hp3.gif ---
GIF89ax
³*Y¤*¡ýªÕkZ·+Ù¶{ö¥Ùº,Õ»öíW°iÃâuyw0ݱ|áºí;Wá
;nØ1c¸?Ny0Ö)öÚ´ØÍ,;£¦9vµOÕ®c¶½6íÛumãÞÝT7ïßTAN¼¸ñ
--- NEW FILE: ShowEngine.html ---
<!-- $Id: ShowEngine.html,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $ -->
<table class="inspector-data">
<tr class="heading">
<th colspan=2>Engine/Application Properties</th>
</tr>
<tr class="heading">
<th>Name</th> <th>Property</th>
</tr>
<tr class="even">
<th>Tapestry Framework Version</th>
<td><span jwcid="insertFrameworkVersion"/></td>
</tr>
<tr class="odd">
<th>Application Name</th>
<td><span jwcid="insertApplicationName"/></td>
</tr>
<tr class="even">
<th>Context Path</th>
<td><span jwcid="insertContextPath"/></td>
</tr>
<tr class="odd">
<th>Servlet Path</th>
<td><span jwcid="insertServletPath"/></td>
</tr>
<tr class="even">
<th>Engine Class</th>
<td><span jwcid="insertEngineClass"/></td>
</tr>
<tr class="odd">
<th>Locale</th>
<td><span jwcid="insertLocale"/></td>
</tr>
<tr class="even">
<th>Visit</th>
<td>
<span jwcid="ifNoVisit">
<em>none</em>
</span>
<span jwcid="ifVisit">
<span jwcid="insertVisit"/>
</span>
</td>
</tr>
</table>
<h1>Operations</h1>
<table class="inspector-data">
<tr class="even">
<td><a jwcid="restart" target="_new"><img jwcid="restartButton"/></a>
</td>
<td>Restart the application (in a new window).
</td>
</tr>
<tr class="even">
<td><a jwcid="reset"><img jwcid="resetButton"/></a>
</td>
<td>
Reset the application, discarding all cached specifications, assets
and templates.
</td>
</tr>
</table>
<h1>Serialized Engine</h1>
<p>The serialized state of the application engine (the size of this is relevant
for application servers which support clustering).
<p><span jwcid="insertByteCount"/> bytes:
<pre><span jwcid="insertSerializedEngine"/></pre>
<h1>Request Context</h1>
<span jwcid="insertRequest"/>
--- NEW FILE: ShowTemplate.java ---
package net.sf.tapestry.contrib.inspector;
import java.util.Iterator;
import java.util.Map;
import net.sf.tapestry.BaseComponent;
import net.sf.tapestry.Gesture;
import net.sf.tapestry.IComponent;
import net.sf.tapestry.IDirect;
import net.sf.tapestry.IEngineService;
import net.sf.tapestry.IMarkupWriter;
import net.sf.tapestry.IRender;
import net.sf.tapestry.IRequestCycle;
import net.sf.tapestry.ITemplateSource;
import net.sf.tapestry.RequestCycleException;
import net.sf.tapestry.parse.CloseToken;
import net.sf.tapestry.parse.ComponentTemplate;
import net.sf.tapestry.parse.LocalizationToken;
import net.sf.tapestry.parse.OpenToken;
import net.sf.tapestry.parse.TemplateToken;
import net.sf.tapestry.parse.TextToken;
import net.sf.tapestry.parse.TokenType;
/**
* Component of the {@link Inspector} page used to display
* the ids and types of all embedded components.
*
*
* @version $Id: ShowTemplate.java,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $
* @author Howard Lewis Ship
*
**/
public class ShowTemplate extends BaseComponent implements IDirect
{
public boolean getHasTemplate()
{
Inspector inspector;
inspector = (Inspector) getPage();
// Components that inherit from BaseComponent have templates,
// others do not.
return inspector.getInspectedComponent() instanceof BaseComponent;
}
public IRender getTemplateDelegate()
{
return new IRender()
{
public void render(IMarkupWriter writer, IRequestCycle cycle) throws RequestCycleException
{
writeTemplate(writer, cycle);
}
};
}
/**
* Writes the HTML template for the component. When <jwc> tags are
* written, the id is made a link (that selects the named component). We
* use some magic to accomplish this, creating links as if we were a
* {@link DirectLink} component, and attributing those links
* to the captive {@link DirectLink} component embedded here.
*
**/
private void writeTemplate(IMarkupWriter writer, IRequestCycle cycle)
{
IComponent inspectedComponent = getInspectedComponent();
ComponentTemplate template = null;
ITemplateSource source = getPage().getEngine().getTemplateSource();
try
{
template = source.getTemplate(cycle, inspectedComponent);
}
catch (Exception ex)
{
return;
}
writer.begin("pre");
int count = template.getTokenCount();
for (int i = 0; i < count; i++)
{
TemplateToken token = template.getToken(i);
TokenType type = token.getType();
if (type == TokenType.TEXT)
{
write(writer, (TextToken) token);
continue;
}
if (type == TokenType.CLOSE)
{
write(writer, (CloseToken) token);
continue;
}
if (token.getType() == TokenType.LOCALIZATION)
{
write(writer, (LocalizationToken) token);
continue;
}
if (token.getType() == TokenType.OPEN)
{
boolean nextIsClose = (i + 1 < count) && (template.getToken(i + 1).getType() == TokenType.CLOSE);
write(writer, nextIsClose, (OpenToken) token);
if (nextIsClose)
i++;
continue;
}
// That's all the types known at this time.
}
writer.end(); // <pre>
}
/** @since NEXT_RELEASE **/
private IComponent getInspectedComponent()
{
Inspector page = (Inspector)getPage();
return page.getInspectedComponent();
}
/** @since NEXT_RELEASE **/
private void write(IMarkupWriter writer, TextToken token)
{
int start = token.getStartIndex();
int end = token.getEndIndex();
// Print the section of the template ... print() will
// escape and invalid characters as HTML entities. Also,
// we show the full stretch of text, not the trimmed version.
writer.print(token.getTemplateData(), start, end - start + 1);
}
/** @since NEXT_RELEASE **/
private void write(IMarkupWriter writer, CloseToken token)
{
writer.begin("span");
writer.attribute("class", "jwc-tag");
writer.print("</");
writer.print(token.getTag());
writer.print(">");
writer.end(); // <span>
}
/** @since NEXT_RELEASE **/
private void write(IMarkupWriter writer, LocalizationToken token)
{
IComponent component = getInspectedComponent();
writer.begin("span");
writer.attribute("class", "jwc-tag");
writer.print("<span key=\"");
writer.print(token.getKey());
writer.print('"');
Map attributes = token.getAttributes();
if (attributes != null && !attributes.isEmpty())
{
Iterator it = attributes.entrySet().iterator();
while (it.hasNext())
{
Map.Entry entry = (Map.Entry) it.next();
String attributeName = (String) entry.getKey();
String attributeValue = (String) entry.getValue();
writer.print(' ');
writer.print(attributeName);
writer.print("=\"");
writer.print(attributeValue);
writer.print('"');
}
}
writer.print('>');
writer.begin("span");
writer.attribute("class", "localized-string");
writer.print(component.getString(token.getKey()));
writer.end(); // <span>
writer.print("</span>");
writer.end(); // <span>
}
/** @since NEXT_RELEASE **/
private void write(IMarkupWriter writer, boolean nextIsClose, OpenToken token)
{
IComponent component = getInspectedComponent();
IEngineService service = getPage().getEngine().getService(IEngineService.DIRECT_SERVICE);
String[] context = new String[1];
// Each id references a component embedded in the inspected component.
// Get that component.
String id = token.getId();
IComponent embedded = component.getComponent(id);
context[0] = embedded.getIdPath();
// Build a URL to select that component, as if by the captive
// component itself (it's a Direct).
Gesture g = service.buildGesture(getPage().getRequestCycle(), this, context);
writer.begin("span");
writer.attribute("class", "jwc-tag");
writer.print("<");
writer.print(token.getTag());
writer.print(" jwcid=\"");
writer.begin("span");
writer.attribute("class", "jwc-id");
writer.begin("a");
writer.attribute("href", g.getURL());
writer.print(id);
writer.end(); // <a>
writer.end(); // <span>
writer.print('"');
Map staticValues = token.getStaticValuesMap();
if (staticValues != null)
{
Iterator ii = staticValues.entrySet().iterator();
while (ii.hasNext())
{
Map.Entry e = (Map.Entry) ii.next();
writer.print(' ');
writer.print(e.getKey().toString());
writer.print("=\"");
writer.print(e.getValue().toString());
writer.print('"');
}
}
// Collapse an open & close down to a single tag.
if (nextIsClose)
writer.print('/');
writer.print('>');
writer.end(); // <span>
}
/**
* Invoked when a component id is clicked.
*
**/
public void trigger(IRequestCycle cycle)
{
Inspector inspector = (Inspector) getPage();
Object[] parameters = cycle.getServiceParameters();
inspector.selectComponent((String) parameters[0]);
IComponent newComponent = inspector.getInspectedComponent();
// If the component is not a BaseComponent then it won't have
// a template, so switch to the specification view.
if (!(newComponent instanceof BaseComponent))
inspector.setView(View.SPECIFICATION);
}
/**
* Always returns true.
*
* @since 2.3
*
**/
public boolean isStateful()
{
return true;
}
}
--- NEW FILE: Specification_NRp2.gif ---
GIF89ax
--- NEW FILE: ShowSpecification.html ---
<!-- $Id: ShowSpecification.html,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $ -->
<table>
<tr valign=top>
<td>
<table class="inspector-data" width="100%">
<tr class="even">
<th>Specification Resource Path</th>
<td><span jwcid="insertSpecificationPath"/>
<span jwcid="showComponentDescription"/>
</td>
</tr>
<tr class="odd">
<th>Java class</th>
<td><span jwcid="insertJavaClass"/></td>
</tr>
<span jwcid="ifNotPage">
<tr class="even">
<th>Allow informal parameters</th>
<td><span jwcid="insertAllowInformal"/></td>
</tr>
<tr class="odd">
<th>Allow body</th>
<td><span jwcid="insertAllowBody"/></td>
</tr>
</span>
</table>
<span jwcid="ifFormalParameters">
<table class="inspector-data" width="100%">
<tr class="heading">
<th colspan=4>Formal Parameters</th>
</tr>
<tr class="heading">
<th>Name</th> <th>Required</th> <th>Java type</th> <th>Binding</th>
</tr>
<tr jwcid="e_formal">
<td><span jwcid="insertFormalName"/>
<span jwcid="showParameterDescription"/>
</td>
<td><span jwcid="insertFormalRequired"/></td>
<td><span jwcid="insertFormalType"/></td>
<td><span jwcid="insertFormalBinding"/></td>
</tr>
</table>
</span>
<span jwcid="ifInformalParameters">
<table class="inspector-data" width="100%">
<tr class="heading">
<th colspan=2>Informal Parameters</th>
</tr>
<tr class="heading">
<th>Name</th> <th>Binding</th>
</tr>
<tr jwcid="e_informal">
<td><span jwcid="insertInformalName"/></td>
<td><span jwcid="insertInformalBinding"/></td>
</tr>
</table>
</span>
<span jwcid="ifAssets">
<table class="inspector-data" width="100%">
<tr class="heading">
<th colspan=2>Assets</th>
</tr>
<tr class="heading">
<th>Name</th> <th>Asset</th>
</tr>
<tr jwcid="e_asset">
<td><span jwcid="insertAssetName"/></td>
<td><span jwcid="insertAssetValue"/></td>
</tr>
</table>
</span>
<span jwcid="ifProperties">
<table class="inspector-data" width="100%">
<tr class="heading">
<th colspan=2>Properties</th>
</tr>
<tr class="heading">
<th>Name</th> <th>Property</th>
</tr>
<tr jwcid="e_property">
<th><span jwcid="insertPropertyName"/></th>
<td><span jwcid="insertPropertyValue"/></td>
</tr>
</table>
</span>
<span jwcid="ifBeans">
<table class="inspector-data" width="100%">
<tr class="heading">
<th colspan=3>Helper Beans</th>
</tr>
<tr class="heading">
<th>Name</th> <th>Class</th> <th>Lifecycle</th>
</tr>
<tr jwcid="e_bean">
<td><span jwcid="insertBeanName"/></td>
<td><span jwcid="insertBeanClass"/></td>
<td><span jwcid="insertBeanLifecycle"/></td>
</tr>
</table>
</span>
</td>
<td>
<span jwcid="ifComponents">
<table border="0" class="inspector-data">
<tr class="heading">
<th colspan=2>Embedded Components</th>
</tr>
<tr class="heading">
<th>Id</th> <th>Type</th>
</tr>
<tr jwcid="e_components">
<td>
<a jwcid="selectComponent"><span jwcid="insertComponentId"/></a>
</td>
<td>
<span jwcid="insertComponentType"/>
</td>
</tr>
</table>
</span>
</td>
</tr>
</table>
--- NEW FILE: ShowEngine.java ---
package net.sf.tapestry.contrib.inspector;
import java.io.ByteArrayOutputStream;
import java.io.CharArrayWriter;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import net.sf.tapestry.ApplicationRuntimeException;
import net.sf.tapestry.BaseComponent;
import net.sf.tapestry.IEngine;
import net.sf.tapestry.IMarkupWriter;
import net.sf.tapestry.IRender;
import net.sf.tapestry.IRequestCycle;
import net.sf.tapestry.RequestCycleException;
import net.sf.tapestry.Tapestry;
import net.sf.tapestry.event.PageDetachListener;
import net.sf.tapestry.event.PageEvent;
import net.sf.tapestry.util.io.BinaryDumpOutputStream;
/**
* Component of the {@link Inspector} page used to display
* the properties of the {@link IEngine} as well as a serialized view of it.
* Also, the {@link net.sf.tapestry.RequestContext} is dumped out.
*
*
* @version $Id: ShowEngine.java,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $
* @author Howard Lewis Ship
*
**/
public class ShowEngine extends BaseComponent implements PageDetachListener
{
private byte[] serializedEngine;
/**
* Registers with the page as a {@link PageDetachListener}.
*
* @since 1.0.5
*
**/
protected void finishLoad()
{
getPage().addPageDetachListener(this);
}
public void pageDetached(PageEvent event)
{
serializedEngine = null;
}
/**
* Workaround for OGNL limitation --- OGNL can't dereference
* past class instances.
*
* @since 2.2
*
**/
public String getEngineClassName()
{
return getPage().getEngine().getClass().getName();
}
private byte[] getSerializedEngine()
{
if (serializedEngine == null)
buildSerializedEngine();
return serializedEngine;
}
private void buildSerializedEngine()
{
ByteArrayOutputStream bos = null;
ObjectOutputStream oos = null;
try
{
bos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(bos);
// Write the application object to the stream.
oos.writeObject(getPage().getEngine());
// Extract the application as an array of bytes.
serializedEngine = bos.toByteArray();
}
catch (IOException ex)
{
throw new ApplicationRuntimeException(
Tapestry.getString("ShowEngine.could-not-serialize"),
ex);
}
finally
{
close(oos);
close(bos);
}
// It would be nice to deserialize the application object now, but in
// practice, that fails due to class loader problems.
}
private void close(OutputStream stream)
{
if (stream == null)
return;
try
{
stream.close();
}
catch (IOException ex)
{
// Ignore.
}
}
public int getEngineByteCount()
{
return getSerializedEngine().length;
}
public IRender getEngineDumpDelegate()
{
return new IRender()
{
public void render(IMarkupWriter writer, IRequestCycle cycle)
throws RequestCycleException
{
dumpSerializedEngine(writer);
}
};
}
private void dumpSerializedEngine(IMarkupWriter responseWriter)
{
CharArrayWriter writer = null;
BinaryDumpOutputStream bos = null;
try
{
// Because IReponseWriter doesn't implement the
// java.io.Writer interface, we have to buffer this
// stuff then pack it in all at once. Kind of a waste!
writer = new CharArrayWriter();
bos = new BinaryDumpOutputStream(writer);
bos.setBytesPerLine(32);
bos.write(getSerializedEngine());
bos.close();
responseWriter.print(writer.toString());
}
catch (IOException ex)
{
// Ignore.
}
finally
{
if (bos != null)
{
try
{
bos.close();
}
catch (IOException ex)
{
// Ignore.
}
}
if (writer != null)
{
writer.reset();
writer.close();
}
}
}
}
--- NEW FILE: Restart_NRp2.gif ---
GIF89ax
--- NEW FILE: Inspector.css ---
H1 {
font-size: 12pt;
font-weight: bold;
}
H2 {}
H3 {}
A {
color:#ffffff;
}
A:Visited {}
A:Active {}
A:Hover {}
SPAN.error
{
color: Red;
font-weight: bold;
background-color : "#330066"
}
BODY {
font-family: "Trebuchet MS", sans-serif;
background-color: #839cd1;
}
TABLE.inspector-data TR.odd TD {
text-align : left;
color : Black;
background-color : Silver;
}
TABLE.inspector-data TR.even TH
{
text-align : right;
font-weight: bold;
}
TABLE.inspector-data TR.odd TH
{
text-align: right;
color : Black;
background-color : Silver;
font-weight: bold;
}
TABLE.inspector-data TR.even TD {
text-align : left;
}
TABLE.inspector-data,
TABLE.selector
{
font-size: 9pt;
}
TABLE.selector TD.page-link
{
font-style: italic;
}
TABLE.selector TD
{
verticle-align: center;
}
TABLE.inspector-data TR.heading TH,
TABLE.template TH
{
text-align: center;
color : White;
background-color : "#330066";
font-weight: bold;
}
TABLE.template TD
{
background-color: Silver;
font-size: small;
}
SPAN.message
{
color : Silver
font-size: large;
}
SPAN.jwc-tag
{
font-weight: bold;
}
SPAN.jwc-id, SPAN.localized-string
{
font-style: italic;
}
TABLE.request-context-border {
border-width : 1;
border-color : Black;
font-size: 9pt;
}
SPAN.request-context-object {
font-weight : bold;
text-align : left;
font-size: 12pt;
}
TR.request-context-section TH {
text-align : center;
color : White;
background-color : Blue;
}
TR.request-context-header TH {
text-align : center;
color : White;
background-color : Blue;
}
TABLE.request-context-object TR.odd TD {
text-align : left;
color : Black;
background-color : Silver;
}
TABLE.request-context-object TR.odd TH {
color : Black;
background-color : Silver;
text-align : right;
}
TABLE.request-context-object TR.even TD {
text-align : left;
}
TABLE.request-context-object TR.even TH {
text-align : right;
}
TABLE.request-context-object {
width : 100%;
font-size: 9pt;
}
TABLE.request-context-object TR {
vertical-align : text-top;
}
TABLE.exception-display TR.even {
top : auto;
}
TABLE.exception-displaY TD
{
width: 100%;
}
TABLE.exception-display TR.even TH {
text-align : right;
font-weight : bold;
}
TABLE.exception-display TR.odd TD {
text-align : left;
background-color : Silver;
}
TABLE.exception-display TR.odd TH {
text-align : right;
font-weight : bold;
background-color : Silver;
}
TABLE.exception-display TR.even TD {
text-align : left;
}
TABLE.exception-display TR.stack-trace {
font-size : small;
font-family : sans-serif;
text-align : left;
}
UL
{
margin-top: 0px;
margin-bottom: 0px;
margin-left: 20px;
}
--- NEW FILE: ViewTabs.jwc ---
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: ViewTabs.jwc,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $ -->
<!DOCTYPE component-specification PUBLIC
"-//Howard Lewis Ship//Tapestry Specification 1.3//EN"
"http://tapestry.sf.net/dtd/Tapestry_1_3.dtd">
<component-specification class="net.sf.tapestry.contrib.inspector.ViewTabs">
<component id="e" type="Foreach">
<binding name="source" expression="views"/>
<binding name="value" expression="view"/>
</component>
<component id="select" type="ActionLink">
<binding name="listener" expression="listeners.selectTab"/>
</component>
<component id="tab" type="Rollover">
<binding name="image" expression="viewImage"/>
<binding name="focus" expression="focusImage"/>
</component>
<component id="banner" type="Image">
<binding name="image" expression="bannerImage"/>
</component>
<component id="renderBody" type="RenderBody"/>
<private-asset name="SPECIFICATION" resource-path="/net/sf/tapestry/contrib/inspector/Specification_Np1.gif"/>
<private-asset name="SPECIFICATION_selected" resource-path="/net/sf/tapestry/contrib/inspector/Specification_Hp3.gif"/>
<private-asset name="SPECIFICATION_focus" resource-path="/net/sf/tapestry/contrib/inspector/Specification_NRp2.gif"/>
<private-asset name="SPECIFICATION_selected_focus" resource-path="/net/sf/tapestry/contrib/inspector/Specification_HRp4.gif"/>
<private-asset name="SPECIFICATION_banner" resource-path="/net/sf/tapestry/contrib/inspector/Specification_NBanner.gif"/>
<private-asset name="TEMPLATE" resource-path="/net/sf/tapestry/contrib/inspector/Template_Np1.gif"/>
<private-asset name="TEMPLATE_selected" resource-path="/net/sf/tapestry/contrib/inspector/Template_Hp3.gif"/>
<private-asset name="TEMPLATE_focus" resource-path="/net/sf/tapestry/contrib/inspector/Template_NRp2.gif"/>
<private-asset name="TEMPLATE_selected_focus" resource-path="/net/sf/tapestry/contrib/inspector/Template_HRp4.gif"/>
<private-asset name="TEMPLATE_banner" resource-path="/net/sf/tapestry/contrib/inspector/Template_NBanner.gif"/>
<private-asset name="PROPERTIES" resource-path="/net/sf/tapestry/contrib/inspector/Properties_Np1.gif"/>
<private-asset name="PROPERTIES_selected" resource-path="/net/sf/tapestry/contrib/inspector/Properties_Hp3.gif"/>
<private-asset name="PROPERTIES_focus" resource-path="/net/sf/tapestry/contrib/inspector/Properties_NRp2.gif"/>
<private-asset name="PROPERTIES_selected_focus" resource-path="/net/sf/tapestry/contrib/inspector/Properties_HRp4.gif"/>
<private-asset name="PROPERTIES_banner" resource-path="/net/sf/tapestry/contrib/inspector/Properties_NBanner.gif"/>
<private-asset name="ENGINE" resource-path="/net/sf/tapestry/contrib/inspector/Engine_Np1.gif"/>
<private-asset name="ENGINE_selected" resource-path="/net/sf/tapestry/contrib/inspector/Engine_Hp3.gif"/>
<private-asset name="ENGINE_focus" resource-path="/net/sf/tapestry/contrib/inspector/Engine_NRp2.gif"/>
<private-asset name="ENGINE_selected_focus" resource-path="/net/sf/tapestry/contrib/inspector/Engine_HRp4.gif"/>
<private-asset name="ENGINE_banner" resource-path="/net/sf/tapestry/contrib/inspector/Engine_NBanner.gif"/>
<private-asset name="LOGGING" resource-path="/net/sf/tapestry/contrib/inspector/Logging_Np1.gif"/>
<private-asset name="LOGGING_selected" resource-path="/net/sf/tapestry/contrib/inspector/Logging_Hp3.gif"/>
<private-asset name="LOGGING_focus" resource-path="/net/sf/tapestry/contrib/inspector/Logging_NRp2.gif"/>
<private-asset name="LOGGING_selected_focus" resource-path="/net/sf/tapestry/contrib/inspector/Logging_HRp4.gif"/>
<private-asset name="LOGGING_banner" resource-path="/net/sf/tapestry/contrib/inspector/Logging_NBanner.gif"/>
</component-specification>
--- NEW FILE: ShowSpecification.java ---
package net.sf.tapestry.contrib.inspector;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import net.sf.tapestry.BaseComponent;
import net.sf.tapestry.IAsset;
import net.sf.tapestry.IBinding;
import net.sf.tapestry.IComponent;
import net.sf.tapestry.event.PageEvent;
import net.sf.tapestry.event.PageRenderListener;
import net.sf.tapestry.spec.BeanSpecification;
import net.sf.tapestry.spec.ComponentSpecification;
import net.sf.tapestry.spec.ContainedComponent;
import net.sf.tapestry.spec.ParameterSpecification;
/**
* Component of the {@link Inspector} page used to display
* the specification, parameters and bindings and assets of the inspected component.
*
*
* @version $Id: ShowSpecification.java,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $
* @author Howard Lewis Ship
*
**/
public class ShowSpecification extends BaseComponent implements PageRenderListener
{
private IComponent _inspectedComponent;
private ComponentSpecification _inspectedSpecification;
private String _parameterName;
private String _assetName;
private List _sortedComponents;
private IComponent _component;
private List _assetNames;
private List _formalParameterNames;
private List _informalParameterNames;
private List _sortedPropertyNames;
private String _propertyName;
private List _beanNames;
private String _beanName;
private BeanSpecification _beanSpecification;
private static class ComponentComparitor implements Comparator
{
public int compare(Object left, Object right)
{
IComponent leftComponent;
String leftId;
IComponent rightComponent;
String rightId;
if (left == right)
return 0;
leftComponent = (IComponent) left;
rightComponent = (IComponent) right;
leftId = leftComponent.getId();
rightId = rightComponent.getId();
return leftId.compareTo(rightId);
}
}
/**
* Registers this component as a {@link PageRenderListener}.
*
* @since 1.0.5
**/
protected void finishLoad()
{
getPage().addPageRenderListener(this);
}
/**
* Clears all cached information about the component and such after
* each render (including the rewind phase render used to process
* the tab view).
*
* @since 1.0.5
*
**/
public void pageEndRender(PageEvent event)
{
_inspectedComponent = null;
_inspectedSpecification = null;
_parameterName = null;
_assetName = null;
_sortedComponents = null;
_component = null;
_assetNames = null;
_formalParameterNames = null;
_informalParameterNames = null;
_sortedPropertyNames = null;
_propertyName = null;
_beanNames = null;
_beanName = null;
_beanSpecification = null;
}
/**
* Gets the inspected component and specification from the {@link Inspector} page.
*
* @since 1.0.5
**/
public void pageBeginRender(PageEvent event)
{
Inspector inspector;
inspector = (Inspector) getPage();
_inspectedComponent = inspector.getInspectedComponent();
_inspectedSpecification = _inspectedComponent.getSpecification();
}
public IComponent getInspectedComponent()
{
return _inspectedComponent;
}
public ComponentSpecification getInspectedSpecification()
{
return _inspectedSpecification;
}
/**
* Returns a sorted list of formal parameter names.
*
**/
public List getFormalParameterNames()
{
if (_formalParameterNames != null)
return _formalParameterNames;
Collection names = _inspectedSpecification.getParameterNames();
if (names != null && names.size() > 0)
{
_formalParameterNames = new ArrayList(names);
Collections.sort(_formalParameterNames);
}
return _formalParameterNames;
}
/**
* Returns a sorted list of informal parameter names. This is
* the list of all bindings, with the list of parameter names removed,
* sorted.
*
**/
public List getInformalParameterNames()
{
if (_informalParameterNames != null)
return _informalParameterNames;
Collection names = _inspectedComponent.getBindingNames();
if (names != null && names.size() > 0)
{
_informalParameterNames = new ArrayList(names);
// Remove the names of any formal parameters. This leaves
// just the names of informal parameters (informal parameters
// are any parameters/bindings that don't match a formal parameter
// name).
names = _inspectedSpecification.getParameterNames();
if (names != null)
_informalParameterNames.removeAll(names);
Collections.sort(_informalParameterNames);
}
return _informalParameterNames;
}
public String getParameterName()
{
return _parameterName;
}
public void setParameterName(String value)
{
_parameterName = value;
}
/**
* Returns the {@link ParameterSpecification} corresponding to
* the value of the parameterName property.
*
**/
public ParameterSpecification getParameterSpecification()
{
return _inspectedSpecification.getParameter(_parameterName);
}
/**
* Returns the {@link IBinding} corresponding to the value of
* the parameterName property.
*
**/
public IBinding getBinding()
{
return _inspectedComponent.getBinding(_parameterName);
}
public void setAssetName(String value)
{
_assetName = value;
}
public String getAssetName()
{
return _assetName;
}
/**
* Returns the {@link IAsset} corresponding to the value
* of the assetName property.
*
**/
public IAsset getAsset()
{
return (IAsset) _inspectedComponent.getAssets().get(_assetName);
}
/**
* Returns a sorted list of asset names, or null if the
* component contains no assets.
*
**/
public List getAssetNames()
{
if (_assetNames != null)
return _assetNames;
Map assets = _inspectedComponent.getAssets();
_assetNames = new ArrayList(assets.keySet());
Collections.sort(_assetNames);
return _assetNames;
}
public List getSortedComponents()
{
if (_sortedComponents != null)
return _sortedComponents;
Inspector inspector = (Inspector) getPage();
IComponent inspectedComponent = inspector.getInspectedComponent();
// Get a Map of the components and simply return null if there
// are none.
Map components = inspectedComponent.getComponents();
_sortedComponents = new ArrayList(components.values());
Collections.sort(_sortedComponents, new ComponentComparitor());
return _sortedComponents;
}
public void setComponent(IComponent value)
{
_component = value;
}
public IComponent getComponent()
{
return _component;
}
/**
* Returns the type of the component, as specified in the container's
* specification (i.e., the component alias if known).
*
**/
public String getComponentType()
{
String id;
ComponentSpecification containerSpecification;
IComponent container;
ContainedComponent contained;
container = _component.getContainer();
containerSpecification = container.getSpecification();
id = _component.getId();
contained = containerSpecification.getComponent(id);
return contained.getType();
}
/**
* Returns a list of the properties for the component
* (from its specification), or null if the component
* has no properties.
*
**/
public List getSortedPropertyNames()
{
if (_sortedPropertyNames != null)
return _sortedPropertyNames;
Collection names = _inspectedSpecification.getPropertyNames();
if (names != null && names.size() > 0)
{
_sortedPropertyNames = new ArrayList(names);
Collections.sort(_sortedPropertyNames);
}
return _sortedPropertyNames;
}
public void setPropertyName(String value)
{
_propertyName = value;
}
public String getPropertyName()
{
return _propertyName;
}
public String getPropertyValue()
{
return _inspectedSpecification.getProperty(_propertyName);
}
public List getBeanNames()
{
if (_beanNames != null)
return _beanNames;
Collection names = _inspectedSpecification.getBeanNames();
if (names != null && names.size() > 0)
{
_beanNames = new ArrayList(names);
Collections.sort(_beanNames);
}
return _beanNames;
}
public void setBeanName(String value)
{
_beanName = value;
_beanSpecification = _inspectedSpecification.getBeanSpecification(_beanName);
}
public String getBeanName()
{
return _beanName;
}
public BeanSpecification getBeanSpecification()
{
return _beanSpecification;
}
}
--- NEW FILE: ShowDescription.jwc ---
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: ShowDescription.jwc,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $ -->
<!DOCTYPE component-specification PUBLIC
"-//Howard Lewis Ship//Tapestry Specification 1.3//EN"
"http://tapestry.sf.net/dtd/Tapestry_1_3.dtd">
<component-specification class="net.sf.tapestry.BaseComponent"
allow-body="no"
allow-informal-parameters="no">
<parameter name="description" required="yes"/>
<component id="ifDescription" type="Conditional">
<inherited-binding name="condition" parameter-name="description"/>
</component>
<component id="descriptionImage" type="Image">
<binding name="image" expression="assets.info"/>
<inherited-binding name="alt" parameter-name="description"/>
</component>
<private-asset name="info" resource-path="/net/sf/tapestry/contrib/inspector/info.gif"/>
</component-specification>
--- NEW FILE: tapestry-logo.gif ---
GIF89a4
¡Ã]1ËåÊ
;FþËI hè&>¬Úp\5WäxÌ2$ÀuÍ1æ-²ÚQݾ·VΦÂkÓâàGÖÍØkßÌf!ÃþVa!õjåÙÓs½AAÊã¨A
Aß{{æ¹g"¬ -P#÷±Àhà&öEDTQGV8 bj¼°UôE
Sdgá &MpHP±0à°`Û(h#«±1
ôDù¶ãÉaù`À:Yakt`M+t°[bRN©Ääöõh¦f½-H
RvÁ}gÆye ( 'z|Ö×ð -Î géI£
Ù
änªÛƽÊA@UÁ©&ðG(à^mCPä²]1踰Ô@)øë§½¢©*
D¤R`P˶Lks
¤ÈLIìhÎ{F3ç 3@ F"³vF$DgS80ð4Îq.gF#YÛÕT õC·ØÔlüÒmÀªj÷lÏþ\ÓSTÌ`Àf¸¬G@{ÄÍ<30pU»sªñE è ÕïS%
--- NEW FILE: Template_NRp2.gif ---
GIF89ax
)¶ Ó³Z¹¦E5Û·mËN;p¨W®l»ÞÕWì\¿uͪ--ܲ ÿR5¼vða«E5&å·`÷Þýêõ*Ö®ë
=³/iO'VMt4ë×~]Ã45íÛ4?êÞÍ»·ï
--- NEW FILE: Engine_HRp4.gif ---
GIF89ax
--- NEW FILE: InspectorValidationDelegate.java ---
package net.sf.tapestry.contrib.inspector;
import net.sf.tapestry.IMarkupWriter;
import net.sf.tapestry.IRequestCycle;
import net.sf.tapestry.RequestCycleException;
import net.sf.tapestry.valid.ValidationDelegate;
/**
* Customized version of {@link ValidationDelegate} that changes some
* output behavior.
*
*
* @author Howard Lewis Ship
* @version $Id: InspectorValidationDelegate.java,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $
* @since 1.0.8
*
**/
public class InspectorValidationDelegate extends ValidationDelegate
{
public void writeSuffix(IMarkupWriter writer, IRequestCycle cycle)
throws RequestCycleException
{
if (isInError())
{
writer.printRaw(" ");
writer.begin("span");
writer.attribute("class", "error");
writer.print("**");
writer.end();
}
}
}
--- NEW FILE: ShowDescription.html ---
<!-- $Id: ShowDescription.html,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $ -->
<span jwcid="$content$">
<span jwcid="ifDescription"><img jwcid="descriptionImage"/></span>
</span>
--- NEW FILE: ViewTabs.html ---
<!-- $Id: ViewTabs.html,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $ -->
<table border=0 cellpadding=0 cellspacing=2>
<tr>
<td>
<span jwcid="e">
<a jwcid="select"><img jwcid="tab" width="120" height="19"/></a>
</span>
</td>
</tr>
<tr>
<td><span jwcid="banner"/></td>
</tr>
<tr>
<td><span jwcid="renderBody"/></td>
</tr>
</table>
--- NEW FILE: Reset_Np1.gif ---
GIF89ax
--- NEW FILE: Engine_NBanner.gif ---
GIF89aX
J´¨Ñ£(KÉ´©Ó§P£JJµªÕ«X!*Íʵ«×¯`ÃK¶ìÀ¨]˶۷pãÊK·®Ý»xóêÝË·¯ß¿L¸°áÃ#V±ãÇ#KL¹²åË3kÌØ¤À¸' 0Z
¦¤è£ F¦ãmäèÉ
Û©¡¶ºò½©«´¢¦cªÊñ¨®Öê+h°~ê¿Kå©jª[É®jì³ÐFû¬ûéw«Òf«í¶Rêø&m}Û!·äk®j«îºìÞ8RðÆ+ï¼ôÖkï½øæ«ï¾üÎÔY
--- NEW FILE: Reset_Np1_disabled.gif ---
GIF89ax
--- NEW FILE: InspectorButton.html ---
<!-- $Id: InspectorButton.html,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $ -->
<span jwcid="$content$">
<div id="tapestryInspector" style="position:absolute; border-color:black; border-width:2px; border-style:solid; padding:3px; background-color:#839cd1;">
<a jwcid="link"><img jwcid="rollover"/></a>
</div>
</span>
--- NEW FILE: ViewTabs.java ---
package net.sf.tapestry.contrib.inspector;
import net.sf.tapestry.BaseComponent;
import net.sf.tapestry.IAsset;
import net.sf.tapestry.IRequestCycle;
/**
* Component of the {@link Inspector} page used to select the view.
*
*
* @version $Id: ViewTabs.java,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $
* @author Howard Lewis Ship
*
**/
public class ViewTabs extends BaseComponent
{
private static View[] views =
{
View.SPECIFICATION,
View.TEMPLATE,
View.PROPERTIES,
View.ENGINE };
private View view;
public View[] getViews()
{
return views;
}
public void setView(View value)
{
view = value;
}
// We don't worry about cleaning this up at the end of the request cycle
// because the value is an Enum, a singleton that would stay in memory
// anyway.
public View getView()
{
return view;
}
private IAsset getImageForView(boolean focus)
{
StringBuffer buffer;
Inspector inspector;
boolean selected;
String key;
inspector = (Inspector) getPage();
selected = (view == inspector.getView());
buffer = new StringBuffer(view.getName());
if (selected)
buffer.append("_selected");
if (focus)
buffer.append("_focus");
key = buffer.toString();
return (IAsset) getAssets().get(key);
}
public IAsset getViewImage()
{
return getImageForView(false);
}
public IAsset getFocusImage()
{
return getImageForView(true);
}
public IAsset getBannerImage()
{
Inspector inspector;
View selectedView;
String key;
inspector = (Inspector) getPage();
selectedView = inspector.getView();
key = selectedView.getName() + "_banner";
return (IAsset) getAssets().get(key);
}
public void selectTab(IRequestCycle cycle)
{
Inspector inspector;
inspector = (Inspector) getPage();
inspector.setView(view);
}
}
--- NEW FILE: Properties_NRp2.gif ---
GIF89ax
--- NEW FILE: Engine_Np1.gif ---
GIF89ax
--- NEW FILE: InspectorButton.java ---
package net.sf.tapestry.contrib.inspector;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpSession;
import net.sf.tapestry.BaseComponent;
import net.sf.tapestry.Gesture;
import net.sf.tapestry.IDirect;
import net.sf.tapestry.IEngine;
import net.sf.tapestry.IEngineService;
import net.sf.tapestry.IMarkupWriter;
import net.sf.tapestry.INamespace;
import net.sf.tapestry.IRequestCycle;
import net.sf.tapestry.IScript;
import net.sf.tapestry.IScriptSource;
import net.sf.tapestry.RequestCycleException;
import net.sf.tapestry.ScriptException;
import net.sf.tapestry.ScriptSession;
import net.sf.tapestry.Tapestry;
import net.sf.tapestry.html.Body;
/**
* Component that can be placed into application pages that will launch
* the inspector in a new window.
*
* [<a href="../../../../../ComponentReference/InspectorButton.html">Component Reference</a>]
*
* <p>Because the InspectorButton component is implemented using a {@link net.sf.tapestry.html.Rollover},
* the containing page must use a {@link Body} component instead of
* a <body> tag.
*
* @version $Id: InspectorButton.java,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $
* @author Howard Lewis Ship
*
**/
public class InspectorButton extends BaseComponent implements IDirect
{
private boolean _disabled = false;
/**
* Gets the listener for the link component.
*
* @since 1.0.5
**/
public void trigger(IRequestCycle cycle) throws RequestCycleException
{
String name = getNamespace().constructQualifiedName("Inspector");
Inspector inspector = (Inspector) cycle.getPage(name);
inspector.inspect(getPage().getName(), cycle);
}
/**
* Renders the script, then invokes the normal implementation.
*
* @since 1.0.5
**/
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) throws RequestCycleException
{
if (_disabled || cycle.isRewinding())
return;
IEngine engine = getPage().getEngine();
IScriptSource source = engine.getScriptSource();
IScript script = source.getScript("/net/sf/tapestry/contrib/inspector/InspectorButton.script");
Map symbols = new HashMap();
IEngineService service = engine.getService(IEngineService.DIRECT_SERVICE);
Gesture g = service.buildGesture(cycle, this, null);
symbols.put("URL", g.getURL());
ScriptSession scriptSession = null;
try
{
scriptSession = script.execute(symbols);
}
catch (ScriptException ex)
{
throw new RequestCycleException(this, ex);
}
Body body = Body.get(cycle);
if (body == null)
throw new RequestCycleException(Tapestry.getString("InspectorButton.must-be-contained-by-body"), this);
body.process(scriptSession);
// Now, go render the rest from the template.
super.renderComponent(writer, cycle);
}
public boolean isDisabled()
{
return _disabled;
}
public void setDisabled(boolean disabled)
{
_disabled = disabled;
}
/**
* Always returns false.
*
* @since 2.3
*
**/
public boolean isStateful()
{
return false;
}
}
--- NEW FILE: ShowEngine.jwc ---
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: ShowEngine.jwc,v 1.1.2.1 2002/11/30 03:31:37 hship Exp $ -->
<!DOCTYPE component-specification PUBLIC
"-//Howard Lewis Ship//Tapestry Specification 1.3//EN"
"http://tapestry.sf.net/dtd/Tapestry_1_3.dtd">
<component-specification class="net.sf.tapestry.contrib.inspector.ShowEngine" allow-body="no" allow-informal-parameters="no">
<component id="insertFrameworkVersion" type="Insert">
<field-binding name="value" field-name="net.sf.tapestry.Tapestry.VERSION"/>
</component>
<component id="insertApplicationName" type="Insert">
<binding name="value" expression="page.engine.specification.name"/>
</component>
<component id="insertContextPath" type="Insert">
<binding name="value" expression="page.engine.contextPath"/>
</component>
<component id="insertServletPath" type="Insert">
<binding name="value" expression="page.engine.servletPath"/>
</component>
<component id="insertEngineClass" type="Insert">
<binding name="value" expression="engineClassName"/>
</component>
<component id="insertLocale" type="Insert">
<binding name="value" expression="page.engine.locale.displayName"/>
</component>
<component id="ifNoVisit" type="Conditional">
<binding name="condition" expression="! page.engine.hasVisit"/>
</component>
<component id="insertVisit" type="Insert">
<binding name="value" expression="page.engine.visit"/>
</component>
<component id="ifVisit" type="Conditional">
<binding name="condition" expression="page.engine.hasVisit"/>
</component>
<component id="restart" type="ServiceLink">
<b...
[truncated message content] |