/* * RomRaider Open-Source Tuning, Logging and Reflashing * Copyright (C) 2006-2012 RomRaider.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package com.romraider.logger.ecu.ui.tab.injector; import com.romraider.editor.ecu.ECUEditor; import com.romraider.logger.ecu.definition.EcuParameter; import com.romraider.logger.ecu.definition.EcuSwitch; import com.romraider.logger.ecu.definition.ExternalData; import com.romraider.logger.ecu.ui.DataRegistrationBroker; import com.romraider.logger.ecu.ui.tab.LoggerChartPanel; import static java.awt.BorderLayout.CENTER; import static java.awt.BorderLayout.WEST; import static javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER; import static javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS; import javax.swing.JPanel; import javax.swing.JScrollPane; import java.awt.BorderLayout; import java.util.List; public final class InjectorTabImpl extends JPanel implements InjectorTab { private static final long serialVersionUID = 5365322624406058883L; private final LoggerChartPanel chartPanel = new LoggerChartPanel("Pulse Width (ms)", "Fuel per Combustion Event (cc)"); private final InjectorControlPanel controlPanel; public InjectorTabImpl(DataRegistrationBroker broker, ECUEditor ecuEditor) { super(new BorderLayout(2, 2)); controlPanel = new InjectorControlPanel(this, broker, ecuEditor, chartPanel); JScrollPane scrollPane = new JScrollPane(controlPanel, VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_NEVER); add(scrollPane, WEST); add(chartPanel, CENTER); } public double getFuelStoichAfr() { return controlPanel.getFuelStoichAfr(); } public double getFuelDensity() { return controlPanel.getFuelDensity(); } public boolean isRecordData() { return controlPanel.isRecordData(); } public boolean isValidClOl(double value) { return controlPanel.isValidClOl(value); } public boolean isValidAfr(double value) { return controlPanel.isValidAfr(value); } public boolean isValidRpm(double value) { return controlPanel.isValidRpm(value); } public boolean isValidMaf(double value) { return controlPanel.isValidMaf(value); } public boolean isValidCoolantTemp(double value) { return controlPanel.isValidCoolantTemp(value); } public boolean isValidIntakeAirTemp(double value) { return controlPanel.isValidIntakeAirTemp(value); } public boolean isValidMafvChange(double value) { return controlPanel.isValidMafvChange(value); } public boolean isValidTipInThrottle(double value) { return controlPanel.isValidTipInThrottle(value); } public void addData(double pulseWidth, double fuelcc) { chartPanel.addData(pulseWidth, fuelcc); } public void setEcuParams(List<EcuParameter> params) { controlPanel.setEcuParams(params); } public void setEcuSwitches(List<EcuSwitch> switches) { controlPanel.setEcuSwitches(switches); } public void setExternalDatas(List<ExternalData> external) { controlPanel.setExternalDatas(external); } public JPanel getPanel() { return this; } }