2012-03-12 4 views
0

파슬리부터 시작하여 자동 와이어 작동을 관리 할 수 ​​없습니다. 필자의 설정은 flex 4.5와 파슬리 3.0.0을 기반으로합니다.파슬리 자동 와이어 링이 작동하지 않습니다.

<fx:Declarations> 
    <parsley:ViewSettings autowireComponents="true"/> 
    <parsley:ContextBuilder config="{SimulateurConfig}" /> 

    <s:TraceTarget 
      includeCategory="true" 
      includeLevel="true" 
      includeTime="true" 
      level="{LogEventLevel.DEBUG}" 
      > 
     <s:filters> 
      <fx:String>org.spicefactory.parsley.*</fx:String> 
     </s:filters> 
    </s:TraceTarget> 
</fx:Declarations> 

구성은 매우 간단합니다 :

내 응용 프로그램은 folowing bootrap 포함

<fx:Declarations> 
    <View type="com.coach.ui.PanelAFinancer"/> 
    <Object type="com.coach.domain.AFinancer" /> 
</fx:Declarations> 

을 그리고 내 패널에는 다음이 포함

<fx:Script><![CDATA[ 
    import com.coach.domain.AFinancer; 

    [Bindable] [Inject] 
    public var model:AFinancer; 
    ]]></fx:Script> 


<s:Label text="Model injected? { model != null }"/> 

은 내가 잘하지만 모든 것을했다고 생각 모델이 내보기에 삽입되어 있지 않습니다. 추적은 다음을 나타냅니다.

[trace] 12:49:12.186 [INFO] org.spicefactory.parsley.core.state.manager.impl.DefaultGlobalDomainManager Using new ApplicationDomain for key [object _Flex_simulateur_mx_managers_SystemManager] 
[trace] 12:49:12.218 [INFO] org.spicefactory.parsley.core.view.impl.DefaultViewManager Add view root: Flex_simulateur0/Flex_simulateur 
[trace] 12:49:12.218 [INFO] org.spicefactory.parsley.core.bootstrap.impl.DefaultBootstrapManager Creating Context [Context(FlexConfig{SimulateurConfig})] without parent 
[trace] 12:49:12.296 [INFO] org.spicefactory.parsley.core.lifecycle.impl.DefaultManagedObjectHandler Configure managed object with [ObjectDefinition(type = com.coach.domain::AFinancer, id = _SimulateurConfig_MxmlRootObjectTag1)] and 0 processor(s) 

보기 처리의 표시가 없습니다.

<fx:Declarations> 
    <sf:Configure/> 
</fx:Declarations> 

주입 작동 : 나는 패널에서«수동 설정»추가하는 경우

[trace] 12:56:04.983 [INFO] org.spicefactory.parsley.core.state.manager.impl.DefaultGlobalDomainManager Using new ApplicationDomain for key [object _Flex_simulateur_mx_managers_SystemManager] 
[trace] 12:56:05.015 [INFO] org.spicefactory.parsley.core.view.impl.DefaultViewManager Add view root: Flex_simulateur0/Flex_simulateur 
[trace] 12:56:05.030 [INFO] org.spicefactory.parsley.core.bootstrap.impl.DefaultBootstrapManager Creating Context [Context(FlexConfig{SimulateurConfig})] without parent 
[trace] 12:56:05.124 [INFO] org.spicefactory.parsley.core.lifecycle.impl.DefaultManagedObjectHandler Configure managed object with [ObjectDefinition(type = com.coach.domain::AFinancer, id = _SimulateurConfig_MxmlRootObjectTag1)] and 0 processor(s) 
[trace] 12:56:05.140 [DEBUG] org.spicefactory.parsley.core.view.handler.ViewConfigurationHandler Process view 'Flex_simulateur0.ApplicationSkin3._ApplicationSkin_Group1.contentGroup.viewRoot.PanelAFinancer7' with [Context(FlexConfig{SimulateurConfig})] 
[trace] 12:56:05.155 [INFO] org.spicefactory.parsley.core.lifecycle.impl.DefaultManagedObjectHandler Configure managed object with [ObjectDefinition(type = com.coach.ui::PanelAFinancer, id = _SimulateurConfig_MxmlViewTag1)] and 1 processor(s) 
[trace] 12:56:05.155 [DEBUG] org.spicefactory.parsley.core.lifecycle.impl.DefaultManagedObjectHandler Applying [Property(name=[Property model in class com.coach.ui::PanelAFinancer],value={ImplicitTypeReference(type=undefined)})] to managed object with [ObjectDefinition(type = com.coach.ui::PanelAFinancer, id = _SimulateurConfig_MxmlViewTag1)] 
[trace] 12:56:05.171 [DEBUG] org.spicefactory.parsley.core.view.processor.DefaultViewProcessor Add view 'Flex_simulateur0.ApplicationSkin3._ApplicationSkin_Group1.contentGroup.viewRoot.PanelAFinancer7' to [Context(FlexConfig{SimulateurConfig})] 

그것을 내 모든 전망을 독점 태그에 추가 요구하기 때문에 해결 방법은 매우 무거운 편이다 .

구성에 어떤 문제가 있는지 생각해보십시오.

답변

0

다른 솔루션을 사용하는 것이 좋습니다. 뷰를 구성 (또는 와이어 링) 할 때 파슬리는 클래스를 반영하고 주입 지점을 찾기 위해 모든 속성을 반복해야합니다. 이것은 많은 비용과 시간을 필요로합니다. 몇 가지 유선보기는 괜찮을 지 모르지만 일반적으로 Flex 및 Parsley를 사용하는 경우보기가 많을 가능성이 높으므로 일반적으로 그렇지 않습니다.

모든 모델, 발표자, 서비스 등을 모든보기를 제외하고 파슬리 구성에 만드는 것이 좋습니다. 보기에서 FastInject 태그는 다음과 같이 사용하면됩니다.

<fx:Declarations> 
    <spicefactory:FastInject property="model" type="{AFinancer}" /> 
</fx:Declarations> 
<fx:Script><![CDATA[ 
    import com.coach.domain.AFinancer; 

    [Bindable] 
    public var model:AFinancer; 
]]></fx:Script> 

리플렉션이 필요하지 않으므로 훨씬 더 좋은 방법입니다. 유일한 "문제점"은보기에서 비즈니스 관심사를 분리하는 데 더 나은 Parsley 메타 데이터를보기에 사용할 수 없다는 것입니다. 또한 응용 프로그램 전체에서 발표자를 재사용하고 해당 발표자를 테스트하는 데 도움이됩니다.

+0

문제가있을 수 있지만 내 문제는 파슬리에 의존하지 않고 깨끗한보기를 유지하는 것이 었습니다. 나는 항상 IoC를 사용하는 것을 성가 시게 만들고 코드에서 많은 프레임 워크 설정을해야한다. http://www.spicefactory.org/parsley/docs/3.0/manual/view.php#config_automatic의 첫 번째 문장은 작동해야 함을 나타냅니다. – GaetanZ

+0

예, 그렇게 할 수 있습니다. 클래스의 문자열을 지정하는 대신 클래스를 직접 바인딩하십시오.''화면에보기를 어떻게 추가합니까? –

+0

새로운 기능은 없으며 응용 프로그램 mxml에있는 태그입니다. – GaetanZ