Change States in component from main view

The scenario like this:
The main view includes many component views. On my main view
there have a radio button to choice different role type, for
example: admin and user. For different role have different views.
But they don’t have big difference.
My question is how could I implement my component view change
states when I click button on the main view? I don’t want do
change states in main view since I need create two component views
for different roles.
Thanks.

Consider adding a second state to your application, even if
you don't put anything into it.
In each of the components that should change state when the
role is changed, add a listener on the application for the state
change event ("currentStateChange"). When this event is fired,
query the application for its current state:
var appState:String = (Application.application as
Application).currentState;
Use that to change the state of the component. Remember
you'll also need to do this when your component is first
created.

Similar Messages

  • Changing state of application from within a custom component

    Hello, I have several custom components all of which are included in the parent application.
    When I try to change state from a custom component, I get an error  saying "undefined state: state name". How do I change the state of the  application from within a custom component ? All the states are defined in the parent application.

    @linrsvp,
    If you are using Flex3 try Application.application.currentState = "somestate";
    If you are using Flex4 try FlexGlobas.topLevelApplication.currentState = "somestate";
    Don't forget to import the corresponding namespaces for the above.
    Thanks,
    Bhasker

  • EHP5 launchpad - application from main view

    With traditional homepage framework I used for ESS homepage, I cannot launch an application directly from Area Group page.
    Eg: I want to show 'Help docs' link on ESS home page. And onlick of this link should take user to external site.
    Now I am creating a launchpad for EHP5 ESS applications. Looks like I cant do this with launchpad too.
    I am restricted to take user to a main view > area view > external site.
    I checked all the BADI from spot APB_LAUNCHPAD, but could find anyway to modify this.
    Is this the way it is designed or did I miss anything?
    Thanks,
    Nag

    have you checked here
    Application HRESS_A_MENU with Overview Pattern Configuration (OVP) HRESS_AC_MENU
    Component Configuration HRESS_CC_MENU_AREA_GROUP which has been created for the FPM Launchpad component FPM_LAUNCHPAD_UIBB.
    Component Configuration HRESS_CC_MENU_AREA_GROUP which points to the following:
    Launchpad configuration Role: ESS and Instance: MENU for menu rendering.
    Launchpad configuration Role: ESS and Instance: RELATED_LINKS for the Related Links section in the Business Package for Employee Self-Service (WDA).
    Feeder Class CL_HRESS_LPD_MENU which is used to modify the menu at runtime based on BAdI implementations of HRESS_MENU.
    Also see Dynamic Rendering of the Menu (BAdI HRESS_MENU).
    http://help.sap.com/erp2005_ehp_05/helpdata/en/01/163f3e14e648cb909fb687d2736903/frameset.htm

  • How to get change a GUI component from another class?

    Hi there,
    I'm currently trying to change a GUI component in my 'Application' class from my 'Dice' class.
    So the Application class sets up some GUI including a JLabel that initially displays "Change".
    The 'Dice' class contains the ActionPerformed() method for when the 'Change' button (made from Application class) is clicked.
    And it returns an 'int' between 1 and 6.
    Now I want to set this number back int he JLabel from the Application class.
    APPLICATION CLASS
    import javax.swing.*;
    import java.awt.*;
    import java.util.Random;
    import java.awt.event.*;
    public class Application extends JFrame implements ActionListener{
         public JPanel rollDicePanel = new JPanel();
         public JLabel dice = new JLabel("Loser");
         public Container contentPane = getContentPane();
         public JButton button = new JButton("Change");
         public Dice diceClass = new Dice();
         public Application() {}
         public static void main(String[] args)
              Application application = new Application();
              application.addGUIComponents();
         public void addGUIComponents()
              contentPane.setLayout(new BorderLayout());
              rollDicePanel.add(dice);
            button.addActionListener(diceClass);
            contentPane.add(rollDicePanel, BorderLayout.SOUTH);
            contentPane.add(button,BorderLayout.NORTH);
              this.setSize(460, 655);
              this.setVisible(true);
              this.setResizable(false);
         public void changeDice()
              dice.setText("Hello");
         public void actionPerformed(ActionEvent e) {}
    }DICE
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class Dice implements ActionListener
         public Dice() {}
         public void actionPerformed(ActionEvent e)
              //super.actionPerformed(e);
              String event = e.getActionCommand();
              if(event.equals("Change"))
                   System.out.println("Will be about to change the 'dice' label");
                   Application application = new Application();
                   application.dice.setText("Hello");
    }

    It's all about references, baby. The Dice object needs a way to communicate with the Application object, and so Dice needs a reference to Application. There are many ways to pass this. In my example I pass the application object directly to Dice, but a better way would use interfaces and some indirection. Look up the Observer pattern for a better way to do this that scales much better than my brute-force approach.
    import javax.swing.*;
    import java.awt.*;
    public class Application extends JFrame // *** implements ActionListener
        // *** make all of these fields private ***
        private JPanel rollDicePanel = new JPanel();
        private JLabel dice = new JLabel("Loser");
        private Container contentPane = getContentPane();
        private JButton button = new JButton("Change");
        // *** pass a reference to your application ("this")
        // *** to your Dice object:
        private Dice diceClass = new Dice(this);
        public Application()
        public static void main(String[] args)
            Application application = new Application();
            application.addGUIComponents();
        public void addGUIComponents()
            contentPane.setLayout(new BorderLayout());
            rollDicePanel.add(dice);
            button.addActionListener(diceClass);
            contentPane.add(rollDicePanel, BorderLayout.SOUTH);
            contentPane.add(button, BorderLayout.NORTH);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setPreferredSize(new Dimension(460, 655));
            pack();
            setLocationRelativeTo(null);
            setVisible(true);
            setResizable(false);
        // *** I'm not sure what this is supposed to be doing, so I commented it out.
        //public void changeDice()
            //dice.setText("Hello");
        // *** ditto.  I strongly dislike making a GUI class implement ActionListeenr
        //public void actionPerformed(ActionEvent e)
        // *** here's the public method that the Dice object calls
        public void setTextDiceLabel(String text)
            dice.setText(text);
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class Dice implements ActionListener
        // *** have a variable that holds a reference to your application object
        private Application application;
        private boolean hello = true;
        public Dice(Application application)
            // *** get that reference via a constructor parameter (one way to do this)
            this.application = application;
        public void actionPerformed(ActionEvent e)
            String event = e.getActionCommand();
            if (event.equals("Change"))
                System.out.println("Will be about to change the 'dice' label");
                if (hello)
                    // *** call the application's public method
                    application.setTextDiceLabel("Hello");
                else
                    application.setTextDiceLabel("Goodbye");
                hello = !hello;
                //Application application = new Application();
                //application.dice.setText("Hello");
    }

  • Show component from main application mxml.

    Hi all,
         I have a main application mxml and inside has a button named show_form. After that, I design an form named Form_A. And now, I want when click on show_form button fire the Form_A and made it appear.
         Hown can I do this ?
         Thanks !

    There are many ways of doings this, it depends how your forms are shown.
    Are they in a ViewStack or similar container? If so just change the view from the click handler function for the button.
    If they are in a Canvas/HBox/VBox, in the click handler function of the button you can do a check like if Form_A.visible==true then submit it and hide it, else submit the other form. You can also have a variable that tracks if Form_A was submitted.
    If you have code, post it here and we can find the best solution with a clear example in front.

  • Is it possible to change the "/messagebroker/amf/", from the view of the webserver?

    I have BlazeDS integrated into a J2EE application.  All method innvocations from the Flash client flow through an Apache webserver, until it reaches its destination of the J2EE application.  The Flash client exercises several distinct methods through this BlazeDS service.
    My question is, from an Apache webserver perspective, is there a way for Apache to distinguish one method from another?  Right now, Apache views everything as a POST to the URI of "../messagebroker/amf".  The options seem to be:
    1)  Dig into the POST to find the method signature.  This seems scary given the POST has binary content.
    2)  Try to change the URI of "../messagebroker/amf" for each method.  I have no idea how to go about this.
    3)  Maybe include a method signature in the http header?  Again, not sure how to do such a thing in Flash/Flex.
    If anyone has addressed this requirement in the past, I'd be very greatful for some advice.

    Hi. I haven't heard of anyone trying to do this in the past. I'm just curious, why does the Apache server need to know what method is being called?
    I would think something like 2) you could do mostly on the Apache side. Just brainstorming here but in your client application(s) you could manually create a ChannelSet with a channel that had the method name in the uri, so for example "../messagebroker/amf/method1" and "../messagebroker/amf/method2". The apache server could then do whatever it needed to do for the individual methods and redirect all requests to "../messagebroker/amf".
    Here is a link to the BlazeDS documentation that deals with channels and endpoints. That has some information on manually creating a ChannelSet and channels on the client in case you decide to go that route.    
    http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=lcconfig_2.html
    Hope that helps.
    -Alex

  • Run function in component from Main Application

    Hello all.
    I have my main.mxml application, that has a component inside of it.  The component is called <ns1:record/> with an id of "rec".
    This component has a function inside of it named doConnect(event:MouseEvent).
    Now i want to be able to add an event listener to a button on the Main.mxml that will run a function inside the component when clicked.
    I have managed to add an event listener to the Main.mxml that triggers a function held within the Main.mxml when a button clicked inside the component is clicked.
    I did this by using this code.
                <ns1:record id="rec" x="9" y="6" camera="{camera}" microphone="{microphone}" creationComplete="makeEvent()">
                </ns1:record>             //Event listener
                public function makeEvent():void {
                    rec.backbtn.addEventListener(MouseEvent.CLICK,swapstate);
                protected function swapstate(event:MouseEvent):void {
                    viewstack1.selectedChild=config;
    No matter what i try thou i cant get this to work the other way around.
    What i need help with is - clicking a button within the Main.mxml to run a function inside the component Record.
    If anyone can help that would be great !
    Thanks in advance.

    Hi djh88ukwb,
    From your post if I understand you correctly you want to listen for a event in record component when a button in main mxml is clicked...based on this
    assumption I am suggesting you a solution...
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete()">
    <mx:Script>
      <![CDATA[
       private function onButtonClicked(event:MouseEvent):void
       rec.swapstate(event);
      ]]>
    </mx:Script>
    <ns1:record id="rec" x="9" y="6" camera="{camera}" microphone="{microphone}" creationComplete="makeEvent()"></ns1:record>
    <mx:Button id="myBtn" label="Call Function in Record Comp" click="onButtonClicked()" />
    </mx:Application>
    <!-- In your record component Add a public function  swapstate as shown below-->
    public function swapstate(event:MouseEvent):void {
                    viewstack1.selectedChild=config;
    Please try this and let me know....
    Thanks,
    Bhasker

  • Generate insert statement using columns from all_tab_cols view

    i am trying to generate a dynamic insert statement using the columns for a table from the all_tab_cols view. if i do a select, i get the output as rows. How do i convert the row out to columns so that i get something like this : INSERT INTO TABLE_NAME (COL1, COL2, COL3,COL4.....) .
    Any help will be appreciated!

    SQL> select * from my_test;
    no rows selected
    SQL> desc my_Test;
    Name                                      Null?    Type
    COL1                                               NUMBER
    COL2                                               NUMBER
    COL3                                               NUMBER
    SQL> declare
      2  cursor c1 is select column_name from all_tab_cols where table_name = 'MY_TEST';
      3  v_sql VARCHAR2(10000) := NULL;
      4  v_cnt NUMBER := 0;
      5  BEGIN
      6  FOR I in C1 LOOP
      7  v_cnt := v_cnt + 1;
      8  v_sql := 'INSERT INTO my_test('||I.column_name||') values('||v_cnt||')';
      9  EXECUTE IMMEDIATE v_sql;
    10  END LOOP;
    11  COMMIT;
    12  end;
    13  /
    PL/SQL procedure successfully completed.
    SQL> select * from my_Test;
          COL1       COL2       COL3
             1
                        2
                                   3
    SQL>

  • Calling a method in a component from main application

    Hi,
    I have a mxml component( menu1.mxml) . In the menu1.mxml
    there is a include for the actionscript file(menu1.as). In the main
    application page(SampleLogin.mxml) I want to call the method in the
    btnSubmit_Click() on the saveIndex() method for case 0. I am
    attaching all the code below

    case 0:
    menuOne.btnSubmit_Click( );
    break;
    Also it would probably be following best practices to used a
    custom event to pass the information in your "LoginButton_Click()"
    function to the application.

  • Load/Unload Component from Main Application

    I want to load in my main application 2 components. At this moment I load them with this:
    <components:loadProject id="loadPrj" visible="false" click="loadPrj_clickHandler(event)" verticalCenter="7" horizontalCenter="0"/>
    and I only set visible to true. Inside this component there is a canvas.
    But, is there any other way to do this using an AS class file? I would like to load/unload it on click, not only set true/false to visible.

    For dynamic creation and destruction of objects, you want to use ActionScript.
    So in your main app file, you might have a button that triggers a click handler that does this:
    private function myClickHandler()void {
                    var b1:CustomComponent = new CustomComponent();
                    var b2:CustomComponent = new CustomComponent();
                    /// Be sure to add them to the display list if they are visual components
                    myPanel.addElement(b1);
                    myPanel.addElement(b1);

  • Action reference in the MAIN view for other Views

    Hi Experts,
    I have created a view(MAIN) that contains SUBMIT button and also included four other views(Using ViewContainerUIElement) in the MAIN view itslef. So am calling the respective view based on some certain condition from MAIN view.
    Now my problem is, am using  check_mandatory_attr_on_view() method which is being called on SUBMIT action from MAIN view of WDDOBEFOREACTION. But it is not checking Required Fields from other views. It checks the Required Fields only in the MAIN view.
    I know that I want to call the reference of other views in MAIN view, but how can I do it?
    Please help me, as how I can check the Required fields on action of SUBMIT button in MAIN view for other views.
    BR,
    RAM.

    Hi,
    Though am in MAIN view, If i clicks the submit button it checks the Required fields on both MAIN and Sub views, where still I have not called the Sub view.
    If you didn't call the sub view, the WDDOINIT method of your sub view wouldn't have been triggered and so the sub view reference is not set in the component controller, isn't it.?
    OR you are calling sub view separately in the initial state and get the reference and then in your MAIN view calling the sub view based on condition in the View Container UI..?
    If so, create an attribute in your Main view (say sub_view_name of type string) and then use the below code to get the current sub view name and then pass the corresponding sub view reference:
    DATA:lr_view_controller    type ref to        IF_WD_VIEW_CONTROLLER,
           lr_main_view_usage  type ref to        IF_WD_RR_VIEW_USAGE.
           lr_vc_assignment      type ref to        IF_WD_RR_VIEW_CNT_ASSIGNMENT.
           lr_view_usage           type ref to        IF_WD_RR_VIEW_USAGE.
           lr_t_views                 type                WDRR_VCA_OBJECTS.
           lr_s_view                  like line of        lr_t_views.
           lr_view                     type ref to        if_wd_rr_view.    
          lr_view_controller = wd_this->wd_get_api( ).
        lr_main_view_usage = lr_view_controller->GET_VIEW_USAGE( ).
       lr_t_views  = lr_main_view_usage->GET_VIEW_CNT_ASSIGNMENTS( ). "This will return all the View Container assignments.
    * Now loop over all the View containers and get the reference of embedding view.
       loop at lr_t_views  into lr_s_view .
          lr_vc_assignment = lr_s_view-VIEW_CNT_ASSIGNMENT.
          lr_view_usage  = lr_vc_assignment->GET_DEFAULT_VIEW_USAGE( ). " This will return view usage reference
          lr_view = lr_view_usage->get_view( ). " This will have the meta info of view
          wd_this->sub_view_name = lr_view->get_name( ).   
       endloop.
    Now in onAction submit,
    CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW(
                                  EXPORTING
                                   view_controller =  lr_view_controller " MAin view reference
    case wd_this->sub_view_name.
    when 'SUB_VIEW1'.
    CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW(
                                  EXPORTING
                                   view_controller = wd_comp_controller->gr_emb_view1.
    when 'SUB_VIEW2'.
    CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW(
                                  EXPORTING
                                   view_controller = wd_comp_controller->gr_emb_view2.
    Or, alternatively; create all the nodes(of sub views) in component controller, then map all those to MAIN view, then read the required node attributes and validate manually.
    hope this helps u,
    Regards,
    Kiran

  • Client-side Memory leak while executing PL/SQL and reading from a view

    Iam noticing memory leaks in OCCI while performing the following:
    Sample function()
    1. Obtain a connection
    2. Create a statement to execute a PL/SQL procedure
    3 Execute the statement created in step #2
    4. Terminate the statement created in step #2
    5. Create a statement to read from a view which was populated
    by executing stored procedure in step #3
    6. Execute the statement created in step #5
    7. Terminate the statement created in step #5
    8. Release the connection
    The PL/SQL populates a view with fixed 65,000 records for every execution. PL/SQL opens a cursor, loads 65000 records and populates the target view and closes the cursor at the end. If i invoke the above function it results in memory leak of 4M for every call. I tried several variants such as:
    1. Disabling statement caching
    2. Using setSQL instead of newly creating second SQL statement
    3. Obtaining two separate connections for these two activities (PL/SQL exec and View read)
    4. Breaking the sample function into two, one for each of these activities (PL/SQL exec and View read).
    All the combinations results in the same behaviour of 4M memory leak.
    Iam using Oracle 10g Client/Server 10.2.0.1.0.
    Is there any known limitations in this area?

    Yes. Iam closing the result set and terminating the statement.
    My program contains layers of inhouse wrapper classes, which will take some time for
    me to present it in pure OCCI calls, to be posted here for your understanding.
    After some more debugging, i found that if the connection level statement caching is set to
    0, the memory leak is much lower than before.
    Thanks.
    Message was edited by:
    user498920

  • Changing states from within a component

    Let's say that I have a TileList that is rendering data in a
    VBox. Eventually the TileList fills up and starts scrolling. I want
    to change states when clicking on item in the TileList.
    I don't want to place the click-attribute in the TileList,
    because it will change states when I am scrolling the list without
    actually selecting anything.
    I want to say click="currentState='state2'" inside the VBox,
    but that does not work because state2 is at the root level, and I
    don't know how to get to the root-level (in lack of a better word)
    from withing the component.
    This is not the proper syntax, so misunderstand me the right
    way here... Is there an equivallence to
    click="currentState='_root.state2'" in mxml?
    Thanks for any suggestions or best practices. I want the easy
    way out.
    This is the general structure...
    <mx:Application>
    <mx:states>
    <mx:State id="state1"/>
    <mx:State id="state2"/>
    <mx:State id="state3"/>
    </mx:states>
    <mx:TileList dataprovider="{...}">
    <mx:itemRenderer>
    <mx:component>
    <mx:VBox id="ClickThisBoxToChangeStates">
    <mx:Image/>
    <mx:Label/>
    </mx:Vbox>
    </mx:component>
    </mx:itemRenderer>
    </mx:TileList>
    </mx:Application>

    Your assumption is right.
    It doesn't work because there is no state2-state defined
    within the mx:component.
    In the documentation about changing states it says that I can
    go from application level and change states within a component;
    like this: click="currentState='mycomponent.anotherstate'" but not
    how I can change a state at application level from within a state.
    When I try, it says (at runtime) that the state is not defined.
    So I don't know why <mx:VBox
    click="currentState='state2'"/> doesn't work.
    I apprechiate your expertese a lot.

  • How to change state of a constraint from DEFERABLE to IMMEDIATE?

    Hi,
    I am runnig 10gR2 and would like to change state of a constraint from
    DEFERABLE to IMMEDIATE without recreating it.
    The change is working at the session level with
    SET CONSTRAINT <constraint name> IMMEDIATE;
    But this is not visible for other users.
    So my question is, if there is any other way to do it, so the change would be visible for every user.
    Here is what I have done:
    CREATE TABLE TEST_TBL
    ID NUMBER
    ALTER TABLE TEST_TBL ADD CONSTRAINT pk_test_tbl PRIMARY KEY(ID)
    INITIALLY DEFERRED DEFERRABLE;
    SQL> INSERT INTO test_tbl VALUES(1);
    1 row created.
    SQL> INSERT INTO test_tbl VALUES(1);
    1 row created.
    SQL> INSERT INTO test_tbl VALUES(1);
    1 row created.
    SQL> COMMIT;
    COMMIT
    ERROR at line 1:
    ORA-02091: transaction rolled back
    ORA-00001: unique constraint (TEST_SCHEMA.PK_TEST_TBL) violated
    The constraint is checked only at commit,
    To change this:
    SQL> SET CONSTRAINT pk_test_tbl IMMEDIATE;
    Constraint set.
    SQL> INSERT INTO test_tbl VALUES(1);
    1 row created.
    SQL> INSERT INTO test_tbl VALUES(1);
    INSERT INTO test_tbl VALUES(1)
    ERROR at line 1:
    ORA-00001: unique constraint (TEST_SCHEMA.PK_TEST_TBL) violated
    But if I would connect with user B, I would be able to do multiple inserts with value 1.
    Thanks

    I am runnig 10gR2 and would like to change state of a constraint from
    DEFERABLE to IMMEDIATE without recreating it.From Oracle Constraints:
    Note: A non-deferrable constraint is generally policed by a unique index (a unique index is created
    unless a suitable index already exists). A deferrable constraint must be policed by a non-unique index
    (as it's possible for a point of time during a transaction for duplicate values to exist). This is why
    it is not possible to alter a constraint from non-deferrable to deferrable. Doing so would require
    Oracle to drop and recreate the index.
    A PK enforces uniqueness procedurally without relying on a unique index. The main advantage
    of a non-unique index is the constraint can be disabled and re-enabled without the index being dropped and recreated.

  • Transfer data from a Pop up to the main view

    Dear expert,
    i want to transfer data from a popup to the main view,
    i created a TEXT_EDIT UI-Element on my main View and on a popup, and when writing a text on the TEXT_EDIT UI-element on the popup, i want get it (or display it) on the TEXT_EDIT UI-Element of my main View after clicking on the Popups OK button .
    is there any kind of ways to do this
    BR

    HI,
    Is your issue resolved.Create a node and a attribute in Comp controller and map this to the both the Main and Popup view.
    Bind the same attirbute to btoh the TEXT EDIT UI elements..U need not write any code for this..When you enter the value in the popup and the same will be shown in the MAIN view's TEXT edit.There is not need to SET ATTRBUTE as it is already bound to the context attribute..Hope it is clear. IOn OK button just...close the popup..
    now i am getting error :
    View Is Already Displayed in Window W_MAIN of Component ZCOMPO
    I thnk you are trying to create/open a popup for the same view twice.Please check it.
    Regards,
    Lekha.

Maybe you are looking for

  • Looping issue in Smartform

    Hi All.. I am working on a smartform. While activating the form, i came across a error called "A line of I_ITEMS and WA_ITEMS is not mutually convertible. In Unicode program, I_ITEMS must have  same structure layout". But in program, i have defined b

  • How to display a description and make validations

    Hello colleagues... As most of you I'm coming from a Forms background and I'm triying to understand some techniques. But my question is If have a simple PL/SQL block to display a descripction and make some validations, How can I do the same task usin

  • Technical system in SLD

    Hi everybody, Can anyone let me know for which systems connection property does ,the Standalone technical system refers to in  SLD? Regards. Subrat

  • Ordinary Depreciation Date

    Hi SAP Gurus, In my understanding the asset is depreciated since we bought it. Lets say I have bought one asset in 01/01/2008  and I would run depreciation on 06/01/08. Would it calculate the depreciation from the date which we will key in Master dat

  • SQLJ Error

    I am trying to write the following prog to display the detail of the table prod (pname varchar2(20), price number(10)),using Positional Iterator. but couldnt write a simple program . here is the code, as I compile the code it says testpos.sqslj:45.2-