Package weka.gui

Examples of weka.gui.ViewerDialog


 
  /**
   * 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);
    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);
    }
  }
View Full Code Here


      setButtons(null);
    } else if (e.getSource() == m_EditBut) {
      // Delete the selected files
      int selected = m_List.getSelectedIndex();
      if (selected != -1) {
  ViewerDialog dialog = new ViewerDialog(null);
  String filename = m_List.getSelectedValue().toString();
  int result;
  try {
    DataSource source = new DataSource(filename);
    result = dialog.showDialog(source.getDataSet());
    // nasty workaround for Windows regarding locked files:
    // if file Reader in Loader is not closed explicitly, we cannot
    // overwrite the file.
    source = null;
    System.gc();
    // workaround end
    if ((result == ViewerDialog.APPROVE_OPTION) && (dialog.isChanged())) {
      result = JOptionPane.showConfirmDialog(
      this,
      Messages.getInstance().getString("DatasetListPanel_ActionPerformed_Result_JOptionPaneShowConfirmDialog_Text"));
      if (result == JOptionPane.YES_OPTION) {
        Saver saver = ConverterUtils.getSaverForFile(filename);
        saver.setFile(new File(filename));
        saver.setInstances(dialog.getInstances());
        saver.writeBatch();
      }
    }
  }
  catch (Exception ex) {
View Full Code Here

 
  /**
   * 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);
    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);
    }
  }
View Full Code Here

      m_ColumnIndex = columnIndex;
     
      m_Button = new JButton(Messages.getInstance().getString("ArffTable_RelationalCellEditor_RelationalCellEditor_JButton_Text"));
      m_Button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
          ViewerDialog        dialog;
          int                 result;
         
          dialog = new ViewerDialog(null);
          dialog.setTitle(
              Messages.getInstance().getString("ArffTable_RelationalCellEditor_RelationalCellEditor_ViewerDialog_Text")
              + ((ArffSortedTableModel) getModel()).getInstances().attribute(m_ColumnIndex - 1).name());
          result = dialog.showDialog(m_CurrentInst);
          if (result == ViewerDialog.APPROVE_OPTION) {
            m_CurrentInst = dialog.getInstances();
            fireEditingStopped();
          }
          else {
            fireEditingCanceled();
          }
View Full Code Here

      m_ColumnIndex = columnIndex;
     
      m_Button = new JButton("...");
      m_Button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
          ViewerDialog        dialog;
          int                 result;
         
          dialog = new ViewerDialog(null);
          dialog.setTitle(
              "Relational attribute Viewer - "
              + ((ArffSortedTableModel) getModel()).getInstances().attribute(m_ColumnIndex - 1).name());
          result = dialog.showDialog(m_CurrentInst);
          if (result == ViewerDialog.APPROVE_OPTION) {
            m_CurrentInst = dialog.getInstances();
            fireEditingStopped();
          }
          else {
            fireEditingCanceled();
          }
View Full Code Here

      setButtons(null);
    } else if (e.getSource() == m_EditBut) {
      // Delete the selected files
      int selected = m_List.getSelectedIndex();
      if (selected != -1) {
  ViewerDialog dialog = new ViewerDialog(null);
  String filename = m_List.getSelectedValue().toString();
  int result;
  try {
    DataSource source = new DataSource(filename);
    result = dialog.showDialog(source.getDataSet());
    // nasty workaround for Windows regarding locked files:
    // if file Reader in Loader is not closed explicitly, we cannot
    // overwrite the file.
    source = null;
    System.gc();
    // workaround end
    if ((result == ViewerDialog.APPROVE_OPTION) && (dialog.isChanged())) {
      result = JOptionPane.showConfirmDialog(
      this,
      "File was modified - save changes?");
      if (result == JOptionPane.YES_OPTION) {
        Saver saver = ConverterUtils.getSaverForFile(filename);
        saver.setFile(new File(filename));
        saver.setInstances(dialog.getInstances());
        saver.writeBatch();
      }
    }
  }
  catch (Exception ex) {
View Full Code Here

 
  /**
   * 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);
    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);
    }
  }
View Full Code Here

 
  /**
   * 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);
    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);
    }
  }
View Full Code Here

TOP

Related Classes of weka.gui.ViewerDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.