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
CONNECTING = Connecting
READING = Reading data
READING_EXTERNAL = Reading plugins only
LOGGING = Logging to file
STOPPED = Stopped

View File

@ -543,7 +543,11 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
private void loadLoggerConfig() {
String loggerConfigFilePath = getSettings().getLoggerDefinitionFilePath();
if (isNullOrEmpty(loggerConfigFilePath)) showMissingConfigDialog();
if (isNullOrEmpty(loggerConfigFilePath))
{
showMissingConfigDialog();
getSettings().setLogExternalsOnly(true);
}
else {
try {
EcuDataLoader dataLoader = new EcuDataLoaderImpl();
@ -1527,40 +1531,45 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
private void buildModuleSelectPanel() {
moduleSelectPanel.removeAll();
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()) {
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());
}
cb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
stopLogging();
final JCheckBox source = (JCheckBox) actionEvent.getSource();
if (source.isSelected()) {
getSettings().setLogExternalsOnly(false);
setTarget(source.getText());
}
else {
getSettings().setLogExternalsOnly(true);
}
startLogging();
}
});
cb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
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();
moduleGroup.add(cb);
moduleSelectPanel.add(cb);
moduleSelectPanel.validate();
}
}
}

View File

@ -468,7 +468,10 @@ public final class QueryManagerImpl implements QueryManager {
@Override
public void run() {
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 void readingDataExternal() {
}
public synchronized void loggingData() {
}
@ -90,4 +94,6 @@ public final class DataRegistrationBrokerImpl implements DataRegistrationBroker
handlerManager.deregisterData(loggerData);
}
}

View File

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

View File

@ -38,6 +38,7 @@ public final class StatusIndicator extends JPanel implements StatusChangeListene
private final JLabel statusLabel = new JLabel();
private static final String TEXT_CONNECTING = rb.getString("CONNECTING");
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_STOPPED = rb.getString("STOPPED");
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);
}
public void readingDataExternal() {
updateStatusLabel(TEXT_READING_EXTERNAL, ICON_READING);
}
public void loggingData() {
updateStatusLabel(TEXT_LOGGING, ICON_LOGGING);
}