one step back - keeping compatibility with autoupdate jar

This commit is contained in:
rusefillc 2025-02-10 21:42:54 -05:00
parent 5775c3aad5
commit 075d7621b0
24 changed files with 43 additions and 37 deletions

View File

@ -115,6 +115,12 @@ public class AutoupdateUtil {
);
}
@Deprecated //
public static void trueLayout(Component component) {
// todo: inline in Aug of 2025
trueLayoutAndRepaint(component);
}
public static void trueLayoutAndRepaint(Component component) {
assertAwtThread();
if (component == null)

View File

@ -132,7 +132,7 @@ public class TriggerImage {
f.showFrame(content);
f.getFrame().setSize(900, 700);
AutoupdateUtil.trueLayoutAndRepaint(content);
AutoupdateUtil.trueLayout(content);
});
SwingUtilities.invokeAndWait(() -> {
@ -162,8 +162,8 @@ public class TriggerImage {
topPanel.add(secondWheelControl);
}
AutoupdateUtil.trueLayoutAndRepaint(topPanel);
AutoupdateUtil.trueLayoutAndRepaint(content);
AutoupdateUtil.trueLayout(topPanel);
AutoupdateUtil.trueLayout(content);
triggerPanel.tdcPosition = triggerWheelInfo.getTdcPosition();
triggerPanel.gaps = triggerWheelInfo.getGaps();
@ -203,8 +203,8 @@ public class TriggerImage {
triggerPanel.name = getTriggerName(triggerWheelInfo);
// triggerPanel.id = "#" + triggerWheelInfo.id;
AutoupdateUtil.trueLayoutAndRepaint(triggerPanel);
AutoupdateUtil.trueLayoutAndRepaint(triggerPanel);
AutoupdateUtil.trueLayout(triggerPanel);
AutoupdateUtil.trueLayout(triggerPanel);
content.paintImmediately(content.getVisibleRect());
new File(OUTPUT_FOLDER).mkdir();
UiUtils.saveImage(OUTPUT_FOLDER + File.separator + "trigger_" + findByOrdinal(triggerWheelInfo.getId()) + ".png", content);

View File

@ -55,7 +55,7 @@ public class SensorSnifferPane {
unpackValues(message, values);
if (!paused) {
processValues();
AutoupdateUtil.trueLayoutAndRepaint(canvas);
AutoupdateUtil.trueLayout(canvas);
}
}
});
@ -70,7 +70,7 @@ public class SensorSnifferPane {
@Override
public void actionPerformed(ActionEvent e) {
clear();
AutoupdateUtil.trueLayoutAndRepaint(canvas);
AutoupdateUtil.trueLayout(canvas);
setPaused(pauseButton, false);
}
});

View File

@ -330,7 +330,7 @@ public class StartupFrame {
noPortsMessage.setVisible(ports.isEmpty() || !hasEcuOrBootloader);
AutoupdateUtil.trueLayoutAndRepaint(connectPanel);
AutoupdateUtil.trueLayout(connectPanel);
}
public static void setFrameIcon(Frame frame) {
@ -398,7 +398,7 @@ public class StartupFrame {
comboPorts.setSelectedItem(defaultPort);
}
AutoupdateUtil.trueLayoutAndRepaint(comboPorts);
AutoupdateUtil.trueLayout(comboPorts);
return hasEcuOrBootloader;
}

View File

@ -370,8 +370,8 @@ public class ProgramSelector {
}
}
AutoupdateUtil.trueLayoutAndRepaint(updateModeComboBox);
AutoupdateUtil.trueLayoutAndRepaint(content);
AutoupdateUtil.trueLayout(updateModeComboBox);
AutoupdateUtil.trueLayout(content);
}
@NotNull

View File

@ -14,7 +14,7 @@ public abstract class InitOnFirstPaintPanel {
if (isFirstPaint) {
content.removeAll();
content.add(createContent(), BorderLayout.CENTER);
AutoupdateUtil.trueLayoutAndRepaint(content);
AutoupdateUtil.trueLayout(content);
isFirstPaint = false;
}
super.paint(g);

View File

@ -61,7 +61,7 @@ public class LogDownloader {
JPanel logFileEntry = createFilePanel(message.substring(colonIndex + 1), size);
logFiles.add(logFileEntry);
AutoupdateUtil.trueLayoutAndRepaint(logFiles.getParent());
AutoupdateUtil.trueLayout(logFiles.getParent());
}
}
});

View File

