Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7930781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:32:01+00:00 2026-06-03T20:32:01+00:00

I have a recursive method like this: protected void executeAction( TreeItem ti ) {

  • 0

I have a recursive method like this:

    protected void executeAction( TreeItem ti )
{
    boolean isChecked = ti.getChecked();

    if ( isChecked )
    {
        Somedata data = (SomeData) ti.getData();
        String action = data.getSelectedAction();
        ActionManager am = data.getActionManager();
        AbstractActionAgent agent = am.getAction( action );
        if ( agent != null )
        {                
            agent.updateModel( data );   //Makes a server trips and long computation               
        }
    }
    int itemcnt = ti.getItemCount();
    TreeItem[] childTrees = ti.getItems();

    for ( int i = 0; i < itemcnt; i++ )
    {
        executeAction( childTrees[i] );
    }
}

My updateModel method freezes the UI, so I tried using Job, but my problem is that I want the update model to be executed for checked TreeItem only and it should follow the sequence of checked TreeItems. If I use Job, I have no control over which checked TreeIem is processed first. Also I tried putting the whole executeAction method in a Job, but ran into invalid thread while accessing the TreeItem.

I need some ideas so that I can spwan a new thread while maintaining the sequence and not freezing my UI.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:32:03+00:00Added an answer on June 3, 2026 at 8:32 pm

    You could try this. Collect you model objects in a Tree and run that updateModel in a separate job. The below code doesn’t run. You may need to tweak it a bit.

      class Node {
        private SomeData nodeData;
        private List<Node> children = new ArrayList();
    

    // Create getters, setters..
    }

    protected void executeAction( TreeItem ti, Node parentNode ) {
    boolean isChecked = ti.getChecked();
    Node n = null;
    if ( isChecked )
    {
        Somedata data = (SomeData) ti.getData();
        if (parentNode != null) {
           n = new Node();
           n.setNodeData(data);
           parentNode.addChild(n);
        }
    
    }
    int itemcnt = ti.getItemCount();
    TreeItem[] childTrees = ti.getItems();
    
    for ( int i = 0; i < itemcnt; i++ )
    {
        executeAction( childTrees[i],n );
    }
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this recursive method which deletes empty folders: private void DeleteEmpty(DirectoryInfo directory) {
I have this recursive method: public Hund getMor(int id) { Hund barn = getHund(id);
I have a recursive method call. When any exception is thrown, I would like
In Java I had a method like this. public static void digPackageLines( List<PkgLine> pkgLineList,
I have a recursive method that builds a tree-like structure of a resource and
I have a data structure that looks like this: [ {:choices=>[Hello, Hi]}, , {:choices=>[wor,
I have a list of hierarchical data like this: var list = new List<Data>(){some
I have a data structure that looks like this: public class Node { public
I have a recursive method on the base form that takes in a control
So I have a homework question where I'm supposed to use a recursive method

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.