Setting up dynamic actions

Hullo there,
I'm still on my way with my Monopoly game.
Now, I have a center panel displaying the squares 'properties' when a player lands on it. For example, when he lands on a Station, the center panel has a list with the price, the owner (if owned), etc. This is done via a SquareListener.
So far, so good. BUT, I'd like now to give the player options in a popup menu.
For example, if the square is owned by himself, he can't buy it, but can sell it or built it. On the other hand, he may buy each square which isn't already oned by somebody...
This is where I'm stuck. My square listener isn't enough here. I'll have a lot of testing and checking to do for each square. So I thought there might be another solution for this.Maybe a list of actions. But what of type would be these ? Moreover, the actions cannot belong to the square, since they will be different for each player (see above).
What am I to do there ?
Sorry if it's a bit confuse, I'm confused and quite lost here, to say the truth.

1) Is it the correct way to do it or should I create a
separate Actions class ?Why are you re-creating the actions all the time?
I would write it as:
public class Square {
    Action buy;
    Action build;
    Action[] allActions;
    //Add some more attributes
    public Square()  {
        buyAction = new BuyAction();
        build = new BuildAction();
        allActions = new Action[] { buy, build };
    public Action[] getAction(Player player) {  //The method could return a JMenu
        for (int i=0; i<allActions.length; i++) {
            allActions.setEnabled(true);
if (player.equals(owner)) {
buy.setEnabled(false);
return allActions;
class BuyAction extends AbstractAction {
//Add some code here
//Add code for the other inner classes
You could either write the actions as innerclasses, or as separate classes, and write a callback interface. Depends on your situation.
2) I read somewhere some time ago (don't remember
where nor when) that custom actions where memory
consuming and one should prefer actionListeners. Is
this true ? You don't have to bother about that in your case (just try to change your implementation so that you aren't re-creating all actions all the time. Actions is what you should normally use, since an action can be re-used. I.e. you can add/set the same action to a button and menu item etc. And when you disable the action, all buttons and menu items that has it will be disabled.
/Kaj

Similar Messages

  • Enter a value using set value dynamic action

    Hi,
    I'm using Oracle 11g XE with apex 4.0.2.
    I've been trying to use a dynamic action on a text field 'item_group'. Button doesn't have this facility. I created an advanced action using 'set value' with no condition the value being 'RAM.' The event is "change", selection type 'event source', set type is 'static assignment' and value is RAM. It is supposed to trigger when the create button is pressed but nothing happens and the field is still null. I've tried variations on this but nothing works. Can anyone help.
    Thanks
    Tim

    are you looking dynamic sql ?
    Refer this
    http://docs.oracle.com/cd/B10500_01/appdev.920/a96590/adg09dyn.htm

  • Select List not setting on Dynamic action

    I have a report with a SQL query with a condition based on a select list on the same page. So I have a select list - :P9_PARTID
    My query for my report is:
    select l.sitename, sum(qty) "No."
    from eng_stock s, eng_sites l
    where partid=:P9_PARTID and l.id=s.siteid and TRANSTYPE not in ('Purchase','Transfer From')
    group by l.sitename
    When a person makes a selection on the select list (:P9_PARTID), I the report updates without having to submit the page. great!
    However.. when the :P9_PARTID select list stays null?
    Thanks in advance!

    I'm having a little trouble with your grammar, but I think you're asking for this:
    select l.sitename, sum(qty) "No."
    from eng_stock s, eng_sites l
    where (partid=:P9_PARTID OR :P9_PARTID IS NULL)
    and l.id=s.siteid and TRANSTYPE not in ('Purchase','Transfer From')
    group by l.sitenameRegards,
    Scott
    blog: [url grassroots-oracle.com]grassroots-oracle.com
    twitter: [url twitter.com/swesley_perth]@swesley_perth
    -- please mark any useful posts as helpful or correct, in the end it helps us all

  • Dynamic action setvalue from pl/sql function

    Hi,
    I have a currency table with exchange rate column.
    I created a form that allow user to select currency from the table and get the rate into Px_RATE page items.
    I would like to implement it using Dynamic action in apex 4
    Please help me on this case
    Thanks & regards

    Hi,
    You can achieve this by defining a dynamic action as follows...
    #1 - Right click on the page item used to select the currency (let's call it P1_CURRENCY for purposes of this example) and select 'Create Dynamic Action'
    #2 - Select 'Advanced' as we're going to use the 'Set Value' dynamic action type, which is not available in the 'Standard' branch of the wizard.
    #3 - Name your dynamic action, say 'GET RATE', click 'Next'.
    #4 - Leave the 'When' attributes as default, this just defines that the dynamic action will fire whenever the currency item changes, click 'Next'.
    #5 - For the 'True Action > Action' select 'Set Value'
    #6 - Think about whether you want to set the value on page load from the dynamic action also, if so leave the 'Fire on Page Load' checkbox checked.
    #7 - [Assuming you have a simple PL/SQL API that returns the rate, say get_rate for example] Select 'Set Type' of 'PL/SQL Function Body'
    #8 - For 'PL/SQL Function Body' specify something like: return get_rate(:P1_CURRENCY);#9 - For 'Page Items to Submit', specify the currency item P1_CURRENCY and click 'Next'
    #10 - For the 'Affected Elements' specify 'Item' and then select the page item where you want to return the rate value, say P1_RATE.
    #11 - Click 'Create'.
    Let me know if this works for you or if you have any further questions.
    Regards,
    Anthony.

  • Dynamic actions settings to mail generation

    Hi
    The actions are set for mali generation ,when ever personnel action happen.while testing the mail generation some actions are fine which are set in dynamic actions with out action for reasons.but some of actions are not working which are mentioned action for reason.
    one case i set dynamic actions for hiring action with mentioning action reason.that time it will entered in to programing and generating mail.
    but in another case i have 3-4 reason for actions that time the program will considering only action type ,its not entering into program considering action for reason.
    can any body give me brief advise how to set dynamic action while action having the action reasons.
    Regards,
    arjun

    Sreehari,
    You can configure feature M0001 (Add MASSN/MASSG as your decision operation) and you can call this feature in the dynamic action table T588Z
    Reward Points if this is helpful.
    Sanghamitra
    Message was edited by:
            Sanghamitra11

  • Dynamic Action - Mail to Oulook

    Hi,
    I have set up Dynamic actions that send a mail to SAP MAIL via a distribution list and this is working fine.  My question is how do I send the mail to OUTLOOK ?  Is this possible using SAPCONNECT and customisation thorugh IMG or will I need to code a function to do it ?
    Regards,
    Chan.
    Edited by: Mr Chan Bhogal on Jul 2, 2008 9:13 AM

    Hi,
    You will have to code a routine for the same.
    SO_NEW_DOCUMENT_SEND_API1 is the function module for this purpose and use U for external mails.
    And do basis configuration in transaction SCOT to attach mail server to SAP system.
    Regards,
    Divya
    Points Valuable.

  • Dynamic action - default values

    Hi guys,
    Anybody knows if it is possible to set a dynamic action in order to default P0001-WERKS field in the Infotype 0001?
    Thank you very much!

    So you mean to say, Action 0000 Infotype and Org Assignment 0001 infotype will have different values depending on Action Type??
    This is not at all possibleeeeee!!
    The WERKS that you enter in IT0000 stores in IT0001 but not in IT0000
    Regards
    ...Sadhu

  • Dynamic Action infinite loop

    Hi,
    I have a page with number of days, start date and end date.
    If I change the number of days, I want to set the end date based on start date + num days.
    I also want to go the other way so if they enter an end date, it will calculate the number of days.
    I have dynamic actions for these and they both work fine. The problem is I get a Stack Overflow error after about a second. I assume it is stuck constantly running the 2 dynamic actions one after another, each triggering each other.
    Has anyone else had this issue? And how did you solve it?
    Thanks
    Richard

    Richard,
    Where you have Ajax based dynamic actions ('Set Value' and 'Execute PL/SQL Code') that attempt to save some item's value in session state (via the 'Page Items to Submit' attribute), you will definitely hit issues if SSP is enable for those particular items. This also effects other places where item values can be set via AJAX (Interactive report regions and cascading LOVs), not just in dynamic actions.
    The reason this doesn't work is is because it is not possible to generate a valid checksum on the client, in order for the item to be submitted successfully. In fact, providing a mechanism to calculate a checksum on the client would obviously open up a whole new security vulnerability.
    You can workaround this by evaluating each page item that you wish to set via dynamic actions and seeing if you can switch off SSP (setting to 'Unrestricted') for just that specific item. You can still have SSP enabled for the application and page, and for other page items, importantly including whichever item stores the primary key or where you have some other vulnerable value stored in some page item.
    I have also filed a documentation bug to better explain this in the help text. Patrick also filed an enhancement request for the 'Advisor', so that it checks if SSP is enabled for any page item values that are set from one of these places and alerts the user accordingly.
    Hope this helps.
    Anthony.

  • Dynamic action with set value on date field

    Hi,
    I'm using APEX 4.02
    I'm trying to calculate the age based on the date of birth dynamically on a form. I'm trying to do this with a (advanced)dynamic action with set value.
    I'm able to get this kind of action working based on a number field etc, but NEVER on a date field.
    I've read all posts on this subject but so far no solution. Even if I try to simply copy the value over to another date field or typecast it to a string ( to_char function ) it does not work. So for me the problem seems to be in the source field being a date field.
    I've tried using the source value as is in a select statement :
    select :P33_GEBOORTEDATUM from dual;
    and also type casted based on the date format :
    select TO_DATE(:P33_GEBOORTEDATUM,'DD-MON-YYYY') from dual
    but still no luck.
    On the same form I don't have any issues as long as the calculation is based on number fields, but as soon as I start using dates all goes wrong.
    Any suggestions would be greatly appreciated. If you need any extra info just let me know.
    Cheers
    Bas
    b.t.w My application default date format is DD-MON-YYYY, maybe this has something to do with the issue .... ?
    Edited by: user3338841 on 3-apr-2011 7:33

    Hi,
    Create a dynamic action named "set age" with following values.
    Event: Change
    Selection Type: Item(s)
    Item(s): P1_DATE_OF_BIRTH
    Action: Set value
    Fire on page load: TRUE
    Set Type: PL/SQL Expression
    PL/SQL Expression: ROUND( (SYSDATE - :P1_DATE_OF_BIRTH)/365.24,0)
    Page items to submit: P1_DATE_OF_BIRTH
    Selection Type: Item(s)
    Item(s): P1_AGE
    Regards,
    Kartik Patel
    http://patelkartik.blogspot.com/
    http://apex.oracle.com/pls/apex/f?p=9904351712:1

  • Problem setting a hidden item value when button clicked with dynamic action or pl/sql process

    Apex 4.1
    Oracle 11g
    I have a page that consists of a main region and several sub regions.  I have a pl/sql process in After Header SET_DISPLAY(:P400_DISPLAY :='MAIN';)
    Three subregions have a contional display where P400_DISPLAY = STORE.  This works in hiding the sub regions.
    Now I want to change the P400_DISPLAY value to STORE to show the subregions when I hit a button.
    I tried creating a dynamic action for on click of the add button but get the following error:
    The selected button uses a 'Button Template' that does not contain the #BUTTON_ID# substitution string
    I went to the templates and found:
    Substitution Strings
    Substitution strings are used within sub templates to reference component values. This report details substitution string usage for this template.
    Substitution String
    Referenced
    From
    Description
    #LINK#
    Yes
    Template
    To be used in an "href" attribute
    #JAVASCRIPT#
    No
    To be used in an "onclick" attribute
    #LABEL#
    Yes
    Template
    Button Label
    #BUTTON_ATTRIBUTES#
    No
    Button Attributes
    #BUTTON_ID#
    No
    Generated button ID will be either the button's Static ID if defined, or if not will be an internally generated ID in the format 'B' || [Internal Button ID]
    I then tried creating a page process, pl/sql, :P400_DISPLAY :='STORE'; when the appropriate button is pressed.  The button action is submit page. However, it does not change the P400_DISPLAY value and the subregions stay hidden.
    Suggestions please on how to fix the template or change the P400_DISPLAY value?

    The root issue is that, although you change the value of your page item, it isn't visible to other areas of the page until it is in the session. So, any other action based on the value of your page item; the visibility of a control, a report based on the item's value, etc. will all be unaffected by changing the value of the page item until it has been changed in the session. Even after this the items are stored in the session, you must thereafter do something to cause the value to be reevaluated. To see the effect of this, observe that your page loads and evaluates the value of your page item, it sees that is "MAIN" and hides the regions. However, it doesn't reevaluate them after this.
    So; your choices to get this value set in the session are to either Submit the page, or use JavaScript to set the value in the session. If you use the latter of these, you'll have to do some further work to cause the visibility tests to be re-run, So, let's stick with with the submit method.
    What you've done above sounds correct for this but, there are a lot of decisions you could have made that might have caused things not to happen in the correct sequence.
    Firstly, let's confirm that what I describe above is your problem. From the development environment, load the page, click the button to change the value and submit. Now, click the link labelled Session. Is it still set to MAIN? If so; this is your issue.
    Let's start with the your After Header computation. Did you set it to *only* run if the current value of your page item is NULL??? If not, that's your problem.
    Load Page -> Item set to 'Main' by Computation -> Click Button -> Item set to STORE -> Submit -> Load Page -> Item set to 'Main' by Computation
    See the problem?
    Assuming this isn't the issue, you created a Branch to the same page, right? What is your process point for the Branch? Is it *After* Validation, Computation etc? Because if not, you aren't changing the value before the submit happens.
    I bet it is the first issue but, take a look at these.
    Cheers,
    -Joe

  • IRR dynamic action filter does not work when condition set.

    Hi All
    I've set up a filter on an Interactive report using a dynamic action. The fiilter is used to display records that expire within a term ( example 30,60,90 days.) The dynamic action is set to fire On Change. This all works fine as long as I do not set the report condition to only display when P1_DAYS is not null.
    I am using a report template that includes #REGION_STATIC_ID# as referenced in this post -
    http://anthonyrayner.blogspot.com/2010/07/report-filtering-with-apex-40-dynamic.html
    I hoped not to display a blank report region .. wait until after the user selects the "term" before displaying the results. Any workaround suggestions would be appreciated.
    Version -
    Application Express 4.0.1.00.03
    Thanks
    MO

    Kindly check the following link for reference.
    sample configuration link
    http://www.cisco.com/c/en/us/td/docs/wireless/controller/5700/software/release/3se/security/configuration_guide/b_sec_3se_5700_cg/b_sec_1501_3850_cg_chapter_01110.html
    http://www.cisco.com/c/en/us/td/docs/wireless/controller/7-0/configuration/guide/c70/c70intf.html
    Trouble shooting link
    http://www.cisco.com/c/en/us/support/docs/security/secure-access-control-system/113485-acs5x-tshoot.html

  • Dynamic Action on tabular form: to auto set value for all changes rows

    Hi All:
    I am using APEX4.2.3 and I am not very familar with JQUERY or Javascript.
    I am having a tabular form to support Update and Delete action. The tabular form has 4 columns:
    Column A: ID                      (Number)     : Read-only column
    column B: Name                 (Varchar2)   : Editable
    Column C: Age                    (Number)     : Editable
    Column D: ChangeFlag      (Varchar2)   : Read-only column                             ==> however, I want this column been automatically upldated by my APEX application
    Here is the requirement: First user update Column B, or C or both for # of rows; then user click "Save Change" button. For ALL updated rows, I need to automatically update Column D with below logic:
    For a given row,
                   IF Column D IS NULL  THEN
                         set value = 'M'                           -- M means modified
                   ELSE --- column D has a value already
                        IF last character of Column D is 'M', THEN
                               don't do anything;
                        ELSE
                              set value of D = existing value + 'M'                       (here + means concatenate
                       END IF;
                END IF;
    I thought this can be done by creating dynamic action on tabular form ... I have researched this on this forum and can't find a good match example ..
    I know I can implement this using a DB trigger; however, I want to learn if this can be achived via Dynamic Action.
    Thanks!
    Kevin

    Hi Expert:
    Anyone can offer any direction or help on this?
    Thanks!
    Kevin

  • DYnamic Action to set the value of a wage type in IT0014

    Dear Experts,
    i have created a dynamic action to create a record in IT0014 (wage type 92011) if another record in IT0014 (wage type 9207) is created/changed. that is:
    0014  9207  06   I        INS,0014,9211,,(P0014-BEGDA),(P0014-ENDDA)/D
    0014  9207  06   W     Q0014-BETRG=2
    now, when i change/create the wage type 9207 in IT0014, the dynamic action opens IT0014 with subtype 9211, and with begin & end dates as set in the action , but an error message that asks me to Enter Amount !!!
    why can't the dynamic action read the amount (2) which I want to insert ?!!
    Thanks in advance

    Dear Rovan,
    you should not use Q there,
    Do not set defaults for Q fields of an Infotype because the values for these fields are derived from the corresponding P fields.
    0014 9207 06 I INS,0014,9211,,(P0014-BEGDA),(P0014-ENDDA)/D
    0014 9207 06 W P0014-BETRG=2
    Regards,
    mohammed
    Edited by: 0mohammed1 on Oct 27, 2011 5:53 PM

  • How to make dynamic actions using Set Value work in all browsers?

    I’m having a cross-browser incompatibility issue with dynamic actions using Set Value.  The dynamic action works like a charm on Chrome but has no effect on either IE or Firefox.  The code in oracle.apex.com and here are the credentials:
    Workspace: DDBA
    Username: [email protected]
    Password: redtruck12
    These code is on page 3 and here are the details:
    There are two report lists (Standard and Special) and some of the reports require additional information supplied in either select lists or text boxes.
    If the user selects a Standard report requiring a select list/text box, then the dynamic action sets the value of Special Reports to NULL (and vice-versa).
    The dynamic action is to prevent a simultaneous selection of both the Standard and Special reports.  To see how it works on Chrome, do this:
    Run Page 3
    Select the ‘Report for Search Criteria’ option from the Standard Report list.  A ‘Search Criteria’ text box appears
    Select the ‘Report by Release’ option from the Special Reports list.  A select list appears and the ‘Search Criteria’ text box disappears.
    If you do the same things on IE or Firefox, the text box does not disappear. 

    Hi,
    Things are going wrong with setting the item values to NULL. If you check your session state, you'll see that in chrome your items values indeed will be set to null, but in firefox they won't.
    Also I've noticed that you don't reset the other input fields, so their values persist in the session state. Since you submit your page every time you change one of the report select lists, this might lead to unexpected behaviour. Lastly, I've noticed you use a sql exists expression to manage the display/hide of your page items. A condition of type "Value of  expression 1 = expression 2" causes less overhead as you don't need to switch to the db sql engine for every item to validate.
    I'd suggest you rethink your specs and try to create:
    - One dynamic action (since a value of standard select excludes the value of special select, and vice versa)
    - Set the values for hidden items to null, also in session state
    - Use a refresh of region as extra event in your dynamic action, instead of submitting your page for every change.
    Regards,
    Vincent
    http://vincentdeelen.blogspot.com

  • Dynamic Action Set Value - PLSQL Error - cannot contain an expression

    I am trying to use below in a Dynamic Action to Set Value with PL/SQL Function. The dynamic action does not update the item appropriately. I tried to run the below directly in SQL Workshop but received the error "PLS-00372: In a procedure, RETURN statement cannot contain an expression". How can I get below to return the value needed?
    DECLARE
    rqstdaloe number;
    rqstdeloe number;
    devpercent number;
    rqsttarget date;
    timeleft number;
    PSPTime number;
    DevTime number;
    DevPer number;
    BEGIN
    SELECT SUM("TRACK_TIME_SPENT") INTO rqstdaloe
    FROM "TIME_TRACKER"
    LEFT JOIN "TBL_R66_TASK_TYPE" ON "TASK_TYPE_ID" = "TRACK_TYPE"
    WHERE "TRACK_REQUEST_ID" = :P2_REQUEST_ID AND "TASK_TYPE_TYPE" = 'DEV';
    rqstdeloe := :P2_REQUEST_ELOE;
    SELECT SUM(TT1."TRACK_TIME_SPENT") INTO DevTime
    FROM "TIME_TRACKER" TT1
    LEFT JOIN "TBL_R66_TASK_TYPE" TT2 ON TT1."TRACK_TYPE" = TT2."TASK_TYPE_ID"
    WHERE TT1."TRACK_USER" = :P2_PSP_ASSIGNED_PRIMARY AND TT2."TASK_TYPE_TYPE" = 'DEV';
    SELECT SUM(TT1."TRACK_TIME_SPENT") INTO PSPTime
    FROM "TIME_TRACKER" TT1
    WHERE TT1."TRACK_USER" = :P2_PSP_ASSIGNED_PRIMARY;
    DevPer := ROUND(DevTime/PSPTime,2)*8;
    timeleft := TRUNC(((NVL(rqstdeloe,0) - NVL(rqstdaloe,0))/DevPer)+.99999,0);
    rqsttarget := to_date(sysdate,'mm/dd/yyyy') + timeleft;
    RETURN rqsttarget;
    END;

    Hi Dave,
    just a quick hint. If you just want to have the time part of a date/sysdate, you can use TRUNC to do that. So your existing code
    rqsttarget := to_date(sysdate,'mm/dd/yyyy') + timeleft;could be changed to
    rqsttarget := trunc(sysdate) + timeleft;If you perform a TO_DATE on a date variable, the PL/SQL engine will first convert that date variable with an implicit type conversion to a VARCHAR2, because the TO_DATE interface only supports VARCHAR2's and NUMBER's.
    But implicit type conversions are always dangerous, because if your default date format mask isn't mm/dd/yyyy your TO_DATE will fail.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

Maybe you are looking for