'How to update javaFX progressbar with jgit close repository progress

I have the following code. Basically, when I click a button, I call a method to clone a repository using jgit.

The cloneResult is called using "setProgressMonite" and I was expecting that I could change the progressbar value and also a label with information that I get from jgit.

The prints to the console shown in the code work correctly so, my question is:

  1. Why can't I update the gui with this code?
  2. How can I do it?

NOTE: my app never finish the clone of the repository but also doesn't return any exception.

@FXML
protected void onButtonClick() throws IOException, GitAPIException {
    button.setDisable(true);

    Task<Git> task = new Task<Git>() {
        @Override
        public Git call() throws GitAPIException, IOException {
            Git result = callGit();
            return result;
        }
    };

    task.setOnSucceeded(e -> {
        Git result = task.getValue();
        guiGetDataButton.setDisable(false);
        // update UI with result
    });

    new Thread(task).start();
}

public Git callGit() throws IOException, GitAPIException {
    Git cloneResult = Git.cloneRepository()
        .setURI(REMOTE_URL)
        .setDirectory(new File(Context.getInstance().getPathToRepo()))
        .setCredentialsProvider(new UsernamePasswordCredentialsProvider(settings.getUsername(),
                             Cryptograph.decrypt(settings.getPassword(), Context.getInstance().getVAULTKEY())))
        .setBranch("main")
        .setProgressMonitor(new SimpleProgressMonitor())
        .call();

    guiLog.appendText(cloneResult.toString() + "\n");
    
    return cloneResult;
}

private static class SimpleProgressMonitor implements ProgressMonitor {
    String currentTask;
    int numberOfItemsToProcess;

    Controller c = new Controller();

    @Override
    public void start(int i) {
        System.out.println("START!!!");
    }

    @Override
    public void beginTask(String s, int i) {
        currentTask = s;
        numberOfItemsToProcess = i;
        System.out.println("Begin task '" + s + "' with i = " + i);
        c.guiMainProgressBarLabel.setText(s);
    }

    @Override
    public void update(int i) {
        if (currentTask != null && numberOfItemsToProcess > 0) {
            c.guiMainProgressBar.setProgress(i / numberOfItemsToProcess);
        }
        System.out.println("Update " + i);
    }

    @Override
    public void endTask() {
        System.out.println("END!!!");
    }

    @Override
    public boolean isCancelled() {
        return false;
    }
}


Solution 1:[1]

First, start with valid HTML; an <li> element must be a descendant of either a <ul> or <ol>, for some reason you've reversed that wrapping. Corrected, it should like:

::marker {
  color: red;
}
<ol>
  <li>My name is Osirin. I'm 23 and currently studying Computer Science in college. I'm a bit late starting third level as I had a few issues in secondary school. Despite this, I'm committed to finishing my degree and working abroad in the States for Google.</li>
</ol>

Here, we use the ::marker pseudo-element to style the markers of all <li> elements within the document; to style those of <ol> and <ul> differently, we can instead:

ol li::marker {
  color: red;
}
ul li::marker {
  color: purple;
}
<ol>
  <li>My name is Osirin. I'm 23 and currently studying Computer Science in college. I'm a bit late starting third level as I had a few issues in secondary school. Despite this, I'm committed to finishing my degree and working abroad in the States for Google.</li>
</ol>

<ul>
  <li>My name is Osirin. I'm 23 and currently studying Computer Science in college. I'm a bit late starting third level as I had a few issues in secondary school. Despite this, I'm committed to finishing my degree and working abroad in the States for Google.</li>
</ul>

In the event that you choose not to use the default list-marking, and use list-style-none on the <li>, <ul> or <ol> elements, and use CSS generated-content the ::marker pseudo-element will be removed, and instead you'd have to style the color specifically, as so:

*, ::before, ::after {
  box-sizing: border-box;
  font: 1rem / 1.5 sans-serif;
  margin: 0;
  padding: 0;
}

ol, ul, li {
  list-style-type: none;
}

ul, ol {
  counter-reset: listCounter;
}

li::before {
  content: counter(listCounter);
  color: lime;
  margin-inline: 1em;
}
<ol>
  <li>My name is Osirin. I'm 23 and currently studying Computer Science in college. I'm a bit late starting third level as I had a few issues in secondary school. Despite this, I'm committed to finishing my degree and working abroad in the States for Google.</li>
</ol>

<ul>
  <li>My name is Osirin. I'm 23 and currently studying Computer Science in college. I'm a bit late starting third level as I had a few issues in secondary school. Despite this, I'm committed to finishing my degree and working abroad in the States for Google.</li>
</ul>

Solution 2:[2]

  1. Change the colour of the bullet in the unordered list to red and increased its size.
::marker {
  color: red;
  font-size: 2em;
}

Source: https://developer.mozilla.org/en-US/docs/Web/CSS/::marker

  1. Put some distance between the image and the paragraph text.

Add CSS style to the <img> tag. e.g. Adding margin.

<img src="aine.jpg" alt="personal" width="200" length="200" style="float: left;margin-right: 20px;" />
  1. Correcting your HTML: <li> should be followed by <ol>.

Complete HTML code snippet as below:

<!DOCTYPE html>
<html>

<head>
  <style>
    h1 {
      text-align: center;
    }
    
    h5 {
      text-align: center;
    }
    
    body {
      background-color: #fafafa;
    }
    
     ::marker {
      color: red;
      font-size: 2em;
    }
  </style>
</head>

<body>
  <h1>About Me</h1>
  <h5>Hanjour and Haznawi</h5>

  <div style="text-align: right">
    <img src="aine.jpg" alt="personal" width="200" length="200" style="float: left; margin-right: 20px" />
  </div>

  <oi>
    <li>
      My name is Osirin. I'm 23 and currently studying Computer Science in college. I'm a bit late starting third level as I had a few issues in secondary school. Despite this, I'm committed to finishing my degree and working abroad in the States for Google.
    </li>
  </oi>
</body>

</html>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2