If you have a simple test case of “inclusion in exclusion” then we should look 
at that.  If the only way to see it is to run your actual code that’s fine, but 
I may not have time to look right away.

I don’t know how many people have existing code with what I’ll call 
“unnecessary states” in them, so I don’t know how valuable it will be to the 
rest of the Royale folks to have an implementation that is fault tolerant.  It 
might be quick and simple to create a variant of the states implementation that 
is fault tolerant.  I don’t know, because I haven’t looked to see what the root 
problem is.

I would stay with states, and either create that fault tolerant version or just 
clean up the “unnecessary states”.   Cleaning up the unnecessary states will 
make your code more efficient than building in fault tolerance.

Also, if you really want a fault tolerant states impl,  it might be “cheaper” 
to see if one of the other committers has time to create it for you.

My 2 cents,
-Alex

From: Serkan Taş <[email protected]>
Reply-To: "[email protected]" <[email protected]>
Date: Monday, October 21, 2019 at 7:02 PM
To: "[email protected]" <[email protected]>
Subject: Re: nested states not handled correctly

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<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D1AeLJndyE0SnDgCoSdIjgC6hfgubgFnPj&data=02%7C01%7Caharui%40adobe.com%7C5fcd64d4c06640dada0a08d75693efbc%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637073065701362634&sdata=2vgUNtRogCS4TyS1YV%2F86Ec9HEWVcg5QamVSuNGtelo%3D&reserved=0>


Of course, I could be wrong…
-Alex


Thanks,
Serkan


From: Serkan Taş 
<[email protected]><mailto:[email protected]>
Reply-To: "[email protected]"<mailto:[email protected]> 
<[email protected]><mailto:[email protected]>
Date: Monday, October 21, 2019 at 12:09 PM
To: "[email protected]"<mailto:[email protected]> 
<[email protected]><mailto:[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%7C5fcd64d4c06640dada0a08d75693efbc%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637073065701372591&sdata=jjW31rXL5c8HG9Fa1ybbMEyeUiPPcswn%2FDjMsC3EtxA%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>





Reply via email to