Actions and ActionListeners as parameters

Hi everybody,
I want to overload a method so it can take either 2 Actions, 2 ActionListeners, or one of each. The issue with this is that I'd have to make 4 overloaded signatures and almost identical methods, like this:
method( action, action )
method( action, listener )
method( listener, action )
method( listener, listener )It seems like doing it this way would result in a lot of extra code, and hence become a real pain in the neck. So, I was curious, has anyone else either tried to do this before, or do you have any ideas as to how I might be able to do this more efficiently? When I looked at the API it didn't look like Actions and ActionListeners share a root class I can use.
Thanks,
Jezzica85

jezzica85 wrote:
Hi everybody,
I want to overload a method so it can take either 2 Actions, 2 ActionListeners, or one of each. The issue with this is that I'd have to make 4 overloaded signatures and almost identical methods, like this:
method( action, action )
method( action, listener )
method( listener, action )
method( listener, listener )
Well, if you want to support that then you are just going to have to do suffer through it, the only shortcut I can recommend is that your method(action, listener) and method(listener, action) are the same so you only have to implement 1 and just use the other as a entry point to call the one you wish to contain the code.

Similar Messages

  • JSF Actions and ActionListeners with Tiles and forms

    I�m having a problem trying to use the Tiles functionality in Struts 1.1 with JSF and was wondering if anyone could help me.
    I have defined a very simple header, menu, content Tile that doesn�t involve nesting of tiles (ExampleTile_content1Level.jsp).
    I have 3 JSP pages, the first testHarness.jsp is NOT built using Tiles and is just used to load some test data into a session scoped bean using an actionListener and then forward to a Tile generated page (ExampleTile3.jsp) using a hard-coded action �applicationSummary� when a commandLink is pressed. This works fine for both the action and actionListener.
    ExampleTile3.jsp contains another commandLink that is meant to forward to another tile ExampleTile2.jsp. This also works until I try to add the <h:form> � </h:form> tag around the outside of the <h:panelGrid> tags in ExampleContent1.jsp when the action and actionListener then fail to fire and I get an �Error on Page� message in Explorer the detail of which says �Error �com_sun_rave_web_ui_appbase_renderer_CommandLinkRendererer� is null or not an object�.
    However I need a form so that I can bind UI controls to data from the bean stored in the session scope. This is only a problem when I use Tiles to define the pages. Does anyone know what I am doing wrong?
    Any help would be much appreciated.
    Tiles.xml
       <definition name="example3" path="/pages/exampleTile_content1Level.jsp" >
              <put name="headerClass" value="someStyle"/>
              <put name="menuClass" value="someStyle"/>
              <put name="contentClass" value="someStyle"/>
              <put name="header-title" value="/pages/exampleHeader.jsp" />
              <put name="menu" value="/pages/exampleMenu.jsp" />
              <put name="content" value="/pages/exampleContent1.jsp" />
       </definition>
       <definition name="example2" path="/pages/exampleTile_content1Level.jsp" >
              <put name="headerClass" value="someStyle"/>
              <put name="menuClass" value="someStyle"/>
              <put name="contentClass" value="someStyle"/>
              <put name="header" value="/pages/exampleHeader.jsp" />
              <put name="menu" value="/pages/exampleHeader.jsp" />
              <put name="content" value="/pages/exampleContent2.jsp" />
       </definition>ExampleTile3.jsp
    <f:view>
         <h:form>
              <tiles:insert definition="example3" flush="false" />
         </h:form>
    </f:view> ExampleTile2.jsp
    <f:view>
         <h:form>
              <tiles:insert definition="example2" flush="false" />
         </h:form>
    </f:view> Faces-config.xml
    <navigation-rule>
        <from-view-id>/pages/testHarness.jsp</from-view-id>
           <navigation-case>
                <from-outcome>applicationSummary</from-outcome>
                <to-view-id>/pages/exampleTile3.jsp</to-view-id>
              <redirect/>
           </navigation-case>
    </navigation-rule>
    <navigation-rule>
        <from-view-id>/pages/exampleTile3.jsp</from-view-id>
           <navigation-case>
                <from-outcome>nextPage</from-outcome>
                <to-view-id>/pages/exampleTile2.jsp</to-view-id>
                <redirect/>
           </navigation-case>
    </navigation-rule> ExampleTile_content1Level.jsp
    <tiles:importAttribute scope="request"/>
    <h:panelGrid columns="1" >
         <f:subview id="header-title">
              <tiles:insert name="header-title" flush="false" />
         </f:subview>
         <f:subview id="menu">
              <tiles:insert name="menu" flush="false" />
         </f:subview>
         <f:subview id="content">
              <tiles:insert name="content" flush="false" />
         </f:subview>
    </h:panelGrid> ExampleHeader.jsp / ExampleMenu.jsp
    <tiles:importAttribute scope="request"/>
    <h:panelGrid columns="1" columnClasses="someSyle">
         <h:outputFormat value="This is the {0}.">
              <f:param value="Header / Menu as appropriate "/>         
         </h:outputFormat>
    </h:panelGrid> ExampleContent1.jsp
    <tiles:importAttribute scope="request"/>
    <h:form>     <----- Fails with this tag included but works without it.
    <h:panelGrid columns="1" >
              <h:outputFormat value="This is the {0}.">
                   <f:param value="Content on the FIRST page"/>
              </h:outputFormat>
              <h:commandLink action="nextPage" immediate="false">
                   <h:outputText value="Click to go to next page"/>
              </h:commandLink>
    </h:panelGrid>
    </h:form> ExampleContent2.jsp
    <tiles:importAttribute scope="request"/>
    <h:panelGrid columns="1" >
         <h:outputFormat value="This is the {0}.">
              <f:param value="Content on the SECOND page"/>
         </h:outputFormat>
    </h:panelGrid>

    jezzica85 wrote:
    Hi everybody,
    I want to overload a method so it can take either 2 Actions, 2 ActionListeners, or one of each. The issue with this is that I'd have to make 4 overloaded signatures and almost identical methods, like this:
    method( action, action )
    method( action, listener )
    method( listener, action )
    method( listener, listener )
    Well, if you want to support that then you are just going to have to do suffer through it, the only shortcut I can recommend is that your method(action, listener) and method(listener, action) are the same so you only have to implement 1 and just use the other as a entry point to call the one you wish to contain the code.

  • Copying shared actions and objects with new parameters

    Hi All
    I have a problem with objects and shared actions. Here is the scenario:
    I have a sentence where parts of it are written in an informal way. The user is to tap the words of the sentence she/he thinks are informal, and they become highlighted. The user may click a submit button at any time, and if all the correct words have been highlighted, they receive a correct message.
    To achieve this I have given each word two click boxes (one for on and off), a highlight box, and have created shared actions for these to work.
    When I copy the group (the two click boxes and the highlight box), the actions are copied too. However, the shared actions parameters still point to the original, and not the copy. So my question is...
    Is there a way to copy objects and their associated shared actions, and have the parameters of the shared actions change to match the newly copied objects?
    Cheers
    Lewis Carey

    Hi Lewis,
    While Copy-Pasting can you make sure that you copy all the referred objects that are used as parameters.
    Also can you please upload your project file(cptx) to acrobat.com and email me the download link at [email protected]
    Regards,
    Haridoss

  • Automation plugin as action and via File/Automate

    Hi,
    I have an Automation plugin that is scriptable (it has a number of exposed scriptable parameters and can be recorded and run from Actions palette). The plugin displayes the UI when it is called interactively (from File/Automate).
    I am however having troubles distinguishing when it is called from an Action palette as a playback of recorded action and when it actually was called interactively from File/Automate (testing it in Photoshop CS6). On plugin invocation I check passed action descriptor and if not empty, read parameters from it and don't show the UI. On the call end, I write script parameters back to a descriptor to be able to use them in recorded action. With this in mind, after PS start first time selecting File/Automate works as expected - no descriptor/parameters passed into the plugin. But after a first call, Photoshop seems to keep the descriptor/parameters written at the end of the plugin and passes it on subsequent user invoked File/Automate. The same happens if plugin is getting called from a recorded action playback (and its expected). Basically after a first invocaction, the plugin will always receive action descriptor whether it called from an action playback or invoked by user.
    I need to distinguish these two cases and basically present UI/start from scratch when user invokes it and use the passed action parameters when action plays it. I have not found anything in SDK to point me to the solution so I'd appreciate the help.
    In filter plugins I can at least get selector start when invoked from UI and use that to free/ignore the action descriptor data.

    I don't think you should care. The option you do care about is this one:
    PIDialogPlayOptions playInfo
    That is part of  PIActionParameters *actionParameters
    That is part of your PSActionsPlugInMessage that comes into your automation plugin entrypoint.
    This parameter has three options:
    a) always display the dialog,
    b) only display the dialog if you don't like the parameters you are given,
    c) never display a dialog (either return an error or proceed with best options but don't stop with a dialog)
    From the file menu, user selected, you should get option a (always). From the actions panel you should get option a or b. From scripting you can get all three options.
    There is also a property in PIProperties.h called propPlayInProgress but the above information should be what you need to do the correct thing with dialogs.

  • UICommand action and actionListener - invoke in different phases

    Hi,
    I am trying to get the action and actionListener methods of a command button invoked in different phases. When the button is pressed I would like the actionListener to be invoked immediately, but the action method only in the "invoke applications phase", unless the form validation failed.
    Setting immediate to "true" doesn't work, as I can't get the action method to be queued for later processing. I also can't make them both actionListeners as the action method controls navigation.
    Any way round this?
    Thanks!

    Action = Executed in the invoke application phase. Runs a method in a bean that returns a String object. The String is used by the navigation system to determine which page to render next. The rules for this are set up in the faces-config.xml file, in the navigation-rule sections.
    ActionListener = Executed in the invoke application phase. Is triggered when the action event occurs for the component the listener is attached too. This listener can perform miscellaneous actions required when the button is clicked, but does not return a String that affects the navigation.
    What order do they get called? Try this out!
    http://www.jsftutorials.net/faces-config/phaseTracker.html
    It'll help you understand the JSF lifecycle. Which is VERY important, especially when those weird errors start occurring (or JSF seems to be ignoring your commands).
    CowKing

  • Critical Action and Role/Profile Analysis job in not running in GRC 5.3

    Hi Team,
    I  am working for a client where GRC 5.3 is installed( support pack 4 and patch 1).
    The installation is complete and also the post processing is done.
    We have scheduled a periodic ( weekly ) incremental background job for Critical Action and Role/Profile.
    Following are the parameter setting used:
    Task: Risk Analysis -Batch
    Batch Mode : Incremental
    First time it run successfully on 28th June'09 and it is completed with spool also. But next time it is supposed to run on 4th of July'09 . But it does not. And since then it is in same state.
    I am not able to find any reason that why it is behaving this way where other incremental jobs are running successfully.
    It will be helpfull if any one can guide me providing the solution.
    Regards,
    Kakali

    Hi Varun,
    I go to the Job History Button. It shows the following data only :
    2009-06-28 00:00:59 Done Job Completed successfully
    2009-06-27 23:45:00 Started RAR_PE1CLNT100_Critical Action and Role/Profile Analysis started :threadid: 0
    Under the Last Run Colomn it shows 28th June ( Status -completed)
    Under Next Run Date it is showing 4th July
    Follwoing are the list of Updates available From SP05
    When executing the critical roles/profile jobs in background, a message
    "error while executing the Job: null" comes up. ---( this one is for which come under Informer Tab)
    Background job spools are not available after upgrade from 5.2 to 5.3.
    Critical action and critical role/profile analysis cannot be run in
    background by system. --- ( But in my case It ran for once )
    Selection parameters (System, User and User Group) have been provided for
    "Critical Action and Role/Profile Analysis" in Configuration->Background
    Job->Schedule Job. --- ( it means it run usually)
    Critical Actions report in detail view shows no results after executing the
    Risk Analysis Job in the background. The same report shows data when
    executed in the foreground. ( this one is for which come under Informer Tab )
    When there is only one periodic job configured in RAR, this job fails to
    start after the first time in the specified time. ( this is not true, becoz there other periodic jobs running successfuly)
    Unable to run Informer - audit reports - critical role and profiles with
    logical systems. ( this is again under Informer Tab )
    I had gone through this  earlier also, but not able to match any update with my problem. If if have any other suggestion you can provide me the same.
    Is there any way to check for job log so that I can check what is the problem. View Log option is also greyed out as we have sap logger set up as a default logger Parameter. I have made it enable just to check but there is nothing.
    Please Guide.
    Regards,
    Kakali

  • Warning: Action and Event are not compatible for LinktoAction type

    Hi,
       I get a warning message "Action and event are not compatible" for the action associated with the type LinkToAction. The Action method "ShowDetails" has the parameters wdEvent (default) and IWDNodeElement.
       Can anybody please suggest what causes this warning?
    Regards
    Sagar

    Sagar,
    Unfortunately, it is impossible to remove this warning completely. However, you may safely ignore it.
    What you can do is copy text of warning (or part of text), then click "Filter" icon on Tasks view in IDE and set filter to hide these warnings. I do this for annoying "UI element has no lable text"
    Valery Silaev
    SaM Solutions
    http://www.sam-solutions.net

  • I delete some emails ,there are moved to trash . I delete them from trash folder too and they still appear in a folder called 'all messages". I repeat the same actions and after a while they appear again!what should i do to delete them permanently??

    I delete some emails ,there are moved to trash . I delete them from trash folder too and they still appear in a folder called 'all messages". I repeat the same actions and after a while they appear again!what should i do to delete them permanently??

    If you are using Apple's Mail app 6.5 is the latest version irrespective of what a previous poster says. It does sound though that you are using a gmail account online via a web browser. Please confirm and fill in missing information.

  • HT4085 How do I lock my ipad screen so the swipe action and side button on screen don't work? My cats do these things and the game disappears.

    How do I lock my ipad screen so the swipe action and the side button on the screen do not work?  When my cats play a game on my ipad, they regularly swipe the screen and push the side button and the game disappears.

    The button on the top that you use to lock and unlock or put to sleep is the power button.  The button lower center of the screen is the home button...can be used to also wake from sleep and switch to the base home screen.
    Good to hear you are now able to lock rotation, even if you are not sure how you did it
    If you go to the iBook icon, tap Store in the uppper left side of the screen, you can search for the iPad User Guide...a free download that will place the guide in your iBooks library as a great source of background information.

  • How to pass Multi and Singlr value Parameters to DB2 query, which is using in SSRS report for ODBC connection

    Hi Guys,
    I am using DB2 database in SSRS. I have to pass Single Value and Multi Value Parameters. I tried with Select * From DB2Table Where
    Column=@PRM_Name Or Select * From DB2Table Where
    Column=:PRM_Name . It is not working and throwing error. Please help me out.
    Connection Details: ODBC
    Thanks Shiven:)

    Hi SKM,
    So you mean to say that Go to DataSource->Add Dataset-> Query Type-Text-> Under Query:
    click on fx (Expression)-> Write this expression
    For Single Value Parameter:
    ="SELECT customer_name, telephone_number, address1, address2, city from MyTable
    WHERE city = '" + Parameters!City.Value + "'"
    OR
    ="SELECT customer_name, telephone_number, address1, address2, city from MyTable
    WHERE city =  '" & Parameters!City.Value & "'"
    Keep it in mind if Parameter is String then
    It should be in Single quote ''.
     Like
    ="SELECT customer_name, telephone_number, address1, address2, city from MyTable WHERE city
    ='Hyderabad' "
    For Multivalu Parameter:
    ="SELECT EmployeeID, FirstName, LastName, LoginID FROM SHIVEN.AUDIT Where FirstName
    in ('" + REPLACE(JOIN(Parameters!City.Value,","),",","','") + "')"
    NOTE:
    If your Parameter is Single Value Parameter and You want to enter string values with Coma (,)
    separated (Like Hyderabad, Chennai, Delhi).
    In this case, you have to use below expression.
    ="SELECT customer_name, telephone_number, address1, address2, city from MyTable
    WHERE city IN ('" + REPLACE(Parameters!City.Value ,",","','") + "')"
    OR
    ="SELECT customer_name, telephone_number, address1, address2, city from MyTable
    WHERE city IN  ('" & REPLACE(Parameters!City.Value ,",","','") & "')"
    In above expression: Replace will replace all , with ‘,’ and city IN (‘Hyderabad’, ‘Chennai’,
    ‘Delhi’) will not throw any error.
     Note: You have to write expression in one line in Expression editor for dataset
    query
    Thanks It is working fine but it is tough job if query is big.
    Hi S kumar,
    The above approach we use when we have source like DB2, becasue DB2 has some syntactical differences to pass multivalue paramaeter. I tested and it works good, if i am mentioning the query in above format by using Fx button while creating dataset.
    but if we want fetch data from view which exist in DB2 and we need to call db2 view in SSRS and pass multivalue parameter in a way we did above then could you please mention the steps and way to achieve this.
    Thanks in advance!

  • How to:  using the Place command in an action and remember the correct source filename...

    I have a large set of product, architecture, and other subject-specific photos, that I’m preparing for a new website; all to be placed in various galleries.
    For each photo, I want it to have the same background.  If I were doing this manually, I would simply “place” the subject photo into the background, and save it – back to the original photo name.
    In other words, doing this manually, PRODUCT_001.TIF gets placed into STANDARD_BKGRND.TIF, (thereby automatically correctly sizing and centering it), and then saving the result back to PRODUCT_001.TIF; either overwriting the original, or into a new folder.   (I have the original file somewhere else, and am working with an intermediate copy).
    But since I have several hundred photos, how do I create an action (and really – a droplet) that will save the resulting file to the desired name?  Typically placing photo ‘PRODUCT_001’ into photo ‘B’, alters photo ‘STANDARD_BKGRND’, so I can’t save the result back to ‘PRODUCT_001’.  Said differently, in a droplet, each time it's run saves the result back to the same filename 'STANDARD_BKGRND'.
    The end result – I want to apply that droplet to all the PRODUCT_***.TIF files in a given folder, and end up with the same file names as before.
    Thanks in advance for your help!
    Jerry
    PS - I have no scripting experience in PS, but have written code in other applications/scenarios.

    Its great that your products are cutouts layers,  Its easy to put cutouts on backgrounds and even add layer style to the product layer to enhance the composite. Still cutouts have size and resolution as  do your background images. 
    When you make composites. A document that is place in or pasted into the current document will be resample to match the current documents DPI resolution to preserve the size of the document being place or pasted in size.
    Additionally if your using place if the document being placed in does not fit within the current document's canvas size. Photoshop may scale the image to fit within the canvas.  It depends on your user id Photoshop Preference setting.
    That means you need you handle the sizes involved.
    I would think that you would want the final composite to be the size of the background image.
    You need to know its size and dpi resolution.  You must use image size on your product image and make the image have the same dpi resolution and a size smaller then the background image.  Perhas they have the same dip resolution as the background and are smaller in size. If that the cast their size are good no image resize  is required,
    Then you need to use canvas size to make the document have the same size and resolution as the background image.
    You may want to center the product layer over the canvas however Canvas size will add canvas evenly around the produt layer's layer bounds when you leave the anchor point in the center. 
    When you then place in the background image it will not be resampled for it has the same dpi resolution as the current document and it will not be scaled for it is an exact canvas size fit.  All that remains to be done is  move the current placed layer below the  product layer 
    The document name is the product image file name opened by you or by Photoshop automate batch process.

  • How to:  using the Place command in an action and remembering the source filename...

    I have a large set of product, architecture, and other subject-specific photos, that I’m preparing for a new website; all to be placed in various galleries.
    For each photo, I want it to have the same background.  If I were doing this manually, I would simply “place” the subject photo into the background, and save it – back to the original photo name.
    In other words, doing this manually, PRODUCT_001.TIF gets placed into STANDARD_BKGRND.TIF, (thereby automatically correctly sizing and centering it), and then saving the result back to PRODUCT_001.TIF; either overwriting the original, or into a new folder.   (I have the original file somewhere else, and am working with an intermediate copy).
    But since I have several hundred photos, how do I create an action (and really – a droplet) that will save the resulting file to the desired name?  Typically placing photo ‘PRODUCT_001’ into photo ‘B’, alters photo ‘STANDARD_BKGRND’, so I can’t save the result back to ‘PRODUCT_001’.  Said differently, in a droplet, each time it's run saves the result back to the same filename 'STANDARD_BKGRND'.
    The end result – I want to apply that droplet to all the PRODUCT_***.TIF files in a given folder, and end up with the same file names as before.
    Thanks in advance for your help!
    Jerry
    PS - I have no scripting experience in PS, but have written code in other applications/scenarios. 

    Actions don't have access to the document name (where the file name is).  Scripts do, however.
    If your products are sequentially numbered, you're in luck.  You can overide the "Save as command" and make sure that your naming uses a sequence which you can set to the same starting number as your product. Here is an example of how to configure File -> Automate -> Batch (assume the set and action are your hand built one)
    Instead of "Document name" you'd type "PRODUCT_" per your example and choose a 3 digit Serial number.
    The "Starting Serial #" is where you can change if your products are numbered say, 101 and up.

  • I can't synch my iPhone with iTunes because the device does not show up in a device window when I plug it in...it's missing in action and thus I'm not able to add any content from the iTunes to my iPhone, e.g. podcasts

    I can't synch my iPhone with iTunes because the device does not show up in a device window when I plug it in...it's missing in action and thus I'm not able to add any content from the iTunes to my iPhone, e.g. podcasts.   All the instructions on synching start with "find your device in the device window".  But what if you have no device window?

    Missing "message" from above: The iPad "DGMTR" is synced with another iTunes library on DGMTR's MacBook Pro. Do you want to erase this iPad and sync with this iTunes library? An iPad can be synched with only one iTunes library at a time. Erasing and syncing replaces the contents of this iTunes library.
    I thought the libraries were the same.

  • Unable to expand DG is Lync client - Cannot perform this action, and the cause is unknown.

    Hi,
    I have a user in our Hong Kong office that is unable to open a distribution group she has added to her Groups. She gets the error message "Cannot perform this action, and the cause is unknown. Contact your support team to investigate."
    I can add the group and expand it, so can some of her colleague, and some cannot. Her colleagues who can have the same client and global policy settings as she does. 
    I read in a similar thread that this could be resolved by confirming the server times on Lync, AD (domain controller checked and Exchange but they were all correct and in sync. 
    The global policy is set to 250 max contacts - but does a DL count as 1 contact, or does it count all the people within the DG? I am getting HK to confirm she does not have too many contacts but I dont think this is the issue. 
    Anyone else come across this issue?
    Phil

    You can run the command Test-CsGroupExpansion to test the ability of a user to employ group expansion.
    For the usage of the command, you can check
     http://technet.microsoft.com/en-us/library/gg399009.aspx
    Lisa Zheng
    TechNet Community Support

  • Lost all my actions and 3rd party filters after upgrading to Photoshop CC 2014

    How do I get all of my actions and 3rd party filters from Photoshop CC to Photoshop CC 2014?

    If you migrate your CC presets you should get your Actions, Pattens, Sahapes, Shapes etc back. Menu Edit>Presets>Migrare Presets. You need to copy or to install you 3rd Party plug-ins into CC 2014.

Maybe you are looking for

  • How to interrupt a process ?

    I have started a process to transfer files from my pc to my imac and it seems to be blocked. Howcan I interrupt it ?

  • Jarsigner - IllegalStateException: zip file closed

    E:\>e:\j2sdk1.4.2\bin\jarsigner.exe -verify -verbose e:\eclipse\startup.jar jarsigner: java.lang.IllegalStateException: zip file closed any idea? unzip can do unpack the .jar file with no problem the jar utility can manage the file: E:\>e:\j2sdk1.4.2

  • SAP HANA Documents/Blogs

    Hi Mentors, I have recently started with SAP-HANA .Would like to know the document taking into consideration the following 2 scenarios's : 1.  SAP HANA along with SAP-BW . 2.  SAP HANA stand alone Please let me know the related blogs/Articles for the

  • RT- cannot setup HDD, or new ip

    Hi fellows,  I am trying to set a desktop PC as a RT, but I'm very disappointed with the results as I tested everything and got no advancement... ...would you please please help me out here?! These are PC spec, motherboard: Asus P5Q SE PLUS (has IDE)

  • ITunes U Support Email

    I am the iTunes U admin for my university. Who can I contact to find out how to properly format an Atom feed for use on our iTunes U site? The iTunes U admin guide does not go into detail. thanks