/** * Pops up the modal dialog and waits for Cancel or OK. * * @param inst the instances to display * @return either APPROVE_OPTION, or CANCEL_OPTION */ public int showDialog(Instances inst) { setInstances(inst); return showDialog(); } }
/** * initializes the dialog with the given parent * * @param parent the parent for this dialog */ public ViewerDialog(Frame parent) { super(parent, ModalityType.DOCUMENT_MODAL); createDialog(); }
@Override public void actionPerformed(ActionEvent e) { ViewerDialog dialog; int result; Instances copy; Instances newInstances; copy = new Instances(owner.getTestData()); dialog = new ViewerDialog(null); dialog.setSize(800, 600); dialog.setLocationRelativeTo(owner); result = dialog.showDialog(copy); if (result == ViewerDialog.APPROVE_OPTION) { // if class was not set before, reset it again after use of filter newInstances = dialog.getInstances(); if (owner.getTestData().classIndex() < 0) newInstances.setClassIndex(-1); owner.setTestData(newInstances); } } };
/** * edits the current instances object in the viewer */ public void edit() { ViewerDialog dialog; int result; Instances copy; Instances newInstances; final int classIndex = m_AttVisualizePanel.getColoringIndex(); copy = new Instances(m_Instances); copy.setClassIndex(classIndex); dialog = new ViewerDialog(null); dialog.pack(); dialog.setSize(1000, 600); dialog.setIconImage(((Frame) SwingUtilities.getWindowAncestor(PreprocessPanel.this)).getIconImage()); dialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(PreprocessPanel.this)); result = dialog.showDialog(copy); if (result == ViewerDialog.APPROVE_OPTION) { try { addUndoPoint(); } catch (Exception e) { e.printStackTrace(); } // if class was not set before, reset it again after use of filter newInstances = dialog.getInstances(); if (m_Instances.classIndex() < 0) newInstances.setClassIndex(-1); setInstances(newInstances); } }
@Override public void actionPerformed(ActionEvent evt) { ViewerDialog dialog; int result; dialog = new ViewerDialog(null); dialog.setTitle("Relational attribute Viewer - " + ((DataSortedTableModel) getModel()).getInstances() .attribute(m_ColumnIndex - 1).name()); result = dialog.showDialog(m_CurrentInst); if (result == ViewerDialog.APPROVE_OPTION) { m_CurrentInst = dialog.getInstances(); fireEditingStopped(); } else { fireEditingCanceled(); } } });
ViewerDialog dialog = new ViewerDialog(null); String filename = m_List.getSelectedValue().toString(); int result; try { DataSource source = new DataSource(filename); result = dialog.showDialog(source.getDataSet()); System.gc(); if ((result == ViewerDialog.APPROVE_OPTION) && (dialog.isChanged())) { result = JOptionPane.showConfirmDialog(this, "File was modified - save changes?"); Saver saver = ConverterUtils.getSaverForFile(filename); saver.setFile(new File(filename)); saver.setInstances(dialog.getInstances()); saver.writeBatch();
JPanel panel; setTitle("Viewer"); getContentPane().setLayout(new BorderLayout()); getContentPane().add(m_ArffPanel, BorderLayout.CENTER); getContentPane().add(panel, BorderLayout.SOUTH); m_UndoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(panel, BorderLayout.SOUTH); m_CancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { panel.add(m_CancelButton); pack(); setLocationRelativeTo(getParent());
@Override public void actionPerformed(ActionEvent e) { ViewerDialog dialog; int result; Instances copy; Instances newInstances; copy = new Instances(owner.getTestData()); dialog = new ViewerDialog(null); dialog.setSize(800, 600); dialog.setLocationRelativeTo(owner); result = dialog.showDialog(copy); if (result == ViewerDialog.APPROVE_OPTION) { // if class was not set before, reset it again after use of filter newInstances = dialog.getInstances(); if (owner.getTestData().classIndex() < 0) newInstances.setClassIndex(-1); owner.setTestData(newInstances); } } };
/** * edits the current instances object in the viewer */ public void edit() { ViewerDialog dialog; int result; Instances copy; Instances newInstances; final int classIndex = m_AttVisualizePanel.getColoringIndex(); copy = new Instances(m_Instances); copy.setClassIndex(classIndex); dialog = new ViewerDialog(null); dialog.pack(); dialog.setSize(1000, 600); dialog.setIconImage(((Frame) SwingUtilities.getWindowAncestor(PreprocessPanel.this)).getIconImage()); dialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(PreprocessPanel.this)); result = dialog.showDialog(copy); if (result == ViewerDialog.APPROVE_OPTION) { try { addUndoPoint(); } catch (Exception e) { e.printStackTrace(); } // if class was not set before, reset it again after use of filter newInstances = dialog.getInstances(); if (m_Instances.classIndex() < 0) newInstances.setClassIndex(-1); setInstances(newInstances); } }
@Override public void actionPerformed(ActionEvent evt) { ViewerDialog dialog; int result; dialog = new ViewerDialog(null); dialog.setTitle("Relational attribute Viewer - " + ((DataSortedTableModel) getModel()).getInstances() .attribute(m_ColumnIndex - 1).name()); result = dialog.showDialog(m_CurrentInst); if (result == ViewerDialog.APPROVE_OPTION) { m_CurrentInst = dialog.getInstances(); fireEditingStopped(); } else { fireEditingCanceled(); } } });
ViewerDialog dialog = new ViewerDialog(null); String filename = m_List.getSelectedValue().toString(); int result; try { DataSource source = new DataSource(filename); result = dialog.showDialog(source.getDataSet()); System.gc(); if ((result == ViewerDialog.APPROVE_OPTION) && (dialog.isChanged())) { result = JOptionPane.showConfirmDialog(this, "File was modified - save changes?"); Saver saver = ConverterUtils.getSaverForFile(filename); saver.setFile(new File(filename)); saver.setInstances(dialog.getInstances()); saver.writeBatch();
JPanel panel; setTitle("Viewer"); getContentPane().setLayout(new BorderLayout()); getContentPane().add(m_ArffPanel, BorderLayout.CENTER); getContentPane().add(panel, BorderLayout.SOUTH); m_UndoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getContentPane().add(panel, BorderLayout.SOUTH); m_CancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { panel.add(m_CancelButton); pack(); setLocationRelativeTo(getParent());
/** * edits the current instances object in the viewer */ public void edit() { ViewerDialog dialog; int result; Instances copy; Instances newInstances; copy = new Instances(m_Data); dialog = new ViewerDialog(null); dialog.setSize(800, 600); dialog.setLocationRelativeTo(this); result = dialog.showDialog(copy); if (result == ViewerDialog.APPROVE_OPTION) { try { addUndoPoint(); } catch (Exception e) { e.printStackTrace(); } // if class was not set before, reset it again after use of filter newInstances = dialog.getInstances(); if (m_Data.classIndex() < 0) newInstances.setClassIndex(-1); notifyTabsDataChanged(null, newInstances); } }
@Override public void actionPerformed(ActionEvent evt) { ViewerDialog dialog; int result; dialog = new ViewerDialog(null); dialog.setTitle("Relational attribute Viewer - " + ((ArffSortedTableModel) getModel()).getInstances() .attribute(((ArffSortedTableModel)getModel()).getAttributeIndex(columnIndex)).name()); result = dialog.showDialog(m_CurrentInst); if (result == ViewerDialog.APPROVE_OPTION) { m_CurrentInst = dialog.getInstances(); fireEditingStopped(); } else { fireEditingCanceled(); } } });
/** * Pops up the modal dialog and waits for Cancel or OK. * * @param inst the instances to display * @return either APPROVE_OPTION, or CANCEL_OPTION */ public int showDialog(Instances inst) { setInstances(inst); return showDialog(); } }
/** * initializes the dialog with the given parent * * @param parent the parent for this dialog */ public ViewerDialog(Frame parent) { super(parent, ModalityType.DOCUMENT_MODAL); createDialog(); }
@Override public void actionPerformed(ActionEvent evt) { ViewerDialog dialog; int result; dialog = new ViewerDialog(null); dialog.setTitle("Relational attribute Viewer - " + ((ArffSortedTableModel) getModel()).getInstances() .attribute(((ArffSortedTableModel)getModel()).getAttributeIndex(columnIndex)).name()); result = dialog.showDialog(m_CurrentInst); if (result == ViewerDialog.APPROVE_OPTION) { m_CurrentInst = dialog.getInstances(); fireEditingStopped(); } else { fireEditingCanceled(); } } });