Package org.woped.qualanalysis.paraphrasing.editing

Examples of org.woped.qualanalysis.paraphrasing.editing.TextualDescriptionDialog


   
    //Add Button or Add JMenuItem
    if(e.getSource() == this.paraphrasingPanel.getAddButton() || e.getSource() == this.paraphrasingPanel.getAddItem()){

      clearAllHighlighting();
      new TextualDescriptionDialog(this.paraphrasingPanel.getEditor() , this.table, this.paraphrasingPanel.getParaphrasingOutput().getDefaultTableModel(), "new");

    }
   
   
    //Up Button or Up JMenuItem
    if(e.getSource() == this.paraphrasingPanel.getUpButton() || e.getSource() == this.paraphrasingPanel.getUpItem()){
      int selectedRow = this.paraphrasingPanel.getParaphrasingOutput().getTable().getSelectedRow();
      if(selectedRow != -1){
        if(this.table.getSelectedRowCount() == 1){
          //Only swap row if a row except the first is selected
          if(selectedRow > 0){
            this.defaultTableModel.moveRow(selectedRow, selectedRow, selectedRow-1);
            this.table.setRowSelectionInterval(selectedRow-1, selectedRow-1);
            this.paraphrasingOutput.updateElementContainer();
          }
        }
      }
      else{
        JOptionPane.showMessageDialog(null,Messages.getString("Paraphrasing.Up.Notification"));
      }
    }
   
    //Down Button or Down JMenuItem
    if(e.getSource() == this.paraphrasingPanel.getDownButton()  || e.getSource() == this.paraphrasingPanel.getDownItem()){
      int selectedRow = this.table.getSelectedRow();
      if(selectedRow != -1){
        if(this.table.getSelectedRowCount() == 1){
          //Only swap row if a row except the last is selected
          if(selectedRow < this.defaultTableModel.getRowCount()-1){
            this.defaultTableModel.moveRow(selectedRow, selectedRow, selectedRow+1);
            this.table.setRowSelectionInterval(selectedRow+1, selectedRow+1);
            this.paraphrasingOutput.updateElementContainer();
          }
        }
      }
      else{
        JOptionPane.showMessageDialog(null,Messages.getString("Paraphrasing.Down.Notification"));
      }
    }
   
   
    //Export Button
    if(e.getSource() == this.paraphrasingPanel.getExportButton()){
     
      boolean fileTypeOk = false;
      if (this.defaultTableModel.getRowCount() > 0){
      JFileChooser jFileChooser = new JFileChooser();
      jFileChooser.setFileFilter(new FileFilter() {
              public boolean accept(File f) {
                  return f.getName().toLowerCase().endsWith(".txt");
              }
              public String getDescription() {
                  return "*.txt File";
              }
          });
        while(!fileTypeOk){
          if(jFileChooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION){
            String path = jFileChooser.getSelectedFile().getAbsolutePath();
            if(!path.endsWith(".txt")){
              path = path + ".txt";
            }

            try{
              fileTypeOk = true;
              File file = new File(path);
               
              FileWriter out = new FileWriter(file);
             
              out.write("Created with Workflow PetriNet Designer Version " + Messages.getString("Application.Version") +" (woped.org) \n\n");
              //Export Ids
              if(JOptionPane.showConfirmDialog(null, Messages.getString("Paraphrasing.Export.Question.Message"), Messages.getString("Paraphrasing.Export.Question.Title"), JOptionPane.YES_NO_OPTION== JOptionPane.YES_OPTION){
                for(int i = 0; i < this.paraphrasingPanel.getParaphrasingOutput().getDefaultTableModel().getRowCount(); i++){
                  //out.write(this.paraphrasingPanel.getParaphrasingOutput().getDefaultTableModel().getValueAt(i,0) + " - " + this.paraphrasingPanel.getParaphrasingOutput().getDefaultTableModel().getValueAt(i,1) + "\n");
                  out.write(this.defaultTableModel.getValueAt(i,0) + "\n");
                  out.write(this.defaultTableModel.getValueAt(i,1) + "\n\n");

                }
              }                     
              else{
                for(int i = 0; i < this.defaultTableModel.getRowCount(); i++){
                  out.write(this.defaultTableModel.getValueAt(i,1) + "\n\n");
                }
              }
              LoggerManager.info(Constants.PARAPHRASING_LOGGER, " Description exported to: " + path)
             
              out.close();
            }
            catch(Exception ex){
//              System.out.println("Fehler: " + ex);
             
              JOptionPane.showMessageDialog(null, Messages.getString("Paraphrasing.Export.Error.Message") + "\n" + ex.getMessage(),
                  Messages.getString("Paraphrasing.Export.Error.Title"), JOptionPane.INFORMATION_MESSAGE);
            }
           
         
          }
          else{
            fileTypeOk = true;
          }
         
        }
       
      }
      else{
        JOptionPane.showMessageDialog(null,Messages.getString("Paraphrasing.Export.Numberelements.Message"),Messages.getString("Paraphrasing.Export.Numberelements.Title"), JOptionPane.INFORMATION_MESSAGE);
     
    }
   
    //Properties JMenuItem
    if(e.getSource() == this.paraphrasingPanel.getPropertiesItem()){
      int selectedRow = this.table.getSelectedRow();
      if(selectedRow != -1){
        new TextualDescriptionDialog(this.editor, this.table, this.defaultTableModel, "edit", selectedRow);
        this.table.setRowSelectionInterval(selectedRow,selectedRow);
      }
    }
  }
View Full Code Here


          }
        }
       
        //Edit
        if(e.getClickCount() == 2){
          new TextualDescriptionDialog(this.editor, this.table, this.defaultTableModel, "edit", row);
        }
      }
     
     
      if(SwingUtilities.isRightMouseButton(e)){
View Full Code Here

     
        //row selected and enter button pressed
        if(k.getKeyCode() == KeyEvent.VK_ENTER)
        {
          if(row != -1){
            new TextualDescriptionDialog(this.editor, this.table, this.defaultTableModel, "edit", row);
            this.table.setRowSelectionInterval(row-1,row-1);
          }
          else{
            JOptionPane.showMessageDialog(null,Messages.getString("Paraphrasing.Delete.Notification"));
          }
View Full Code Here

TOP

Related Classes of org.woped.qualanalysis.paraphrasing.editing.TextualDescriptionDialog

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.