GT-2376-b: fixing some bugs from internal users (gui shenanigans)

This commit is contained in:
adamopolous 2019-05-09 12:39:39 -04:00
parent f57af0b730
commit ea9e1c2dda
8 changed files with 10 additions and 11 deletions

View file

@ -329,7 +329,7 @@ public class TaskMonitorServiceTest extends AbstractGhidraHeadedIntegrationTest
monitor1 = TaskMonitorService.getMonitor(); monitor1 = TaskMonitorService.getMonitor();
assertTrue(monitor1 instanceof SecondaryTaskMonitor); assertTrue(monitor1 instanceof SecondaryTaskMonitor);
monitor1.reset(); monitor1.release();
monitor1 = TaskMonitorService.getMonitor(); monitor1 = TaskMonitorService.getMonitor();
assertTrue(monitor1 instanceof TaskDialog); assertTrue(monitor1 instanceof TaskDialog);

View file

@ -942,17 +942,18 @@ public class DialogComponentProvider
} }
}); });
subStatusLabel = new JLabel(); subStatusLabel = new JLabel(" ");
subStatusLabel.setName("subStatusLabel"); subStatusLabel.setName("subStatusLabel");
subStatusLabel.setHorizontalAlignment(SwingConstants.CENTER); subStatusLabel.setHorizontalAlignment(SwingConstants.CENTER);
subStatusLabel.setForeground(Color.blue); subStatusLabel.setForeground(Color.blue);
subStatusLabel.setFont(subStatusLabel.getFont().deriveFont(Font.ITALIC)); subStatusLabel.setFont(subStatusLabel.getFont().deriveFont(Font.ITALIC));
subStatusLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); subStatusLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 3, 5));
subStatusLabel.setFont(subStatusLabel.getFont().deriveFont(11.0f)); subStatusLabel.setFont(subStatusLabel.getFont().deriveFont(9.0f));
// use a strut panel so the size of the message area does not change if we make // use a strut panel so the size of the message area does not change if we make
// the message label not visible // the message label not visible
int height = statusLabel.getPreferredSize().height; int height =
statusLabel.getPreferredSize().height + subStatusLabel.getPreferredSize().height + 5;
panel.add(Box.createVerticalStrut(height), BorderLayout.WEST); panel.add(Box.createVerticalStrut(height), BorderLayout.WEST);
panel.add(statusLabel, BorderLayout.CENTER); panel.add(statusLabel, BorderLayout.CENTER);

View file

@ -54,6 +54,6 @@ public class HourglassAnimationPanel extends JPanel {
iconList.add(ResourceManager.loadImage("images/hourglass24_11.png")); iconList.add(ResourceManager.loadImage("images/hourglass24_11.png"));
AnimatedIcon progressIcon = new AnimatedIcon(iconList, 150, 0); AnimatedIcon progressIcon = new AnimatedIcon(iconList, 150, 0);
add (new JLabel(progressIcon), BorderLayout.CENTER); add(new JLabel(progressIcon), BorderLayout.NORTH);
} }
} }

View file

@ -50,6 +50,7 @@ public class SecondaryTaskMonitor implements TaskMonitor {
public void setMessage(String message) { public void setMessage(String message) {
if (parentMonitor instanceof TaskDialog) { if (parentMonitor instanceof TaskDialog) {
((TaskDialog) parentMonitor).setSecondaryMessage(message); ((TaskDialog) parentMonitor).setSecondaryMessage(message);
return;
} }
parentMonitor.setMessage(message); parentMonitor.setMessage(message);
} }

View file

@ -336,7 +336,6 @@ public class TaskDialog extends DialogComponentProvider implements TaskMonitor {
SwingUtilities.invokeLater(closeDialog); SwingUtilities.invokeLater(closeDialog);
} }
@Override
public synchronized void reset() { public synchronized void reset() {
taskDone = false; taskDone = false;
taskID.incrementAndGet(); taskID.incrementAndGet();
@ -476,5 +475,4 @@ public class TaskDialog extends DialogComponentProvider implements TaskMonitor {
} }
return secondaryTaskMonitor; return secondaryTaskMonitor;
} }
} }

View file

@ -257,7 +257,6 @@ public class TaskMonitorComponent extends JPanel implements TaskMonitor {
/** /**
* Reset this monitor so that it can be reused * Reset this monitor so that it can be reused
*/ */
@Override
public synchronized void reset() { public synchronized void reset() {
isCancelled = false; isCancelled = false;
taskID.incrementAndGet(); taskID.incrementAndGet();

View file

@ -112,7 +112,7 @@ public class DefaultLanguageService implements LanguageService, ChangeListener {
return lang; return lang;
} }
finally { finally {
monitor.setMessage(""); monitor.release();
} }
} }

View file

@ -66,7 +66,7 @@ public interface TaskMonitor {
* monitor being returned from the {@link TaskMonitorService} on the next * monitor being returned from the {@link TaskMonitorService} on the next
* invocation. * invocation.
*/ */
public default void reset() { public default void release() {
synchronized (this) { synchronized (this) {
setMessage(""); setMessage("");
setProgress(0); setProgress(0);