/** * Lets the user add a dataset. */ protected void addDataset() { int retVal; retVal = m_FileChooserDatasets.showOpenDialog(this); if (retVal != ConverterFileChooser.APPROVE_OPTION) return; m_ModelDatasets.addElement(m_FileChooserDatasets.getSelectedFile().getAbsolutePath()); m_Modified = true; updateButtons(); }
/** * Lets the user add a dataset. */ protected void addDataset() { int retVal; retVal = m_FileChooserDatasets.showOpenDialog(this); if (retVal != ConverterFileChooser.APPROVE_OPTION) return; m_ModelDatasets.addElement(m_FileChooserDatasets.getSelectedFile().getAbsolutePath()); m_Modified = true; updateButtons(); }
/** * Queries the user for a file to load instances from, then loads the * instances in a background process. This is done in the IO thread, and an * error message is popped up if the IO thread is busy. */ public void setInstancesFromFileQ() { if (m_IOThread == null) { int returnVal = m_FileChooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { final File selected = m_FileChooser.getSelectedFile(); m_IOThread = new Thread() { @Override public void run() { setInstancesFromFile(selected); m_IOThread = null; } }; m_IOThread.setPriority(Thread.MIN_PRIORITY); // UI has most priority m_IOThread.start(); } } else { JOptionPane.showMessageDialog(this, "Can't load at this time,\n" + "currently busy with other IO", "Load Instances", JOptionPane.WARNING_MESSAGE); } }
/** * Queries the user for a file to load instances from, then loads the * instances in a background process. This is done in the IO thread, and an * error message is popped up if the IO thread is busy. */ public void setInstancesFromFileQ() { if (m_IOThread == null) { int returnVal = m_FileChooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { final File selected = m_FileChooser.getSelectedFile(); m_IOThread = new Thread() { @Override public void run() { setInstancesFromFile(selected); m_IOThread = null; } }; m_IOThread.setPriority(Thread.MIN_PRIORITY); // UI has most priority m_IOThread.start(); } } else { JOptionPane.showMessageDialog(this, "Can't load at this time,\n" + "currently busy with other IO", "Load Instances", JOptionPane.WARNING_MESSAGE); } }
/** * Opens a dataset. */ public void open() { int retVal; retVal = m_FileChooser.showOpenDialog(this); if (retVal != ConverterFileChooser.APPROVE_OPTION) return; open(m_FileChooser.getSelectedFile(), m_FileChooser.getLoader()); }
/** * Opens a dataset. */ public void open() { int retVal; retVal = m_FileChooser.showOpenDialog(this); if (retVal != ConverterFileChooser.APPROVE_OPTION) return; open(m_FileChooser.getSelectedFile(), m_FileChooser.getLoader()); }
/** * Opens a dataset. */ public void open() { int retVal; retVal = m_FileChooser.showOpenDialog(this); if (retVal != ConverterFileChooser.APPROVE_OPTION) return; open(m_FileChooser.getSelectedFile(), m_FileChooser.getLoader()); }
/** * loads the specified file into the table */ public void loadFile() { int retVal; int i; String filename; retVal = fileChooser.showOpenDialog(this); if (retVal != ConverterFileChooser.APPROVE_OPTION) { return; } setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); for (i = 0; i < fileChooser.getSelectedFiles().length; i++) { filename = fileChooser.getSelectedFiles()[i].getAbsolutePath(); loadFile(filename, fileChooser.getLoader()); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
/** * loads the specified file into the table */ public void loadFile() { int retVal; int i; String filename; retVal = m_FileChooser.showOpenDialog(this); if (retVal != ConverterFileChooser.APPROVE_OPTION) { return; } setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); for (i = 0; i < m_FileChooser.getSelectedFiles().length; i++) { filename = m_FileChooser.getSelectedFiles()[i].getAbsolutePath(); loadFile(filename, m_FileChooser.getLoader()); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
/** * loads the specified file into the table */ public void loadFile() { int retVal; int i; String filename; retVal = m_FileChooser.showOpenDialog(this); if (retVal != ConverterFileChooser.APPROVE_OPTION) { return; } setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); for (i = 0; i < m_FileChooser.getSelectedFiles().length; i++) { filename = m_FileChooser.getSelectedFiles()[i].getAbsolutePath(); loadFile(filename, m_FileChooser.getLoader()); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
/** * loads the specified file into the table */ public void loadFile() { int retVal; int i; String filename; retVal = fileChooser.showOpenDialog(this); if (retVal != ConverterFileChooser.APPROVE_OPTION) { return; } setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); for (i = 0; i < fileChooser.getSelectedFiles().length; i++) { filename = fileChooser.getSelectedFiles()[i].getAbsolutePath(); loadFile(filename, fileChooser.getLoader()); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
@Override public void actionPerformed(ActionEvent ae) { ConverterFileChooser fc = new ConverterFileChooser( System.getProperty("user.dir")); fc.setDialogTitle("Set Data File"); int rval = fc.showOpenDialog(GUI.this); if (rval == JFileChooser.APPROVE_OPTION) { AbstractFileLoader loader = fc.getLoader(); try { if (loader != null) { m_Instances = loader.getDataSet(); } if (m_Instances.classIndex() == -1) { m_Instances.setClassIndex(m_Instances.numAttributes() - 1); } a_learn.setEnabled(true); a_learnCPT.setEnabled(true); repaint(); } catch (Exception e) { e.printStackTrace(); } } } } // class ActionSetData
@Override public void actionPerformed(ActionEvent ae) { ConverterFileChooser fc = new ConverterFileChooser( System.getProperty("user.dir")); fc.setDialogTitle("Set Data File"); int rval = fc.showOpenDialog(GUI.this); if (rval == JFileChooser.APPROVE_OPTION) { AbstractFileLoader loader = fc.getLoader(); try { if (loader != null) { m_Instances = loader.getDataSet(); } if (m_Instances.classIndex() == -1) { m_Instances.setClassIndex(m_Instances.numAttributes() - 1); } a_learn.setEnabled(true); a_learnCPT.setEnabled(true); repaint(); } catch (Exception e) { e.printStackTrace(); } } } } // class ActionSetData
/** * Queries the user for a file to load instances from, then loads the * instances in a background process. This is done in the IO thread, and an * error message is popped up if the IO thread is busy. */ public void setInstancesFromFileQ() { if (m_IOThread == null) { int returnVal = m_FileChooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { try { addUndoPoint(); } catch (Exception ignored) { // ignored } if (m_FileChooser.getLoader() == null) { JOptionPane.showMessageDialog(this, "Cannot determine file loader automatically, please choose one.", "Load Instances", JOptionPane.ERROR_MESSAGE); converterQuery(m_FileChooser.getSelectedFile()); } else { setInstancesFromFile(m_FileChooser.getLoader()); } } } else { JOptionPane.showMessageDialog(this, "Can't load at this time,\n" + "currently busy with other IO", "Load Instances", JOptionPane.WARNING_MESSAGE); } }
/** * Queries the user for a file to load instances from, then loads the * instances in a background process. This is done in the IO thread, and an * error message is popped up if the IO thread is busy. */ public void setInstancesFromFileQ() { if (m_IOThread == null) { int returnVal = m_FileChooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { try { addUndoPoint(); } catch (Exception ignored) { // ignored } if (m_FileChooser.getLoader() == null) { JOptionPane.showMessageDialog(this, "Cannot determine file loader automatically, please choose one.", "Load Instances", JOptionPane.ERROR_MESSAGE); converterQuery(m_FileChooser.getSelectedFile()); } else { setInstancesFromFile(m_FileChooser.getLoader()); } } } else { JOptionPane.showMessageDialog(this, "Can't load at this time,\n" + "currently busy with other IO", "Load Instances", JOptionPane.WARNING_MESSAGE); } }
retVal = fc.showOpenDialog(null);
retVal = fc.showOpenDialog(null);
filechooser = (ConverterFileChooser) getSessionValue(owner, SESSION_KEY_FILECHOOSER); if (filechooser.showOpenDialog(owner) != ConverterFileChooser.APPROVE_OPTION) return; AbstractFileLoader loader = filechooser.getLoader();
filechooser = (ConverterFileChooser) getSessionValue(owner, SESSION_KEY_FILECHOOSER); if (filechooser.showOpenDialog(owner) != ConverterFileChooser.APPROVE_OPTION) return; AbstractFileLoader loader = filechooser.getLoader();
+ getSelectedFile() + "' does not exist - please select again!"); if (retVal == JOptionPane.OK_OPTION) { result = showOpenDialog(parent); } else { result = CANCEL_OPTION;