Controlling view states

It would be nice to get feedback from a more experienced
developer about how I should implement my view with regards to
state, on the one hand I have a book (essential flex 2.0 with
actionscript 3.0) which explains that view state should be handled
using <mx:state> and on the other hand I have the cairngorm
examples (cairngorm store and cairngorm login) that use a
viewstack.
I don't think I fully comprehend what the implications of
choosing one or the other will be, other than using viewstack looks
simpler.
I would be grateful for any advice. Thankyou
James

from flexcoders on yahoo
Here's what I'm getting from all the manual reading I've been
doing over the past week. Others may correct me or clarify as
needed.
- Think of the base state as the "home page"... it's the
initial state of the app or component when the user browses to it.
I can't think of a good reason why it would ever be empty unless
you wanted to implement some kind of transition or effect
immediately upon loading it.
- In the larger sense of UI design, HTML "pages" are
addressed in the Flex metaphor with ViewStacks attached to a
navigator. Use this for macro changes in the interface.
- View states are used to display incremental changes in
state. Sounds like you are using that correctly insofar as you
describe it... however, depending on how your user interface is
designed and what you're trying to accomplish, the "Detail" state
you describe could also be just an incremental change to the
"Master" state with the Master state remaining visible. Also, the
"Master" state could be your base state since it's empty and that's
the first thing the user sees.

