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

Similar Messages

  • Best approach to using command link from within a custom component

    I have created a navigation component "Menu" , used as follows:
    <custom:menu />The contents of menu are stored in an xml file and the Menu component delegates the rendering to a custom renderer, which basicaly writes out html links. (Actually, the component does a lot more, but I'm simplifying to get to the point.).
    Sometimes, I need to render a command link instead of a regular html link. I don't want to re-invent the wheel here, so I want to delegate this to the standard command link components.
    Approach 1: create child components within the Menu component constructor, e.g.
    HtmlCommandLink c = new HtmlCommandLink();
              MethodExpression e = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().
                   createMethodExpression(FacesContext.getCurrentInstance().getELContext(),
                   "#{registrationEditor.enterSubmission}",
                   String.class,
                   new Class[] { });
              c.setActionExpression(e);
              c.setValue("TestLink");
              c.setTransient(true);
              getChildren().add(c);Approach 2: delegate to the CommandLinkRenderer within my custom renderer, e.g.CommandLinkRenderer delegate = new CommandLinkRenderer();
                        HtmlCommandLink link = new HtmlCommandLink();
                        ExpressionFactory elFactory =
                             FacesContext.getCurrentInstance().getApplication().getExpressionFactory();
                        MethodExpression actionExpression =
                             elFactory.createMethodExpression(context.getELContext(), c.getExpression(), String.class, new Class[] {});
                        link.setActionExpression(actionExpression);
                        link.setParent(component.getParent());
                        link.setValue(c.getLabel());
                        delegate.encodeBegin(context, link);
                        delegate.encodeChildren(context, link);
                        delegate.encodeEnd(context, link);Is either of these a respectable approach - they feel a little hackish. If so, which do you prefer. If not, what do you recommend?
    Thanks
    Richard

    I think either is a fine approach and not at all hackish. I prefer the second, although I couldn't tell you why (just a gut feeling). That said, I haven't tried either so there may be hidden problems. My main concern would be what happens when the request is submitted from the page, that the Restore View phase is done correctly so that the proper event is fired.

  • Navigation from within a custom component ???

    Hi All
    I am working on a new project in Flex 4 and i have a Viewstack on my main page.  Then i have 6 custom components in the viewstack, the first being the home page.  In this homepage custom component i have linkbuttons which i want the user to click on to navigate the viewstack ..
    So what would be the best way to do this ?
                             <fx:Script>
                                  <![CDATA[
                                       ]]>
                             </fx:Script>
                   <mx:ViewStack id="vs" width="800" height="1000">
                        <s:NavigatorContent width="100%">
                             <v:VHome id="vHome" />
                                            <v:VHome id="vAbout" />
                                            <v:VHome id="vShop" />
                                            <v:VHome id="vProducts" />
                                            <v:VHome id="vSupport" />
                                            <v:VHome id="vContact" />
                             </s:NavigatorContent>
                   </mx:ViewStack>
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               width="100%">
         <s:layout>
              <s:VerticalLayout />
         </s:layout>
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
              <mx:Spacer height="10" />
              <s:Panel title="Welcome" width="100%">
              </s:Panel>
              <s:HGroup>
                   <s:Panel width="397" height="200">
                        <MX:LinkButton />
                   </s:Panel>
                   <s:Panel width="397" height="200">
                        <MX:LinkButton />
                   </s:Panel>               
              </s:HGroup>
              <s:HGroup>
                   <s:Panel width="397" height="200">
                        <MX:LinkButton />
                   </s:Panel>
                   <s:Panel width="397" height="200">
                        <MX:LinkButton />
                   </s:Panel>               
              </s:HGroup>
              <s:HGroup>
                   <s:Panel width="397" height="200">
                        <MX:LinkButton />
                   </s:Panel>
                   <s:Panel width="397" height="200" >
                        <MX:LinkButton />
                   </s:Panel>               
              </s:HGroup>
    </s:Group>
    Many Thanks

    If I am understanding this correctly, you have three choices.
    1. Do something like ViewStack.selectedIndex(id of tab in viewstack), but not sure if selectedIndex is correct but whatever the method name is.
    2. Fire an event and set up listeners
    3. Go with a framework and use its notifications or event system
    If this is a production app I suggest fighting the urge to go the easy route and use a framework as before you know it you will in the middle of spaghetti code.

  • WebLogic Server 7.0: Including another JSP from within a custom tag

    Hi all,
              has anyone made experience with including (ie. processing) a dynamic
              resource (JSP) from within a custom JSP tag?
              Using the following code inside doEndTag():
              pageContext.include("/templates/blub.jsp");
              throws a ServletException (Note: the JSP is a part of the web app
              which is deployed as war). Does it make a difference if the web
              application is warred up into and therefore include cannot resolve the
              specified relative URL?
              [Tomcat 4.1.10 doesn't have problems for that matter]
              The full stack trace is:
              javax.servlet.ServletException: java.lang.NullPointerException
              at com.foo.taglibs.template.InsertTag.doEndTag(InsertTag.java:55)
              at jsp_servlet._models.__index._jspService(__index.java:774)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:376)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
              at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5360)
              at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2468)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
              TIA,
              niko.
              

    Try the same code from an exploded web app.
              Niko Schmuck wrote:
              > Hi all,
              >
              > has anyone made experience with including (ie. processing) a dynamic
              > resource (JSP) from within a custom JSP tag?
              >
              > Using the following code inside doEndTag():
              >
              > pageContext.include("/templates/blub.jsp");
              >
              > throws a ServletException (Note: the JSP is a part of the web app
              > which is deployed as war). Does it make a difference if the web
              > application is warred up into and therefore include cannot resolve the
              > specified relative URL?
              > [Tomcat 4.1.10 doesn't have problems for that matter]
              >
              > The full stack trace is:
              >
              > javax.servlet.ServletException: java.lang.NullPointerException
              > at com.foo.taglibs.template.InsertTag.doEndTag(InsertTag.java:55)
              > at jsp_servlet._models.__index._jspService(__index.java:774)
              > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              > at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)
              > at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
              > at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:376)
              > at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
              > at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5360)
              > at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
              > at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
              > at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2468)
              > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
              >
              > TIA,
              > niko.
              Rajesh Mirchandani
              Developer Relations Engineer
              BEA Support
              

  • Retrieve data from AD from within a custom sharepoint 2010 webpart

    Hi,
    I have a requirement to retrieve user data from AD and display from within a custom built webpart.
    I am using the PrincipalContext class etc to get the info from AD, i have sucesfully done this in a console program without having to specifiy a username/password.
    In the webpart i have successfully retrieved the data by hard coding my domain username/password.
    Any ideas what i could do to get the webpart to retrieve information from AD without having to specify username/password?
    thanks cjm

    Hi C.J, 
    I wrote an example of this using credentials stored in the Secure Store in the TechNet Wiki. The article is here: http://social.technet.microsoft.com/wiki/contents/articles/20110.sharepoint-retrieving-credentials-from-the-secure-store-application-using-c.aspx
    There's an example in the above article about building a webpart that connects to AD using the credentials.
    Regards, Matthew
    MCPD | MCITP
    My Blog
    View
    Matthew Yarlett's profile
    See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
    Upload and Crop User Profile Photos

  • Add task to notification from within the customer enhancement

    Is there a function module that will add a task to a notification from within a customer exit?  I've tried to use a BAPI within QQMA0014 (Save Exit) , but this interferes with the processing of the notification.  The imported internal task table for the exit can be manipulated, but I am not sure how, or what, needs to be present and would prefer using a function module.
    Thanks,
    Brian Basch

    Brian,
       I would activate the change document for the custom fields which will act as a trigger for a custom event(Even better than creating a generic event based on create / change notification) that would be tied to a simple single step standard task pointing to a create Task FM. I would use the exit on SAVE to update the custom fields for the task(You will have to enhance your BAPI to update the custom fields if you don't want to use this exit).
    Regards
    Narasimhan

  • Start a WS application from within a java program

    Hi,
    I need to start a WebStart application from within a java program. Therefore I develeoped a class which starts javaws.exe within its main-method like this:
    try {
    Runtime.getRuntime().exec(
    "c:\\java web start\\javaws.exe http://a.b/c.jnlp"
    } catch (Exception e) {
    e.printStackTrace();
    And that did not work. Java Web Start tries to start the .jnlp program but returns with the message, that the app-desc|applet-desc|installer-desc|component-desc is missing. But it is there: It is an applet and thus I defined an applet-dec.
    I tried to do it from a command line with the followinf command:
    java -Djnlpx.home="C:\abc" -cp "C:\abc\javaws.jar" com.sun.javaws.Main http://a.b/c.jnlp
    And that works. But using this command from within my jjava prog using the Runtime.exec() method does not work.
    By the way, simply type "javaws http://a.b/c.jnlp" at the command line does not work.
    Can anybody help me? How may I start a .jnlp program within another java program.
    Kind Regards,
    Tobias Neubert

    Hi,
    I recently had a quite similar problem. At least the error message by the Java Web Start application on Mac OS X complained about the same error (app-desc|applet-desc|installer-desc|component-desc). It turned out to be some bad invisible characters in the jnlp file. I copied some sample from a web page which for some reason contained some unicode chars that the parser doesn't like. Use a different text editor or the less command on unix to see if there are some strange characters in you jnlp file.
    But it seems strange that it does work from the command line and not from your code.
    -Stefan

  • Changing a .properties file from within a programme

    Hi, I was just wondering is there anyway that i can change a .properties file from within a programme?
    I have certain values in the .properties file and I want to add a username and password to the file once it has been entered in a login part of the programme.
    I have had a look at the docs and can not seem to find any suitable methods.
    Cheers Gareth.

    store is a good method.
    In practical use, sometimes you have a .properties file full of comments (properties files are to be modified by humans, and humans need comments), but they are not retrieved by "load" so they will not be stored back by "store". It's a pity that it happens (the equivalent Windows API, WritePrivateProfileString, has a better behaviour).
    Maybe someone has written a method that can modify a properties file, without changing the order of the pairs name=value and without throwing out comments.

  • Can you Launch External Applications From Within InDesign Ebook?

    Hi all,
    I was wondering if it is possible to open an external application from within an ebook (created with InDesign) e.g. click on a link and have an external ssh client open up for instance?
    Thanks in advance for any advice.
    Regards,
    RG

    It's possible to include hyperlinks in an InDesign file and export them in an EPUB file. Since I'm not familiar with working with SSH clients (in fact, I just had to Google it to have a clue what you're talking about), is this something that can be invoked in a standard URL format? If so, you could probably include it.
    The next issue is whether the link would work. The link couldn't be used directly in any eBook reader I know of, but at least the iBook on an iPad or iPhone would switch to to Safari to let you follow a URL to its destination. But I don't think that's possible on most eBooks.

  • To contact 3rd party application from within EJB container

    What are the possible options to communicate with an external application from within EJB container? Options that I can think of are
    - RMI
    - JMS
    - Socket communication
    - HTTP
    - any other option???
    And if anyone can give the pros & cons of the different approaches, based on their experiences it will be great.

    Hi,
    There is one more.
    Web Services which is much powerful than any other.
    Ofcourse for this also u have to use socket communication and http protocol.
    SOAP(Simple Object Access Protocol).. I think u got it..
    I prefer SOAP as it has many adavantages over RMI and other.
    Thanks,
    All the best.
    What are the possible options to communicate with an
    external application from within EJB container?
    Options that I can think of are
    - RMI
    - JMS
    - Socket communication
    - HTTP
    - any other option???
    And if anyone can give the pros & cons of the
    different approaches, based on their experiences it
    will be great.

  • Can´t change alias to use from within iPhone 4 Mail app

    According to the iPhone 4 users manual to choose the alias you want to use when sending an email, it´s as simple as to tap de "from field" to select the desired alias.
    The problem, in my case, is that the "from field" doesn´t appears, so I can´t tap on it and I cannot see from within the iPhone 4 Mail application wich alias I am supposed to be using.
    I´ve changed my default acount to use in Mobilme and it works fine there but it uses another different from the one I choosed in the iPhone 4 (though it changed the alias I had before).
    Any suggestions on what to do ???

    See if you can get Skype to work.
    Basic troubleshooting steps  
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 
    Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101
     In Memory of Steve Jobs 

  • Copy application from within an application?

    Ok, this may be a bit of a stretch, but is it possible to create a new application as a copy of an existing one from within an application?
    To explain: I'm envisioning an APEX framework where I have a "core" application which has all of my standard functionality built in; whenever I want to build a new application, I copy that, rather than building a new one from scratch. Information about the applications (active status, authentication method, created by, last modified by, description, etc.) would be stored in a central (custom) table (this much has been covered by Scott Spendolini in this presentation).
    So, I'd like to build an application which would show me the data from this central table, and also have a wizard that would a) copy the core application to a new ID, potentially setting some features in the process, and b) create the appropriate record in the central table.
    Thanks,
    -David

    David,
    I am having the same thoughts and will watch this thread. I believe what you are referring to is "subscribing to a master application" of which I have no experience in.
    Just saw another thread similar to this one:
    See {thread:id=1774693}
    Jeff
    Edited by: jwellsnh on Nov 22, 2010 1:58 PM

  • How to change the default directory from within SQL*Plus ?

    Hello,
    I want to change the default directory directly from within SQL*Plus to be able to launch my command files with simple instructions like :
    @my_command.sql
    If I haven't launched SQL*Plus from the directory containing the file my_command.sql, how do I change the default directory to the directory of my command files ?
    I've searched through the Oracle documentation, there's no SET DEFAULTDIR or something like that. When I do a SHOW ALL, there's no variable containing the default directory.
    If you have an idea...
    regards,
    Jérôme.

    Hi Jérôme (J鲴me ?),
    You cannot directly do that, but you can use @@ instead of @ to run subscripts in the same directory as the superscript
    # head /tmp/tl30/xxx/[xyz].sql                    
    ==> /tmp/tl30/xxx/x.sql <==
    prompt call y
    @y
    prompt call z
    @@z
    quit
    ==> /tmp/tl30/xxx/y.sql <==
    prompt i am in y
    ==> /tmp/tl30/xxx/z.sql <==
    prompt i am in z
    # pwd                                             
    /root
    # sqlplus -s scott/tiger@lsc62 @/tmp/tl30/xxx/x.sql
    call y
    SP2-0310: Datei "y.sql" konnte nicht geöffnet werden
    call z
    i am in zKind regards
    Laurent Schneider
    OCM DBA

  • Calling a java application from within another class

    I have written a working java application that accepts command line parameters through public static void main(String[] args) {} method.
    I'm using webMethods and I need to call myapplication from within a java class created in webMethods.
    I know I have to extend my application class within the webMethods class but I do not understand how to pass the parameters.
    What would the syntax look like?
    Thanks in advance!

    why do you want to call the second class by its main method ??
    Why not have another static method with a meaningfull name and well defined parameters ?
    main is used by the jvm as an entry point in your app. it is not really meant for two java applications to communicate with each other but main and the code is not really readable.
    Have a look at his sample
    double myBalance = Account.getBalance(myAccountId);
    here Account is a class with a static method getBalance which return the balance of the account id you passed.
    and now see this one, here Account has a main method which is implemented to call getBalance.
    String[] args = new String[1];
    args[0] = myAccountId;
    Account.main(args);
    the problem with the code above is
    main doesn't return anything so calling it does do much good. two the code is highly unreadable because no one know what does the main do... unlike the sample before this one where the function name getBalance clearly told what is the function doing without any additional comments.
    hope this helps.... let me know if you need any additional help.
    regards,
    Abhishek.

  • Starting an external .exe application from within Visual Basic

    How do I start an external .exe appliction from within Visual Basic. for example start Internet Explorer or FireFox?
    Thanks in advance
    Big Buzzard
    Philippe de Marchin

    How do I start an external .exe appliction from within Visual Basic. for example start Internet Explorer or FireFox?
    If you know the path and filename of the application, or if it is an application that the operating system will find for you, then you can pass the application details to the Start method of the Process class.   If you don't know the path and filename
    of the application - for instance you want to start the user's web browser but it might be IE or Firefox or something else, then the argument to the Start method can be of any file type for which the extension has been associated with an application installed
    on the system. 
    https://msdn.microsoft.com/en-us/library/53ezey2s(v=vs.110).aspx

Maybe you are looking for