refactoring

This commit is contained in:
rusefi 2020-06-17 01:10:35 -04:00
parent f26cb56e4a
commit 1da3395fd3
5 changed files with 11 additions and 17 deletions

View File

@ -76,6 +76,14 @@ public class AutoupdateUtil {
);
}
public static void trueLayout(Component component) {
if (component == null)
return;
component.invalidate();
component.validate();
component.repaint();
}
public static class ConnectionAndMeta {
private String zipFileName;
private HttpURLConnection httpConnection;

View File

@ -188,7 +188,6 @@ public class RecentCommands {
content.add(createButton(reentrant, entry.command));
}
}
UiUtils.trueRepaint(content.getParent());
UiUtils.trueLayout(content.getParent());
}
});

View File

@ -234,7 +234,7 @@ public class EngineSnifferPanel {
* this is to fix the UI glitch when images tab shows a tiny square
*/
System.out.println("displayChart");
UiUtils.trueRepaint(chartPanel.getParent());
UiUtils.trueLayout(chartPanel.getParent());
}
public JPanel getPanel() {

View File

@ -1,6 +1,7 @@
package com.rusefi.ui.util;
import com.rusefi.StartupFrame;
import com.rusefi.autoupdate.AutoupdateUtil;
import org.jetbrains.annotations.NotNull;
import javax.imageio.ImageIO;
@ -77,27 +78,14 @@ public class UiUtils {
* to hack http://rusefi.com/forum/viewtopic.php?f=2&t=631&p=10083#p10081
*/
public static void trueRepaint(JComponent control) {
control.invalidate();
control.repaint();
}
public static void trueRepaint(Container control) {
trueLayout(control);
// if (control == null)
// return;
// control.invalidate();
// control.repaint();
}
/**
* todo: one 'trueXXX' method should be enough, which one?
*/
public static void trueLayout(Component component) {
if (component == null)
return;
component.invalidate();
component.validate();
component.repaint();
AutoupdateUtil.trueLayout(component);
}
public static java.util.List<Component> getAllComponents(final Container c) {

View File

@ -78,7 +78,6 @@ public class SensorGauge {
wrapper.removeAllChildrenAndListeners();
wrapper.addMouseListener(mouseListener);
wrapper.add(gauge, BorderLayout.CENTER);
UiUtils.trueRepaint(wrapper.getParent());
UiUtils.trueLayout(wrapper.getParent());
}