/* * 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.maf; 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.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER; import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS; import javax.swing.JPanel; import javax.swing.JScrollPane; import java.awt.BorderLayout; import java.util.List; public final class MafTabImpl extends JPanel implements MafTab { private static final long serialVersionUID = -6978027421649432740L; private final LoggerChartPanel chartPanel = new LoggerChartPanel("MAF (v)", "Total Correction (%)"); private final MafControlPanel controlPanel; public MafTabImpl(DataRegistrationBroker broker, ECUEditor ecuEditor) { super(new BorderLayout(2, 2)); controlPanel = new MafControlPanel(this, broker, ecuEditor, chartPanel); JScrollPane scrollPane = new JScrollPane(controlPanel, VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_NEVER); add(scrollPane, WEST); add(chartPanel, CENTER); } 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 mafv, double correction) { chartPanel.addData(mafv, correction); } 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; } }