let's log DFU window messages

This commit is contained in:
rusefi 2021-09-26 15:20:23 -04:00
parent a57b4c58a9
commit 7bef26344e
3 changed files with 11 additions and 11 deletions

View File

@ -16,5 +16,6 @@
<orderEntry type="library" exported="" name="annotations" level="project" />
<orderEntry type="module" module-name="inifile" exported="" />
<orderEntry type="library" name="mockito-all-1.10.19" level="project" />
<orderEntry type="module" module-name="logging" />
</component>
</module>

View File

@ -6,7 +6,7 @@ import java.net.URL;
import java.util.concurrent.atomic.AtomicReference;
public class rusEFIVersion {
public static final int CONSOLE_VERSION = 20210925;
public static final int CONSOLE_VERSION = 20210926;
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
public static long classBuildTimeMillis() {

View File

@ -1,5 +1,6 @@
package com.rusefi.ui;
import com.rusefi.FileLog;
import com.rusefi.ui.util.FrameHelper;
import com.rusefi.ui.util.UiUtils;
import org.jetbrains.annotations.NotNull;
@ -13,10 +14,10 @@ import java.awt.*;
*/
public class StatusWindow implements StatusConsumer {
// todo: extract driver from console bundle? find a separate driver bundle?
private final JTextArea log = new JTextArea();
private final JTextArea logTextArea = new JTextArea();
private final JPanel content = new JPanel(new BorderLayout());
private final JLabel bottomStatusLabel = new JLabel();
private final JScrollPane messagesScroll = new JScrollPane(log, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) {
private final JScrollPane messagesScroll = new JScrollPane(logTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) {
@Override
public Dimension getPreferredSize() {
return new Dimension(400, 400);
@ -26,7 +27,7 @@ public class StatusWindow implements StatusConsumer {
protected final FrameHelper frameHelper = new FrameHelper();
public StatusWindow() {
log.setLineWrap(true);
logTextArea.setLineWrap(true);
content.add(messagesScroll, BorderLayout.CENTER);
content.add(bottomStatusLabel, BorderLayout.SOUTH);
}
@ -48,17 +49,15 @@ public class StatusWindow implements StatusConsumer {
frameHelper.getFrame().setTitle(title);
frameHelper.showFrame(content, false);
UiUtils.centerWindow(frameHelper.getFrame());
log.setText(""); // let's remove stuff from previous invocation
logTextArea.setText(""); // let's remove stuff from previous invocation
}
@Override
public void appendMsg(final String s) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
log.append(s + "\r\n");
UiUtils.trueLayout(log);
}
SwingUtilities.invokeLater(() -> {
FileLog.MAIN.logLine(s);
logTextArea.append(s + "\r\n");
UiUtils.trueLayout(logTextArea);
});
}