Hi Alex,
22.10.2019 00:30 tarihinde Alex Harui yazdı:
There might still be other bugs, but we have not tried to make the
code worth with exclusions within exclusions.
Also bugs in inclusion in exclusion
In keeping with the PAYG philosophy, we don’t want to burden the
States implementation with fault tolerance for such conditions. You
are welcome to create a variation of the States implementation with
that fault tolerance if you want.
My application flow is highly dependent on state implementation, so I
have simply 3 options :
1. redesign flow without state implementation
2. wait for a time to have the bugs fixed
3. try to fix it with my own
I am not sure which one feasible for my case, as I can not go P(AYG
)without one of them, advises ?
In your example, if the Form as excludeFrom loggedOutState, then there
should be no need for the child formItem to also have excludeFrom
loggedOutState.
Seems like i could not express my self clearly; This code piece is just
prepared for those who want to see the bug clearly and simply, it is not
the real case.
Here is the original :
https://drive.google.com/open?id=1AeLJndyE0SnDgCoSdIjgC6hfgubgFnPj
Of course, I could be wrong…
-Alex
Thanks,
Serkan
*From: *Serkan Taş <[email protected]>
*Reply-To: *"[email protected]" <[email protected]>
*Date: *Monday, October 21, 2019 at 12:09 PM
*To: *"[email protected]" <[email protected]>
*Subject: *nested states not handled correctly
Hi,
Here is the simple example for test case.
In this example;
When you click on the button, the state is switched between two states
: loggedOutState/loggedInState.
And according to the state definition the form is shows and hides
according to the state.
The button "nevershown" is never shown because it is excluded from
both states loggedOutState/loggedInState.
The one which is strange is the form item "button1". It has the same
state with the button "nevershown" , but behaves like it has no
excludeFrom tag defined. It behaves similar when you use "includeIn" tag.
I am going to debug the code and try to find-out what is wrong, but if
anybody has any solution and/or idea I highly appreciate.
Thank,
Serkan
Sample test case code
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.adobe.com%2Fmxml%2F2009&data=02%7C01%7Caharui%40adobe.com%7Ca35d3174cd4d48ff11db08d7565a2847%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637072817542459144&sdata=4cplnt4VsGPfBoTKcl6QMs46WgRaQTSmPJIuHL7vv1Y%3D&reserved=0>
xmlns:s="library://ns.apache.org/royale/spark"
xmlns:mx="library://ns.apache.org/royale/mx"
paddingBottom="0" paddingTop="0" paddingLeft="0" paddingRight="0"
height="100%" width="100%"
creationComplete="onCreationComplete()"
>
<fx:Metadata>
</fx:Metadata>
<s:states>
<s:State name="loggedOutState"/>
<s:State name="loggedInState"/>
<s:State name="jobDetailState"/>
</s:states>
<fx:Script>
<![CDATA[
import mx.formatters.DateFormatter;
import org.apache.royale.utils.Timer;
[Bindable]
var time:String;
private var ticker:Timer;
[Bindable]
private var counter:Number = 0;
protected function
button_clickHandler(event:MouseEvent):void {
if(currentState == "loggedOutState") {
currentState = "loggedInState";
} else if(currentState == "loggedInState") {
currentState = "loggedOutState";
}
}
public function showTime():void {
ticker = new Timer(1,1);
ticker.addEventListener(Timer.TIMER, onTimerComplete);
ticker.start();
COMPILE::JS
{
var d = new Date();
time = d.toLocaleTimeString() + ' ' +
d.toLocaleDateString();
}
}
public function onCreationComplete():void {
showTime();
}
public function onTimerComplete(event:Timer):void {
showTime();
counter ++;
}
]]>
</fx:Script>
<fx:Declarations>
</fx:Declarations>
<s:layout>
<s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10"
paddingTop="10" paddingBottom="20" />
</s:layout>
<s:Button id="button" width="200" label="Show/Hide"
click="button_clickHandler(event)"/>
<mx:Panel title="Form Container Example"
paddingBottom="10" paddingTop="10" paddingLeft="10"
paddingRight="10"
height="100%" width="100%">
<mx:Text width="100%"
text="Moving from one form field to another triggers
the validator."/>
<mx:Form width="100%" height="100%" excludeFrom="loggedOutState" >
<mx:FormHeading label="Enter values into the form."/>
<mx:FormItem label="First name" >
<mx:TextInput id="fname" width="200"/>
</mx:FormItem>
<mx:FormItem label="Date of birth (mm/dd/yyyy)">
<mx:TextInput id="dob" width="200"/>
</mx:FormItem>
<mx:FormItem excludeFrom="loggedOutState,loggedInState" >
<s:Button id="button1" width="200" label="Time :
{time}" />
</mx:FormItem>
</mx:Form>
</mx:Panel>
<s:Button id="nevershown"
excludeFrom="loggedOutState,loggedInState" label="Never Shown Button" />
</s:Application>