Similar Messages

  • What is the best practice for changing view states?

    I have a component with two Pie Charts that display
    percentages at two specific dates (think start and end values).
    But, I have three views: Start Value only, End Value only, or show
    Both. I am using a ToggleButtonBar to control the display. What is
    the best practice for changing this kind of view state? Right now
    (since this code was inherited), the view states are changed in an
    ActionScript function which sets the visible and includeInLayout
    properties on each Pie Chart based on the selectedIndex of the
    ToggleButtonBar, but, this just doesn't seem like the best way to
    do this - not very dynamic. I'd like to be able to change the state
    based on the name of the selectedItem, in case the order of the
    ToggleButtons changes, and since I am storing the name of the
    selectedItem for future reference.
    Would using States be better? If so, what would be the best
    way to implement this?
    Thanks.

    I would stick with non-states, as I have always heard that
    states are more for smaller components that need to change under
    certain conditions, like a login screen that changes if the user
    needs to register.
    That said, if the UI of what you are dealing with is not
    overly complex, and if it will not become overly complex, maybe
    states is the way to go.
    Looking at your code, I don't think you'll save much in terms
    of lines of code.

  • Populate Flex Grids during view state?

    Hi, I am very new to Flex. I am working on a Flex project where I want to populate xml data in the two grids during viewstate. In my project, I have two grid which resides in the two discinct view state named as "Category" and "Topic". For these two view state, i have two disctinct grids.
    I am successfully able to populate one grid that is "Category" state grid but when i change the state on button click event another grid does not populate with the data.
    Can anyone help me with this?
    Please have a look on the code below for better idea:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="730" height="492" creationComplete="TopCategoryTopic()" currentState="HotCategory">
    <mx:states>
      <mx:State name="HotTopic">
          <mx:SetEventHandler target="{btnHotTopics}" name="click" handlerFunction="TopCategoryTopic">     
          </mx:SetEventHandler>
      <mx:SetProperty target="{btnHotTopics}" name="label" value="Top &quot;Hot&quot; Topic"/>
      <mx:RemoveChild target="{categoryGrid}"/>
      <mx:AddChild relativeTo="{canvas1}" position="lastChild">
        <mx:DataGrid id="topicGrid" x="10" y="27" width="601" height="263" color="#000000">   
        </mx:DataGrid>
      </mx:AddChild>
      <mx:AddChild relativeTo="{canvas1}" position="lastChild">
        <mx:Label x="10" y="10" text="Top &quot;Hot&quot; Topic" width="150" color="#000000" fontWeight="bold" fontFamily="Verdana" fontSize="11" id="label0"/>
      </mx:AddChild>
      </mx:State>
      <mx:State name="HotCategory">
        <mx:SetEventHandler target="{btnHotCategories}" name="click" handlerFunction="TopCategoryTopic">     
          </mx:SetEventHandler>
          <mx:SetProperty target="{btnHotCategories}" name="label" value="Top &quot;Hot&quot; Categories"/>
      <mx:RemoveChild target="{categoryGrid}"/>
      <mx:AddChild relativeTo="{canvas1}" position="lastChild">
        <mx:DataGrid id="categoryGrid"  x="10" y="27" width="601" height="263" color="#000000">   
        </mx:DataGrid>
      </mx:AddChild>
      <mx:AddChild relativeTo="{canvas1}" position="lastChild">
        <mx:Label x="10" y="10" text="Top &quot;Hot&quot; Category" width="159" color="#000000" fontWeight="bold" fontFamily="Verdana" fontSize="11" id="label2"/>
      </mx:AddChild>
      </mx:State>
    </mx:states>
    <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
      width="730" height="492" headerHeight="20"
          showCloseButton="true" borderColor="#000000"
      layout="absolute" fontSize="12" verticalScrollPolicy="off"
      horizontalScrollPolicy="off" title="Customer Success &amp; Strategy - Q4 Hot Topics/Categories"
      themeColor="#0E4463" horizontalCenter="0"
      verticalCenter="0" id="CSSTopPresenter" cornerRadius="0" alpha="1.0"
      backgroundColor="#FFFFFF" borderThickness="0" close="CloseWindow()"
      color="#FFFFFF" borderThicknessLeft="3" borderThicknessRight="3" borderThicknessBottom="3">
        <mx:Script>
            <![CDATA[
                import mx.controls.dataGridClasses.DataGridColumn;
          import mx.collections.XMLListCollection;
            import mx.managers.PopUpManager;
                import mx.rpc.events.FaultEvent;
      import mx.rpc.events.ResultEvent;
      import mx.rpc.http.HTTPService;
      import mx.events.FlexEvent;
      import mx.controls.Alert;
      import flash.events.MouseEvent;
                [Bindable]
                private var _xmlData:XMLList;
                private function TopCategoryTopic():void
                    var httpService:HTTPService = new HTTPService();
                httpService.url = "http://ri/co.UI/CtSS/Rsources/Hgory.aspx?Month=January&Year=2009";
                httpService.resultFormat = "e4x";
        httpService.addEventListener(ResultEvent.RESULT, onResultHttpService);
        httpService.send();
                //funtion to receive Http Service Response as XML Document         
              private function onResultHttpService(e:ResultEvent):void
        //var xmlData:XMLList = e.result.CategoryTopic;
        var category:XMLList = e.result.categories;
        var topic:XMLList= e.result.topics;
        if(currentState=="HotCategory")
            categoryGrid.dataProvider = category;
            for each (var node:XML in category[0].children())
                addDataGridColumn1(node.name());
        else if(currentState=="HotTopic")
          topicGrid.dataProvider = topic;
          for each (var node1:XML in topic[0].children())
            addDataGridColumn2(node1.name());
        //function to add Categories column dynamically
      private function addDataGridColumn1(dataField:String):void
        var dgc:DataGridColumn=new DataGridColumn(dataField);
        var cols:Array=categoryGrid.columns;
        cols.push(dgc);
        categoryGrid.columns=cols;
        categoryGrid.validateNow(); 
                //function to add Topic column dynamically
      private function addDataGridColumn2(dataField:String):void
        var dgc:DataGridColumn=new DataGridColumn(dataField);
        var cols:Array=topicGrid.columns;
        cols.push(dgc);
        topicGrid.columns=cols;
        topicGrid.validateNow(); 
          //funtion to remove grid window
      private function CloseWindow():void
        PopUpManager.removePopUp(this);
        ]]>
        </mx:Script>
        <mx:Button id="btnHotCategories" label="Top &quot;Hot&quot; Categories" width="173" height="37" borderColor="#2673A9" cornerRadius="6" labelPlacement="left" color="#000000" click="currentState='HotCategory'" x="45" y="23" fillAlphas="[1.0, 1.0]" fillColors="[#4D8F8D, #CCD3DE]"/>
        <mx:Button id="btnHotTopics" label="Top &quot;Hot&quot; Topic"  width="172" height="38" cornerRadius="6" borderColor="#000000"  color="#000000" click="currentState='HotTopic'"  x="46" y="78" fillAlphas="[1.0, 1.0]" fillColors="[#4D8F8D, #CCD3DE]"/>
        <mx:Canvas width="621" height="302" borderStyle="solid" borderColor="#0092F9" y="155" x="46" cornerRadius="9"  alpha="0.61" backgroundColor="#0092f9" id="canvas1">
        </mx:Canvas> 
        <mx:Image x="294" y="0" width="373" height="147" source="assets/CategoryTopic.gif"/>
    </mx:TitleWindow>
    </mx:Canvas>
    Thanks in advance.
    Vivek Jain
    Software Engineer

    I simplified the problem to it's essence and came up with this:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal"
        creationComplete="init()">
        <mx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                [Bindable]
                public var lProvider:ArrayCollection;
                private function init():void
                    var la:Array = [{label: "Conference", checked: true},
                                    {label: "Tickets", checked: false}];
                    lProvider = new ArrayCollection(la);
            ]]>
        </mx:Script>
        <mx:List id="cList" width="200" dataProvider="{lProvider}" itemClick="lProvider.refresh()">
            <mx:itemRenderer>
                <mx:Component>
                    <mx:HBox width="100%">
                        <mx:CheckBox selected="{data.checked}" click="data.checked = event.target.selected"/>
                        <mx:Label text="{data.label}"/>
                    </mx:HBox>
                </mx:Component>
            </mx:itemRenderer>
        </mx:List>
        <mx:VBox width="600">
            <mx:Panel title="Conference component" width="100%" height="200"
                    visible="{lProvider.getItemAt(0).checked}"
                    includeInLayout="{lProvider.getItemAt(0).checked}"/>
            <mx:Panel title="Ticket component" width="100%" height="200"
                    visible="{lProvider.getItemAt(1).checked}"
                    includeInLayout="{lProvider.getItemAt(1).checked}"/>
        </mx:VBox>
    </mx:Application>
    Does this help?
    Dany

  • SSRS 2012 Problem understanding View State Validation steps

    Hi,
    ***** Note I have put my question on Bold to make it easier****
    I am trying to Implement this solution on our systems and need help on how to set it up ?
    Pasted from 
    http://technet.microsoft.com/en-us/library/cc281307.aspx?lc=1033
    How to Configure View State Validation
    To run a scale-out deployment on an NLB cluster, you must configure view state validation so that users can view interactive HTML reports. You must do this for the report server and for Report Manager.
    View state validation is controlled by the ASP.NET. By default, view state validation is enabled and uses the identity of the Web service to perform the validation. However, in an NLB cluster scenario, there are multiple service instances and web service
    identities that run on different computers. Because the service identity varies for each node, you cannot rely on a single process identity to perform the validation.
    To work around this issue, you can generate an arbitrary validation key to support view state validation, and then manually configure each report server node to use the same key. You can use any randomly generated hexadecimal sequence. The validation algorithm
    (such as SHA1) determines how long the hexadecimal sequence must be.
    1.
    Generate a validation key and decryption key by using the autogenerate functionality provided by the .NET Framework.(Well, how to generate Validation key using .Net Framework?)
    In the end, you must have a single <machineKey> entry that you can paste into the Web.config file for each Report Manager instance in the scale-out deployment. 
    The following example provides an illustration of the value you must obtain. Do not copy the example into your configuration files; the key values are not valid.
     Copy Code
    <machineKey validationKey="123455555" decryptionKey="678999999" validation="SHA1" decryption="AES"/>
    2.
    Open the Web.config file for Report Manager, and in the <system.web> section paste the <machineKey> element that you generated. By default, the Report Manager Web.config file is located in \Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting
    Services\ReportManager\Web.config.
    3.
    Save the file.
    4.
    Repeat the previous step for each report server in the scale-out deployment. 
    5.
    Verify that all Web.Config files in the \Reporting Services\Report Manager folders contain identical <machineKey> elements in the <system.web> 
    Does the key generate using above generates the key with same element ?
    Any help on this would be appreciated .
    Thank you !
    Thanks

    Hi SQL_Help:
    Per my understanding that you have some question with the steps descript about "How to Configure View State Validation", you don't know how to generate Validation key and also not clear if all the Web.Config files will add the same
    code, right?
    We have many method to generate the validation key,details information below for your reference:
    Generate either from the machineKey generator utility from
    http://aspnetresources.com/tools/keycreator.aspx or  your very own utility or from this link: http://www.eggheadcafe.com/articles/GenerateMachineKey/GenerateMachineKey.aspx
    We can add some code to generate the key, details steps and sample code in article below for your reference:
    How to create keys by using Visual C# .NET for use in Forms authentication
    We should add the same code which include the generated key in all the web.config file in each server node. 
    More Details information you can reference to the rticle below:
    https://msdn.microsoft.com/en-us/library/ff649308.aspx
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Change base view state from a custom component

    I'm pretty new to flex and I'm having a small issue in change the view state from a component.
    My Application have 2 custom components called userlogin and main menu. In the main application page I have userlogin component in one state and the main menu component in another. I'm trying to change the state if the login in successful from user login to main menu. I have the following function written inside the login component.
    private function IsUserLoggedIn(evt:ResultEvent):void
                    if (evt.result.islogin.toString() == "true")
                        currentState = "MainMenu";
                    else
                        Alert.show("Login failed, please try again.", "Login Failed");
    This code worked when I had all the controls in the main page. But then I created components and included them in to components and now when the login is success, its giving the following error.
    ArgumentError: Undefined state 'MainMenu'.
        at mx.core::UIComponent/getState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UI Component.as:9908]
        at mx.core::UIComponent/findCommonBaseState()[E:\dev\4.0.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9928]
        at mx.core::UIComponent/commitCurrentState()[E:\dev\4.0.0\frameworks\projects\framework\src\ mx\core\UIComponent.as:9750]
        at mx.core::UIComponent/setCurrentState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\ core\UIComponent.as:9701]
        at mx.core::UIComponent/set currentState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:6087 ]
        at components::UserLoginForm/__btnSubmit_click()[C:\Projects\WarrantyAutomation\src\componen ts\UserLoginForm.mxml:60]
    I'm sure this has something to do with accessing the states from a custom component, but I do not know how to change the state to the main menu. Please help me with this. Any help is greatly appriciated.

    Hi dasun1981,
    private function IsUserLoggedIn(evt:ResultEvent):void
                    if (evt.result.islogin.toString() == "true")
                        currentState = "MainMenu";
                    else
                        Alert.show("Login failed, please try again.", "Login Failed");
    If I am right the above function is in your userlogin component and the two components "userlogincomponent" and "maincomponent" are in main application file and the states were also defined in main application file.
    But in the function above the currentState refers to the state of the userlogin component and not the main application ...but the states are defined in main application file...that's the reason why the exception was thrown...
    Instead you replace the line in the above function with the below line:
    Application.application.currentState = "MainMenu";
    Please mark it as answer if it helped you.
    Thanks,
    Bhasker Chari

  • SSRS 2008 R2 Problem understanding View State Validation steps

    Hi,
    Sorry, but I have some problem understanding this steps. Please help me to understand this. 
    Pasted from
    http://technet.microsoft.com/en-us/library/cc281307.aspx?lc=1033
    How to Configure View State Validation
    To run a scale-out deployment on an NLB cluster, you must configure view state validation so that users can view interactive HTML reports. You must do this for the report server and for Report Manager.
    View state validation is controlled by the ASP.NET. By default, view state validation is enabled and uses the identity of the Web service to perform the validation. However, in an NLB cluster scenario, there are multiple service instances
    and web service identities that run on different computers. Because the service identity varies for each node, you cannot rely on a single process identity to perform the validation.
    To work around this issue, you can generate an arbitrary validation key to support view state validation, and then manually configure each report server node to use the same key. You can use any randomly generated hexadecimal sequence.
    The validation algorithm (such as SHA1) determines how long the hexadecimal sequence must be.
    Generate a validation key and decryption key by using the autogenerate functionality provided by the .NET Framework.
    (Well, how to generate Validation key using .Net Framework?) In the end, you must have a single <machineKey> entry that you can
    paste into the Web.config file for each Report Manager instance in the scale-out deployment.  
    The following example provides an illustration of the value you must obtain. Do not copy the example into your configuration files; the key values are not valid.
    Copy Code
    <machineKey validationKey="123455555" decryptionKey="678999999" validation="SHA1" decryption="AES"/>
    Open the Web.config file for Report Manager, and in the <system.web> section paste the <machineKey> element that you generated. By default, the Report Manager
    Web.config file is located in \Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager\Web.config.
    Save the file.
    Repeat the previous step for each report server in the scale-out deployment. 
    (Do I need to repeat all 3 previous steps?)
    Verify that all Web.Config files in the \Reporting Services\Report Manager folders contain identical <machineKey> elements in the <system.web> section.
    Thanks

    Jerry,
    Thanks for the reply.
    From the above View State Validation Steps,
    For 1st step , how to generate validation key using .Net Framework?
    for 4th step, Do I need to repeate all 3 previous steps?
    Thanks
    Kp

  • Control break statements in Scripts

    Hi All
    Please help me.
    What are the control break statements are possible in SAP Scripts for Main Window.
    Regards
    Praveen

    This gives over view of almost all control commands.
    ADDRESS               Formatting of addresses
    BOTTOM, ENDBOTTOM     Define footer text in a window
    BOX, POSITION, SIZE   Boxes, lines and shading
    CASE, ENDCASE         Case distinction
    DEFINE                Value assignment to text symbols
    HEX, ENDHEX           Hexadecimal values
    IF, ENDIF             Conditional text output
    INCLUDE               Include other texts
    NEW-PAGE              Explicit forms feed
    NEW-WINDOW            Next window MAIN
    PRINT-CONTROL         Insert print control character
    PROTECT, ENDPROTECT   Protect from page break
    RESET                 Initialize outline paragraphs
    SET COUNTRY           Country-specific formatting
    SET DATE MASK         Formatting of date fields
    SET SIGN              Position of +/- sign
    SET TIME MASK         Formatting of time fields
    STYLE                 Change style
    SUMMING               Summing variables
    TOP                   Set header text in window MAIN

  • View states for components

    Hi hoping someone could help. I understand view states and can use them. However in this situation I want to have a view state for a control bar but I already have 2 view states for another component (a panel component) in my Flex app and want to separate the control bar view state from the panel view state.
    Therefore when I set the currentState = 'showBtn' it's affecting the panel view state and I don't want it to. I've tried putting the <mx:states> tag in under the component i'm trying to add the button view state to but i'm getting an "Initializer for the property 'states' is not allowed here" error.

    i've tried that... when i start using the id of the component like myPanel.currentState = "whatever" it tells me the currentState whatever is undefined. it only seems to work if i do currenState = "whatever". here is some of my code to help you see my problem:
    <mx:Script>
    <![CDATA[ 
    private function toggleFilter():void{ 
    if (p1.currentState == 'viewRequests'){p1.currentState =
    'searchFilter';filterButton.label =
    'Hide Filter';}
    else{p1.currentState =
    'viewRequests';filterButton.label =
    'Show Filter'; 
    private function buttonBar():void{ 
    if (changeQueue.selectedItem.REQ_BY_ID == Application.application.parameters.emplid){queueControlBar.currentState =
    'showRecallBtn';}
    else{queueControlBar.currentState =
    ]]>
    </mx:Script>
    <mx:states>
    <mx:State name="viewRequests">
    <mx:AddChild relativeTo="{p1}" position="firstChild">
    <mx:HBox id="resultBox" width="100%" height="100%">
    <mx:DataGrid id="changeQueue" x="0" y="0" width="100%" height="100%" dataProvider="{SAMService.getRequests.lastResult}" change="buttonBar();">
    <mx:columns>
    <mx:DataGridColumn headerText="Change ID" dataField="CHANGE_ID" visible="false"/>
    <mx:DataGridColumn headerText="Change Type" dataField="CHANGE_TYPE"/>
    <mx:DataGridColumn headerText="Status" dataField="STATUS"/>
    <mx:DataGridColumn headerText="Request Date" dataField="REQ_DT" labelFunction="doDateLabel"/>
    <mx:DataGridColumn headerText="Requested By ID" dataField="REQ_BY_ID" />  
    </mx:columns>
    </mx:DataGrid>
    </mx:HBox>
    </mx:AddChild>  
    </mx:State>
    <mx:State name="searchFilter">
    <mx:AddChild relativeTo="{p1}" position="secondChild">
    <SearchPanel id="searchPanel" width="100%" height="100%"/>
    </mx:AddChild>
    </mx:State>
    <mx:State name="showRecallBtn">
    <mx:AddChild relativeTo="{queueControlBar}" position="lastChild">
    <mx:Button label="Recall Item" icon="@Embed(source='images/recall.gif')" enabled="{changeQueue.dataProvider.length > 0}"/>
    </mx:AddChild>
    </mx:State>
    </mx:states>
     <mx:HBox x="0" y="360" width="95%" horizontalAlign="center" paddingLeft="25" paddingRight="25">
     <mx:Panel id="p1" width="100%" height="90%" layout="absolute" title="Change Request Queue" currentState="viewRequests">
     <mx:ControlBar>
     <mx:HBox id="queueControlBar" width="100%" horizontalAlign="center" currentState="">
     <mx:Button label="Details" icon="{detailsIcon}" enabled="{changeQueue.selectedIndex>-1}" click="WindowManager.add(getDetails(), this, true);"/>
     <mx:Button id="filterButton" label="Show Filter" icon="@Embed(source='images/search.png')" click="toggleFilter();"/>
     <mx:Button id="OICbutton" label="Export OIC Changes" icon="@Embed(source='images/export.png')" enabled="{changeQueue.dataProvider.length > 0}" click="oicChanges();"/>
     </mx:HBox>
     </mx:ControlBar>
     </mx:Panel>
     </mx:HBox>

  • How: Modules within View States?

    Hey fellow FLEXers:
    I have a main app configured with view states. Each view state should load a module. Only the first module loads, and when the second one tries to run it fails to run. Any ideas what may be causing this?
    Here is the main app code:
    And here the SignIn module:
    And here the CompanySelection module:
    And the CompanyTileList component that the CompanySelection module requires:
    Any help is greatly appreciated.
    Also, if anyone can point me in the direction of some good tutorials for using modules and views (hopefully in combination), that would be great. I purchased the book FLEX 3 in Action, but unfortunately it doesn't go into too much detail on this topic.
    Thanks!
    Mike

    The problem I am experiencing is that the TileList in the CompanySelection module is not being populated; it results in the module displaying without the tile list.
    Everytime I try to add ActionScript code in my post using the INSERT HTML functionality, it dissappears. Any ideas? I'll try adding XML.
    Main App:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
         xmlns:mx="http://www.adobe.com/2006/mxml"
         creationComplete="app_init()"
    >
         <mx:Script>
              <![CDATA[
                   import mx.controls.Alert;
                   import mx.rpc.events.FaultEvent;
                   import com.brassworks.ValueObjects.UserVO;
                   [Bindable]
                   private var current_user:UserVO;
                   private function app_init():void
                        setState("SignIn");
                        //if ((!current_user) || (current_user.id <= 0)) {setState("SignIn");}
                   public function setState(state:String):void
                        currentState = state;
                   public function handleFault(event:FaultEvent):void
                        Alert.show(event.fault.faultDetail, event.fault.faultString);
                   public function show_error(error:Error, s_function:String):void
                        Alert.show("Method:" + s_function + "\nName: " + error.name + "\nID: " + error.errorID + "\nMessage: " + error.message + "\nStack Trace: " + error.getStackTrace() + "\nError: " + error.toString());
              ]]>
         </mx:Script>
         <mx:Canvas
              id="pnl_default"
         >
         </mx:Canvas>
         <mx:states>
              <mx:State
                   name="SignIn"
              >
                   <mx:RemoveChild
                        target="{pnl_default}"
                   />
                   <mx:AddChild>
                        <mx:ModuleLoader
                             id="mdl_signin"
                             url="com/brassworks/modules/admin/SignIn.swf"
                        />
                   </mx:AddChild>                    
              </mx:State>
              <mx:State
                   name="ChooseCompany"
              >
                   <mx:RemoveChild
                        target="{pnl_default}"
                   />
                   <mx:AddChild>
                        <mx:ModuleLoader
                             id="mdl_choose_company"
                             url="com/brassworks/modules/admin/CompanySelection.swf"
                        />
                   </mx:AddChild>                    
              </mx:State>
         </mx:states>
         <mx:transitions>
              <mx:Transition
                   fromState="*"
                   toState="*"
              >
                   <mx:Parallel
                        id="trn_default"
                        targets="{['SignIn', 'ChooseCompany']}"
                   >
                        <mx:Fade
                             alphaFrom="0.0"
                             alphaTo="1.0"
                        />
                   </mx:Parallel>
              </mx:Transition>
         </mx:transitions>
    </mx:Application>
    SignIn module:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Module
         xmlns:mx="http://www.adobe.com/2006/mxml"
         layout="absolute"
    >
         <mx:RemoteObject
              id="LoginRemote"
              destination="login"
              showBusyCursor="true"
         >
               <mx:method name="sign_in" result="signin_handle(event)" />
               <mx:method name="sign_out" result="signout_handle(event)" />
         </mx:RemoteObject>
         <mx:Script>
              <![CDATA[
                   import mx.rpc.events.FaultEvent;
                   import mx.utils.ArrayUtil;
                   import mx.rpc.events.ResultEvent;
                   import mx.controls.Alert;
                   import com.brassworks.ValueObjects.CurrentUserVO;
                   import mx.events.VideoEvent;
                   [Bindable]
                   private var this_user:CurrentUserVO = new CurrentUserVO();
                   private function init():void
                   private function signin_handle(event:ResultEvent):void
                        try
                             this_user = event.result as CurrentUserVO;
                             if (this_user.token == null) {Alert.show("Supplied login credentials are not valid. Please try again.");}
                             else
                                  this.parentApplication.setState("ChooseCompany");
                                  //Alert.show("You are now logged in, " + this_user.first_name + " " + this_user.last_name + ".");
                        catch (error:FaultEvent)
                             handleFault(error);
                   private function signout_handle(event:ResultEvent):void
                   private function sign_in(event:Event):void
                        //Alert.show(txt_name.text + "|" + txt_password.text);
                        LoginRemote.sign_in(txt_username.text, txt_password.text);
                   private function sign_out(event:Event):void
                   private function show_error(error:Error, s_function:String):void
                        Alert.show("Method:" + s_function + "\nName: " + error.name + "\nID: " + error.errorID + "\nMessage: " + error.message + "\nStack Trace: " + error.getStackTrace() + "\nError: " + error.toString());
                   private function handleFault(event:FaultEvent):void
                        Alert.show(event.fault.faultDetail, event.fault.faultString);
              ]]>
         </mx:Script>
         <mx:Panel
              id="pnl_signin"
              title="Sign In"
              horizontalAlign="center"
              verticalAlign="middle"
         >
              <mx:Form
                   id="frm_signin"
                   cornerRadius="5"
                   defaultButton="{btn_signin}"
              >
                   <mx:FormItem
                        id="fi_username"
                        label="Username:"
                   >
                        <mx:TextInput
                             id="txt_username"
                        />
                   </mx:FormItem>
                   <mx:FormItem
                        id="fi_password"
                        label="Password:"
                   >
                        <mx:TextInput
                             id="txt_password"
                             displayAsPassword="true"
                        />
                   </mx:FormItem>
              </mx:Form>
              <mx:ControlBar>
                   <mx:LinkButton
                        id="lnk_request_password"
                        label="Forgot your password?"
                        click="currentState='RequestPassword'"
                   />
                   <mx:Spacer
                        id="spc_spacer"
                        width="100%"
                   />
                   <mx:Button
                        id="btn_signin"
                        label="Sign In"
                        click="sign_in(event)"
                   />
              </mx:ControlBar>
         </mx:Panel>
    <!--     
         <mx:states>
              <mx:State
                   name="RequestPassword"
              >
                   <mx:SetProperty
                        target="{pnl_signin}"
                        name="title"
                        value="Request New Password"
                   />
                   <mx:SetProperty
                        target="{btn_signin}"
                        name="label"
                        value="Submit Request"
                   />
                   <mx:RemoveChild
                        target="{lnk_request_password}"
                   />
                   <mx:RemoveChild
                        target="{fi_password}"
                   />
                   <mx:AddChild
                        relativeTo="{spc_spacer}"
                        position="before"
                   >
                        <mx:target>
                             <mx:LinkButton
                                  id="lnk_sign_in"
                                  label="Return to Sign In form."
                                  click="currentState=''"
                             />
                        </mx:target>
                   </mx:AddChild>
              </mx:State>
         </mx:states>
         <mx:transitions>
              <mx:Transition
                   fromState="*"
                   toState="*"
              >
                   <mx:Parallel
                        id="trn_default"
                        targets="{['RequestPassword']}"
                   >
                        <mx:Fade
                             alphaFrom="0.0"
                             alphaTo="1.0"
                        />
                   </mx:Parallel>
              </mx:Transition>
         </mx:transitions>
    -->
    </mx:Module>
    CompanySelection module:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Module
         xmlns:mx="http://www.adobe.com/2006/mxml"
         layout="absolute"
         xmlns:components="com.brassworks.components.*"
         horizontalAlign="center"
    >
         <mx:RemoteObject
              id="CompanyRemote"
              destination="company"
              source="Company"
              showBusyCursor="true"
         >
               <mx:method name="load_by_user" result="getCompanyHandler(event)"/>
         </mx:RemoteObject>
         <mx:Script>
              <![CDATA[
                   import mx.events.ListEvent;
                   import mx.controls.Alert;
                   import mx.core.ByteArrayAsset;
                   import mx.controls.Image;
                   import mx.rpc.events.FaultEvent;
                   import mx.rpc.soap.LoadEvent;
                   import mx.utils.ArrayUtil;
                   import com.brassworks.ValueObjects.CompanyVO;
                   import mx.collections.ArrayCollection;
                   import mx.rpc.events.ResultEvent;
                   public function mod_init():void
                        CompanyRemote.load_by_user("mike");
                   private function getCompanyHandler(event:ResultEvent):void
                        Alert.show('test3');
                        //var results:ArrayCollection = event.result as ArrayCollection;
                        //companies = event.result as ArrayCollection;
                        tll_company_selection.dataProvider = event.result;
                   private function toObject(element:String, index:int, array:Array):Object
                        return {label:element};
                   private function item_click(event:ListEvent):void
                        Alert.show(TileList(event.currentTarget).selectedItem.id.toString());
              ]]>
         </mx:Script>
         <mx:Canvas
              borderColor="#636363"
              backgroundColor="#FCF4DA"
              width="900"
              horizontalCenter="true"
         >
              <mx:TileList
                   id="tll_company_selection"
                   columnWidth="260"
                   maxColumns="2"
                   rowHeight="150"
                   itemRenderer="com.brassworks.components.CompanyTileList"
                   itemClick="item_click(event)"
                   width="520"
                   horizontalScrollPolicy="off"
                   horizontalCenter="0"
                   backgroundAlpha="0.0"
                   borderStyle="none"
                   creationComplete="mod_init()"
              />
         </mx:Canvas>
    </mx:Module>
    CompanyTileList component:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox
         xmlns:mx="http://www.adobe.com/2006/mxml"
         verticalScrollPolicy="off"
         horizontalScrollPolicy="off"
         horizontalCenter="0"
         width="260"
         paddingLeft="5"
         paddingRight="5"
         paddingTop="0"
         paddingBottom="0"
    >
         <mx:Script>
              <![CDATA[
                   import com.brassworks.ValueObjects.CompanyVO;
                   import mx.utils.Base64Decoder;
                   import flash.utils.ByteArray;
                   [Bindable]
                   private var _company_name:String;
                   [Bindable]
                   private var _company_logo:ByteArray;
                   private var _decoder:Base64Decoder = new Base64Decoder();
                   public var _company:CompanyVO;
                   private function tile_list_init():void
                        _company = data as CompanyVO;
                        _company_name = _company.name;
                        _decoder.decode(_company.logo);
                        _company_logo = _decoder.toByteArray();
              ]]>
         </mx:Script>
         <mx:Image
              source="{_company_logo}"
              width="250"
              height="100"
         />
         <mx:Label
              text="{_company_name}"
              creationComplete="tile_list_init()"
              width="100%"
              left="0"
              right="0"
              textAlign="center"
         />
    </mx:VBox>

  • Selecting View States and TabNavigator Canvases

    Hello all Flex fans...
    I have two questions for somebody who has done this before.
    It will take a bit of explaining so bear with me.
    I have a datagrid called "selClaimant" as the starting point
    of my application. When I select something from the selClaimant
    datagrid I change view states to a view called "ClaimView". In the
    ClaimView state I have a TabNavigator control with several canvases
    called "Claimant" and "Claims" and several others.
    My first question is when I select something from the
    selClaimant datagrid how do I ensure that the Claimant canvas is
    displayed in the TabNavigator and not the Claims canvas???
    My second question is similar to the first but with a twist.
    First off the Claims canvas also has two view states (call them
    "ViewOne" and "ViewMany"). ViewOne has a datagrid control called
    selClaim that allows me to select a claim that has been filed by
    the claimant. ViewMany allows me to see all the details about the
    selected claim. When I select a claimant from the selClaimant
    datagrid I query the database to see how many claims that the
    selected claimant has filed. If there has only been one claim filed
    I want the starting state to be the ViewMany canvas when the user
    clicks on the Claims TabNavigator. If there is more than one claim
    in the database then I want the ViewOne to be displayed so I can
    select which claim I want the detail on.
    I store the number of claims in an array so I can use the
    array length to see if I have one or more claims but I am not sure
    how to logically force my view state and canvas state.
    Thanks in advance to the guru that helps me with this one!!!
    Have an Ordinary Day...
    KomputerMan ~|:-)

    Question one is answered... put this into the action script
    that handles the datagrid selected event.
    claimantTabNav.selectedIndex = 0;
    claimantTabNavigator is the ID of the tabnavigator whose
    canvas I want selected. 0 is the first tab in the navigator. Good
    thing I grew up on UNIX and can still remember how to count
    starting with a 0 instead of a 1. :)
    Have an Ordinary Day...
    KomputerMan ~|:-)

  • What happen if i use controll break statement in between select & endselect

    Hi all,
    what happen if i use controll break statement in between select & endselect ?
    Thanks in Advance
    KR

    Hi for reference u can go through this code example
    data:
      fs_tab like sflight.
      data:
       t_tab like standard table of fs_tab.
       select * from sflight into table t_tab.
       loop at t_tab into fs_tab.
         write: / fs_tab-carrid.
       endloop.
       refresh t_tab.
       clear fs_tab.
       select * from sflight into fs_tab.
         at new fs_tab-carrid.
           append fs_tab to t_tab.
         endat.
       endselect.

  • Named Criteria created, but it does not show up in the Data Controls view

    Hello there,
    I wish to use a data-bound ADF Mobile ListView in one of the pages on the app. However, only entries of the underlying data that fulfill a certain condition shall be displayed in the list. The condition basically is an "Equals" test against a bind variable in the pageFlowScope. Therefore, I have created a corresponding Named Criteria for the data control - proceeded like described here:
    https://blogs.oracle.com/adf/entry/create_named_criteria_in_ejb
    The Named Criteria, in my case, has been created and saved, yet it does not show up in the Data Controls view of JDeveloper. Therefore, I cannot drag it on a UI element to use it.
    I only have the "Operations" folder where the quick guide above also shows a "Named Criteria" folder.
    Refreshing or restarting JDeveloper did not solve this.

    It was all taken care of by Gaurav Aggarwal
    He got me all fixed up, Thank you for your concern.
    Daniel Walters

  • C#/SharePoint -View State related issue while exporting data to excel

    We have web application based on SharePoint. We have a list view to display data based on Search Criteria. We have total of around 16000 data. When we try to export all data to excel it gives an error. The cause of the issue is:
    View State is used to save the state of page i.e. the previous state. When the export to excel link is clicked, the data present in the grid is actually saved in view state so that the overhead of again generating
    the data(as per the selection criteria) can be avoided. Now, this View state has a limitation of storage of these records. When we put in some selection criteria, the no. of records is less hence no problem in actually storing the view state. But when there
    is no selection criteria, 16306 records are too much to be stored in view state. Hence the error occurs.
    We tried to solve this issue by creating a compressor class and overriding two methods:
     LoadPageStateFromPersistenceMedium
    SavePageStateToPersistenceMedium
    This has resolved the issue with Export to Excel. However, there is now some issue in the paging of the list view. The list view has a column with hyperlink which opens related data in a form. While we click on the link in 2<sup>nd</sup>
    page of the list view, it displays data for the link in the 1<sup>st</sup> page at same row.
    Please suggest how to resolve this issue or any workaround for this

    We have web application based on SharePoint. We have a list view to display data based on Search Criteria. We have total of around 16000 data. When we try to export all data to excel it gives an error. The cause of the issue is:
    View State is used to save the state of page i.e. the previous state. When the export to excel link is clicked, the data present in the grid is actually saved in view state so that the overhead of again generating
    the data(as per the selection criteria) can be avoided. Now, this View state has a limitation of storage of these records. When we put in some selection criteria, the no. of records is less hence no problem in actually storing the view state. But when there
    is no selection criteria, 16306 records are too much to be stored in view state. Hence the error occurs.
    We tried to solve this issue by creating a compressor class and overriding two methods:
     LoadPageStateFromPersistenceMedium
    SavePageStateToPersistenceMedium
    This has resolved the issue with Export to Excel. However, there is now some issue in the paging of the list view. The list view has a column with hyperlink which opens related data in a form. While we click on the link in 2<sup>nd</sup>
    page of the list view, it displays data for the link in the 1<sup>st</sup> page at same row.
    Please suggest how to resolve this issue or any workaround for this

  • How to control Object States of different objects with single button?

    I have a set of Images, stacked one on the other. I have selected all of them & created Object States for them. I also have a set of Text Objects, each containing a description of the images. These text objects are also stacked on top of each other & I've created object states for them too. I have two buttons which go to previous state & next state. When I do a mouse release operation on these buttons, only my images are moving from state to state.
    My question is how do I control the states of these different types of objects (images & type) so that they change states in sync with each other - I want to have an image 1 with its description, then image 2 with its description & so on. Thanks in advance.

    You just group your description with images

  • How to clear table control view lines?

    Dear Experts,
    I created one ALV Report with push buttons. User can select multiple line. After select the lines, when user clicks push button in ALV, then am calling POPUP screen 1100 with save and cancel button. which ever line user selected in ALV, that will appear in the POPUP screen 1100 with table control view.
    issue :
    Ex :
    In ALV user selected 3 lines , that appeared in POPUP screen 1100 table control view. Now user wants to select some more line in ALV. so user clicked cancel and reached ALV screen. user selected 2 more line in ALV (total 5 lines). Again user clicked same push button in ALV, But now same 3 lines (old record) are appearing in POPUP screen 1100, new records (5 lines) are not appearing.
    Code :
    My PBO internal table is having 5 records. but in table control only 3 records are appearing.
    PROCESS BEFORE OUTPUT.
      MODULE status_1100.
      LOOP AT git_prq_items1 INTO gwa_prq_items1
                             WITH CONTROL ctl_pr_items.    
    ENDLOOP.
    PROCESS AFTER INPUT.
      MODULE user_command_1100.
      LOOP AT git_prq_items1.
        MODULE read_table_control. " if any changes happened in table control - read table control.
      ENDLOOP.
    MODULE status_1100 OUTPUT.
      SET PF-STATUS ''.
    ENDMODULE.                 " status_1100  OUTPUT
    git_prq_items1 -  this internal table is having 5 records.
    Please suggest where should i correct.
    Regards
    chessleo.
    Edited by: sapleo on May 6, 2011 9:59 AM

    Hi.,
    Clear the records and populate new records., also use refresh table display if u are using oo alv.
    check  BCALV_GRID_05 report.,
    Hope this helps u.,
    Thanks & Regards
    Kiran

Maybe you are looking for