Commit 82509834 authored by James's avatar James

v0.3

 - persist recent run with embedded derby db
 - remove "transfer mark number" from graph
 - changed graph background to dark gray
parent 7c40ec53
......@@ -5,4 +5,5 @@
/jdm.properties
/tmp
*.zip
/build.properties
\ No newline at end of file
/build.properties
/derbyDB/
\ No newline at end of file
......@@ -31,11 +31,15 @@ v0.2
- show recent runs (not persisted)
- default to nimbus look and feel
desired features
v0.3
- persist recent run with embedded derby db
- remove "transfer mark number" from graph
- persist recent run with jpa
http://www.vogella.com/tutorials/JavaPersistenceAPI/article.html
- changed graph background to dark gray
desired features
- resizing main frame stretches tabbed pane instead of empty panel
- hard drive specs, ie. manufacturer, size, speed
- auto clear disk cache linux
- auto clear disk cache windows
......
......@@ -73,7 +73,7 @@
-->
<!-- software revision number -->
<property name="version" value="0.2"/>
<property name="version" value="0.3"/>
<property name="releaseDir" value="jdiskmark-v${version}"/>
<target name="-post-jar">
......
File added
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.homepage=https://gitlab.com/jamesmarkchan/jDiskMark
application.title=jDiskMark
application.vendor=jamesmarkchan
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/jDiskMark.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.jcommon-1.0.21.jar=libs/jcommon-1.0.21.jar
file.reference.jfreechart-1.0.17.jar=libs/jfreechart-1.0.17.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.jcommon-1.0.21.jar}:\
${file.reference.jfreechart-1.0.17.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=jdiskmark.App
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=JDK_1.8
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=-Aeclipselink.canonicalmodel.use_static_factory=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.homepage=https://gitlab.com/jamesmarkchan/jDiskMark
application.title=jDiskMark
application.vendor=jamesmarkchan
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/jDiskMark.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.derby.jar=libs\\derby.jar
file.reference.jcommon-1.0.21.jar=libs/jcommon-1.0.21.jar
file.reference.jfreechart-1.0.17.jar=libs/jfreechart-1.0.17.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.jcommon-1.0.21.jar}:\
${file.reference.jfreechart-1.0.17.jar}:\
${libs.eclipselink.classpath}:\
${file.reference.derby.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}:\
${libs.eclipselinkmodelgen.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=jdiskmark.App
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=JDK_1.8
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="jDiskMarkPU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<!--<property name="eclipselink.logging.level" value="FINE"/>-->
<property name="javax.persistence.jdbc.url" value="jdbc:derby:derbyDB;create=true"/>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="javax.persistence.schema-generation.database.action" value="create"/>
</properties>
</persistence-unit>
</persistence>
......@@ -23,6 +23,7 @@ import javax.swing.UnsupportedLookAndFeelException;
*/
public class App {
public static final String APP_CACHE_DIR = System.getProperty("user.home") + File.separator + ".jDiskMark";
public static final String PROPERTIESFILE = "jdm.properties";
public static final String DATADIRNAME = "jDiskMarkData";
public static final int MEGABYTE = 1024 * 1024;
......@@ -121,6 +122,10 @@ public class App {
@Override
public void run() { App.saveConfig(); }
});
// configure the embedded DB in .jDiskMark
System.setProperty("derby.system.home", APP_CACHE_DIR);
loadSavedRuns();
}
public static void loadConfig() {
......@@ -202,6 +207,22 @@ public class App {
return sb.toString();
}
public static void loadSavedRuns() {
Gui.runPanel.clearTable();
// populate run table with saved runs from db
System.out.println("loading stored run data");
DiskRun.findAll().stream().forEach((DiskRun run) -> {
Gui.runPanel.addRun(run);
});
}
public static void clearSavedRuns() {
DiskRun.deleteAll();
loadSavedRuns();
}
public static void msg(String message) {
Gui.mainFrame.msg(message);
}
......
package jdiskmark;
import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
*/
public class DiskRun {
@Entity
@Table(name="DiskRun")
@NamedQueries({
@NamedQuery(name="DiskRun.findAll",
query="SELECT d FROM DiskRun d")
})
public class DiskRun implements Serializable {
static DecimalFormat df = new DecimalFormat("###.###");
public enum Type { READ, WRITE, READ_WRITE; }
public enum BlockSequence {SEQUENTIAL, RANDOM; }
@Column
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
long id;
// configuration
@Column
Type runType;
@Column
BlockSequence blockOrder;
@Column
int numMarks = 0;
@Column
int numBlocks = 0;
@Column
int blockSize = 0;
@Column
long txSize = 0;
// run data
int id;
Date startTime = new Date();
@Temporal(TemporalType.TIMESTAMP)
Date startTime;
@Temporal(TemporalType.TIMESTAMP)
Date endTime = null;
@Column
int totalMarks = 0;
@Column
double cumMin = 0;
@Column
double cumMax = 0;
@Column
double cumAvg = 0;
@Override
......@@ -36,7 +69,12 @@ public class DiskRun {
return "Run("+runType+","+blockOrder+"): "+totalMarks+" cum avg: "+cumAvg;
}
public DiskRun() {
this.startTime = new Date();
}
DiskRun(Type type, BlockSequence order) {
this.startTime = new Date();
runType = type;
blockOrder = order;
}
......@@ -44,13 +82,27 @@ public class DiskRun {
public String getMin() {
return cumMin == -1 ? "- -" : df.format(cumMin);
}
public void setMin(double min) {
cumMin = min;
}
public String getMax() {
return cumMax == -1 ? "- -" : df.format(cumMax);
}
public void setMax(double max) {
cumMax = max;
}
public String getAvg() {
return cumAvg == -1 ? "- -" : df.format(cumAvg);
}
public void SetAvg(double avg) {
cumAvg = avg;
}
public String getDuration() {
if (endTime == null) {
return "unknown";
......@@ -59,4 +111,25 @@ public class DiskRun {
long diffSeconds = duration / 1000 % 60;
return String.valueOf(diffSeconds) + "s";
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
static List<DiskRun> findAll() {
EntityManager em = EM.getEntityManager();
return em.createNamedQuery("DiskRun.findAll", DiskRun.class).getResultList();
}
static int deleteAll() {
EntityManager em = EM.getEntityManager();
em.getTransaction().begin();
int deletedCount = em.createQuery("DELETE FROM DiskRun").executeUpdate();
em.getTransaction().commit();
return deletedCount;
}
}
......@@ -19,6 +19,7 @@ import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.EntityManager;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
......@@ -126,6 +127,12 @@ public class DiskWorker extends SwingWorker <Boolean, DiskMark> {
run.cumAvg = wMark.cumAvg;
run.endTime = new Date();
}
EntityManager em = EM.getEntityManager();
em.getTransaction().begin();
em.persist(run);
em.getTransaction().commit();
Gui.runPanel.addRun(run);
}
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package jdiskmark;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
/**
*
* @author James
*/
public class EM {
private static EntityManager em = null;
static EntityManager getEntityManager() {
if (em == null) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("jDiskMarkPU");
em = emf.createEntityManager();
}
return em;
}
}
......@@ -52,7 +52,7 @@ public final class Gui {
chart = ChartFactory.createXYLineChart(
"XY Chart", // Title
"Transfer Mark Number", // x-axis Label
null, // x-axis Label
"Bandwidth MB/s", // y-axis Label
dataset, // Dataset
PlotOrientation.VERTICAL, // Plot Orientation
......@@ -61,7 +61,7 @@ public final class Gui {
false // Configure chart to generate URLs?
);
XYPlot plot = chart.getXYPlot();
plot.setBackgroundPaint(Color.BLACK);
plot.setBackgroundPaint(Color.DARK_GRAY);
NumberAxis range = (NumberAxis) plot.getDomainAxis();
range.setNumberFormatOverride(NumberFormat.getNumberInstance());
chart.getTitle().setVisible(false);
......
......@@ -32,12 +32,20 @@
<Property name="text" type="java.lang.String" value="Options"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem3">
<MenuItem class="javax.swing.JMenuItem" name="clearRunsItem">
<Properties>
<Property name="text" type="java.lang.String" value="Clear Messages"/>
<Property name="text" type="java.lang.String" value="Clear Previous Runs"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem3ActionPerformed"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="clearRunsItemActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="clearLogsItem">
<Properties>
<Property name="text" type="java.lang.String" value="Clear Event Logs"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="clearLogsItemActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="deleteDataMenuItem">
......@@ -150,7 +158,7 @@
<Component id="jPanel2" max="32767" attributes="0"/>
<Component id="jSeparator2" alignment="0" max="32767" attributes="0"/>
<Component id="progressPanel" alignment="1" max="32767" attributes="0"/>
<Component id="tabbedPane" alignment="0" pref="887" max="32767" attributes="0"/>
<Component id="tabbedPane" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
......@@ -582,8 +590,8 @@
<Component class="jdiskmark.RunPanel" name="runPanel">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Previouis Runs">
<Property name="tabTitle" type="java.lang.String" value="Previouis Runs"/>
<JTabbedPaneConstraints tabName="Previous Runs">
<Property name="tabTitle" type="java.lang.String" value="Previous Runs"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
......
......@@ -134,7 +134,8 @@ public final class MainFrame extends javax.swing.JFrame {
fileMenu = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
optionMenu = new javax.swing.JMenu();
jMenuItem3 = new javax.swing.JMenuItem();
clearRunsItem = new javax.swing.JMenuItem();
clearLogsItem = new javax.swing.JMenuItem();
deleteDataMenuItem = new javax.swing.JMenuItem();
resetSequenceMenuItem = new javax.swing.JMenuItem();
jSeparator1 = new javax.swing.JPopupMenu.Separator();
......@@ -387,7 +388,7 @@ public final class MainFrame extends javax.swing.JFrame {
.addGap(0, 6, Short.MAX_VALUE))
);
tabbedPane.addTab("Previouis Runs", runPanel);
tabbedPane.addTab("Previous Runs", runPanel);
msgTextArea.setEditable(false);
msgTextArea.setColumns(20);
......@@ -483,13 +484,21 @@ public final class MainFrame extends javax.swing.JFrame {
optionMenu.setText("Options");
jMenuItem3.setText("Clear Messages");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
clearRunsItem.setText("Clear Previous Runs");
clearRunsItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
clearRunsItemActionPerformed(evt);
}
});
optionMenu.add(jMenuItem3);
optionMenu.add(clearRunsItem);
clearLogsItem.setText("Clear Event Logs");
clearLogsItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
clearLogsItemActionPerformed(evt);
}
});
optionMenu.add(clearLogsItem);
deleteDataMenuItem.setText("Delete Data Dir");
deleteDataMenuItem.addActionListener(new java.awt.event.ActionListener() {
......@@ -576,7 +585,7 @@ public final class MainFrame extends javax.swing.JFrame {
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jSeparator2)
.addComponent(progressPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 887, Short.MAX_VALUE)
.addComponent(tabbedPane)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
......@@ -656,9 +665,9 @@ public final class MainFrame extends javax.swing.JFrame {
}
}//GEN-LAST:event_openLocButtonActionPerformed
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
private void clearLogsItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearLogsItemActionPerformed
clearMessages();
}//GEN-LAST:event_jMenuItem3ActionPerformed
}//GEN-LAST:event_clearLogsItemActionPerformed
private void multiFileCheckBoxMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiFileCheckBoxMenuItemActionPerformed
App.multiFile = multiFileCheckBoxMenuItem.getState();
......@@ -696,12 +705,19 @@ public final class MainFrame extends javax.swing.JFrame {
App.saveConfig();
}//GEN-LAST:event_writeSyncCheckBoxMenuItemActionPerformed
private void clearRunsItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearRunsItemActionPerformed
App.msg("Clearing previous runs.");
App.clearSavedRuns();
}//GEN-LAST:event_clearRunsItemActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBoxMenuItem autoRemoveCheckBoxMenuItem;
private javax.swing.JCheckBoxMenuItem autoResetCheckBoxMenuItem;
private javax.swing.JComboBox blockSizeCombo;
private javax.swing.JButton chooseButton;
private javax.swing.JMenuItem clearLogsItem;
private javax.swing.JMenuItem clearRunsItem;
private javax.swing.JPanel controlsPanel;
private javax.swing.JMenuItem deleteDataMenuItem;
private javax.swing.JScrollPane eventScrollPane;
......@@ -727,7 +743,6 @@ public final class MainFrame extends javax.swing.JFrame {
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JPanel jPanel2;
private javax.swing.JPopupMenu.Separator jSeparator1;
private javax.swing.JSeparator jSeparator2;
......
......@@ -41,7 +41,7 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="jTable1">
<Component class="javax.swing.JTable" name="runTable">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="11" rowCount="0">
......
......@@ -5,6 +5,8 @@
*/
package jdiskmark;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import javax.swing.table.DefaultTableModel;
/**
......@@ -19,6 +21,14 @@ public class RunPanel extends javax.swing.JPanel {
public RunPanel() {
initComponents();
Gui.runPanel = RunPanel.this;
// auto scroll to bottom when a new record is added
runTable.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
runTable.scrollRectToVisible(runTable.getCellRect(runTable.getRowCount()-1, 0, true));
}
});
}
/**
......@@ -31,9 +41,9 @@ public class RunPanel extends javax.swing.JPanel {
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
runTable = new javax.swing.JTable();
jTable1.setModel(new javax.swing.table.DefaultTableModel(
runTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
......@@ -49,19 +59,19 @@ public class RunPanel extends javax.swing.JPanel {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(jTable1);
if (jTable1.getColumnModel().getColumnCount() > 0) {
jTable1.getColumnModel().getColumn(0).setPreferredWidth(25);
jTable1.getColumnModel().getColumn(1).setPreferredWidth(40);
jTable1.getColumnModel().getColumn(2).setPreferredWidth(10);
jTable1.getColumnModel().getColumn(3).setPreferredWidth(10);
jTable1.getColumnModel().getColumn(4).setPreferredWidth(10);
jTable1.getColumnModel().getColumn(5).setPreferredWidth(10);
jTable1.getColumnModel().getColumn(6).setPreferredWidth(150);
jTable1.getColumnModel().getColumn(7).setPreferredWidth(15);
jTable1.getColumnModel().getColumn(8).setPreferredWidth(40);
jTable1.getColumnModel().getColumn(9).setPreferredWidth(40);
jTable1.getColumnModel().getColumn(10).setPreferredWidth(40);
jScrollPane1.setViewportView(runTable);
if (runTable.getColumnModel().getColumnCount() > 0) {
runTable.getColumnModel().getColumn(0).setPreferredWidth(25);
runTable.getColumnModel().getColumn(1).setPreferredWidth(40);
runTable.getColumnModel().getColumn(2).setPreferredWidth(10);
runTable.getColumnModel().getColumn(3).setPreferredWidth(10);
runTable.getColumnModel().getColumn(4).setPreferredWidth(10);
runTable.getColumnModel().getColumn(5).setPreferredWidth(10);
runTable.getColumnModel().getColumn(6).setPreferredWidth(150);
runTable.getColumnModel().getColumn(7).setPreferredWidth(15);
runTable.getColumnModel().getColumn(8).setPreferredWidth(40);
runTable.getColumnModel().getColumn(9).setPreferredWidth(40);
runTable.getColumnModel().getColumn(10).setPreferredWidth(40);
}
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
......@@ -85,11 +95,11 @@ public class RunPanel extends javax.swing.JPanel {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTable runTable;
// End of variables declaration//GEN-END:variables
public void addRun(DiskRun run) {
DefaultTableModel model = (DefaultTableModel) this.jTable1.getModel();
DefaultTableModel model = (DefaultTableModel) this.runTable.getModel();
model.addRow(
new Object[] {
run.runType,
......@@ -106,4 +116,10 @@ public class RunPanel extends javax.swing.JPanel {
});
}
public void clearTable() {
DefaultTableModel model = (DefaultTableModel) this.runTable.getModel();
while (model.getRowCount() > 0) {
model.removeRow(0);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment