Pass parameter to Runnable invoked by SwingUtil.invokeLater()

Hi there,
I just got trapped by a Threading problem in my SwingApplet:
The Applet parses XML Documents it receives from a Servlet and dynamically creates a GUI from that description, using Swing Components. (actually Applet and Servlet exchange a Queue of JAVA Objects, each representing a fraction of the complete GUI Description or causing the Applet to show a certain URL, for example)
Getting the XML Documents is done in an extra Thread (not the EventDispatchThread), since that might take a while. For doing the actual update of the Swing Components I use SwingUtilities.invokeLater(Runnable doc).
doc is my internal Representation of the GUI, doc.run() does the actual Parsing and GUI Updating.
My Question is: How can I pass doc the Message it has to parse in a way that subsequent calls to invokeLater(doc) (which - as I mentioned - are done in another Thread) cannot disturb the processing of the previous call?
My actual (pseudo-)code tries it this way:
Executed in Calling Thread:
private void callSwing(PWDocumentGui doc)
try
Iterator it = fromserver.getInqueue().iterator();
while (it.hasNext())
PWMessage msg = (PWMessage) it.next();
doc.setContent(msg);
Thread.sleep(2000); // makes it work for the moment - but thats extremely unsafe!!
it.remove();
catch (Exception e)
System.err.println(e);
Internal Document representing the GUI:
class PWDocumentGui extends Observable implements Runnable
private InternalModel internalmodel; // holds internal Model of GUI (Arrays of Swing Components
private String onemessage; // holds one message to be parsed: VALUE IS THE PROBLEM !
public void synchronized setContent(String themessage)
onemessage = themessage; // remeber the Message to be parsed
SwingUtilities.invokeLater(this) // call this.run() in EventThtead
// Called in Event Thread
// value of onemessage in the meantime might be overwritten by subsequent call to setContent().
public void run()
// do the parsing into the local and thus update internalmodel
parse(onemessage);
// Notify Observers (the Renderers registered as Observers of this) that they should update themselves
// accordicg to internalmodel
setChanged()
notifyObservers();
public InternalModel getModel() {    return internalmodel;   }
I suspect that the solution might be easy - for someone more relaxed...
This might be a question concerning design, not Swing, I think.
Thanks for any answer!
Uwe

Try creating an inner class which implements runnable.
Give the inner class members to hold the parameters you want to pass.
Implement the inner class's run() to check the variables and use them.
When calling invoke later create a new instance of the inner class, initialise the members for the parameter values and pass the inner class instance to invokeLater rather than the object of the main class.
In this way you get one copy of the parameters for every call to invoke later.

