Commit ceb1a8fc authored by Eric Seigne's avatar Eric Seigne
Browse files

Fix CRLF

parent 1ec74ab9
syntax: regexp
.DS_Store$
mvplan/build/*
mvplan/dist/*
mvplan/nbproject/private*
mvplan/mvplan.xml
mvplan_core/build/*
mvplan_core/dist/*
mvplan_core/nbproject/private*
mvplan_core/target/*
mvplan/target/*
syntax: glob
.settings/*
mvplan_core/.project
mvplan_core/.classpath
.project
syntax: regexp
.DS_Store$
mvplan/build/*
mvplan/dist/*
mvplan/nbproject/private*
mvplan/mvplan.xml
mvplan_core/build/*
mvplan_core/dist/*
mvplan_core/nbproject/private*
mvplan_core/target/*
mvplan/target/*
syntax: glob
.settings/*
mvplan_core/.project
mvplan_core/.classpath
.project
This diff is collapsed.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mvplan</artifactId>
<packaging>jar</packaging>
<name>MV-Plan GUI</name>
<parent>
<groupId>mvplan</groupId>
<artifactId>mvplan-parent</artifactId>
<version>1.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>mvplan</groupId>
<artifactId>mvplan_core</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>jgoodies</groupId>
<artifactId>looks</artifactId>
<version>1.2.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/assembly/mvplan.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>mvplan.main.Mvplan</mainClass>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mvplan</artifactId>
<packaging>jar</packaging>
<name>MV-Plan GUI</name>
<parent>
<groupId>mvplan</groupId>
<artifactId>mvplan-parent</artifactId>
<version>1.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>mvplan</groupId>
<artifactId>mvplan_core</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>jgoodies</groupId>
<artifactId>looks</artifactId>
<version>1.2.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/assembly/mvplan.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>mvplan.main.Mvplan</mainClass>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
<assembly>
<id>all</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<unpack>true</unpack>
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
<assembly>
<id>all</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<unpack>true</unpack>
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
/*
* DiveSegmentModel.java
*
* Provides AbstractTableModel for the dive segment table on the Main Window (MainFrame)
*
* @author Guy Wittig
* @version 04-Mar-2005
*
* This program is part of MV-Plan
* copyright 2006 Guy Wittig
*
* 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.
*
* The GNU General Public License can be read at http://www.gnu.org/licenses/licenses.html*
*/
package mvplan.datamodel;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import mvplan.gas.Gas;
import mvplan.main.MvplanInstance;
import mvplan.segments.SegmentAbstract;
public class DiveSegmentModel extends AbstractTableModel
{
String [] headings;
List <SegmentAbstract> knownSegments;
public static int COLUMN_COUNT=5;
public DiveSegmentModel(List knownSegments)
{
this.knownSegments=knownSegments;
// Create headings from resource file
// e.g. headings = new String[] {"Depth", "Time","Gas","SP","Enable"};
headings = new String[] {
MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.diveTable.depth.text"),
MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.diveTable.time.text"),
MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.diveTable.gas.text"),
MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.diveTable.setpoint.text"),
MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.diveTable.enable.text") };
}
// Accessors
public List<SegmentAbstract> getKnownSegments() { return knownSegments;}
public int getRowCount() { return knownSegments.size();}
public int getColumnCount() { return COLUMN_COUNT; }
public String getColumnName(int col) { return headings[col]; }
public SegmentAbstract getSegment(int row) { return (SegmentAbstract)knownSegments.get(row);}
/*
* Move row up
*/
public void moveRowUp(int row)
{
// Check bounds
if(row > 0 && row <= (knownSegments.size()-1)) {
SegmentAbstract s=(SegmentAbstract)knownSegments.get(row-1);
knownSegments.set(row-1,knownSegments.get(row));
knownSegments.set(row,s);
}
// Fire event
fireTableDataChanged();
}
/*
* Move row down
*/
public void moveRowDown(int row)
{
// Check bounds
if(row >= 0 && row < (knownSegments.size()-1)) {
SegmentAbstract s=(SegmentAbstract)knownSegments.get(row+1);
knownSegments.set(row+1,knownSegments.get(row));
knownSegments.set(row,s);
}
// Fire event
fireTableDataChanged();
}
/*
* Remove row from model
*/
public void removeRow(int row)
{
knownSegments.remove(row);
// Fire event
fireTableDataChanged();
}
/*
* Get class for column
*/
public Class getColumnClass(int col) {
SegmentAbstract s=(SegmentAbstract)knownSegments.get(0);
switch (col) {
case 0: return new Double(s.getDepth()).getClass();
case 1: return new Double(s.getTime()).getClass();
case 2: // Ensure we don't have a null gas
if(s.getGas()==null) s.setGas(new Gas(0.0, 0.21, 66.0));
return s.getGas().getClass();
case 3: return new Double(s.getSetpoint()).getClass();
case 4: return s.getEnable().getClass();
default: return null;
}
}
/*
* Check if cell is editable
*/
public boolean isCellEditable(int row, int col)
{
// All are editable
return true;
}
/*
* Set value at cell
*/
public void setValueAt(Object obj, int row, int col)
{
// New JVM appears to miss combo box selections so check for nulls
if(obj == null) {
//System.out.println("DiveSegmentModel.setValueAt(): null argument");
return;
}
// Get dive segment related to this row
SegmentAbstract s=(SegmentAbstract)knownSegments.get(row);
double d;
String str;
// Switch by column. If entries are out of bounds then set them to zero.
switch (col) {
case 0: // Depth
d=((Double)obj).doubleValue();
if(d<0.0 || d>MvplanInstance.getMvplan().getPrefs().getMaxDepth()) d=0.0;
s.setDepth(d);
break;
case 1: // Time
d=((Double)obj).doubleValue();
if(d<0.0 || d>MvplanInstance.getMvplan().getPrefs().getMaxSegmentTime()) d=0.0;
s.setTime(d);
break;
case 2: // Gas
s.setGas((Gas)obj);
break;
case 3: // Setpoint
d=((Double)obj).doubleValue();
if (d<0.0 || d>MvplanInstance.getMvplan().getPrefs().getMaxSetpoint()) d=0.0;
s.setSetpoint(d);
break;
case 4: // Enable
s.setEnable((Boolean)obj);
break;
default:
break;
}
}
/*
* Get value at cell
*/
public Object getValueAt(int row, int col)
{
// Get dive segment related to this row
SegmentAbstract s=(SegmentAbstract)knownSegments.get(row);
s.setType(SegmentAbstract.CONST); // Fix for previous bug
// Switch by column
switch (col) {
case 0: // Depth
return new Double(s.getDepth());
case 1: // Time
return new Double(s.getTime());
case 2: // Gas
return s.getGas().toString();
case 3: // Setpoint
return new Double(s.getSetpoint());
case 4: // Enable
return s.getEnable();
default: return null;
}
}
}
/*
* DiveSegmentModel.java
*
* Provides AbstractTableModel for the dive segment table on the Main Window (MainFrame)
*
* @author Guy Wittig
* @version 04-Mar-2005
*
* This program is part of MV-Plan
* copyright 2006 Guy Wittig
*
* 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.
*
* The GNU General Public License can be read at http://www.gnu.org/licenses/licenses.html*
*/
package mvplan.datamodel;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import mvplan.gas.Gas;
import mvplan.main.MvplanInstance;
import mvplan.segments.SegmentAbstract;
public class DiveSegmentModel extends AbstractTableModel
{
String [] headings;
List <SegmentAbstract> knownSegments;
public static int COLUMN_COUNT=5;
public DiveSegmentModel(List knownSegments)
{
this.knownSegments=knownSegments;
// Create headings from resource file
// e.g. headings = new String[] {"Depth", "Time","Gas","SP","Enable"};
headings = new String[] {
MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.diveTable.depth.text"),
MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.diveTable.time.text"),
MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.diveTable.gas.text"),
MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.diveTable.setpoint.text"),
MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.diveTable.enable.text") };
}
// Accessors
public List<SegmentAbstract> getKnownSegments() { return knownSegments;}
public int getRowCount() { return knownSegments.size();}
public int getColumnCount() { return COLUMN_COUNT; }
public String getColumnName(int col) { return headings[col]; }
public SegmentAbstract getSegment(int row) { return (SegmentAbstract)knownSegments.get(row);}
/*
* Move row up
*/
public void moveRowUp(int row)
{
// Check bounds
if(row > 0 && row <= (knownSegments.size()-1)) {
SegmentAbstract s=(SegmentAbstract)knownSegments.get(row-1);
knownSegments.set(row-1,knownSegments.get(row));
knownSegments.set(row,s);
}
// Fire event
fireTableDataChanged();
}
/*
* Move row down
*/
public void moveRowDown(int row)
{
// Check bounds
if(row >= 0 && row < (knownSegments.size()-1)) {
SegmentAbstract s=(SegmentAbstract)knownSegments.get(row+1);
knownSegments.set(row+1,knownSegments.get(row));
knownSegments.set(row,s);
}
// Fire event
fireTableDataChanged();
}
/*
* Remove row from model
*/
public void removeRow(int row)
{
knownSegments.remove(row);
// Fire event
fireTableDataChanged();
}
/*
* Get class for column
*/
public Class getColumnClass(int col) {
SegmentAbstract s=(SegmentAbstract)knownSegments.get(0);
switch (col) {
case 0: return new Double(s.getDepth()).getClass();
case 1: return new Double(s.getTime()).getClass();
case 2: // Ensure we don't have a null gas
if(s.getGas()==null) s.setGas(new Gas(0.0, 0.21, 66.0));
return s.getGas().getClass();
case 3: return new Double(s.getSetpoint()).getClass();
case 4: return s.getEnable().getClass();
default: return null;
}
}
/*
* Check if cell is editable
*/
public boolean isCellEditable(int row, int col)
{
// All are editable
return true;
}
/*
* Set value at cell
*/
public void setValueAt(Object obj, int row, int col)
{
// New JVM appears to miss combo box selections so check for nulls
if(obj == null) {
//System.out.println("DiveSegmentModel.setValueAt(): null argument");
return;
}
// Get dive segment related to this row
SegmentAbstract s=(SegmentAbstract)knownSegments.get(row);
double d;
String str;
// Switch by column. If entries are out of bounds then set them to zero.
switch (col) {
case 0: // Depth
d=((Double)obj).doubleValue();
if(d<0.0 || d>MvplanInstance.getMvplan().getPrefs().getMaxDepth()) d=0.0;
s.setDepth(d);
break;
case 1: // Time
d=((Double)obj).doubleValue();
if(d<0.0 || d>MvplanInstance.getMvplan().getPrefs().getMaxSegmentTime()) d=0.0;
s.setTime(d);
break;
case 2: // Gas
s.setGas((Gas)obj);
break;
case 3: // Setpoint
d=((Double)obj).doubleValue();
if (d<0.0 || d>MvplanInstance.getMvplan().getPrefs().getMaxSetpoint()) d=0.0;
s.setSetpoint(d);
break;
case 4: // Enable
s.setEnable((Boolean)obj);
break;
default:
break;
}
}
/*
* Get value at cell
*/
public Object getValueAt(int row, int col)
{
// Get dive segment related to this row
SegmentAbstract s=(SegmentAbstract)knownSegments.get(row);
s.setType(SegmentAbstract.CONST); // Fix for previous bug
// Switch by column
switch (col) {
case 0: // Depth
return new Double(s.getDepth());
case 1: // Time
return new Double(s.getTime());
case 2: // Gas
return s.getGas().toString();
case 3: // Setpoint
return new Double(s.getSetpoint());
case 4: // Enable
return s.getEnable();
default: return null;
}
}
}
/*
* GasModel.java
*
* Provides AbstractTableModel for the gas table on the Main Window (MainFrame)
*
* @author Guy Wittig
* @version 18-Jun-2006
*
* This program is part of MV-Plan
* Copywrite 2006 Guy Wittig
*
* 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,