/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* JpnlAnalisys.java
*
* Created on 06/03/2010, 11:59:30
*/
package systole.view.tabs;
import java.awt.CardLayout;
import systole.view.accordion.JAccordion;
import javax.swing.JPanel;
import org.jfree.chart.ChartPanel;
import systole.domain.analysis.Analysis;
import systole.view.accordion.JPnlAccordionFinalSignal;
import systole.view.accordion.JPnlAccordionPatient;
import systole.view.accordion.JPnlAccordionReport;
import systole.view.accordion.JPnlAccordionSegments;
import systole.view.accordion.JAccordion.Accordion;
import systole.view.charts.XYChart;
import systole.view.messages.EntityDescriptions;
import systole.view.tabs.controllers.AnalysisController;
/**
*
* @author jmj
*/
public class JpnlAnalysis extends javax.swing.JPanel {
/**
*
*/
private static final long serialVersionUID = 1435411250880614283L;
private AnalysisController analysisControl;
private JAccordion accordion;
private JPnlAccordionPatient accordionPatient;
private JPnlAccordionSegments accordionSegments;
private JPnlAccordionFinalSignal accordionFinalSignal;
private JPnlAccordionReport accordionReport;
//Right Split
private JPnlFinalSignal finalSignalPnl;
private JPnlSignals signals;
private JPnlSegments segments;
private JReportView report;
/** Creates new form JpnlAnalisys
* @param logic
*/
public JpnlAnalysis(AnalysisController logic) {
initComponents();
this.analysisControl = logic;
this.initForm();
}
private void initForm(){
this.signals = new JPnlSignals();
this.segments = new JPnlSegments(this.analysisControl);
this.finalSignalPnl = new JPnlFinalSignal(this.analysisControl);
this.report = new JReportView(this.analysisControl);
this.report.setSize(this.PnlRigthSplit.getSize());
this.PnlRigthSplit.add(signals, "Signals");
this.PnlRigthSplit.add(segments, "Segments");
this.PnlRigthSplit.add(finalSignalPnl, "Final");
this.PnlRigthSplit.add(report, "Report");
this.initAccordion();
}
private void initAccordion() {
accordion = new JAccordion(this);
accordion.setPreferredSize(this.jPnlLeftSplit.getSize());
accordionPatient = new JPnlAccordionPatient(this.analysisControl);
accordion.addBar("Señal", JAccordion.Accordion.SIGNAL, getAccordionPatient(), "resources/accordicons/patientdata.png");
accordionSegments = new JPnlAccordionSegments(this.analysisControl);
accordion.addBar("Segmentos", JAccordion.Accordion.SEGMENTS, getAccordionSegments(), "resources/accordicons/segments.png");
accordionFinalSignal = new JPnlAccordionFinalSignal(this.analysisControl);
accordion.addBar("Resultados", JAccordion.Accordion.FINAL_SEGMENT, getAccordionFinalSignal(), "resources/accordicons/finalcurve.png");
accordionReport = new JPnlAccordionReport(this.analysisControl);
accordion.addBar("Informe", JAccordion.Accordion.REPORT, getAccordionReport(), "resources/accordicons/report.png");
this.jPnlLeftSplit.add(accordion);
accordion.setVisibleBar(0);
this.jPnlLeftSplit.revalidate();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jSplitPnl = new javax.swing.JSplitPane();
jPnlLeftSplit = new javax.swing.JPanel();
PnlRigthSplit = new javax.swing.JPanel();
setName("Form"); // NOI18N
setRequestFocusEnabled(false);
setLayout(new java.awt.BorderLayout());
jSplitPnl.setDividerLocation(175);
jSplitPnl.setLastDividerLocation(175);
jSplitPnl.setName("jSplitPnl"); // NOI18N
jSplitPnl.setPreferredSize(new java.awt.Dimension(140, 1));
jPnlLeftSplit.setMaximumSize(new java.awt.Dimension(160, 0));
jPnlLeftSplit.setName("jPnlLeftSplit"); // NOI18N
jPnlLeftSplit.setPreferredSize(new java.awt.Dimension(140, 0));
jPnlLeftSplit.setLayout(new javax.swing.BoxLayout(jPnlLeftSplit, javax.swing.BoxLayout.LINE_AXIS));
jSplitPnl.setLeftComponent(jPnlLeftSplit);
PnlRigthSplit.setName("PnlRigthSplit"); // NOI18N
PnlRigthSplit.setLayout(new java.awt.CardLayout());
jSplitPnl.setRightComponent(PnlRigthSplit);
add(jSplitPnl, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel PnlRigthSplit;
private javax.swing.JPanel jPnlLeftSplit;
private javax.swing.JSplitPane jSplitPnl;
// End of variables declaration//GEN-END:variables
public void addFilteredCharts(ChartPanel rawsignal, ChartPanel filteredsignalChart, XYChart filteredsignal) {
this.accordionPatient.updateSignalData();
this.getJpnlSignals().addRecordCharts(rawsignal, filteredsignalChart, filteredsignal);
this.getPnlRigthSplit().revalidate();
}
/**
* @param overlayedSegments
* @param finalSegment
* @param derivatives
*/
public void addProcessedCharts(XYChart overlayedSegments, XYChart finalSegment, XYChart derivatives) {
this.getFinalSignalPnl().loadPanels(overlayedSegments, finalSegment, derivatives);
}
/**
*
*/
public void showFinalPnl() {
this.accordion.setVisibleBar(2);
this.showPnl(JAccordion.Accordion.FINAL_SEGMENT);
}
/**
* @param accordion
*/
public void showPnl(Accordion accordion) {
CardLayout cl = (CardLayout) this.PnlRigthSplit.getLayout();
switch (accordion) {
case FINAL_SEGMENT:
cl.show(this.PnlRigthSplit, "Final");
break;
case SEGMENTS:
this.segments.showLastPanel();
cl.show(this.PnlRigthSplit, "Segments");
break;
case SIGNAL:
cl.show(this.PnlRigthSplit, "Signals");
break;
case REPORT:
cl.show(this.PnlRigthSplit, "Report");
break;
case PATIENT:
break;
}
this.PnlRigthSplit.revalidate();
}
/**
* @return PnlRigthSplit
*/
public JPanel getPnlRigthSplit() {
return PnlRigthSplit;
}
/**
*
* @return FinalSignalPnl
*/
public JPnlFinalSignal getFinalSignalPnl() {
return finalSignalPnl;
}
/**
*
* @return Signals
*/
public JPnlSignals getJpnlSignals() {
return signals;
}
/**
* @return Segments
*/
public JPnlSegments getJpnlSegments() {
return segments;
}
/**
* @param analysis the analysis to set
*/
public void setAnalysis(Analysis analysis) {
this.analysisControl.setAnalysis(analysis);
}
/**
* @return the analysis
*/
public Analysis getAnalysis() {
return this.analysisControl.getAnalysis();
}
/**
*
* @return Report Panel
*/
public JReportView getJReportView() {
return report;
}
/**
* @return the accordionPatient
*/
public JPnlAccordionPatient getAccordionPatient() {
return accordionPatient;
}
/**
* @return the accordionSegments
*/
public JPnlAccordionSegments getAccordionSegments() {
return accordionSegments;
}
/**
* @return the accordionFinalSignal
*/
public JPnlAccordionFinalSignal getAccordionFinalSignal() {
return accordionFinalSignal;
}
/**
* @return the accordionReport
*/
public JPnlAccordionReport getAccordionReport() {
return accordionReport;
}
public AnalysisController getController() {
return this.analysisControl;
}
public void clearObjectInstance() {
analysisControl = null;
accordion = null;
accordionPatient = null;
accordionSegments = null;
accordionFinalSignal = null;
accordionReport = null;
finalSignalPnl = null;
signals = null;
segments = null;
report = null;
this.removeAll();
}
}