Similar Messages

  • How to pass parameter into a source variable of a invoke activity

    I'm an new BPELer, I created a invoke activity to submit Oracle Appplications concurrent program, but I don't know how to pass parameter into source variable.
    BTW, I have created the mapper file (.xsl) file.
    could anyone tell me how to do that?
    Thanks,
    Victor

    Hi.
    How you start application? I think you send message to webservice(BPEL process is webservice too). So construct message with variable and value.
    But I created only processes where input value doesn't matter. I haven't use mapper yet too.

  • Hidding the passing parameter

    hi,
    I using <netui:anchor> to invoke an action.
    and withthin the end tag , i using <netui:parameter> to pass the value to next
    page.
    is there any way to hide the passing parameter at URL.
    is there any config file i can edit and pause all the method become "POST".
    thanks for help.

    Hi Mark,
    Check the below one .You dont need to specify structure at FORM ..part as it inherits the properties from PERFORM.
    PERFORM create_alv_list TABLES t_table
                            USING alv_sku
                                  i_events.
    PERFORM create_alv_list TABLES t_table
                            USING alv_resource
                                  i_events1.
    *&      Form  create_alv_list
    *       text
    *      -->T_TABLE    text
    *      -->P_TABNAME  text
    *      -->P_EVENTS   text
    FORM create_alv_list TABLES t_table
                         USING p_tabname
                               p_events.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          it_fieldcat = i_fieldcat[] "You dont need to specify [] here
          is_layout   = i_layout
          i_tabname   = p_tabname
          it_events   = p_events
        TABLES
          t_outtab    = t_table.
    ENDFORM.                    "create_alv_list
    Regards,
    Venkat.O

  • How to pass parameter through URL to bounded task flow with page fragment

    I want to pass parameter to Bounded Task Flow With Page Fragment trough URL
    as I start this taks flow with router and according to this Param I will rout the user.
    I added input param to taks flow named direction and make the task flow called URL invoke url-invoke-allowed
      <input-parameter-definition id="__41">
          <name id="__42">direction</name>
          <value>#{pageFlowScope.direction}</value>
          <class>java.lang.String</class>
        </input-parameter-definition>but I don't know how to add this to the JSPX that I will add the bounded task flow Inside.
    and How to pass this from URL

    Hi,
    url-invoke-allowed is only required if the task flow itself is directly accessible from a browser (which is not the case at all if the task flow uses page fragments). To pass input parameters to a task flow that is embedded in a region and that has input parameters, you define the input parameters on the taskFlow Id that is created in the PageDef file of the containing page. To learn ADF task flows, have a look at the videos below. They also contain a sample for passing parameters to a region
    http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/taskflow-overview-p1/taskflow-overview-p1.html
    http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/taskflow-overview-p2/taskflow-overview-p2.html
    Frank

  • Passing a variable to invoke-expression

    hello
    can anyone help me to pass a variable to invoke-expression. basically i need to assign deny permission for a group in all domains. look below:
    Foreach ($DN in $Domains)
    $Group=((Get-ADDomain $DN).Name)+"\Group1"
    Get-ADOrganizationalUnit -Filter {name -eq "MY OU"} -Server $DN | % {Invoke-Expression -Command:('dsacls "{0}" /D "$Group":GA' -f $_.Distinguishedname)}
    it is part of the code, the rest of it, is ok. i want to send $group1 in invoke-expression command.
    thank you.

    When you call Invoke-Expression, you're actually launching a completely separate PowerShell.exe process. As such, it will have no visibility of variables that were declared on your 'parent' session, after all, those variables are held in the process memory
    of the parent.
    The same happens when you're dealing with jobs for example. In fact a Invoke-Expression is very similar to a job in this sense, however Invoke-Expression does not continue until the execution of the expression has completed, whereas the whole point of the
    job is to allow you to continue and pick the job up later.
    Anyway, enough rambling...
    To pass a variable to Invoke-Command, you need to use the -ArgumentList parameter, and then access the variables pass through $args. Here's an example:
    Invoke-Command -ScriptBlock {ping $args[0]} -ArgumentList 'localhost'
    In your case, your code should look like this:
    Foreach ($DN in $Domains)
    $Group=((Get-ADDomain $DN).Name)+"\Group1"
    Get-ADOrganizationalUnit -Filter {name -eq "MY OU"} -Server $DN | % {Invoke-Expression -Command:('dsacls "{0}" /D "$args[0]":GA' -f $args[1].Distinguishedname)} -ArgumentList $Group, $_

  • Import statement: pass parameter or variable in import statement ??

    Hi All..
    Is there a way to pass parameter or a variable to a url in the import statement..
    I'll be using a url in the import statement, the url will be having a dynamic .rtf file...something like
    <?import:http://#server#:#port#/xmlpserver/<mySubTemplate>.rtf?>
    where <mySubTemplate> is dynamic..
    I've been searching this thread for a while now and ended up close...
    Import sub template dynamically
    Thanks in Advance..

    Have you tried replacing the mySubtemplate.rtf part with a variable, or replace the entire URL using a variable? Try using the same construct from this example in the Report Designer's guide (page 7-14, 10.1.3.4).
    In Microsoft Word's Format Picture dialog box select the Web tab. Enter the
    following syntax in the Alternative text region to reference the image URL:
    url:{IMAGE_LOCATION}
    where IMAGE_LOCATION is an element from your XML file that holds the full
    URL to the image.
    You can also build a URL based on multiple elements at runtime. Just use the
    concat function to build the URL string. For example:
    url:{concat(SERVER,'/',IMAGE_DIR,'/',IMAGE_FILE)}
    where SERVER, IMAGE_DIR, and IMAGE_FILE are element names from your XML
    file that hold the values to construct the URL.
    This method can also be used with the OA_MEDIA reference as follows:
    url:{concat('${OA_MEDIA}','/',IMAGE_FILE)}

  • Pass parameter from request

    Hi,
    I have 2 pages, in page2 CO2, it passes parameter 'cancel'
    processFormRequest{
    else if("Cancel".equals(pageContext.getParameter("event")))
    pageContext.putParameter("cancel", "Y");
    pageContext.forwardImmediately("OA.jsp?page=/company/oracle/apps/xxg2c/goaling/webui/Xxg2cGoalSheetSearchePG",
    null,(byte)0,null,null,true,null);
    in page1, CO1, I get the parameter 'cancel'.
    processRequest{
    cancel = pageContext.getParameter("cancel");
    Now, if I want pass 'cancel' to processFormRequest of CO1, how should I do it?
    thanks
    Lei

    Lei,
    To get the value in co1, there are two alternatives:
    1)Pass value in hashmap:
    HashMap hmap= new HashMap();
    hmap.put("cancel","Y");
    pageContext.forwardImmediately("OA.jsp?page=/company/oracle/apps/xxg2c/goaling/webui/Xxg2cGoalSheetSearchePG",
    null,(byte)0,null,hmap,true,null);
    in page1, CO1 processRequest, you can get it by
    cancel = pageContext.getParameter("cancel");
    2)Pass param in url itself:
    pageContext.forwardImmediately("OA.jsp?page=/company/oracle/apps/xxg2c/goaling/webui/Xxg2cGoalSheetSearchePG&cancel=Y",
    null,(byte)0,null,null,true,null);
    in page1, CO1 processRequest, you can get it by
    cancel = pageContext.getParameter("cancel");
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Issue on How to mimic Deski document from CMS to local machine, pass parameter, execute and save in a mutiple report format then store in a network drive.

    Post Author: usaitconsultant
    CA Forum: JAVA
    Would you know if there's a way to mimic Deski
    document from BOXI server(CMS) to local machine, pass parameter, execute and
    save in a mutiple report format then store in a local drive or network
    drive? Most examples and tutorials in BO XI R2 I've seen are scheduling while drilling report is for web intelligence only and not desktop intelligence.  Please let me know your ideas. I would really appreciate your help. Thanks.

    Post Author: usaitconsultant
    CA Forum: JAVA
    Hi Ted,
    Thanks for the reply.The file is not available in the server. Though, I checked CMS and I found an instance in history tab and the status is failed with error below. 
                Error Message:
                A variable prevented the data provider Query 1 with BANRRD30 from being refreshed. (DMA0008).When I checked my codes, I found out that the object Im using is for web intelligence data provider. However, I cannot find any documentation and example for passing parameter values in desktop intelligence data provider. Any idea on this? You think this is not suported by Report Engine SDK?Thanks.    

  • 'Driver]Parameter missing' Error while trying to pass parameter to MS query & Return Data to Microsoft Excel

    I am trying to set up a parameter query using ODBC-Microsoft Query
    to BMC Remedy The ODBC connection is "AR System ODBC Data Source".
    I want to pass a parameter to modified date field and get all the remedy tickets for which the modified date is<= to the passed parameter date.
    So in MS query, SQL- 
    the query looks like
     WHERE ("Trouble Ticket"."Create Date">={ts '2014-10-01 00:00:00'}) AND ("Trouble Ticket"."Modified-date"<=?)
    I am getting the data fetched from database in the MS query window, but unfortunately
    When I click File-Return Data to Microsoft Excel, its showing an error: Driver]Parameter missing
    I set the connection properties- parameter-Prompt for value using the following string.
    Please help

    Hi,
    Based on the error message, I recommend we try the suggestion: Replace all "..."  with [...]
    http://www.pcreview.co.uk/forums/error-parameter-query-odbc-remedy-bmc-software-com-t3232964.html
    Then, if you want to connect the Remedy's oracle database, please see the thread:
    http://www.tek-tips.com/viewthread.cfm?qid=1123112
    We may try the workaround: Write an Excel macro which connects to the database and fetch the data based on the SQL query.
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    If you have further question about write macro, I recommend you post the question to the MSDN forum for Excel
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • How to get month value from custom calendar without passing parameter from SSRS in MDX query

    Could you please throw some light to achieve below requirement?  
    I need to filter the data between two periods dynamically . The date calendar here works differently(ex:-Date 26-Aug-2014 will fall in period 7 which is last date and 27-Aug-2014 will fall in period 8 and it is first date of period 8),so I cannot go
    with system date period/Month. Date Hierarchy is like YEAR,QUARTER,PERIOD ,WEEK and DAY.
    I cannot use SSRS for passing parameter. Requirement is to extract last 2 period of data dynamically in Power Pivot with MDX.
    Thanks Chandan

    Hi Chandan,
    You might try something like this
    Tail(null:
    Extract(
    StrToMember("[FYDay].[DATE].&[ + cStr(Format(Now(),"yyyy-MM-ddT00:00:00")) + "]")
    *[FYDay].[DateHierarchy].[Day]
    ,[FYDay].[DateHierarchy]).parent.parent
    ,2)
    What it is doing is multiplying Day by the current date, which returns a set of one date with cardinality of (Date,Day).  The Extract is pulling out just the datehierarchy Day.  the the Tail() is getting it and the previous day.
    Hope that helps,
    Richard

  • Using Go URL to Pass parameter between dashboard

    Hi All,
    I am trying to pass parameter using GO URL functionality from one dashboard analysis field to another dashboard.
    The navigation is working properly but the parameter is not getting passed, I am not sure why.
    The Called dashboard has a analysis which has IS PROMPTED filter attached to it for the passing filter. I tried various ways to make this work
    Option 1
    In the calling analysis, I am using a Narrative View and inside I have used the below code.
    <a href="saw.dll?Go&Path=/shared/MI/_portal/Client-MI&Page=Supplier%20Detail%20Tab&Action=Navigate&P0=1&P1=eq&P2=Dim%20Supplier.Supplier%20Name%20Current&P3=1+%22STR%20LTD%22"> @2[br/]
    This one navigate but filtering is not happening
    Option 2 (My first preference will be this option)
    Also I tried to provide custom Data Format under the column Properties
    [html]"<font class="nav" onclick=\"JavaScript:GoNav(event, '/shared/MI/_portal/Client-MI/Supplier Detail Tab','Dim Supplier','Supplier Name Current','"@"');\">"@"</font>
    This ends up giving error
    Type mismatch of catalog object /shared/MI/_portal/Client-MI/Supplier Detail Tab -- expected , got .
      Error Details
    Error Codes: UVWDR6UA 
    Also, both the tabs (Called and Calling are under the same Dashboard)
    Can anyone please let me know, were I am making mistake. I tried refereeing Oracle documentation but still no result.
    Thanks

    Looks like you've got it almost right - just an extra unneeded "
    <a href="two.jsp"?ant=<%= ant %>"><%=antName%></a>
    which should render on the page as something like
    My Ant Task
    When you click the link, it should pass that parameter, and you can get it via request.getParameter().

  • Error while passing parameter in Oracle Jdeveloper

    Hi All,
    I was passed Crystal report viewer object  From Servlet it is Running fine but one problem in that while passing parameter from that page  to data base it is not supporting (The ok Button on page).
    can any one tell me how to find Action Button (.Jsp page)
    Because i am using .jsp  page That was made in CR4E
    in that i found only jsp code I have not get how to work Action of that button
    Also another problem while making Viewer.jsp pge ..rpt-Crystal reports--->>Create Viewer Jsp->>Insert CrysatlReport viewer API code------->>>1.Connectparameterinthat report 2.connect the crystalreportPageViewer  while makin this page  i was running on Apache tomcat Server it is not displaying Anything only Displaying Blank Browser
    Can Any one help me...
    Sincerly
    Amol

    For your first question can you please be a little more clear as to what you are referring to?  I am not familiar with an action button for the parameter pages.... what I can tell you is that we don't have any jsp code for the viewer controls, all of that is generated dynamically at runtime.  We do have a viewer SDK that you can use to set properties on the viewer; information about this can be found in the [Developer Library|https://boc.sdn.sap.com/developer/library] in the Viewer SDK documentation book.
    For your second question, I assume you are referring to generating a viewer page from a report in Crystal Reports for Eclipse.  You will need to uncomment the viewer code (for some reason when the page is generated, the viewer code has block comments surrounding it).  You will probably want to make sure the parameter code is uncommented as well. 
    In addition to this, there is a helper file called JRCHelperSample.java that contains all of the helper methods for the automatically generated viewer page.  This can be modified in whatever way you wish to suit your needs.

  • How to Pass parameter to Custom Scheduler dynamically

    hi ,
    I am new to OIM.
    Need your help in passing parameters dynamically to Custom Scheduler.
    I have created Custom Scheduler by extending Task Support.
    I have registered the plugin through API , using PlatformService.registerPlugin() method.
    As I need to send the parameter(s) to this CustomScheduler, I have defined them in Metadata (CustomScheduleTask.xml) file as below and got it imported into DB
    through weblogicImportMetadata.sh script by providing the path of the file.
    <scheduledTasks xmlns="http://xmlns.oracle.com/oim/scheduler">
    <task>
    <name>CustomScheduleTask</name>
    <class>org.schedule.custom.task.CustomScheduleTask</class>
    <description>Fetch details of the given user_id</description>
    <retry>5</retry>
    <parameters>
    <string-param required="true" helpText="Login Name">Login Name</string-param>
    </parameters>
    </task>
    </scheduledTasks>
    Iam able to import this plugin as well as register the plugin successfully. Now I have defined a job to which this Custom SchedulerTask is mapped.
    Now in order to run this job(schedule task) I need to provide Login name( or id) which needs to be send as a parameter for the scheduler to get executed.
    But while defining the job with this Schedule Task on OIM console, I was not able to define or pass parameter to this job. hence parameter is null in
    CustomSchedule 's execute method .
    Kindly help me how to pass parameter dynamically while running the scheduler from OIM console so that the execute method would be able to receive it.
    Thank you in Advance.
    Regards,
    Kumar

    Hi,
    When you have created the schedule job for your custom schedule task, you should see your Login Name textfield in the schedule task. If not, then there verify your schedule task xml.
    In your schedule class code, add:
    public void execute(HashMap arg0) {
              final String METHOD_NAME = "execute :: ";
              logger.debug(CLASS_NAME + METHOD_NAME + "Entering Method - execute");
              try {
                   String LoginName = arg0.get("Login Name");
    Regards,
    Sunny

  • Can't pass parameter's to a transaction in a new win and skip first screen.

    Dear experts,
    I'm trying to open a  transaction('CV04N') in a new window from a screen that has input box and a pushbutton. I'm trying to pass parameter(DOKNR/'CV1') into the new transaction and skip the first selection-screen. I tried to use Get/Set parameter and that didn't work.
    Also i tried to passing values with batch input and that did pass my values but without skipping the first screen and also it froze the transaction.
    Is there anything I can do to fix this problem?

    Hi Gershon Osmolovski,
    Alvaro is right, CV04N needs to press Execute button. So you need to use Batch Input. If it doesn't work, there must be an error in your code, what messages are returned by SAP? I have tested right now, SAP leaves immediately after the selection screen because there is a code that stops the program if it detects it runs using batch input (SY-BINPT system field). So, you should run CALL TRANSACTION with OPTIONS FROM structured data object (data type CTU_PARAMS, see ABAP documentation for more information), with component NOBINPT='X'. Be careful as an ALV grid is then displayed, you can only simulate the buttons so I advise you to indicate the exaction selection in the selection screen, then press "select all", and execute the function you want.
    If you need more help, paste your code, only useful part.
    BR
    Sandra

  • Passing parameter to the i18n text from xml view in fiori app

    Hi,
    Could somebody let me know how to pass parameter to get the i18n text inside xml view of a Fiori app.
    For e.g. inside my i18n properties file i have a entry like:
    PEC_ISSUE={0}issues of total{1}
    inside xml i use it like {i18n>PEC_ISSUE}
    but now how do i pass those 2 parameters to this ??
    i know in javascript it works with , (comma) but does not work in xml. Any help...
    Thanks,
    Ashish

    Hi Michele,
    I found it. Below is the example from my coding.
    <Text      text="{parts: [{path: 'i18n>PEC_to'}, {path: 'promoprocsteps>RetailPromotionSalesFromDate_E'},
                                                           {path:'promoprocsteps>RetailPromotionSalesToDate_E'}],
                                                           formatter: 'retail.promn.promotioncockpit.utils.Formatter.formatDatesString'}"  />
    So you have to create a formatter and pass all the strings to the formatter and then do it inside JS.
    In JS you do it in this way:
    i18n.getText(i18String, [newString, string2]);
    i hope this helps.
    Regards,
    Ashish

Maybe you are looking for