Can a method be an input parameter?

inside
ActionPerformed(ActionEvent e) {
  Object src = e.getSource();
     PlcManager.setWaitCursor(this);  
     try{
          if(src == getBtnInquiry()){     
               onActionInquiry(true);
               saveLogFile();
     } catch (Exception ex) {
               ex.printStackTrace();
     } finally {
               com.hmm.manager.PlcManager.setDefaultCursor(this);  
}I want to make it as:
ActionPerformed(ActionEvent e) {
      Object src = e.getSource();
      showWaitCursor(getBtnSave(), onActionSave());
}Putting aside the tidieous issue of what is PlcManager,
private void onActionSave()  {
  System.out.println("SAVE!"); 
}just focus on the method can have another method as an input parameter.
Please, let me know asap. Thanks -

// *** Your Interface ***
public interface BtnAction
    public void doAction(); // Put any signature you like
// *** Implementing classes
public class BtnDelete implements BtnAction
    public void doAction() // Use signature from interface
        // Do your button delete
    // Can have other methods
public class BtnSave implements BtnAction
    public void doAction() // Use signature from interface
        // Do your button save
    // Can have other methods
public class BtnPrint implements BtnAction
    public void doAction() // Use signature from interface
        // Do your button print
    // Can have other methods
public class BtnInquiry implements BtnAction
    public void doAction() // Use signature from interface
        // Do your button inquiry
    // Can have other methods
// Etc...in your Pic thingie...public void showWaitCursor (JButton button, BtnAction action) // Can have other parameters or signatures...
    // Yada yada yada...
    action.doAction(); // Call the polymorphic method with your signature
}and to call:// Yada yada yada
BtnSave saveBtn = new BtnSave();
// Pass saveBtn as a BtnAction interface; the BtnSave doAction will be invoked.
showWaitCursor (new JButton(), saveBtn);Note that the Btnxxxx classes can still extend another class as well as implementing your interface. They can even implement other interfaces as well.

Similar Messages

  • Crystal Report with text(csv) data file, can we set it as input parameter?

    Hi,
    I am a new user of Crystal Reports 2008.
    I have created a report with charts in it. The input data comes from a csv text file.
    Can I set the name of this text file as an input parameter?
    as I need to generate 44 similar reports with different text filenames(and data)?
    Thank you.
    Regards

    Brian,
    Thanks much.
    I did exactly what you said.
    Just to see any change, I first gave a bad report file name just to see if I am accidentally pointing to a different file,
    but I got an error saying report not found.
    Then I renamed my original datafile name and generated a report and it still generated one without giving an error.
    Then I also gave a junk name to the logoninfo and printed that name, the new name was assigned to logoninfo, but the code did not error out.
    It ended up generating the report.
    Now here is what I think is happening,
    1) The save data in report option seems to be still on even though I have turned it off in 2 locations
    a) file -> Report Options
    b) file -> Options -> Reporting tab.
    2) For some reason the logoninfo is getting ignored as well.
    Since I did not see any answers yesterday I posted a link to this thread on the .Net forum
    Crystal Report with text(csv) data file, can we set it as input param? C#
    and Ludek Uher says that I am connecting to the text file via a DAO database engine and so need to use the same code for changing the text file as for changing an Access database.
    But the link he gave me tells me to try the same thing that we have been trying..
    Here is my plan,
    1) I will first try and find out why my save data with report option is still on ( but it shows off in Crystal ).
    2) why is LogonInfo getting ignored.
    Meanwhile any suggestions from anyone are welcome.

  • How can I pass Recordsets as input parameter to a Function ?

    Hi Gurus,
    I want to create a function that receive recordsets as input parameter also returns recordsets as output.
    I have a requirement to do stock taking for all order items of one Order number in one single query execution (to avoid row by row basis).
    From the post in the forum I know that a function can return recordsets / query result using REF CURSOR or pipelined table function.
    My question is : how to pass the recordsets as input parameter to that function ?
    (because I could have 75 rows item in one order number)
    Below is the DDL and the query :
    create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
    insert into stocks values('P001', 'WH001', '01-dec-2006', 30)
    insert into stocks values('P001', 'WH002', '01-dec-2006', 50)
    insert into stocks values('P001', 'WH002', '01-jan-2007', 50 )
    insert into stocks values('P001', 'WH001', '01-Mar-2007', 150)
    insert into stocks values('P002', 'WH003', '01-dec-2006', 25)
    insert into stocks values('P002', 'WH003', '15-Jan-2007', 50)
    insert into stocks values('P002', 'WH003', '01-Mar-2007', 75)
    insert into stocks values('P003', 'WH001', '01-dec-2006', 30)
    insert into stocks values('P003', 'WH002', '15-Jan-2007', 40)
    insert into stocks values('P003', 'WH003', '01-Mar-2007', 50)
    CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
    INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
    INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
    INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
    The query for stock taking :
    select product,warehouse,expireddate, least(qty_available-(sm - qty_ord),qty_available) qty
    from ( select product,warehouse,expireddate,qty_available,qty_ord, sum(qty_available) over(partition by product order by s.product,expireddate,decode(warehouse,priority_wh,0,1),warehouse ) sm
    from stocks s,order_detail o
    where s.product = o.product_ord order by s.product,expireddate,decode(warehouse,priority_wh,0,1) )
    where (sm - qty_ord) < qty_available

    Hi,
    This my requirement :
    I have (simplified)Order_Detail as below :
    CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
    INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
    INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
    INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
    Then I want to do stock taking from my STOCK table (described on my first post on this thread)
    create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
    The rule is : The stok taking is on First In First Out basis, on expireddate.
    And I want to do it in single query.
    I want to make this a Function / Stored Procedure so that other transaction can also make use of this query.
    That is why I need to pass the 3 rows oy mr Order_Detail above, do the query, and return the result.
    Then INSERT the result into ORDER_DETAIL_PER_EXPIRED_DATE table.
    I hope this clear my requirement, is this possible ?
    Thank you,
    xtanto

  • Calling PLSQL Procedure with CLOB input parameter from JDBC

    Hi..
    I've got a PLSQL procedure with a CLOB object as input parameter:
    function saveProject (xmldoc CLOB) RETURN varchar IS
    I want to call that procedure from my JDBC Application as...
    String data = "..."
    CallableStatement proc = conn.prepareCall
              ("begin ? := saveProject (?); end;");
    neither
    proc.setCharacterStream(2, new StringReader(data, data.length());
    nor
    proc.setString(2, data);
    will work.
    The Application throws java.sql.Exception: ... PLS-00306 wrong
    number or types of arguments in call 'SAVEPROJECT'
    How can I use set setClob method?
    The Problem is: with Oracles CLOB implementation I can't create
    an Instance, and from the CallableStatement a can't get a
    Locator for a CLOB-Object.
    This CLOB stuff makes me really nuts!
    please somebody help me.. thanks
    Alex

    Hi All,
    You can not make it like that.
    You can not make clob as input parameter.
    Do you want an easy way?
    This is the easy way.
    sample:
    function myFunction(S varchar2(40))
    return integer as
    begin
    insert into TableAAA values(S)
    --TableAAA only contains 1 column of clob type
    end;
    This will work the problem with this is the parameter is in
    varchar2 right? so there will be limited length for it.
    You can do this to call that function:
    nyFunction('My String that will be input into clob field');
    There's another slight difficult way, I understand that you have
    installed Oracle client/server in your system, try to look at
    jdbc folder and try to find demo.zip in that folder, you can
    find several ways of doing thing with jdbc.
    Have a nice day,
    Evan

  • Crystal Report with text(csv) data file, can we set it as input param? C#

    Hi,
    I am new to the forums and posted a question which belonged to the .net - SAP Crystal reports group.
    Can someone help me with my problem? following is the thread that I have started.
    Crystal Report with text(csv) data file, can we set it as input parameter?
    Thank you in advance.

    Looking at the original thread, you are connecting to the text file via the DAO database engine:
    "I added the text file as follow, new connection -> Access/Excell (DAO) -> select the file and the database type as text"
    Thus I would use the same code for changing the text file as for changing an Access database. See Kbase [1218178 - Error: "Logon failed" when connecting to Access database in .NET application|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313338333133373338%7D.do] for more information. If that does not work, you may want to consider connecting via ODBC or feeding the data from the text file to and ADO .NET dataset and pointing the report at the dataset.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • Problem input parameter

    Hello
    I have a requirement, is that I have a infobjeto operation hour that has the hours that a transaction took place, and I had to build a structure with a range of times, but that touched me to the transformation of one substring operation time to take the first two character of time and store it in another infobjeto created, I have the time as input parameter as date range and give the matchcode the parameter time only shows me the values ​​that holds the master data, but they need select a time range regardless the value is in the master data infobjeto hour.
    As I can handle this in the input parameter so that you can select for example from 00:00 to 05:00.
    If anyone can help me I appreciate it.
    Greetings.
    nando

    Hi David,
    This GROUP_TYPE option is not available anymore in 11.2.0.2 anymore it seems !.
    I posted a question about this today on the owb blog that triggered it all for me.
    I was trying to work tru your example of Table Function Operators and stumbled upon a OMBplus script that doesn't work anymore.
    It now says:
    OMB+> OMBALTER MAPPING 'TF_REFCURSOR_PARAM' MODIFY GROUP 'INGRP1' OF OPERATOR 'GET_EMPS' SET PROPERTIES (GROUP_TYPE) VALUES ('REF_CURSOR')
    OMB02902: Error setting property GROUP_TYPE of INGRP1: MMM1034: Property GROUP_TYPE does not exist.
    And indeed looking at the 11.1. ref doc it is mentioned but not anymore in 11.2.
    (search for group_type)
    11.1 :
    http://download.oracle.com/docs/cd/B28359_01/owb.111/b31279/omb_4create_1.htm
    11.2:
    http://download.oracle.com/docs/cd/E11882_01/owb.112/e14406/chap3006.htm#GDBBAFBF
    But the UI doesn't have the option either !
    How do i use a TFO with a ref_cursor ?

  • Calling Stored Procedure with a DATE input parameter

    Hi. A question about Date input parameters when calling a stored procedure...
    I have a procedure that takes a DATE parameter as input. I would like that DATE value to include a Time element.
    My Application Module method takes an input parameter as java.util.Date (myParamDate) - which will preserve a time element(?).
    However when I create the CallableStatement, I'm trying to set the parameter using setDate like this (for param 5):
                st = getDBTransaction().createCallableStatement("begin cs_my_pck.request_values(?,?,?,?,?,?,?,?); end;", 0);           
                Connection myConn = st.getConnection();
                ArrayDescriptor myArrDesc  =  ArrayDescriptor.createDescriptor("CS_FIELD_TABT", myConn);
                Array sqlParamNameArray = new oracle.sql.ARRAY(myArrDesc, myConn, paramNames.toArray());
                Array sqlParamValueArray = new oracle.sql.ARRAY(myArrDesc, myConn, paramValues.toArray());
                Array sqlFilterNameArray = new oracle.sql.ARRAY(myArrDesc,myConn,filterNames.toArray());
                st.setString(1, repType);
                st.setObject(2, sqlParamNameArray);
                st.setObject(3,sqlParamValueArray);
                st.setObject(4,sqlFilterNameArray);
                java.sql.Date myRepDate = new java.sql.Date(myParamDate.getTime());
                st.setDate(5,myRepDate);
                System.out.println("Report Date = " + myRepDate.toString());
                st.setString(6,repUser);
                st.setString(7,repAttach);
                // set out param
                st.registerOutParameter(8, Types.NUMERIC);
                st.execute();I understand java.sql.Date does NOT include a Time element. But setDate() accepts only a java.sql.Date so my procedure parameter ends up with a zero time element.
    How do I call this procedure retaining the Time element?
    Thanks.

    It includes time element, if you want more precision go with timestamp.
    http://docs.oracle.com/javase/6/docs/api/java/sql/Date.html

  • Dynamic Imagelink Component - Calling Impl method with input parameter

    Hi All,
    I have requirement where Imagelinks are created dynamically on the pageload. Generated the components and the components are displayed on the jspx.
    Now when I click the image link, a method in AMImpl should invoke and this method takes some input parameters.
    I am able to call the method successfully in AMimpl with the help of below code. But I could not understand how to pass the input parameters to that method.
                               RichCommandImageLink lockimageLink =
                                new RichCommandImageLink();
                            lockimageLink.setIcon("icon.png");
                            lockimageLink.setId("icon" + index);                   
                            MethodExpression me =
                                JSFUtils.getMethodExpression("#{bindings." +
                                                             "MyMethodName" +
                                                             ".execute}");
                            lockimageLink.addActionListener(new MethodExpressionActionListener(me));
      public static MethodExpression getMethodExpression(String name) { 
       Class [] argtypes = new Class[1]; 
       argtypes[0] = ActionEvent.class; 
       FacesContext facesCtx = FacesContext.getCurrentInstance(); 
       Application app = facesCtx.getApplication(); 
       ExpressionFactory elFactory = app.getExpressionFactory(); 
       ELContext elContext = facesCtx.getELContext(); 
       return elFactory.createMethodExpression(elContext,name,null,argtypes); 
      } Can some one please suggest how to pass input parameters to the Impl method.
    Jdeveloper Version : 11.1.1.4.0
    Thanks,
    Morgan.
    Edited by: 900114 on May 12, 2012 11:23 PM

    You can use the below method to call an AMImpl method. You can pass parameters as well to the AMImpl method.
    DCBindingContainer bindings = getDCBindingContainer();
    OperationBinding ob = bc.getOperationBinding("MyMethodName");
    Map m = ob.getParamsMap();
    ob.put("paramName", "paramValue"); paramName is the parameter in AMImpl and paramValue is the value to be passed.
    ob.execute();
    Where getDCBindingContainer() is:
    public DCBindingContainer getDCBindingContainer() {
    ExpressionFactory exprFactory;
    ELContext elContext;
    ValueExpression valueExpression;
    DCBindingContainer dcBindingContainer;
    FacesContext facesContext = FacesContext.getCurrentInstance();
    exprFactory = facesContext.getApplication().getExpressionFactory();
    elContext = facesContext.getELContext();
    valueExpression =
    exprFactory.createValueExpression(elContext, "#{bindings}",
    Object.class);
    dcBindingContainer =
    (DCBindingContainer)valueExpression.getValue(elContext);
    return dcBindingContainer;
    Hope this helps
    Edited by: umesh.agarwal on May 13, 2012 12:10 AM
    Edited by: umesh.agarwal on May 13, 2012 12:10 AM

  • How to give input parameter to Bapi when executing a method.

    Hi All,
    I have 1 input field and 1 button.I've defined a model node and inside that model attribute in my view.If I enter something in the Input field the value should go to the particular model attribute I defined.How to pass that input parameter.I have a action like this....
    public void onActionGetDateDetails(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionGetDateDetails(ServerEvent)
        wdThis.wdGetGetDateDetailsCustController().execute_Bapi_Get_Date_Details("");
    // while executing the above method I have to pass the input parameter typed in the input field.
    Structure of my context :
    Bapi_Date_Details
    >Network List(Model Node)
                                          |
                                          -->Network (Model Attribute)
         //@@end
    Help me to solve this.
    Thankx in advance.
    Regards,
    Karthick.K.E

    Hi Karthick,
    You can associate an input field's value to a BAPI in two ways:
    1) binding the input UI element's 'value' directly to the BAPI's input attribute that you want to set. This is the methos Noufal suggested. In this method, make sure you initialize the attribute through the following lines of code in the doInit() method, else, the input field will be disabled.
    <b><Bapi_name>Input input = new <Bapi_name>Input();
    input.set<Attribute_name>(new <dataType>);</b>
    2) The second method is settting the input's 'value' to some other attribute(say 'abc') and giving this value to the input parameter just before calling the RFC.
    input.set<Attribute_name>(wdContext.currentContextElement.getAbc());
    Hope this helps,
    Best Regards,
    Nibu

  • Can't see input parameter in model for webservice

    Hai All,
      I have created model for a webservice in webdynpro project. For a method in that webservice there is an input parameter which is <b>two dymensional string arry</b> . But I am unable to see that parameter in schema of created model. How can i see that input parameter.
    could anybody help me out.
    Regards,
    Charan

    Hai Charan,
    I am Also Facing the same Problem,
    we cant change the auto generated code in webdynpro,
    Its Better to try with object array instead of two dimensional array.
    regards,
    Naga Raju.m

  • How can I pass dynamic value as a user input parameter in discoverer?

    Hi,
    I have a requirement for a discoverer report like this: The report will display only details for Suppliers that have expired (or soon to be) Insurance details. That is the Expiration Date is less than or equal to the day the report is being run plus any days specified in the Number of Days in the Future Parameter.
    The sample code as:
    SELECT s.segment1 vendor_number
    ,s.vendor_name
    ,flv1.meaning classification
    ,pca.certificate_number
    ,pca.certifying_agency
    ,pca.expiration_date
    ,flv2.meaning status
    FROM ap_suppliers s
    ,pos_bus_class_attr pca
    ,fnd_lookup_values flv1
    ,fnd_lookup_values flv2
    WHERE pca.vendor_id = s.vendor_id
    AND flv1.lookup_code = pca.lookup_code
    AND flv1.lookup_type = pca.lookup_type
    AND flv2.lookup_code = pca.class_status
    AND flv2.lookup_type = 'POS_BUS_CLASS_STATUSES'
    AND pca.expiration_date <= trunc(sysdate) + <No. of Days in the Future>
    order by pca.expiration_date asc
    Now the parameter is Number of Days in the Future (Enter the number days in the future to extract the data. This will default to 0).
    Is it possible in discoverer to do so as in query i do that like a condition as pca.expiration_date <= trunc(sysdate) + <No. of Days in the Future>.
    How can I pass <No. of Days in the Future> as a user input parameter in discoverer?
    Please help.

    Hi,
    All you need to do is to create the condition in the discoverer instead of in the query.
    Create a custom folder containing the following sq (note that i removed the condition)l:
    SELECT s.segment1 vendor_number
    ,s.vendor_name
    ,flv1.meaning classification
    ,pca.certificate_number
    ,pca.certifying_agency
    ,pca.expiration_date
    ,flv2.meaning status
    FROM ap_suppliers s
    ,pos_bus_class_attr pca
    ,fnd_lookup_values flv1
    ,fnd_lookup_values flv2
    WHERE pca.vendor_id = s.vendor_id
    AND flv1.lookup_code = pca.lookup_code
    AND flv1.lookup_type = pca.lookup_type
    AND flv2.lookup_code = pca.class_status
    AND flv2.lookup_type = 'POS_BUS_CLASS_STATUSES'
    Then create a discoverer report using this folder using all fields.
    Create a new calculation as (use this exact syntax):
    Sysdate + :No_of_Days_in_the_Future
    Create a new condition:
    pca.expiration_date <= <your calculation>
    To complete it add a sort as you did in the SQL.
    That's it.
    Tamir

  • Can an Input Parameter be used as Target Value in Chart ?

    Hi All,
    It seems like a target value can only be entered as a fixed value, and not be pulled from an input parameter. It seems like input parameters can only be used for filters. Is this true?

    Uhm, ok, I got it.
    In fact, the target must be a constant value and as you said, there isn't a easy way to change it.
    One tricky idea would be use a combo chart (bar and line).
    Create a new dataObject called "target", add a column called "target" for target value and other column called "group" for the value used in your bar chart to grouping the series, and values with the same target for every possible group.
    Then, change your view to combo chart, configuring the same bar chart and add the new dataObject "target", configuring as line chart, using the same grouping.
    You can also expand this idea and include a date column if you can search for some historical data, so you can see in the graph the "evolution" of your target against the data.
    Just one idea...

  • Method to Get the INPUT parameter CONTENT byte length

    method to get the INPUT parameter CONTENT byte length

    Dear "clown of forums",
    Please read the forum rules and ask understandable questions -> one thread per properly formulated question after having searched.
    Thread locked.

  • Can we give *.* as an input parameter to java program.

    i have a simple java program. In the program I’m giving the input parameter as *.*
    But in the main method, I’m getting the argument value as a different one. The name of one of the file in the current directory. Any thing that starts with * like *.txt* is giving the file name in the directory.
    How to parse the *.* through input parameter.
    public class test
         public static void main(String args[]){
              System.out.println("arg[0]-->"+args[0]);
    }

    This is a shell thing, not a Java thing -- your command line shell is expanding things like dot or star. You need to quote it to pass it to your program, unexpanded. The quoting syntax depends on your shell, but try single or double quotes:
    java UrPrgm '.' '*'
    //or
    java UrPrgm "." "*"

  • Where can i find all the input steam method in java??

    Hi
    can some one plz give me a link in this java site, so that i can see the list of input steam related method.
    E.g. reader() ....

    http://java.sun.com/j2se/1.4/docs/api/java/io/package-summary.html

Maybe you are looking for

  • Ipod says has no music right after restoring and syncing

    It started with my ipod randomly going to menu in the middle of a song. Then it started skipping. And finally it would go from song to song but wouldn't play. So I restarted it while walking to class. When it got back to the menu it said there were n

  • Error Message 579024 when trying to purchase App from BB AppWorld

    Hello, I am trying to purchase a game from the AppWorld, on my PB. I am able to login with my BBID, and hit "Pay Now", but I get an error : Problem encountered with PayPaul authorization.(Error:579024) Anyone know what this means? Is there a config p

  • How to run eclipse in macbook pro?

    sir, i have intalled eclipse software to use c++in my mac book pro...i installed the software but the software is not compiling the project i need urget help as i have to use my c++ language asap...thku

  • Time Sheet(HCM)

    Hi Experts    My company is using a third party tool for capturing In and Out Timings. My idea is to upload In &  Out Timings using  ESS . Whenever employee swipes the card Emp Id and Intime and Outtime must be captured in ESS using Portal,  then Fro

  • HT201412 my iPod touch is not responding , the screen in frozen & the screen is yellow .

    my iPod touch 4 is completely unresponsive , it will not do anything when i press any buttons & iTunes doesn't recognize its plugged in when its plugged into my computer . plz helpppppp !