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.

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

  • 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.

  • 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

  • Navigating from within movies

    I've split my site up into movie sections for easier
    reference on the main timeline. How do I navigate from within a
    movie back to the main timeline. I've tried frame numbers, level
    numbers and a few others.
    From the main timeline I can open up the movie I want but
    cant get back. I get stuck in that frame.

    Same here I get the same errors. Not sure what this is. I have noticed that iTunes 9 is a little less responsive than previous releases. I hope this will be a fix.

  • Java:comp/env namespace is only available from within a J2EE component

    Can someone help me to explain and resolve the Exception?
    The Exception is like below:
    javax.naming.NamingException: java:comp/env namespace is only available from within a J2EE component

    Hi temp,
    I can only guess here -- since you haven't provided much information,
    but if you are trying to lookup an EJB from some client class, then
    the client class must also be deployed to OC4J in order to use the
    "java:comp/env" namespace.
    I think if you did a search of this forum's archives for the text
    "java:comp/env", it would probably explain lots of things to you.
    Good Luck,
    Avi.

  • Using transitions and effects within a custom component

    I have created a custom mxml component page within my
    application with an id=Theatre2. When the appropriate button is
    clicked in the main application Theatre2 opens by fading in. Within
    Theatre2 there are two main canvas containers with
    id=theatreLeftMain and theatreRightMain. Within theatreRightMain,
    there are several canvas containers with id=aboutus, curriculum,
    photos, awards0708 and awards0607. They are stacked on top o of
    each other and present via the appropriate button click. I want
    these several canvas containers to each “fade in” when
    the appropriate button is clicked . I have tried both transitions
    and effects but I haven’t been able to get them to work on
    these several internal canvas containers. The Theatre2 component
    page fades in great. Suggestions as to what to use to fade in these
    several containers would be greatly appreciated(effect or
    transition? where to put the code? code to use?). Thanks Joe
    Kerenick

    I found this component, with available source:
    http://www.tink.ws/blog/pairedstackeffect-fade-squash/
    Tracy

  • Is it possible to process a 0kb file within a custom pipeline component?

    Hi There, 
    You probably wondering.. what the hell do you need this for?
    Well.. we have a third party application that process a file as following
    1) Import the original file
    2) Export the original file
    3) Append the original file (with the data I need)
    4) Create a 0 kb file with the original exported filename but added .sem to show me that the export is done.
    So my guessing was to with a custom pipeline component (receive) to pickup the .sem file, and use the original exported file to process the data from within the custom pipeline component. 
    Well, this works perfectly. 
    But... this only works if I add any data to the .sem file. 
    Otherwise BizTalk picks up the .sem file, but does not process it, it actually does not enter the pipeline at all, and it also does not appear in the tracking.
    Is there a possiblity to accept 0kb files within a custom pipeline component?
    Please help, Thanks
    DP 

    Hi,
    Here is an excellent article explaining the behavior of BizTalk for zero Byte files. It can help you achieve your mentioned goal.
    If this answers your question please mark as answer. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • HtmlCommandLink in a custom component

    Hi everybody,
    seems like I got stuck with this Problem here: I am trying to create HtmlCommandLink within my custom component that points to a method via method binding. My code looks as follows:
    ResponseWriter writer = context.getResponseWriter();
    HtmlForm htmlForm = new HtmlForm();
    htmlForm.encodeBegin(getFacesContext());
    HtmlCommandLink htmlCommandLink = new HtmlCommandLink();
    htmlCommandLink.setParent(htmlForm);
    MethodBinding methodBinding = getFacesContext().getApplication().createMethodBinding("#{TestAction.defaultAction}", null);
    htmlCommandLink.setAction(methodBinding);
    htmlCommandLink.encodeBegin(getFacesContext());
    writer.write("Link");
    htmlCommandLink.encodeEnd(getFacesContext());
    htmlForm.encodeEnd(getFacesContext());
    The Link is created in the page and I can click on it but the method is not invoked. I can invoke it in the code manually which means the reference to the method is working. Am I missing something here?
    Any help appreciated
    Florian

    thanks for your help, and i change the code as :
    @Override
         public void encodeBegin(FacesContext context) throws IOException {
              if (context == null) {
                   throw new NullPointerException();
              ResponseWriter writer = context.getResponseWriter();
              ExpressionFactory expressionFactory = context.getCurrentInstance().getApplication().getExpressionFactory();
              ELContext elContext = context.getCurrentInstance().getELContext();
              MethodExpression actionExpression = expressionFactory.createMethodExpression(elContext,
                        "#{UserManager.actionLoad}",null, new Class[] {ActionEvent.class});
              UIParameter parameter = (UIParameter)context.getCurrentInstance().getApplication().createComponent(UIParameter.COMPONENT_TYPE);
              parameter.setId("addId");
              parameter.setTransient(false);
              parameter.setName("id2");
              parameter.setValue(34);
              HtmlCommandLink link = (HtmlCommandLink) context.getApplication().createComponent(HtmlCommandLink.COMPONENT_TYPE);
              HtmlForm form = new HtmlForm();
              form.setId("pageForm");
              link.setTransient(true);
              link.setValue("Create");
              link.setActionExpression(actionExpression);
              link.getChildren().add(parameter);
              this.getParent().getChildren().add(link);
              form.encodeBegin(context);
              link.encodeBegin(context);
              link.encodeEnd(context);
              form.encodeEnd(context);
    I can click on it but the method is not invoked.
    Any help appreciated.

  • How to get jsp PageContext in custom component renderer

    Hi,
    How to find PageContext(javax.servlet.jsp.PageContext) form within the custom component renderer class?
    Please help?
    Thanx & Regards
    Milind

    Strictly you're looking which URL has invoked the new request? With other words, you want the referrer?
    If so, doString referrer = request.getHeader("referer"); // Yes, with the legendaric misspelling.Be careful with this, the client has full control over what he/she sends with the headers, so also the referrer. It might be null or changed while you didn't expect that. If you want to be safe, you may consider to send the current URL as a hidden parameter along with the request.

  • How to forward to an other page within an custom action handler?

    I need to achieve following effect, I want to forward from within an custom action handler to an other page, without calling the other action handlers on the same XSQL page.
    I already wrote some action handlers. I placed 3 of them in one XSQL page.
    The first action handler is supposed to check the request parameters of the previous page. If a parameter is invalid, I want to forward to an other page without calling the other handlers in my XSQL page.
    I was trying to achieve this using sendRedirect(), but without success. The other following handlers in the page are called as well.
    Any help will be really appreciated. Thank you.
    Peter

    Steve,
    was this question resolved? I am running
    into a similar problem.
    My JSP includes a xsql page, but at the
    end of it I want to forward/redirect the
    user to another page. I can't get this
    to work as the include directive always
    flushes the servlet buffer and hence
    a jsp:forward cannot come after a
    jsp:include. I even tried
    response.sendRedirect() and
    that also does not work!
    Is there any solution for this?
    cheers,
    Vijay
    null

  • Navigating from Custom Component to Standard Compoent(IUICCON). Getting Exception "Define Component Usage 'Random Component Usage of Standard component'"

    Hi Everyone,
    We have a requirement to
    Navigate from Custom Component to the Standard Component(IUICCON – Contract
    management) on the basis of some conditions.
    We tried navigating with Manual
    as well Dynamic Navigation. The Navigation is happening properly and the Navigation is completed and we are on the Contract
    Management Screen(Standard component View).
    On the Contract Management
    screen (standard Component view), when we click on New Contract Button; it throws dump stating “Define
    Component Usage IUICOBJ”. After debugging we identified that the issue was with the Parent class/ component is getting changed, because of which the usage was not found.
    Appreciate your help.
    Thanks in Advance.
    Regards,
    Bhavikjp.

    Hi Bhavik,
    Check which is the active enhancement set at the runtime in the component_loading BADI.
    If it is anything other than your enhancement set,Set it to your enhancement set .
    Check if the parameter WCF_IGNORE_ENHANCEMT in Tcode SU01 is set to 'A' for the User.
    Regards JP.

  • How Do I Link to Custom Component States From Scrolling Content Buttons?

    Hi there, I'm in need of some help as i've got a deadline to meet within the next few weeks and im stuck!
    Basically what I've done is i've made a scrolling content lists, containing about 10 products in each one, my plan was to turn each product into a button so that users could click on that product, and take them to a new page containing more detailed information on that product; when they've finished looking at that product they can click a button to return them to the list they were on previously. However I can't just make a brand new state for each product as there is a limit to 20 states, and I will need around 50 of them.
    So, from what i've read I will need to create custom components. the only trouble with doing this is that I can't link to the custom component on a different main timeline state (I dont get the option to link to the states of the custom component).
    If i put the image of the detailed product into the scroll panel I am able to link to it, however, it's inside the scrolling content and it just scrolls around and stuff which isn't what I want; as it makes it look messy.
    - Basically I just need to link from the buttons in the scrolling list, to a more detailed page for that product. Then be able to return to the list using a button.
    If anybody has any input on how to achieve this, please help me out. Starting to panic now as this needs to be finished before september :s
    Btw i'm happy to share my .fxp file it that helps.
    Thanks alot, Hoping for some helpful replies on this topic
    - Tom

    Hi Tom,
    Adding this back here to share my wireframe with the community.
    Have put a quick .fxp together based on the 'product' section of your project.
    Take a look at how the product lists are linking into the product detail pages within their custom components. 
    Using this model you should be able to expand out to infinite product detail states.  If a particular product area has more than the maximum allowed states, just start a new custom component (part 2 for that product section).
    Let me know if you have any questions. Hope this sets you on a path to getting your project complete.  It's looking nice.
    Tanya

Maybe you are looking for