@ -35,7 +35,7 @@ public class PcanConnectorUI {
String stringForTextArea = string;
stringForTextArea += "\r\n";
logTextArea.append(stringForTextArea);
AutoupdateUtil.trueLayoutAndRepaint(logTextArea);
AutoupdateUtil.trueLayout(logTextArea);
});
new NamedThreadFactory("PCAN-connector").newThread(() -> {

View File

@ -170,7 +170,7 @@ public class RecentCommands {
content.add(createButton(uiContext, reentrant, entry.command));
}
}
AutoupdateUtil.trueLayoutAndRepaint(content.getParent());
AutoupdateUtil.trueLayout(content.getParent());
}
});
getConfig().getRoot().setProperty(KEY, pack());

View File

@ -91,7 +91,7 @@ public class SensorLiveGraph extends JPanel {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
AutoupdateUtil.trueLayoutAndRepaint(SensorLiveGraph.this);
AutoupdateUtil.trueLayout(SensorLiveGraph.this);
}
});
}

View File

@ -24,8 +24,8 @@ public class SizeSelectorPanel extends JPanel {
Element selected = (Element) e.getSource();
selectedColumn = selected.column;
selectedRow = selected.row;
AutoupdateUtil.trueLayoutAndRepaint(SizeSelectorPanel.this);
AutoupdateUtil.trueLayoutAndRepaint(SizeSelectorPanel.this);
AutoupdateUtil.trueLayout(SizeSelectorPanel.this);
AutoupdateUtil.trueLayout(SizeSelectorPanel.this);
System.out.println(selectedColumn + " r=" + selectedRow);
}

View File

@ -23,7 +23,7 @@ public class WarningPanel {
@Override
public void actionPerformed(ActionEvent e) {
label.setVisible(!label.isVisible());
AutoupdateUtil.trueLayoutAndRepaint(label);
AutoupdateUtil.trueLayout(label);
}
});

View File

@ -67,7 +67,7 @@ public class MainFrame {
ConnectionStatusLogic.INSTANCE.addListener(isConnected -> SwingUtilities.invokeLater(() -> {
setTitle();
// this would repaint status label
AutoupdateUtil.trueLayoutAndRepaint(tabbedPane.tabbedPane);
AutoupdateUtil.trueLayout(tabbedPane.tabbedPane);
if (ConnectionStatusLogic.INSTANCE.getValue() == ConnectionStatusValue.CONNECTED) {
LocalDateTime dateTime = LocalDateTime.now(ZoneOffset.systemDefault());
String isoDateTime = dateTime.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME);

View File

@ -151,7 +151,7 @@ public class EngineSnifferPanel {
/**
* We have scroll pane size which depends on zoom, that's a long chain of dependencies
*/
AutoupdateUtil.trueLayoutAndRepaint(imagePanel.getParent());
AutoupdateUtil.trueLayout(imagePanel.getParent());
};
resetImagePanel();
@ -225,7 +225,7 @@ public class EngineSnifferPanel {
}
// Repaint now that we've updated state
SwingUtilities.invokeLater(() -> AutoupdateUtil.trueLayoutAndRepaint(imagePanel));
SwingUtilities.invokeLater(() -> AutoupdateUtil.trueLayout(imagePanel));
}
public JPanel getPanel() {

View File

@ -110,7 +110,7 @@ public class LogViewer extends JPanel {
descPanel.removeAll();
descPanel.add(new JLabel("Total digital charts: "));
descPanel.add(new JLabel("" + ChartRepository.getInstance().getSize()));
AutoupdateUtil.trueLayoutAndRepaint(descPanel);
AutoupdateUtil.trueLayout(descPanel);
}
private void openFolder(String folderName) {

View File

@ -144,7 +144,7 @@ public class LuaScriptPanel {
mainPanel.add(upperPanel, BorderLayout.NORTH);
mainPanel.add(centerPanel, BorderLayout.CENTER);
AutoupdateUtil.trueLayoutAndRepaint(mainPanel);
AutoupdateUtil.trueLayout(mainPanel);
SwingUtilities.invokeLater(() -> centerPanel.setDividerLocation(centerPanel.getSize().width / 2));
}

View File

@ -113,7 +113,7 @@ public class DetachedSensor {
Component mockComponent = createMockValueSlider(uiContext.getCommandQueue(), sensor);
mockControlPanel.add(mockComponent);
}
AutoupdateUtil.trueLayoutAndRepaint(content);
AutoupdateUtil.trueLayout(content);
int size = width;
int h = isMockable ? (int) (size * 1.5) : size;
frame.setSize(size, h);

View File

@ -81,7 +81,7 @@ public class SensorGauge {
wrapper.removeAllChildrenAndListeners();
wrapper.addMouseListener(mouseListener);
wrapper.add(gauge, BorderLayout.CENTER);
AutoupdateUtil.trueLayoutAndRepaint(wrapper.getParent());
AutoupdateUtil.trueLayout(wrapper.getParent());
}
private static void showPopupMenu(UIContext uiContext, MouseEvent e, JPanelWithListener wrapper, GaugeChangeListener listener,

View File

@ -91,7 +91,7 @@ public class StatusPanel extends JPanel implements UpdateOperationCallbacks {
stringForTestArea += "\r\n";
}
logTextArea.append(stringForTestArea);
AutoupdateUtil.trueLayoutAndRepaint(logTextArea);
AutoupdateUtil.trueLayout(logTextArea);
});
}

View File

@ -64,7 +64,7 @@ public class LogUploadSelector {
processFolder(folder);
}
AutoupdateUtil.trueLayoutAndRepaint(content);
AutoupdateUtil.trueLayout(content);
}
private void processFolder(String folder) {

View File

@ -224,7 +224,7 @@ public class KnockAnalyzerTab {
boolean enabled = this.getEnabledEcu();
this.setStartState(enabled);
SwingUtilities.invokeLater(() -> AutoupdateUtil.trueLayoutAndRepaint(content));
SwingUtilities.invokeLater(() -> AutoupdateUtil.trueLayout(content));
}
private void flush() {
@ -238,7 +238,7 @@ public class KnockAnalyzerTab {
case CT_ALL:
canvases.forEach(canvas -> {
canvas.processValues(values);
AutoupdateUtil.trueLayoutAndRepaint(canvas.getComponent());
AutoupdateUtil.trueLayout(canvas.getComponent());
});
break;
case CT_SENSORS:
@ -252,7 +252,7 @@ public class KnockAnalyzerTab {
}
canvases.forEach(canvas -> {
AutoupdateUtil.trueLayoutAndRepaint(canvas.getComponent());
AutoupdateUtil.trueLayout(canvas.getComponent());
});
Arrays.fill(values, 0);
@ -300,8 +300,8 @@ public class KnockAnalyzerTab {
}
public void refreshCanvases() {
SwingUtilities.invokeLater(() -> AutoupdateUtil.trueLayoutAndRepaint(canvasesComponent));
SwingUtilities.invokeLater(() -> AutoupdateUtil.trueLayoutAndRepaint(content));
SwingUtilities.invokeLater(() -> AutoupdateUtil.trueLayout(canvasesComponent));
SwingUtilities.invokeLater(() -> AutoupdateUtil.trueLayout(content));
}
public void createCanvas(int number, int divider) {

View File

@ -138,7 +138,7 @@ public class KnockCanvas {
public KnockCanvas(int number, int divider) {
SwingUtilities.invokeLater(() -> AutoupdateUtil.trueLayoutAndRepaint(component));
SwingUtilities.invokeLater(() -> AutoupdateUtil.trueLayout(component));
this.number = number;
SPECTROGRAM_X_AXIS_SIZE = SPECTROGRAM_X_AXIS_SIZE_BASE / divider;

View File

@ -59,7 +59,7 @@ public class KnockMagnitudeCanvas {
public KnockMagnitudeCanvas() {
SwingUtilities.invokeLater(() -> {
AutoupdateUtil.trueLayoutAndRepaint(component);
AutoupdateUtil.trueLayout(component);
});
bufferedImage = new BufferedImage(640, 480, BufferedImage.TYPE_INT_RGB);
@ -178,7 +178,7 @@ public class KnockMagnitudeCanvas {
}
bufferedGraphics.setFont(defaultFont);
AutoupdateUtil.trueLayoutAndRepaint(component);
AutoupdateUtil.trueLayout(component);
}
}

View File

@ -216,7 +216,7 @@ public class Updater {
private void replaceWith(TsPluginBody instance) {
content.removeAll();
content.add(instance.getContent());
AutoupdateUtil.trueLayoutAndRepaint(content.getParent());
AutoupdateUtil.trueLayout(content.getParent());
Window windowAncestor = SwingUtilities.getWindowAncestor(content);
AutoupdateUtil.pack(windowAncestor);
}