How to create a action programatically

Hi ,
Actually I am creating a button dynamically.This function is working fine.
But I am not able to add action to that button.
beacue samplebutton.setAction needs MethodBinding objetc and I am not able to create the same...
ANy idea how can i bind any action to the button programatically?

I am using below sample and it's working good.
RichCommandButton cb = new RichCommandButton();
String actionEL = "#{backingBeanName.actionFunctionName}";
MethodExpression action = actionMethodExpression(actionEL);
cb.setActionExpression(action);
public static MethodExpression actionMethodExpression(String actionName) {
//the MethodExpression to be returned.
MethodExpression methodExpression = null;
//Since Action Method does not accept parameters no argtypes are needed.
Class[] argumentTypes = new Class[0];
FacesContext facesCtx = FacesContext.getCurrentInstance();
Application app = facesCtx.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = facesCtx.getELContext();
methodExpression =
elFactory.createMethodExpression(elContext, actionName, null,
argumentTypes);
try {
// this methodCall does some sort of "evaluation" of the newly created MethodExpression..
// if something is wrong... exception is thrown..
methodExpression.getMethodInfo(elContext);
} catch (Exception e) {
e.printStackTrace();
return methodExpression;
}

Similar Messages

  • How to create new actions ? in the interaction record screen

    Hi all,
    I'm working with the IC web client.
    In the interaction record screen the is a link to actions.
    But how to create new actions ? schedule actions ?
    Component "ICCMP_BT_INR"
    View "InrHeaderViewSet"

    Hi Eran,
    Gret is absolutely right ..The actions are transaction type specific and can be attached along in the customizing as mentioned above by gret , these can then be tested in the SAP gui first for their scheduled and start conditions and then in the ICWC.
    There is no special settings for actions in ICWC if they are there in your transaction they will come in the ICWC.
    Hope this helps
    Regards
    Raj

  • How to create dynamic action

    hi friends,
    could u plz tell me how to create dynamic action? 
    with regards,
    Priya.S

    Hi
    I u need to write the dynamic action as below
    0002     ANZKD     06     3     P     PSPAR-TCLAS<>'B'
    0002     ANZKD     06     4     P     T001P-MOLGA='12'
    0002     ANZKD     06     5     P     P0002-ANZKD>='1'
    0002     ANZKD     06     6     I     INS,0021,2,,(P0002-BEGDA),(P0001-ENDDA)
    This should help you.  rewards
    Regards
    Suresh

  • How to create custom action

    Hi,
    how to create custom action for Assemble permission for CMS. we have CMS.transport action which gives permission to Assemble & also to other activities. I want to know if there is a possiblity to just give that assemble permission instead of Cms.Transport.

    Hi,
    Yes if you are going to modify Umerole.xml then only this is possible
    <ACTION NAME="Manage_All">
    <DESCRIPTION LOCALE="en" VALUE="Overall user administrator permissions, that is, administration of users belonging to any company." />
      <PERMISSIONCLASS="com.sap.security.core.admin.permissions.UMAdminPermissions" NAME="MANAGE_ALL_COMPANIES" VALUE="*" />
    <PERMISSIONCLASS="com.sap.security.core.admin.permissions.UMAdminPermissions" NAME="USERS_ASSIGN_TO_DIFF_COM" VALUE="*" />
    <PERMISSIONCLASS="com.sap.security.core.admin.permissions.UMAdminPermissions" NAME="USER_VIEWPROFILE" VALUE="*" />
    <PERMISSIONCLASS="com.sap.security.core.admin.permissions.UMAdminPermissions" NAME="USER_CHANGEPROFILE" VALUE="*" />
    <PERMISSIONCLASS="com.sap.security.core.admin.permissions.UMAdminPermissions" NAME="USER_CHANGEPASSWORD" VALUE="*" />
    <PERMISSIONCLASS="com.sap.security.core.admin.permissions.UMAdminPermissions" NAME="USER_CREATE" VALUE="*" />
    As you in this UMErole.xml file, we have an Action named = Manage_All
    Also we have PERMISSIONCLASS, waht you can do is find action you want to modify and for e.g you want USER_CHANGEPASSWORD should not be there for Manage_All action, then just delete the permission class for that action.
    Hope this helps,
    Regards,
    Ameya

  • How to make submit action programatically ?

    hi all ;
    how can i make submit action programatically (by clicking on any item in the page) ?
    Regards .

    Hi,
    set autosubmit on the input components to true
    Frank

  • How to create side navigations programatically

    Hi,
    Can you please tell me how to create side navigations for a page programatically.
    Thanks in advance

    See topic "Tabs / Navigation" in dev guide, this is explained ind etaqil with sample code.
    --Mukul                                                                                                                                                                                                                                   

  • How to create an action to insert hundreds of different numbers for limited edition prints?

    Hi,
    I sell limited edition prints of a run of between 350 and 500.
    I am trying to get it set up so that my signature and the print number is included as part of the print. Here is an example:
    You'll see at bottom left there is my signature and underneath is is the print number e.g. 110/350 (this is legible when printed at 18x12" size).
    Inserting the signature and the "/350" is easy since it only needs to be done once per image.
    The difficulty comes with inserting the actual print number e.g. "110"
    At the moment I have 0 to 9 written out and scanned in as separate numbers. So to make "110" I use the "1" digit twice, plus the "0" digit. I.e. I haven't written out 1 to 500 and scanned them in all as separate numbers, I've just done the 10 digits and use those 10 digits to make all the different numbers I need.
    Is there a way to create an action that will create say 350 JPEG copies of the original file, each one with its own unique print number inserted? (And ideally automatically saved with the print number as its file name!)
    Many thanks in advance

    This Script might be able to do some of what you wanted (the startNumber and endNumber would have to be set in the Script).
    It needs a Layer Group named »numbers« to contain layers for the numbers named »0«, »1«, …
    (script edited)
    // this script saves jpg copies with numbers created from number-layers in a layer group;
    // use it at your own risk;
    #target photoshop;
    if (app.documents.length > 0) {
    // define the numbers to create;
    var startNumber = 290;
    var endNumber = 310;
    // set to pixels;
    var originalRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    // get doc;
    var myDocument = app.activeDocument;
    // getting the name and location;
    var docName = myDocument.name;
    var baseName = docName.match(/(.*)\.[^\.]+$/)[1];
    //getting the location;
    var docPath = myDocument.path;
    // duplicate the image;
    var thecopy = myDocument.duplicate (thecopy, false);
    // jpg options;
    var jpgopts = new JPEGSaveOptions();
    jpgopts.embedProfile = true;
    jpgopts.formatOptions = FormatOptions.STANDARDBASELINE;
    jpgopts.matte = MatteType.NONE;
    jpgopts.quality = 9;
    // get number layers;
    var numberSet = thecopy.layers.getByName("numbers");
    // collect in an array;
    var theNumbers = [numberSet.layers.getByName("0"), numberSet.layers.getByName("1"), numberSet.layers.getByName("2"),
    numberSet.layers.getByName("3"), numberSet.layers.getByName("4"), numberSet.layers.getByName("5"),
    numberSet.layers.getByName("6"), numberSet.layers.getByName("7"), numberSet.layers.getByName("8"), numberSet.layers.getByName("9")];
    numberSet.visible = true;
    // proceed if all numbers have been found;
    if (theNumbers.length == 10) {
    // hide layers;
    for (var n = 0; n < numberSet.layers.length; n++) {
    numberSet.layers[n].visible = false
    var theState = thecopy.activeHistoryState;
    // process the numbers;
    for (var m = startNumber; m < endNumber + 1; m++) {
    // the position;
    var theHor = 500;
    // create an array for the new numbers;
    var theArray = new Array;
    // the number;
    var thisString = String(m);
    // duplicate layers to create the numbers;
    for (var o = 0; o < thisString.length; o++) {
    var theNumberLayer = theNumbers[Number(thisString[o])];
    // create copy;
    var theLayer = duplicateMoveRotateScale (theNumberLayer, theHor - Number(theNumberLayer.bounds[0]), 0, 100, 100, 0);
    theNumberLayer.visible = false;
    //alert (m+"_"+o+"\n"+theNumberLayer+"\n"+theLayer);
    // set the hor to edge of the new layer;
    var theHor = theLayer.bounds[2];
    theArray.push(theLayer);
    // get the number for the file name;
    var theNumber = bufferNumberWithZeros(m, String(endNumber).length);
    //save jpg;
    thecopy.saveAs((new File(docPath+"/"+baseName+"_"+theNumber+".jpg")),jpgopts,true);
    // remove copied layers;
    //for (var p = theArray.length - 1; p >= 0; p--) {theArray[p].remove()};
    thecopy.activeHistoryState = theState;
    // close copy;
    thecopy.close(SaveOptions.DONOTSAVECHANGES);
    // reset ruler;
    app.preferences.rulerUnits = originalRulerUnits
    //that’s it; thanks to xbytor;
    ////// buffer number with zeros //////
    function bufferNumberWithZeros (number, places) {
              var theNumberString = String(number);
              for (var o = 0; o < (places - String(number).length); o++) {
                        theNumberString = String("0" + theNumberString)
              return theNumberString
    ////// duplicate layer and move, rotate and scale it //////
    function duplicateMoveRotateScale (theLayer, theX, theY, theScaleX, theScaleY, theRotation) {
    app.activeDocument.activeLayer = theLayer;
    try{
    // =======================================================
    var idTrnf = charIDToTypeID( "Trnf" );
        var desc10 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref6 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref6.putEnumerated( idLyr, idOrdn, idTrgt );
        desc10.putReference( idnull, ref6 );
        var idFTcs = charIDToTypeID( "FTcs" );
        var idQCSt = charIDToTypeID( "QCSt" );
        var idQcsa = charIDToTypeID( "Qcsa" );
        desc10.putEnumerated( idFTcs, idQCSt, idQcsa );
        var idOfst = charIDToTypeID( "Ofst" );
            var desc11 = new ActionDescriptor();
            var idHrzn = charIDToTypeID( "Hrzn" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc11.putUnitDouble( idHrzn, idPxl, theX );
            var idVrtc = charIDToTypeID( "Vrtc" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc11.putUnitDouble( idVrtc, idPxl, theY );
        var idOfst = charIDToTypeID( "Ofst" );
        desc10.putObject( idOfst, idOfst, desc11 );
        var idWdth = charIDToTypeID( "Wdth" );
        var idPrc = charIDToTypeID( "#Prc" );
        desc10.putUnitDouble( idWdth, idPrc, theScaleX );
        var idHght = charIDToTypeID( "Hght" );
        var idPrc = charIDToTypeID( "#Prc" );
        desc10.putUnitDouble( idHght, idPrc, theScaleY );
        var idAngl = charIDToTypeID( "Angl" );
        var idAng = charIDToTypeID( "#Ang" );
        desc10.putUnitDouble( idAngl, idAng, theRotation );
        var idIntr = charIDToTypeID( "Intr" );
        var idIntp = charIDToTypeID( "Intp" );
        var idbicubicAutomatic = stringIDToTypeID( "bicubicAutomatic" );
        desc10.putEnumerated( idIntr, idIntp, idbicubicAutomatic );
        var idCpy = charIDToTypeID( "Cpy " );
        desc10.putBoolean( idCpy, true );
    executeAction( idTrnf, desc10, DialogModes.NO );
    return app.activeDocument.activeLayer
    } catch (e) {}
    Edit: This Script just uses the layers’ horizontal bounds for orientation, so it does not address the issue I referred to earlier reagrding aesthetically pleasing spacing of the elements.

  • How to create an ACTION

    I was just told on another thread to create an ACTION to watermark 80 pictures in one step, however I must be doing something wrong:
    This is step by step what I am doing, I must be doing something wrong because it is not working:
    I create a PSD file with a transparent layer that says "DO NOT PRINT" , this is the layer that I will be adding to all the pics.
    I open the ACTION window and select "CREATE A NEW ACTION" I put a name to it "WATERMARK", press OK and the record button starts.
    I open ONE picture, I open the previously created watermark PSD file, I select the PSD file and drop it on top of the picture, I reposition a little bit so it is in the middle.
    I press save on the picture and select the same name, I do not want to create a new file, just the same name is fine, I have saved all the original pictures somewhere else.
    I close the picture and press stop. So I have an ACTION recorded
    Ok now I go to FILE + AUTOMATE+ BATCH
    I select the name of the action I just created "WATERMARK", now I CHOOSE a folder with many pictures inside, I want to add the watermark on all these pictures from this folder that I am selecting.
    On destination I select NONE, as was indicated in my action I am saving under the same name on the same folder, I do not want to create another folder.
    OK SO I PRESS OK ......
    what the action is doing is...... it opens the pictures on the folder I selected, but inmediately after opening a new picture IT OPEN THE PICTURE WHERE I CREATED THE ACTION and it does all the steps I did on the same picture where I created the action, it doesnt do the action on the new pictures, it just keeps doing over and over again on the same picture where I created the action.
    So at the end I have re-saved over and over again the same picture but it didnt even touch the pictures from the new folder, it just opened every picture but it didnt run any action on them, as indicated the ACTION run over and over again on the same picture where I created the action.
    What am I doing wrong??
    Thanks!

    Actually I am sorry, this is not exactly was is happening.....
    When I do the SAME STEPS in the previous post what it does is gives me an ERROR message and it says "MOVING FUNCTION IS NOT AVAILABLE" so I interpreted as if "for some reason" the ACTION function does not allow me to move layers inside a new picture.
    Due to this what I did was I press the START NEW ACTION , open a new picture and from scratch create a new layer that says "DO NOT PRINT" ... when I do this and I select a new folder to run the action, what it does is it re-saves and re-saves over and over on the same picture where I created the original action, the action doesnt run on each new picture.
    Sorry for all this messy explanation, I am as confused as all this long explanation!!!

  • How to create an action that will crop two sections from one scanned image?

    I'm trying to create an action that will automate the process of cropping the left and right pages from a series of two-page book scans.
    I tried to create a 2 step action which first crops the left half of a scan (by setting the left margin to 0in and the right margin to 6in) and then the right half of the scan (by setting the left margin to 6in and the right margin to. 12in), however when executing, only the left half appears to be cropped.
    I imagine this is due to the fact that once one side of the initial scan is cropped, the other side disappears.
    Is there any way around this?

    Basically i need to create a new document out of a folder full of images.
    You may have to look into Scripting to achieve something like this.
    You could ask in the Scriptimg Forum
    Photoshop Scripting
    But maybe it would suffice to insert the Menu Item
    File – Scripts – Load Files into Stack
    into the Action and then iterate through the Layers with [ or ] and reset the opacities and Blend Modes – but as Actions would not be able to change the number of repetitions of the operation conditionally a custom Script would still seem preferable. 

  • How to create an Action Profile for a Survey

    Hi
    Can you please help me with the steps to create an Action Profile for a Survey. Eg. If the user creates a like Lead / Service, Action profile assigned to the Transaction type has to trigger the Survey.
    Thx

    Hi Kalees,
                Survey is nothing but a Questioner that is Represent the Feedback for a Particular Transaction.
    Controlling Survey by a Action Profile is possible to some Extent indirectly.
    One way of Controlling the Survey Execution based on System Status
    Go To:Customer Relationship Management>Transactions>Settings for Activities>Questionnaires>Define Determination Criteria for Questionnaires Define a Criteria Set for a Particular Status,Here what ever Status Assigned are Responsible for the Survey Form to Appear in that Transaction Type at that Particular Status.
    In Define Determination for Questionnaires: Business Activity:assign the Criteria Set that you have Created to your Survey Form
    Go To:Customer Relationship Management>Transactions>Basic Settings>Status Management>Change Status Profile for User Status The Status Profile that you are using Ensure that the System Statuses are Assigned to a User Status on which you want the Survey Determination to Happen.
    Direct Action Trigger for Survy Form is not Possible
    This is one way to Control the Transaction Type Status and in mean you shall indirectly get Control over the Survey Form
    Hope it Answers your Queries..
    Thanks and Regards,
    RK.

  • How To create multiline NSTextField programatically?

    Hi,
    I want to create multiline NSTextField programatically. I successfully created single line textField.
    Also i want to set text color? any help...
    Thanks.

    https://discussions.apple.com/community/developer_forums
    might be the best place to post this

  • How to create an Action without assotiating it with any jspx in config file

    In side adf-faces-config.xml, I am looking that, we can provide some action/actionlistener name to trigger the event in server side. And all cases i see it is directly associated to a jspx file. If want one action to declare and no jspx association with that action. And I want to use this action from one of my jspx file to redirect the flow to server side like 'response.redirect(MyActionName)'. How can I achieve the same.
    Thanks
    Subrata

    1. adf-faces-config.xml is the wrong file for this. You mean faces-config.xml
    2. Action events are client events that are initiated by a command action. You can create a generic action listener, but how would youimagine this to be triggered ?
    Frank

  • How to create an action to save the file as the name of the selected layer

    I have a .psd with several layers, and I would like to save multiple versions of the document based on the layer name. Is there a way to tell Photoshop to do this through an action? Also, how can I get rid of the "filename_copy" filenaming behavior. I'd like to hit a button and have the file saved as the layer's name while overwriting the existing document without renaming it to whatever_copy.

    The bad news is that it's not possible with an action.  An action simply can't access a layer name.
    But the good news is that it's possible with a script.  Almost anything's possible with a script.
    But the bad news is I'm no script expert.
    But the good news is that there are script experts who hang out here.
    The even better news is that there's a Photoshop scripting forum.
    Best of luck! 
    -Noel

  • How to create save actions in SQL Developer 1.5?

    Hi,
    I am trying to create a save action in SQL Developer, which shall execute "an external tool" I already added.
    I choose "Code-Editor" -> "save actions". I want to add an action, but there are 3 predefined actions and there is no possibility for me to add another. Is there a way for me to add a save action, as it is possible in eclipse?
    What I am trying to do is, I want to trigger an external sql formatter. The sql formatter, which is built in, doesn't fit my needs and the way I can configure it, is very sparse. Therefore I want to use an external tool do to this - and I want it to be executed after saving the document.
    Greetings,
    Daniel

    Right click on the table and select "Export Data": default format is INSERT statement.
    Example of generated SQL:
    --  Fichier créé - mardi-septembre-13-2011  
    --  DDL for Table HELP
      CREATE TABLE "SYSTEM"."HELP"
       (     "TOPIC" VARCHAR2(50 BYTE),
         "SEQ" NUMBER,
         "INFO" VARCHAR2(80 BYTE)
       ) PCTFREE 0 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 49152 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "SYSTEM" ;
    REM INSERTING into SYSTEM.HELP
    Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',1,null);
    Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',2,' @ ("at" sign)');
    Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',3,' -------------');
    Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',4,' Runs the SQL*Plus statements in the specified script. The script can be');
    Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',5,' called from the local file system or a web server.');
    Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',6,null);
    Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',7,' @ {url|file_name[.ext]} [arg ...]');
    Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',8,null);
    Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',9,' where url supports HTTP and FTP protocols in the form:');
    Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',10,null);
    (...)SQL Developer documentation: http://download.oracle.com/docs/cd/E18464_01/index.htm.
    Edited by: P. Forstmann on 13 sept. 2011 21:27

  • How to create data type programati​cally

    Hello,
    we are writing a custom sequence editor that will generate TestStand sequence. I can populate the generated TS sequence sequence with steps using primitive arguments like Boolean, String, Number. Our test methods also use structures and I am having problem with programatically creating custom data type that matches C# struct similarly as one would do in SeqEdit.exe
    I am assuming that there is something to do with Engine.NewDataType() and create new container, but then where to add the returned PropertyObject for it to be a type in the current sequence with a name?
    Roman

    Ray, that's great. This pointed me to right direction, thank you!
    In case someone else needs this; The example worked fine from TestStand, but not from C# :
    PropertyObjectFile[] typeFiles = MyEngine.GetTypePaletteFileList();
    PropertyObjectFile typeFile = typeFiles[0];
    TypeUsageList typeList = typeFile.TypeUsageList;
    string whyNotValid = typeList.ValidateNewTypeName(name, false, out isValidName);
    if (!isValidName)
    return null;
    PropertyObject newType = MyEngine.NewPropertyObject(PropertyValueTypes.Prop​ValType_Container, false, "", 0);
    newType.NewSubProperty("MyNum", PropertyValueTypes.PropValType_Number, false, "", 0);
    newType.SetValNumber("MyNum", 0, 123.0);
    newType.NewSubProperty("MyStr", PropertyValueTypes.PropValType_String, false, "", 0);
    newType.SetValString("MyStr", 0, "AA");
    newType.Name = name;
    typeList.InsertType(newType, 0, TypeCategories.TypeCategory_CustomDataTypes);
    typeFile.IncChangeCount();
    typeFile.SaveFileIfModified(false);
    SetValNumber and SetValString threw an exception on non-existing sub-property so I added the red lines.
    There is one feature not mentioned in example - If you want to have the type in the sequence file instead of INI type files, it also works like this
     PropertyObjectFile typeFile = MySequenceFile as PropertyObjectFile;

Maybe you are looking for

  • Report to see the materials  division wise

    how can we see the list of materials division wise

  • Windows Installer malfunctioning: Is there a workaround to install Adobe Reader?

    AFter hours on the phone with Microsoft to remedy this situation, the advice is to re-install Windows XP Pro. This is an attempt to avoid that action, if possible. Does anyone have a suggestion. All the methods outlined by Microsoft have been attempt

  • Refresh Classical report/basic list

    Hi, I have created a classical report/basic list where user can select check boxes and adjacent rows should be deleted. But after the action, I wish to refresh the report and remove the selected lines from displaying. Please let me know how to achiev

  • Reg : RFC Lookups

    Hi.. Now i have a scenario for u instead : this is what gimme a solid realistic approach :  i have records in this format lets say : RecordID   ordertype 900           0305 900           0305 920           DS01 900           0304 900           0305 9

  • License Cisco ESA in Cluster Configuration

    Guys, Do you have any idea about license Cisco ESA in Cluster Configuration > If i have two appliance in cluster configuration and i have 1000 user, which option for license i must buy ? 1. Just one license for two appliance (which in cluster configu