cannot do direct remove/add because StatusDetail must be preserved

This commit is contained in:
Ben Fry
2023-01-18 23:13:21 -05:00
parent 69dc32fe65
commit b58f3739b2
5 changed files with 12 additions and 11 deletions
@@ -129,9 +129,9 @@ public class ContributionListing {
// This could just be a remove followed by an add, but contributionChanged()
// is a little weird, so that should be cleaned up first [fry 230114]
protected void replaceContribution(Contribution oldContrib, Contribution newContrib) {
removeContribution(oldContrib);
addContribution(newContrib);
/*
// removeContribution(oldContrib);
// addContribution(newContrib);
if (oldContrib != null && newContrib != null) {
if (oldContrib.getImports() != null) {
for (String importName : oldContrib.getImports()) {
@@ -150,7 +150,6 @@ public class ContributionListing {
listener.contributionChanged(oldContrib, newContrib);
}
}
*/
}
@@ -389,7 +389,7 @@ public class ContributionTab extends JPanel {
}
protected void updateStatusDetail(StatusDetail detail) {
protected void applyDetail(StatusDetail detail) {
statusPanel.applyDetail(detail);
}
@@ -725,7 +725,6 @@ public class ListPanel extends JPanel implements Scrollable {
}
/*
// Thread: EDT
protected void contributionChanged(final Contribution oldContrib,
final Contribution newContrib) {
@@ -737,7 +736,6 @@ public class ListPanel extends JPanel implements Scrollable {
// model.fireTableDataChanged();
}
}
*/
// Thread: EDT
@@ -756,7 +754,7 @@ public class ListPanel extends JPanel implements Scrollable {
// Thread: EDT
private void setSelectedDetail(StatusDetail contribDetail) {
contributionTab.updateStatusDetail(contribDetail);
contributionTab.applyDetail(contribDetail);
if (selectedDetail != contribDetail) {
selectedDetail = contribDetail;
@@ -108,8 +108,12 @@ class StatusDetail {
StatusAnimator(ListPanel listPanel) {
thread = new Thread(() -> {
while (Thread.currentThread() == thread) {
//listPanel.repaint();
listPanel.table.repaint();
// Should be ok to call this from any Thread (EDT or otherwise)
// https://www.oracle.com/java/technologies/painting.html#mgr
listPanel.repaint();
// System.out.println("calling repaint() " + System.currentTimeMillis());
// listPanel.table.repaint();
// listPanel.contributionTab.repaint();
// TODO Ideally this should be only calling update on the relevant
// cell with model.fireTableCellUpdated(), but that requires
// more state housekeeping that's already broken. [fry 230115]
@@ -443,7 +443,7 @@ class StatusPanel extends JPanel {
}
removeButton.setEnabled(contrib.isInstalled() && !detail.removeInProgress);
if (detail.updateInProgress || detail.installInProgress || detail.removeInProgress) {
// progressBar.setUI(new PdeProgressBarUI("manager.progress"));
// System.out.println(progressBar.getUI());