|
@@ -4,21 +4,59 @@
|
|
*/
|
|
*/
|
|
package de.nplusc.izc.iZpl;
|
|
package de.nplusc.izc.iZpl;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
+import javax.swing.table.DefaultTableModel;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
*
|
|
*
|
|
* @author LH
|
|
* @author LH
|
|
*/
|
|
*/
|
|
public class BurnLiistManager extends javax.swing.JFrame
|
|
public class BurnLiistManager extends javax.swing.JFrame
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<String[]> baseList;
|
|
/**
|
|
/**
|
|
* Creates new form BurnLiistManager
|
|
* Creates new form BurnLiistManager
|
|
*/
|
|
*/
|
|
- public BurnLiistManager()
|
|
|
|
|
|
+ public BurnLiistManager(List<String[]> data)
|
|
{
|
|
{
|
|
|
|
+ //baseList=data;
|
|
|
|
+ baseList=data;
|
|
initComponents();
|
|
initComponents();
|
|
- }
|
|
|
|
|
|
+ //populateTables()
|
|
|
|
+ reBuildData();
|
|
|
|
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void reBuildData()
|
|
|
|
+ {
|
|
|
|
+ ((DefaultTableModel)tblData.getModel()).setNumRows(1);
|
|
|
|
+ int disknr=0;
|
|
|
|
+ int tr = 0;
|
|
|
|
+ int secondsFromStart=0;
|
|
|
|
+ int DiskMax = 70*60;
|
|
|
|
+ for (String[] dataset : baseList)
|
|
|
|
+ {
|
|
|
|
+ int secs = Integer.valueOf(dataset[2]);
|
|
|
|
+ secondsFromStart+=secs;
|
|
|
|
+ if(secondsFromStart>DiskMax)
|
|
|
|
+ {
|
|
|
|
+ disknr++;
|
|
|
|
+ secondsFromStart=secs;
|
|
|
|
+ }
|
|
|
|
+ tblData.getModel().setValueAt(dataset[0], tr, 0);
|
|
|
|
+ tblData.getModel().setValueAt(dataset[1], tr, 1);
|
|
|
|
+ tblData.getModel().setValueAt(dataset[2], tr, 2);
|
|
|
|
+ tblData.getModel().setValueAt(disknr, tr, 3);
|
|
|
|
+ ((DefaultTableModel)tblData.getModel()).addRow(new String[4]);
|
|
|
|
+ tr++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* This method is called from within the constructor to
|
|
* This method is called from within the constructor to
|
|
* initialize the form.
|
|
* initialize the form.
|
|
@@ -30,70 +68,169 @@ public class BurnLiistManager extends javax.swing.JFrame
|
|
private void initComponents()
|
|
private void initComponents()
|
|
{
|
|
{
|
|
|
|
|
|
|
|
+ btnUp = new javax.swing.JButton();
|
|
|
|
+ btnDown = new javax.swing.JButton();
|
|
|
|
+ btnDelete = new javax.swing.JButton();
|
|
|
|
+ btnKnistern = new javax.swing.JButton();
|
|
|
|
+ jScrollPane1 = new javax.swing.JScrollPane();
|
|
|
|
+ tblData = new javax.swing.JTable();
|
|
|
|
+
|
|
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
|
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
|
|
|
|
|
|
|
+ btnUp.setText("Up");
|
|
|
|
+ btnUp.addActionListener(new java.awt.event.ActionListener()
|
|
|
|
+ {
|
|
|
|
+ public void actionPerformed(java.awt.event.ActionEvent evt)
|
|
|
|
+ {
|
|
|
|
+ btnUpActionPerformed(evt);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ btnDown.setText("DoWn");
|
|
|
|
+ btnDown.addActionListener(new java.awt.event.ActionListener()
|
|
|
|
+ {
|
|
|
|
+ public void actionPerformed(java.awt.event.ActionEvent evt)
|
|
|
|
+ {
|
|
|
|
+ btnDownActionPerformed(evt);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ btnDelete.setText("Delete");
|
|
|
|
+ btnDelete.addActionListener(new java.awt.event.ActionListener()
|
|
|
|
+ {
|
|
|
|
+ public void actionPerformed(java.awt.event.ActionEvent evt)
|
|
|
|
+ {
|
|
|
|
+ btnDeleteActionPerformed(evt);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ btnKnistern.setText("Burrrrrrrrrrrrrrrrrrrrrrrrrrn!");
|
|
|
|
+ btnKnistern.addActionListener(new java.awt.event.ActionListener()
|
|
|
|
+ {
|
|
|
|
+ public void actionPerformed(java.awt.event.ActionEvent evt)
|
|
|
|
+ {
|
|
|
|
+ btnKnisternActionPerformed(evt);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ tblData.setModel(new javax.swing.table.DefaultTableModel(
|
|
|
|
+ new Object [][]
|
|
|
|
+ {
|
|
|
|
+ {null, null, null, null}
|
|
|
|
+ },
|
|
|
|
+ new String []
|
|
|
|
+ {
|
|
|
|
+ "File", "Playlist-Gruppe", "Dauer", "Disk-#"
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ {
|
|
|
|
+ Class[] types = new Class []
|
|
|
|
+ {
|
|
|
|
+ java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
|
|
|
|
+ };
|
|
|
|
+ boolean[] canEdit = new boolean []
|
|
|
|
+ {
|
|
|
|
+ false, false, false, false
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ public Class getColumnClass(int columnIndex)
|
|
|
|
+ {
|
|
|
|
+ return types [columnIndex];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isCellEditable(int rowIndex, int columnIndex)
|
|
|
|
+ {
|
|
|
|
+ return canEdit [columnIndex];
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ tblData.setColumnSelectionAllowed(true);
|
|
|
|
+ tblData.getTableHeader().setReorderingAllowed(false);
|
|
|
|
+ jScrollPane1.setViewportView(tblData);
|
|
|
|
+ tblData.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
|
|
|
+
|
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
|
getContentPane().setLayout(layout);
|
|
getContentPane().setLayout(layout);
|
|
layout.setHorizontalGroup(
|
|
layout.setHorizontalGroup(
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
- .addGap(0, 400, Short.MAX_VALUE)
|
|
|
|
|
|
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
|
|
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
|
|
+ .addComponent(btnKnistern, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
+ .addGroup(layout.createSequentialGroup()
|
|
|
|
+ .addContainerGap()
|
|
|
|
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 603, Short.MAX_VALUE)
|
|
|
|
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
|
|
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
|
|
|
+ .addComponent(btnDelete, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
+ .addComponent(btnDown, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
+ .addComponent(btnUp, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
|
|
|
+ .addGap(19, 19, 19))
|
|
);
|
|
);
|
|
layout.setVerticalGroup(
|
|
layout.setVerticalGroup(
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
- .addGap(0, 300, Short.MAX_VALUE)
|
|
|
|
|
|
+ .addGroup(layout.createSequentialGroup()
|
|
|
|
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
|
+ .addGroup(layout.createSequentialGroup()
|
|
|
|
+ .addGap(22, 22, 22)
|
|
|
|
+ .addComponent(btnUp, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
|
|
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
|
|
+ .addComponent(btnDown, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
|
|
+ .addGap(17, 17, 17)
|
|
|
|
+ .addComponent(btnDelete, javax.swing.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE))
|
|
|
|
+ .addGroup(layout.createSequentialGroup()
|
|
|
|
+ .addContainerGap()
|
|
|
|
+ .addComponent(jScrollPane1)))
|
|
|
|
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
|
|
+ .addComponent(btnKnistern, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
|
|
+ .addContainerGap())
|
|
);
|
|
);
|
|
|
|
|
|
pack();
|
|
pack();
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
|
|
- /**
|
|
|
|
- * @param args the command line arguments
|
|
|
|
- */
|
|
|
|
- public static void main(String args[])
|
|
|
|
- {
|
|
|
|
- /* Set the Nimbus look and feel */
|
|
|
|
- //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
|
|
|
- /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
|
|
|
- * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
|
|
|
- */
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
|
|
|
|
- {
|
|
|
|
- if ("Nimbus".equals(info.getName()))
|
|
|
|
- {
|
|
|
|
- javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- catch (ClassNotFoundException ex)
|
|
|
|
- {
|
|
|
|
- java.util.logging.Logger.getLogger(BurnLiistManager.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
|
|
- }
|
|
|
|
- catch (InstantiationException ex)
|
|
|
|
- {
|
|
|
|
- java.util.logging.Logger.getLogger(BurnLiistManager.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
|
|
- }
|
|
|
|
- catch (IllegalAccessException ex)
|
|
|
|
- {
|
|
|
|
- java.util.logging.Logger.getLogger(BurnLiistManager.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
|
|
- }
|
|
|
|
- catch (javax.swing.UnsupportedLookAndFeelException ex)
|
|
|
|
- {
|
|
|
|
- java.util.logging.Logger.getLogger(BurnLiistManager.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
|
|
- }
|
|
|
|
- //</editor-fold>
|
|
|
|
|
|
+ private void btnUpActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnUpActionPerformed
|
|
|
|
+ {//GEN-HEADEREND:event_btnUpActionPerformed
|
|
|
|
+
|
|
|
|
+ int i = tblData.getSelectedRow();
|
|
|
|
+ if(i<1)
|
|
|
|
+ return;
|
|
|
|
+ String[] d1 = baseList.get(i);
|
|
|
|
+ baseList.remove(i);
|
|
|
|
+ baseList.add(i-1, d1);
|
|
|
|
+ tblData.setRowSelectionInterval(i-1, i-1);
|
|
|
|
+
|
|
|
|
+ reBuildData();
|
|
|
|
+ }//GEN-LAST:event_btnUpActionPerformed
|
|
|
|
+
|
|
|
|
+ private void btnDownActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnDownActionPerformed
|
|
|
|
+ {//GEN-HEADEREND:event_btnDownActionPerformed
|
|
|
|
+ int i = tblData.getSelectedRow();
|
|
|
|
+ if(i>baseList.size()-2)
|
|
|
|
+ return;
|
|
|
|
+ String[] d1 = baseList.get(i+1);
|
|
|
|
+ baseList.remove(i+1);
|
|
|
|
+ baseList.add(i, d1);
|
|
|
|
+ tblData.setRowSelectionInterval(i+1, i+1);
|
|
|
|
+ reBuildData();
|
|
|
|
+ }//GEN-LAST:event_btnDownActionPerformed
|
|
|
|
+
|
|
|
|
+ private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnDeleteActionPerformed
|
|
|
|
+ {//GEN-HEADEREND:event_btnDeleteActionPerformed
|
|
|
|
+ int i = tblData.getSelectedRow();
|
|
|
|
+ baseList.remove(i);
|
|
|
|
+ reBuildData();
|
|
|
|
+ }//GEN-LAST:event_btnDeleteActionPerformed
|
|
|
|
+
|
|
|
|
+ private void btnKnisternActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnKnisternActionPerformed
|
|
|
|
+ {//GEN-HEADEREND:event_btnKnisternActionPerformed
|
|
|
|
+ BurnMe.burnDisk(baseList);
|
|
|
|
+ }//GEN-LAST:event_btnKnisternActionPerformed
|
|
|
|
|
|
- /* Create and display the form */
|
|
|
|
- java.awt.EventQueue.invokeLater(new Runnable()
|
|
|
|
- {
|
|
|
|
- public void run()
|
|
|
|
- {
|
|
|
|
- new BurnLiistManager().setVisible(true);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
|
|
+ private javax.swing.JButton btnDelete;
|
|
|
|
+ private javax.swing.JButton btnDown;
|
|
|
|
+ private javax.swing.JButton btnKnistern;
|
|
|
|
+ private javax.swing.JButton btnUp;
|
|
|
|
+ private javax.swing.JScrollPane jScrollPane1;
|
|
|
|
+ private javax.swing.JTable tblData;
|
|
// End of variables declaration//GEN-END:variables
|
|
// End of variables declaration//GEN-END:variables
|
|
}
|
|
}
|