åœæFlexã䜿çšããŠãããžã§ã¯ããè¡ã£ãŠããŸãããããããžã§ã¯ããå¢ããã°å¢ããã»ã©ãå éšæ§é ã®åŸ®åŠãªéããæ°ã«å ¥ããªããªããŸããã
Flexã§äœæ¥ãã人ã¯èª°ã§ãããã®åé¡ãšMXMLã§èšè¿°ããã³çæãããã³ãŒãã®äœå質ãç¥ã£ãŠãããšæãã®ã§ãFlexã³ã³ãã€ã©ã®ããã€ã¹ãã¯ãªãŒã³ã¢ããããŠææ¡ããããã«ãã®ããã»ã¹ã«ä»å ¥ããããšã«ããŸããã圌ã¯ãMXMLã«ç ç³ãè¿œå ããããšããå§ããAdobeã®çºæ¡ã«ããä»ã®æ©èœã®ç²Ÿç¥ã§ãã§ããéã匷åã«ããããšããŸããã 2幎åŸãç§ã¯ããªããšç§ã®ç¥èãå ±æããããšã«ããŸããã
ãŸããã
SVNãªããžããªããFlexSDKãããžã§ã¯ãããã§ãã¯ã¢ãŠãããããã»ã¹ã®èª¬æã¯è¡ããŸããã ãã®ããã»ã¹ã®èª¬æãžã®ãªã³ã¯ãæ®ããŸã
ãã®èšäºã®å·çæç¹ã§ã¯ãææ°ããŒãžã§ã³ã¯Flex 4.5.1ïŒ4.5.1.21328ïŒã§ãã£ããããããã«åºã¥ããŠãã«ãããå¿ èŠããããŸãã
ã³ã³ãã€ã©ãæãå§ããã°ããã®é ãç§ã¯Javaã®ååãªç¥èãæã£ãŠããªãã£ãã®ã§ãåžžèã䜿ããªããã°ãªããŸããã§ããããã¹ãŠã®å€æŽã¯Notepad ++ã§è¡ãããŸããã
ãæ°ã«å ¥ãã®Java IDEã䜿çšããããšããå§ãããŸãã
äžèº«ã¯äœã§ãã
æ®å¿µãªããã1ã€ã®èšäºã§ã¯ã³ã³ãã€ã©å šäœã®ããã€ã¹ãã«ããŒããã®ã«ååã§ã¯ãªãããããã®èšäºã§ã¯MXMLãã©ã³ã¹ã¬ãŒã¿ãšããã»ãã®äžéšã«ã€ããŠã®ã¿èª¬æããŸãã
ããã«é¢é£ãããã¹ãŠã®ãœãŒã¹ã¯ãmodules / compiler / src / java / flex2 / compiler / mxmlãã©ã«ããŒã«ãããŸãã
- å¥åŠãªããšã«ãã¢ãã©ã€ã¶ãŒããã±ãŒãžã¯ãããŒã¯ã³ã®åœ¢åŒã§è§£æãããXMLã®åæãæ åœããSyntaxAnalyzerãæã泚ç®ãããŸãã ãã®æ®µéã§ã¯ãã³ãŒãçæã¯è¡ããããMXMLããã®çµæã¢ãã«ã®åæã®ã¿ãè¡ãããŸãã
- ïŒãã®èšäºã®ãã¬ãŒã ã¯ãŒã¯å
ã§ïŒç§ãã¡ã«ãšã£ãŠæãèå³æ·±ããã«ããŒããã±ãŒãžã«ã¯ãåä¿¡ããããŒã¯ã³ãAS3ãªããžã§ã¯ãã¢ãã«ã«å€æããäžé£ã®ãã«ããŒãå«ãŸããŠããŸãã ãã®å³ã¯ãããã±ãŒãžã³ã³ããŒãã³ãã瀺ããŠããŸãã
èŠããã«ïŒ
- AbstractBuilder-ä»ã®ãã¹ãŠã®ãŠãŒã¶ãŒã®åºæ¬ã¯ã©ã¹ã«ã¯ãåä¿¡ããããŒã¯ã³ãããªããžã§ã¯ããçæããããã®ããžãã¯ãå«ãŸããŠããŸãã
- XMLListBuilder ã XMLBuilder ã ArrayBuilder ã VectorBuilder-åãã¯ã©ã¹AS3ã®ãã«ããŒã
- InlineComponentBuilderã¯ããã³ã³ããŒãã³ãå ã®ã³ã³ããŒãã³ãããã€ãŸã <fxïŒComponent> </ fxïŒComponent>ãèšè¿°ãããšãã«åœ¢æããããã®ã
- PrimitiveBuilderã¯ãStringãNumberãintãuintãBooleanãªã©ã®èšèªããªããã£ããæ åœããŸãã
- ModelBuilder ã AnonymousObjectGraphBuilderããã³ServiceRequestBuilderã䜿çšãããšã<fxïŒModel />ãªã©ãããªããžã§ã¯ããäœæã§ããŸãã
- ComponentBuilderã¯éåžžã«éèŠãªã¯ã©ã¹ã§ãã äžèšã®ã«ããŽãªã«é©åããªãMXMLã¿ã°ãããªããžã§ã¯ããäœæããããžãã¯ãå«ãŸããŠããŸãã æãé »ç¹ã«äœ¿çšãããã®ã¯ã ãã©ãŒã <sïŒButton />ã<sïŒList />ã<someNamespaceïŒSomeObject />ã®æ§é ãããªããžã§ã¯ããäœæããã®ã¯åœŒã§ãã
- DocumentBuilderã¯ãããšãã°<sïŒApplication />ãªã©ã®ã«ãŒãã¿ã°ã§ãã
- HTTPServiceBuilder ã RemoteObjectBuilderããã³WebServiceBuilder-察å¿ããã¿ã°ã®ãã«ããŒã
- domããã±ãŒãžã«ã¯ãæ€åºãããåMXMLã¿ã°ã¿ã€ãã®Node宣èšãå«ãŸããŠããŸãã æ°ã«ãã人ã¯ãããã±ãŒãžæ§é ãèŠèŠçã«è¡šçŸããåçãæçš¿ããŸãã
- genããã±ãŒãžã«ã¯ãAS3ã³ãŒãçæçšã®é床ãã³ãã¬ãŒã+ãã®ããã®ãã«ããŒã¯ã©ã¹ãå«ãŸããŠããŸãã -keep-generated-actionscriptãæå®ãããŠããå Žåã«ã®ã¿äœ¿çšãããããã§ãªãå Žåã¯ãAbstractSyntaxTreeã§ããã«çæãè¡ãããŸãã
- langããã±ãŒãžã«ã¯ãèšèªåºæã®å®æ°ã®ã»ããå±æ§ããã€ã³ããŒãªã©ã®ãã³ãã©ãŒãå«ãŸããŠããŸãã StandardDefsã«æ³šæããããšããå§ãããŸãã
- Reflectããã±ãŒãžã«ã¯ãReflection APIãšãããããã®ãã©ã€ããŒãå®è£ ãå«ãTypeTableã¯ã©ã¹ãå«ãŸããŠããŸãã
- repããã±ãŒãžã¯ãMXMLããã¥ã¡ã³ãã®åããŒãã®åæååã§ãã æ§é ïŒ
çè«ããå®è·µãžïŒ
ããèªäœã¯ããã»ã©å€ãã®ãçè«ããå€æããããšãæåŸ ããŠããŸããã§ããããããã¯ããªããã©ãã§ãäœã§ããªãç解ããã®ã«å€§ãã«åœ¹ç«ã¡ãŸãã ãããŠãããã§ãMXMLãªããžã§ã¯ãã®ã³ã³ã¹ãã©ã¯ã¿ãŒãã©ã¡ãŒã¿ãŒãæå®ããæ©èœã§ãããã®ã«çŽæ¥é²ã¿ãŸãã
AS3ã®å€ãã®ã¯ã©ã¹ã«ã¯å¿ é ã®ã³ã³ã¹ãã©ã¯ã¿ãŒãã©ã¡ãŒã¿ãŒããããŸãããããã®ã¯ã©ã¹ã¯ããã©ã¡ãŒã¿ãŒãªãã®ãªããžã§ã¯ãã§ã©ãããããã<fxïŒScript />ã¿ã°ã§äœæããå¿ èŠããããŸãã ïŒ
<?xml version="1.0"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"> <fx:Declarations> <Timer xmlns="flash.utils.*" new="1000, 1" /> </fx:Declarations> </s:Application>
æ°ããããŒã¯ãŒãã®éžæã¯ãAS3ã§ã¯newãšããååã®ããããã£ãäœæã§ããªãããã§ãã äºçŽãããŠããŸãã newã§æž¡ããããã®ã¯ããªããžã§ã¯ããåæåãããšãã«è§æ¬åŒ§ã§å²ãŸããŸãããã®å Žåã
new Timer(1000, 1);
æ€èšŒã«åæ Œ
ããªããŒã¿ãŒãæ°ããå±æ§ãã¹ãããããã«ã¯ãåãå±æ§ã«è¿œå ããå¿ èŠããããŸãïŒããšãã°ãincludeInãexcludeFromãªã©ïŒã ããã¹ãæ€çŽ¢ã«ããããã®å±æ§ã¯æåã«lang / StandardDefs.javaã§å®£èšããã次ã«builder / ComponentBuilder.javaïŒisSpecialAttributeã¡ãœããïŒã§æ€èšŒãããããšã瀺ãããŸãã
StandardDefsã«è¿œå
public static final String PROP_NEW = "new";
310è¡åŸïŒ
public static final String PROP_ID = "id";
ComponentBuilderã§ãïŒisSpecialAttributeã¡ãœããïŒ
if (namespace.length() == 0 || namespace.equals(document.getLanguageNamespace())) { if (StandardDefs.PROP_ID.equals(localPart) || StandardDefs.PROP_NEW.equals(localPart) || StandardDefs.PROP_INCLUDE_STATES.equals(localPart) || StandardDefs.PROP_EXCLUDE_STATES.equals(localPart) || StandardDefs.PROP_ITEM_CREATION_POLICY.equals(localPart) || StandardDefs.PROP_ITEM_DESTRUCTION_POLICY.equals(localPart)) { isSpecial = true; } }
ããã§ãããªããŒã¿ãŒã¯MXMLã¿ã°ã®æ°ããå±æ§ãèªããŸããã
ãªããžã§ã¯ãã¢ãã«ã®æ°ããããããã£ãç»é²ãã
ã ãããç§ãã¡ã®å±æ§ã¯ãããªããŸãããã©ããã«ãã®å€ãä¿åããå¿ èŠããããŸããïŒ ãã®ããã«ãModel.javaããããŸãã
ã¯ã©ã¹ã«ããããã£ãš2ã€ã®ã¡ãœãããè¿œå ããããšã«ãããrep / Model.javaã®ã³ã³ã¹ãã©ã¯ã¿ãã©ã¡ãŒã¿ã®ã²ãã¿ãŒ/ã»ãã¿ãŒãäœæããŸãã
protected String constructorParams; public void setConstructorParams(String value) { constructorParams = value; } public String getConstructorParams() { return constructorParams; }
AbstractBuilder.javaã¯ã©ã¹ã®registerModelïŒããŒãããŒããã¢ãã«ã¢ãã«ãããŒã«å€topLevelïŒã¡ãœããã§ãã®ããããã£ã䜿çšããŸãïŒ1617è¡ç®ïŒã
protected void registerModel(Node node, Model model, boolean topLevel) { String id = (String)getLanguageAttributeValue(node, StandardDefs.PROP_ID); String newValue = (String)getLanguageAttributeValue(node, StandardDefs.PROP_NEW); // get the comment from the node and store in the model if(node.comment != null) { // if generate ast if false, lets not scan the tokens here because they will be scanned later in asc scanner. // we will go the velocity template route if(!mxmlConfiguration.getGenerateAbstractSyntaxTree()) { model.comment = node.comment; } else { model.comment = MxmlCommentUtil.commentToXmlComment(node.comment); } } if(newValue != null) { model.setConstructorParams(newValue); } registerModel(id, model, topLevel); }
ã³ãŒãçæã§å±æ§ã䜿çšããŸã
æå°ã®éšåã¯æ®ããŸã-ãªããžã§ã¯ããäœæãããå Žæã«å±æ§ãè¿œå ããã³ã³ã¹ãã©ã¯ã¿ãŒãã©ã±ããã§çŸç¶ã®ãŸãŸã«æž¡ããŸãã ããã«èšã£ãŠãã£ãïŒ
467è¡ç®ã®Adobe TODOã®çŽåŸã®rep / init / ValueInitializer.javaã¯ã©ã¹ãgetDefinitionBodyïŒïŒã¡ãœããïŒ
else { // TODO confirm the availability of a 0-arg ctor!! but do it upstream from here, like when Model is built stringBuilder.append("new " + selfTypeName + "("); if(self.getConstructorParams() != null) { stringBuilder.append(self.getConstructorParams()); } stringBuilder.append(")"); }
ç·šé
ããã§ããã¬ãŒã ã¯ãŒã¯ã®ã«ãŒããã©ã«ããŒïŒãªããžããªããªããžããªå šäœãããŠã³ããŒãããå Žåã¯ãã©ã³ã¯ïŒã®ã³ã³ãœãŒã«ã«ç§»åãããã«ããããžã§ã¯ããå®è¡ããããã«æ®ããŸãã
BSiDeUp-Mac-mini:trunk bsideup$ ant build
次ã®ããã«ãã³ãŒããŒãå ¥ããããã¯ã©ãã«ãŒã也ãããããæ€ åã«å¯ãããã£ããããããšãã§ããŸãïŒå¿ èŠã«å¿ããŠäžç·ãåŒãïŒ ãã®ããã»ã¹ã«ã¯çŽ5åããããŸãã
ïŒãã³ãïŒæåã®ãã«ãåŸãantã³ã³ãã€ã©ãŒã®ã¿ãèµ·åã§ããã³ã³ãã€ã©ãŒã¢ãžã¥ãŒã«ã®ã¿ããã«ããããŸãïŒ
ãã®ç¢æã®ãããªãã®ãåŸ ã£ãåŸïŒ
main: [echo] ant main target completed on 09/16/2011 11:54:25 AM BUILD SUCCESSFUL Total time: 5 minutes 33 seconds
ããã§ãªããã°ãç§ãã¡ã¯åã³ãåã³ãŸã-zanã®ããã¥ã¢ã«ãèªã¿çŽããèŠéãããã®ãæ¢ããŸãã
ãããã«
ãæ°ã«å ¥ãã®IDEã§ãã¬ãŒã ã¯ãŒã¯ãFlexãã¬ãŒã ã¯ãŒã¯ã®å ŽæãšããŠèªä¿¡ãæã£ãŠæå®ã§ããããã«ãªããŸãããããã«ãããæ°ããããµããŒãããä¿®æ£ãããã³ã³ãã€ã©ã®äœ¿çšãéå§ãããŸãã
ä»åã¯ãMXMLã䜿çšããŠä»ã®ãããžã§ã¯ããåé¡ãªãã³ã³ãã€ã«ã§ããäžäœäºææ§ã®å€æŽãè¡ããŸããã次ã®èšäºã§ã¯ããããã¯ãèå³æ·±ãå ŽåãMXMLã®æšæºåäœãå€æŽããããã°ã©ããŒã®ç掻ãããã«ç°¡åã«ããæ¹æ³ã説æããŸãããäžäœäºææ§ã¯å€±ãããŸãã
ããã»ã¹ã§ã¯ãªãçµæã«èå³ããã人ã®ããã«ãæ¢è£œã®mxmlc.jarãã¡ã€ã«ãžã®ãªã³ã¯ãæäŸã ãFlex SDK 4.5ãããŠã³ããŒãããŠ$ {FLEX_SDK_DIR} /lib/mxmlc.jarãã¡ã€ã«ã眮ãæããŸãã
ãæž èŽããããšãããããŸããã