/* * @(#)OpenDialog.java * * This file is part of webCDwriter - Network CD Writing. * * Copyright (C) 2001 Jörg P. M. Haeger * * webCDwriter is free software. See CDcreator.java for details. * * Jörg Haeger, 15.05.2001 */ import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; public class OpenDialog extends Dialog { public OpenDialog() { super("ODTitle"); JPanel panel = new JPanel() { public Insets getInsets() { return new Insets(10, 10, 10, 10); } }; panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); projects = new ListProjects(); try { projects.exec(); } catch (CommandError e) {} int numOfRows = projects.getStrings().length; Vector rowData = new Vector(numOfRows, 0); for (int i = 0; i < numOfRows; i++) rowData.addElement(projects.getInfo(i)); Vector columnNames = new Vector(5, 0); columnNames.addElement(i18n("ODProject")); columnNames.addElement(i18n("ODDate")); columnNames.addElement(i18n("ODFiles")); columnNames.addElement(i18n("ODTracks")); columnNames.addElement(i18n("ODSizeKB")); table = new JTable(rowData, columnNames); table.setPreferredScrollableViewportSize(new Dimension(400, 200)); JScrollPane scrollPane = new JScrollPane(table); panel.add(scrollPane); getContentPane().add(panel, BorderLayout.CENTER); getContentPane().add(createControlPanel("ODOpen"), BorderLayout.SOUTH); pack(); } protected boolean apply() { String value = (String)table.getValueAt(table.getSelectedRow(), 0); if (value == null) return false; State.sessionID = value; return true; } int getNumOfTracks() { return projects.getNumOfTracks(table.getSelectedRow()); } private JList list; private ListProjects projects; private JTable table; }