Calling a method on a component placed in a tab?

I create a tabbed pane. I create x number of tabs in it each with one component. Now I want to call a method on one of those components. How might I do this?
Here was my thought but it is giving me a nullPointerException at the line where I call temp.buildChart(). I guessing that I am not doing this right?
for (int i = 0; i  < graphTabs.getTabCount(); i++){
                            ChartPlotter temp;
                            temp = (ChartPlotter)graphTabs.getTabComponentAt(i);
                            temp.buildChart();
                            graphTabs.setEnabledAt(i, true);
                        }Edit: If it matters any the component of the tab is a JPanel that displays three charts.
Edited by: Sch104 on Jul 1, 2008 12:38 PM

Didn't completely fix the error, but I placed the buildChart() call somewhere else that made sense.
Edited by: Sch104 on Jul 2, 2008 7:37 AM

Similar Messages

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

  • Calling a method in Parent component from Title Window

    Hi all,
    I have a parent component that opens up a Title window when I
    click a button. Now I want to call a method in that parent
    component from the Title window. How do I do this in Flex? Could
    anyone give me a hint please.
    Thank you in advance for the help

    "happybrowndog" <[email protected]> wrote in
    message
    news:gctmql$4t5$[email protected]..
    > That's goddamned ridiculous. What were Flex developers
    thinking that you
    > have
    > to write a custom event to call back to a parent
    component?? Other GUI
    > libraries such as WxWidgets, Fox, Qt, Delphi, MFC,
    WinForms, etc., all
    > allow
    > you to either call via a reference to the parent object
    or submit a
    > callback
    > function into the child object. That's just basic OO
    programming. Flex
    > is
    > looking more and more ridiculous and more like Swing -
    tons of unnecessary
    > coding to do simple things.
    You absolutely _do_ have the capability to pass in a
    reference to the parent
    component, or to create a "hard" reference to
    Application.application. But
    these are not recommended practices, because anything you
    create this way is
    then tied to an environment that implements those properties
    and methods.
    Q (3): I want to run a function in my main application from
    inside my
    custom component. But when I try to refer to myFunction() in
    that
    component, I get a compile time error Call to a possibly
    undefined function
    myFunction. How can I fix this?
    A: Your component has its own scope, so it doesn't know
    anything
    about the functions in the main file. You can get around this
    by directly
    referencing the main application scope like this:
    Application.application.myFunction(). However, this makes
    your component
    tightly coupled, which is a quick way of saying that your
    component is only
    usable in an application that has a myFunction() function in
    it. You're
    better off dispatching an event from your component and
    letting the
    application decide how to handle it. For more information,
    check out the
    following resources:
    http://www.adobe.com/devnet/flex/articles/loose_coupling.html
    http://www.adobe.com/devnet/flex/articles/graduating_pt1.html
    From
    http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf

  • Methods in the Component controller

    Hello,
    When is better call a method in the component controller, than run only a viewu2019s method?
    In other words, what kind of methods should to be in the component controller and what kind of methods should to be in the view?
    Could you give me some examples?
    Regards
    Janeth

    hi
    The EventHandler methods like on Action<actionname>() and methods to fire plugs we will generally used in view controllers.
    If we want to intialise any attributes we will do it in WdDoInit() method of view Controller.
    Generally its not preferrable to write business logic which is used by many components like service contoller generated methods in a view.
    Its a good way to use Service Controller methods like execute<bapiname> in Component Controller.
    For Dynamic Generation of UiElements we will use the WdDoModifyView(..) we use it in View.
    Regards
    sowmya.

  • Calling a method in view from component controller?

    Hi,
    Is it posible to call a method that is defined in the Component Controller in the View?
    If it is posible please give some sample code how to call the method?
    Regards,
    Padmalatha.K

    Padmalatha, all the methods defined in a controller from 'Methods' tab are instance methods. An instance method defined in a component controller is callable from any view controller that holds a reference to the component controller.
    Defining methods between the tags
    //@@begin others
    //@@end
    is useful if you want to declare static methods.

  • Calling a method in the view controller from the component controller

    Hi
    Is there anyway to call a method in the view implementation from the component controller??
    Thanks
    jack

    Thanks for all your replies. I want this kind of a functionality because Im trying to invove a DC (Child DC) from a Parent DC such that the Child DC's view is displayed onto the view container of the Parent DC. I have embedded using 'interface view of a component instance' in the Parent Window and am able to create the component and set usage though the onPlugDefault of the Child View.
    But I observe that when i make a call from the parent, the flow is like this:
    1. The wdDoInit of the Child Component Controller gets triggered first.
    2. Then the wdDoInit of the Child's <b>VIEW</b> gets triggered
    3. and <b>THEN</b> the onPlugDefault of the Child Component Interface View
    What I had actually wanted was to Fire onPlugDefault where Im calling a method LoadData(), after which the Child DC's view must be triggered so it can display the fetched data.
    What is actually happening is the view gets displayed, but no data is displayed in the view.
    Right now I have just given a work around where Im triggering <b>LoadData()</b> of the <b>COmponent COntroller</b> from the <b>wdDoInit</b> of the <b>VIEW</b>.
    Is there a better way to do this? I find it strange that I have to load the Data from the view.
    Thanks
    Jack

  • Calling a method in the Custom ADF component from JSF page

    HI.
    I have created some custom compoents by extending the core ADF Components. Like i have a ComboBoxDefault component with it's ComboBoxDefaultTag.java and Controls.tld file.
    Now my requirement is i want to bind my label to this component from the JSF page. like
    <fwcontrols:label binding="#{listComponents.comboBoxDefaultLabel}" id="label1"/>
    <fwcontrols:comboBoxDefault binding="#{listComponents.cmbLocales}"
    value="en_GB" id="comboBoxDefault" autoSubmit="true" label="label1">
    <f:selectItems value="#{listComponents.locales}"/>
    </fwcontrols:comboBoxDefault>
    In my JSF page the label will have an id, and that id will be specified in the label tag of the component.
    In Tag.java file i have overrided the setProperty(FacesBean facesBean). In this method i have bind all my properties. In core JSF the setProperty method is provided with the UIComponent parameter, so i can call my method in component also. Which is not in case of ADF Faces.
    My main point is how i can call my method setLabel() which is in ComboBoxDefault.java so that i can set the label.
    Thanks in Advance.

    Thanks for all your replies. I want this kind of a functionality because Im trying to invove a DC (Child DC) from a Parent DC such that the Child DC's view is displayed onto the view container of the Parent DC. I have embedded using 'interface view of a component instance' in the Parent Window and am able to create the component and set usage though the onPlugDefault of the Child View.
    But I observe that when i make a call from the parent, the flow is like this:
    1. The wdDoInit of the Child Component Controller gets triggered first.
    2. Then the wdDoInit of the Child's <b>VIEW</b> gets triggered
    3. and <b>THEN</b> the onPlugDefault of the Child Component Interface View
    What I had actually wanted was to Fire onPlugDefault where Im calling a method LoadData(), after which the Child DC's view must be triggered so it can display the fetched data.
    What is actually happening is the view gets displayed, but no data is displayed in the view.
    Right now I have just given a work around where Im triggering <b>LoadData()</b> of the <b>COmponent COntroller</b> from the <b>wdDoInit</b> of the <b>VIEW</b>.
    Is there a better way to do this? I find it strange that I have to load the Data from the view.
    Thanks
    Jack

  • Calling a method in another webdynpro component

    Hi,
    I have two webdynpro components say Comp A and Comp B.
    In Comp A I had a view View A and in Comp B I had a View in View B.
    In View A, I had a method X, I want to call this method in View B of Comp B.
    How I can do this?
    I created a public part of Comp A and tried to add in used webdynpro components. But in the list I am not able to find it.
    Please help.
    Regards
    MQ

    Hi,
    If both the components Comp A and Comp B are in the same DC you can use the interface controller to call the method in comp A. Add this comp A interface controller in Comp B controller by going to the properties tab, so that you can access the methods of comp A interface controller.
    If you have the components in different DC's you can follow the below steps:
    Go to public parts in DC meta data section and create a public part by selecting the first radio button option and add the Comp A by selecting the option (Webdynpro Component-->Selected Entities).
    Click on Finish button so that public part for comp A is created.
    Now build the DC and go to Used Webdynpro components of CompB, give some name and browse to select the used webdynpro component, it will show you the Comp A public part select it and try to finish it.
    Once again build the Dc after doing this.
    Now  you can access the method of comp A in Comp B
    wdThis.wdGetCompA.getX()...
    Hope this helps you..
    Regards,
    Saleem

  • Call a method in the view from Component Controller

    Hi Friends,
    I have written the code for calling the RFC in Component Controller.
    My requirement is to change the properties of UI elements in the view, if I get any exception while calling RFC.
    Can Call a method in the view from Component Controller.
    Regards,
    Lakshmi Prasad.

    HI,
    You can get the error message during the exception of calling RFC in view itself.
    Any way you may call the RFC at some action in the view only.
    Can you explain me what you are trying to do?
    Kind Regards,
    Mukesh

  • Calling a potal application method in webdynpro component(class)

    Hi All,
    I have a requirement where i need to call a method created in a portal application(.par) in a webdynpro component.
    Any Pointers??
    Regards
    Radhika Kuthiala

    hi radhika,
    You need to create a portal service to call that method from webdynpro.
    I am providing u a url, hope it will help you.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0446f5c-fcb9-2910-e082-88becbe3ddc9
    Regards,
    Ravi Shankar

  • Call Inbound Plug or other method of usage component

    Hi guys,
    in crm web ui  i created one component named "A" which has several component usages. One of the usage component is named "B".
    Now the usage component "B" has an inbound plug called "ClearAll", which i want to trigger from component A.
    How do i do that? Or more specific, how do i get the interface controller of component B, so that i can call a the inbound plug method "clearall",
    My Problem is not about Popups.
    in WD_USAGE_INITIALIZE i'm already able to populate the context, but what i need is a method call before or after sharing the context node:
    call method super->wd_usage_initialize
         exporting
           iv_usage = iv_usage.
       case iv_usage->usage_name.
         when 'CUBP_HEAD_SEARCH'.
           try.
             iv_usage->bind_context_node( iv_controller_type  = cl_bsp_wd_controller=>co_type_component
                                          iv_target_node_name = 'PARTNER2'
                                          iv_node_2_bind      = 'PARTNER' ).
    Thanks!

    Very Good ! thanks for this, i also analysed a little bit yesterday and achieved to really call the window controller:
    What i wanted to do is to call the clear_all of BP_HEAD_SEARCH - component, which i always specified as component B.
    In Component A using BP_HEAD_SEARCH, i hooked some coding into method DO_PREPARE_OUTPUT of the only View, which is an overview Page
    Hooking up this method, i'm sure that the initialitation of all context nodes etc. of component B took place and i'll be able to successfully call the inbound plug:
    if me->prepared_output <> 'X'.
      data lr_usage type ref to cl_bsp_wd_component_usage.
      data lr_if_window type ref to cl_bp_head__searchhelpwin_impl.
      data lr_if_window_abstr type ref to  cl_bsp_wd_window.
      lr_usage      ?= me->comp_controller->get_component_usage( 'CUBP_HEAD_SEARCH' ).
      lr_if_window ?= lr_usage->get_interface_view_contr( 'SearchHelpWindow' ).
      lr_if_window->ip_clear_all(  ).
    endif
    the clue was not to use the interface if_bsp_wd_component_usage, but to use the class cl_bsp_wd_component_usage as type of the usage object.
    Doing so, i'll be able to call method get_interface_view_contr which will give me the window controller finally.
    But your solution is good as well !
    Thanks!

  • Wda: call method from a component interface definition (cid)

    hello,
    I created the following scenario:
    - I have a Main-component "m"
    - "L" is a component interface definition (cid) which force both cid-L-implementating components  "L1" and "L2" to extend and fill the method "set_COMP_USAGES()".
    - I have other cid´s (A-C) too
    - at runtime only one of the components "L1" or "L2" is created and the mother-component M holds component-usages (ref to) of the chosen variants of A-C and L as an attribute in the component-controller of m.
    now my problem: my aim is to call a method in m at runtime which is defined at designtime in my cid L (set_COMP_USAGES() )and decided at runtime which variant of this method is chosen (the one from L1 or L2). in this method the references of comp_usages other cid´s should be passed to L1 or L2.
    or short: how can I call a method from a cid-implementating component at runtime via a IF_WD_COMPONENT_USAGE reference (ref to) to this component?

    I got the solution:
    data: L_INTF_CONTROLLER         type ref to ZIWCI_Z_ITF_CID_L.
      L_INTF_CONTROLLER ?= wd_this->COMPONENT_USAGE_L->GET_INTERFACE_CONTROLLER( ).
      CALL METHOD l_intf_controller->set_comp_usages
        EXPORTING
          comp_usage_a = wd_this->COMPONENT_USAGE_a
          comp_usage_b = wd_this->COMPONENT_USAGE_b
          comp_usage_c = wd_this->COMPONENT_USAGE_c.

  • Component calling methods on another component

    I have 2 components: Repository, and Document. A repository
    has an array of documents in variables scope. In each component I
    use the init() method to return an instance of the object. When a
    repository object is inited it generates a query of the documents
    that it contains, and loops through that, calling document.init()
    on each one and adding the resulting document object to the array.
    When I init() a repository and use CFDUMP to view its
    documents array, I get an array of the correct length containing
    document objects. However, when I try to loop through the array and
    call a method like getTitle() on each document, I get empty
    strings. When I init() a document on its own, getTitle() works
    fine. Is there something basic that I'm forgetting here?
    Let me know if you need to see the more code.
    Don Zacharias
    Sacramento, CA

    In the Repository's init() method:
    <cfloop query="qDocuments">
    <!--- create empty document object --->
    <cfset document =
    createObject("component","Document").init(qDocuments.id)>
    <!--- add empty document to array --->
    <cfset arrayAppend(variables.documents,document)>
    </cfloop>
    In the front end
    <!--- show documents for this repository --->
    <cfset arr_documents = repository.getDocuments()>
    <cfloop from="1" to="#arrayLen(arr_documents)#"
    index="i">
    <cfset doc =
    createObject("component","/docmanager_v2/components/Document")>
    <cfset doc = arr_documents[ i ]>
    <cfoutput>Title: #doc.getTitle()#, Summary:
    #doc.getSummary()#, Keywords:
    #doc.getKeywords()#<br></cfoutput>
    </cfloop>
    Now I'm doing createObject twice but I guess that makes
    sense... I wish I knew the principle at work here though...

  • Should  i call pack()  method  JPanel component  ??

    hi,
    I studied as pack(); method need to call only to Top-Level component(container) of Swing.. this is enough. No need to call like JPanel() container .
    Is this true ?

    Yep, especially since JPanel doesn't have a pack() method. :)

  • How to call a bean method from html component in jsf

    hi all
    i need a solution for this problem of mine.. actually em working on a jsf application with contains a jsf-jsp having a span containg html button inside my javascript. i want to call a method on click of this button and fetch some data which i have already populated in my bean.how do i do this??? i hv attached a piece of code of d same...
    <script language="JavaScript" type="text/javascript">
    function test(form){
    var Title="DEBIT, gift, Request, TICK";
    var Span=document.createElement("Span");
    Span.style.position="absolute";
    Span.style.left=(parseInt(110)-5)+"px";
    Span.style.top=(+parseInt(274)-5)+"px";
    Span.style.backgroundColor='Red';
    var next=document.getElementById("forImage");
    next.innerHTML="<img src='http://127.0.0.1:9000/action=clusterserve2dmap&sourcejobname=myjob_clusters' />";
    Span.innerHTML="<[input type='button' >";
    document.getElementById("forImage").appendChild(Span);
    any help is highly appreciated

    Hi,
    this gonna be a hack, but here's how it could work
    - you create a Servlet that accesses the FacesContext to obtain a managed bean
    - you issue a XmlHttpRequest from the button to your servlet to obtain the payload
    - show the retrieved values in your HTML
    see http://www.thoughtsabout.net/blog/archives/000033.html for the middle part
    Frank

Maybe you are looking for

  • How can I get my ipad out of lost mode

    It's actually my daughter's iPad. She got it for Christmas and I took it away from her a few months ago for punishment. She got it back today, but later revealed that her mom put it in lost mode (a few months ago) because she thought it was stolen. A

  • Bookmarks in version older than 8 - installed new hard drive - where is the bookmarks file?

    installed new hard drive two months ago - just now reinstalling Firefox -- installed new version 8 -- need to know where my old bookmarks would be stored (what file and where)

  • FAQ: Installing Elements 10, or What do all these disks do?

    When you purchase Photoshop and/or Premiere Elements 10 as a boxed product, you get a fair number of disks. The main reason for this is that a boxed product purchase of Elements is dual platform, that is, it's for both Windows and Macintosh. When dea

  • Optical Drive kicks in while working on MBP???

    Lately while I am working on my computer the optical drive starts up like I just inserted a disk but did not. Any reason why this would happen? It doesn't cause any problems (so far) but I wonder if anyone else has noticed this happen with their MB?

  • Google Webservice API - failed

    Hi all,   I am exeperimenting with creating a Portal Service from a WSDL. And I am following the example of GoogleSearch given in PDK.   I've created everything according to the documentation and also registered and used the Key for Google API.   The