Added external plugin message. Set external plugin mode if no definition is setup

This commit is contained in:
Robin K 2021-06-22 16:25:21 +02:00
parent a1adb99be9
commit 128b96623a
6 changed files with 65 additions and 39 deletions

View File

@ -1,5 +1,6 @@
# Each of these lines has a trailing space, do not remove it # Each of these lines has a trailing space, do not remove it
CONNECTING = Connecting CONNECTING = Connecting
READING = Reading data READING = Reading data
READING_EXTERNAL = Reading plugins only
LOGGING = Logging to file LOGGING = Logging to file
STOPPED = Stopped STOPPED = Stopped

View File

@ -543,7 +543,11 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
private void loadLoggerConfig() { private void loadLoggerConfig() {
String loggerConfigFilePath = getSettings().getLoggerDefinitionFilePath(); String loggerConfigFilePath = getSettings().getLoggerDefinitionFilePath();
if (isNullOrEmpty(loggerConfigFilePath)) showMissingConfigDialog(); if (isNullOrEmpty(loggerConfigFilePath))
{
showMissingConfigDialog();
getSettings().setLogExternalsOnly(true);
}
else { else {
try { try {
EcuDataLoader dataLoader = new EcuDataLoaderImpl(); EcuDataLoader dataLoader = new EcuDataLoaderImpl();
@ -1527,40 +1531,45 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
private void buildModuleSelectPanel() { private void buildModuleSelectPanel() {
moduleSelectPanel.removeAll(); moduleSelectPanel.removeAll();
final CustomButtonGroup moduleGroup = new CustomButtonGroup(); final CustomButtonGroup moduleGroup = new CustomButtonGroup();
Collection<Module> moduleList = getModuleList();
if(moduleList.size() == 0) {
getSettings().setLogExternalsOnly(true);
}
else {
for (Module module : moduleList) {
final JCheckBox cb = new JCheckBox(module.getName().toUpperCase());
if (touchEnabled == true)
{
cb.setPreferredSize(new Dimension(75, 50));
}
cb.setToolTipText(MessageFormat.format(
rb.getString("TTTEXTEXTERNALS"),
module.getDescription()));
if (getSettings().getTargetModule().equalsIgnoreCase(module.getName())) {
cb.setSelected(true);
setTarget(module.getName());
}
for (Module module : getModuleList()) { cb.addActionListener(new ActionListener() {
final JCheckBox cb = new JCheckBox(module.getName().toUpperCase()); @Override
if (touchEnabled == true) public void actionPerformed(ActionEvent actionEvent) {
{ stopLogging();
cb.setPreferredSize(new Dimension(75, 50)); final JCheckBox source = (JCheckBox) actionEvent.getSource();
} if (source.isSelected()) {
cb.setToolTipText(MessageFormat.format( getSettings().setLogExternalsOnly(false);
rb.getString("TTTEXTEXTERNALS"), setTarget(source.getText());
module.getDescription())); }
if (getSettings().getTargetModule().equalsIgnoreCase(module.getName())) { else {
cb.setSelected(true); getSettings().setLogExternalsOnly(true);
setTarget(module.getName()); }
} startLogging();
}
});
cb.addActionListener(new ActionListener() { moduleGroup.add(cb);
@Override moduleSelectPanel.add(cb);
public void actionPerformed(ActionEvent actionEvent) { moduleSelectPanel.validate();
stopLogging(); }
final JCheckBox source = (JCheckBox) actionEvent.getSource();
if (source.isSelected()) {
getSettings().setLogExternalsOnly(false);
setTarget(source.getText());
}
else {
getSettings().setLogExternalsOnly(true);
}
startLogging();
}
});
moduleGroup.add(cb);
moduleSelectPanel.add(cb);
moduleSelectPanel.validate();
} }
} }

View File

@ -468,7 +468,10 @@ public final class QueryManagerImpl implements QueryManager {
@Override @Override
public void run() { public void run() {
for (StatusChangeListener listener : listeners) { for (StatusChangeListener listener : listeners) {
listener.readingData(); if(settings.isLogExternalsOnly()) listener.readingDataExternal();
else {
listener.readingData();
}
} }
} }
}); });

View File

@ -76,6 +76,10 @@ public final class DataRegistrationBrokerImpl implements DataRegistrationBroker
public synchronized void readingData() { public synchronized void readingData() {
} }
public void readingDataExternal() {
}
public synchronized void loggingData() { public synchronized void loggingData() {
} }
@ -90,4 +94,6 @@ public final class DataRegistrationBrokerImpl implements DataRegistrationBroker
handlerManager.deregisterData(loggerData); handlerManager.deregisterData(loggerData);
} }
} }

View File

@ -25,6 +25,8 @@ public interface StatusChangeListener {
void readingData(); void readingData();
void readingDataExternal();
void loggingData(); void loggingData();
void stopped(); void stopped();

View File

@ -38,6 +38,7 @@ public final class StatusIndicator extends JPanel implements StatusChangeListene
private final JLabel statusLabel = new JLabel(); private final JLabel statusLabel = new JLabel();
private static final String TEXT_CONNECTING = rb.getString("CONNECTING"); private static final String TEXT_CONNECTING = rb.getString("CONNECTING");
private static final String TEXT_READING = rb.getString("READING"); private static final String TEXT_READING = rb.getString("READING");
private static final String TEXT_READING_EXTERNAL = rb.getString("READING_EXTERNAL");
private static final String TEXT_LOGGING = rb.getString("LOGGING"); private static final String TEXT_LOGGING = rb.getString("LOGGING");
private static final String TEXT_STOPPED = rb.getString("STOPPED"); private static final String TEXT_STOPPED = rb.getString("STOPPED");
private static final ImageIcon ICON_CONNECTING = new ImageIcon(StatusIndicator.class.getClass().getResource("/graphics/logger_blue.png")); private static final ImageIcon ICON_CONNECTING = new ImageIcon(StatusIndicator.class.getClass().getResource("/graphics/logger_blue.png"));
@ -60,6 +61,10 @@ public final class StatusIndicator extends JPanel implements StatusChangeListene
updateStatusLabel(TEXT_READING, ICON_READING); updateStatusLabel(TEXT_READING, ICON_READING);
} }
public void readingDataExternal() {
updateStatusLabel(TEXT_READING_EXTERNAL, ICON_READING);
}
public void loggingData() { public void loggingData() {
updateStatusLabel(TEXT_LOGGING, ICON_LOGGING); updateStatusLabel(TEXT_LOGGING, ICON_LOGGING);
} }