Commit 4018108e authored by SAPONE Alann's avatar SAPONE Alann
Browse files

git cache cleared

parent 7e719f33
**/target
keystore
\ No newline at end of file
keystore
.settings
.svn
Fixtures-generator
ExternalLibraries
.project
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ETC</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
/*
* =============================================================================
*
* Copyright (c) 2013, CeSAM / LAM / Pytheas
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* =============================================================================
*/
package org.cnrs.lam.dis.etc.ihm;
import java.awt.*;
import java.util.Vector;
import javax.swing.*;
// Import from org.jfree
import org.cnrs.lam.dis.etc.ihm.tools.ETCXYSeries;
import org.cnrs.lam.dis.etc.ihm.tools.EtcChartPanel;
import org.cnrs.lam.dis.etc.ihm.tools.EtcTabbedPane;
import org.cnrs.lam.dis.etc.ihm.tools.IncorrectParentException;
import org.jfree.chart.*;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeriesCollection;
/**
*
* @author distag
*/
public class PlotPanel extends JPanel {
private static final long serialVersionUID = 1L;
//private int nombreGraphResult;
//To_Plotter mySampleChart = new To_Plotter();
private EtcTabbedPane PlotTabedPane;
private JTabbedPane globalTabPane;
private LogPanel logPanel;
public JTabbedPane getGlobalTabPane() {
return globalTabPane;
}
/** Creates new form PlotPanel */
public PlotPanel() {
initComponents();
}
/**
* Initialisation du conteneur d'onglets pour les graphs
*/
private void initComponents()
{
globalTabPane = new JTabbedPane();
PlotTabedPane = new EtcTabbedPane();
logPanel = new LogPanel();
globalTabPane.addTab("Graphics", PlotTabedPane);
globalTabPane.addTab("Command history", logPanel);
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(globalTabPane, GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(globalTabPane, GroupLayout.DEFAULT_SIZE, 276, Short.MAX_VALUE)
.addContainerGap())
);
}
// ***********-*----*-**-**-*-*-*-*-*-*-*-*
// Méthode créées par GL de maniére à restructurer les principes de créations de graph
/**
* This function returns the Exponent used to express the double
* @param a double xEy
* @return y with 1<x<10
*/
public int getExposant(double in){
double absIn = Math.abs(in);
int out = (int)Math.log10(absIn);
//if (out < 0 )
return out<0?out-1:out;
}
/**
* Méthode principale de création de graph
* @param onglet nom que prend l'onglet
* @param titre titre que prend le graph visible au dessus du graph
* @param nomAxeX nom que prend l'axe horizontal
* @param nomAxeY nom que prend l'axr vertical
* @param x valeurs de X
* @param y valeurs de Y
*/
public void makeAnyGraph(String onglet, String titre, String nomAxeX, String nomAxeY, double[] x, double[] y) throws IncorrectParentException
{
double moyenneY = 0.0;
double coefOK = 1.0;
for (int i = 0 ; i < y.length ; i++ )
{
moyenneY += y[i];
}
moyenneY = moyenneY / y.length;
int coefY = getExposant(moyenneY);
if (coefY < 1E-3 && coefY!=0)
{
nomAxeY = "E" + coefY + " " + nomAxeY;
coefOK = Double.valueOf("1E"+coefY);
}
for (int i = 0 ; i < y.length ; i++ )
{
y[i] = y[i] / coefOK;
}
ButtonTabComponent JButton = new ButtonTabComponent(PlotTabedPane);
XYDataset xydataset = makeDataset(onglet,x,y,titre,nomAxeX,nomAxeY,coefOK);
JFreeChart jfreechart = makeGraph(xydataset,titre, nomAxeX, nomAxeY);
EtcChartPanel chartpanel = new EtcChartPanel(jfreechart);
chartpanel.setPreferredSize(new Dimension(500, 270));
PlotTabedPane.addTab(onglet, chartpanel);
PlotTabedPane.setTabComponentAt(PlotTabedPane.getTabCount()-1, JButton);
PlotTabedPane.setSelectedIndex(PlotTabedPane.getTabCount()-1);
}
/**
* Création de Dataset utilisés pour créér les graphs
* @param x
* @param y
* @return
*/
public XYDataset makeDataset(String nom,double[] x, double[] y, String typeSerie, String unitX, String unitY, double coefY)
{
ETCXYSeries xyseries = new ETCXYSeries(nom,typeSerie,unitX,unitY,coefY);
for (int n = 0; n < x.length ; n++)
{
xyseries.add(x[n], y[n]);
}
return new XYSeriesCollection(xyseries);
}
/**
* Création de Dataset utilisés pour créér les graphs
* avec plusieurs courbes. On suppose que tous les tableaux ont la meme taille
* @param x
* @param y
* @return
*/
public XYDataset makeMultiDataset(String [] legends, Vector<double[]> coordsX, Vector<double[]> coordsY,
String unitX, String unitY){
Vector<ETCXYSeries> data=new Vector<ETCXYSeries>(legends.length);
for (int i = 0; i < legends.length; i++) {
// Suite a evolution de l'objet ETCXYSeries avec un coefY
// Ajout ici de coefY = 1 (donc neutre)
// Meilleur choix possible pour du multiplot ...
data.add(new ETCXYSeries(legends[i],"",unitX,unitY,1.0));
}
for (int i = 0; i < data.capacity(); i++) {
for (int j = 0; j < coordsX.elementAt(0).length; j++) {
data.elementAt(i).add(coordsX.elementAt(i)[j], coordsY.elementAt(i)[j]);
}
}
XYSeriesCollection result=new XYSeriesCollection();
for (int i = 0; i < data.capacity(); i++) {
result.addSeries(data.elementAt(i));
}
return result;
}
/**
* Méthode de création de graph a partir de dataset (eventuellement, avec plusieurs series)
* @param onglet nom que prend l'onglet
* @param titre titre que prend le graph visible au dessus du graph
* @param nomAxeX nom que prend l'axe horizontal
* @param nomAxeY nom que prend l'axr vertical
*/
public void makeAnyGraphFromDataSet(String onglet, String titre, String nomAxeX, String nomAxeY, XYDataset ds) throws IncorrectParentException
{
ButtonTabComponent JButton = new ButtonTabComponent(PlotTabedPane);
JFreeChart jfreechart = makeGraph(ds,titre, nomAxeX, nomAxeY);
EtcChartPanel chartpanel = new EtcChartPanel(jfreechart);
chartpanel.setPreferredSize(new Dimension(500, 270));
PlotTabedPane.addTab(onglet, chartpanel);
PlotTabedPane.setTabComponentAt(PlotTabedPane.getTabCount()-1, JButton);
PlotTabedPane.setSelectedIndex(PlotTabedPane.getTabCount()-1);
}
/**
* Methode de création de graph avec des constantes fixées en dur
* (Orientation verticale, legende true, tooltips true, urls false)
*/
public static JFreeChart makeGraph(XYDataset xyd, String titre, String axeX, String axeY)
{
JFreeChart jfreechart = ChartFactory.createXYLineChart(
titre,
axeX,
axeY,
xyd,
PlotOrientation.VERTICAL,
true,
true,
false);
XYPlot xyplot = (XYPlot)jfreechart.getPlot();
xyplot.setDomainCrosshairVisible(true);
xyplot.setRangeCrosshairVisible(true);
return jfreechart;
}
public LogPanel getLogOut(){
return this.logPanel;
}
public EtcTabbedPane getPlotTabedPane() {
return PlotTabedPane;
}
// Fin GL *******************************************
}
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>build</actionName>
<goals>
<goal>-DskipTests=true</goal>
<goal>install</goal>
</goals>
</action>
</actions>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="0"/>
<Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/cnrs/lam/dis/etc/ui/swing/messages.properties" key="NEW_INSTRUMENT_DIALOG_TITLE" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="instrumentPanel" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Component id="createButton" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cancelButton" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="instrumentPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="createButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="instrumentPanel">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder position="2" title="New Instrument Info">
<ResourceString PropertyName="titleX" bundle="org/cnrs/lam/dis/etc/ui/swing/messages.properties" key="NEW_INSTRUMENT_DIALOG_PANEL" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
<Font PropertyName="font" name="DejaVu Sans" size="12" style="0"/>
</TitledBorder>
</Border>
</Property>
<Property name="name" type="java.lang.String" value="instrumentPanel" noResource="true"/>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="descriptionLabel" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="nameLabel" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="descriptionTextField" pref="411" max="32767" attributes="0"/>
<Component id="nameTextField" alignment="0" pref="411" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="nameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="nameTextField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="descriptionLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="descriptionTextField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="nameLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/cnrs/lam/dis/etc/ui/swing/messages.properties" key="NAME" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="name" type="java.lang.String" value="nameLabel" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="descriptionLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/cnrs/lam/dis/etc/ui/swing/messages.properties" key="DESCRIPTION" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="name" type="java.lang.String" value="descriptionLabel" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="nameTextField">
<Properties>
<Property name="name" type="java.lang.String" value="nameTextField" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="descriptionTextField">
<Properties>
<Property name="name" type="java.lang.String" value="descriptionTextField" noResource="true"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="cancelButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/cnrs/lam/dis/etc/ui/swing/messages.properties" key="CANCEL_BUTTON" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="name" type="java.lang.String" value="cancelButton" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="createButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/cnrs/lam/dis/etc/ui/swing/messages.properties" key="CREATE_BUTTON" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="name" type="java.lang.String" value="createButton" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="createButtonActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>
/*
* =============================================================================
*
* Copyright (c) 2013, CeSAM / LAM / Pytheas
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* =============================================================================
*/
package org.cnrs.lam.dis.etc.ui.swing.generic;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.JTextField;
/**
* <p>This is a text field which can be used to show double values. For geting
* and seting the value of the DoubleTextField only the getValue() and
* setValue() methods should be called (not the getText() and setText() of the
* JTextField).</p> When a non double value is typed in the text field it is
* highlighted with the color given by the errorForground property. In this case
* the getValue() method returns the value of the property defaultValue.
*
* @author Nikolaos Apostolakos
*/
public class DoubleTextField extends JTextField {
/**
* Constructs a new instance of DoubleTextField. This instance is checking
* if its text represents a double on actionPerformed and focusLost events.
*/
public DoubleTextField() {
super();
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkIfDouble();
}
});
addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
checkIfDouble();
}
});
addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
checkIfDouble();
}
});
}
/** The flag used to store if the current value is invalid or not.*/
private boolean currentValueValid = false;
/**
* Returns if the current value of the text field is a valid double
* representation or not. If this method returns false, the getValue()
* method will return the default value.
* @return true if the current text represents a double, false otherwise
*/
public boolean isCurrentValueValid() {
return currentValueValid;
}
/** The variable where the normal foreground color is stored.*/
private Color normalForeground = getBackground();
/**