AuxiliarProcessGUI.java 4.88 KB
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package GUI;

import CSP_ANALYSE.CSPVerificationContract;
import CSP_ANALYSE.CheckerResult;
import LOGIC.AuxiliarProcess;
import LOGIC.Contract;
import LOGIC.ObjectList;
import javax.swing.JOptionPane;

/**
*
* @author sarah
*/
public class AuxiliarProcessGUI extends javax.swing.JFrame {

/**
* Creates new form AuxiliarProcessGUI
*/
public AuxiliarProcessGUI(ObjectList listas, String comp) {
initComponents();
this.listas = listas;
csp.setText(comp);
}
String comportamento = "";
ObjectList listas;
CheckerResult cr = new CheckerResult();


@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

jScrollPane1 = new javax.swing.JScrollPane();
csp = new javax.swing.JTextArea();
concluir = new javax.swing.JButton();
cancelar = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

csp.setColumns(20);
csp.setRows(5);
jScrollPane1.setViewportView(csp);

concluir.setText("concluir");
concluir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
concluirActionPerformed(evt);
}
});

cancelar.setText("cancelar");
cancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelarActionPerformed(evt);
}
});

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(cancelar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(concluir)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(concluir)
.addComponent(cancelar))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);

pack();
}// </editor-fold>//GEN-END:initComponents

private void concluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_concluirActionPerformed
comportamento = csp.getText();
if(!comportamento.equals("")){
Contract contrato = new Contract();
contrato.setChannel(listas.getChannelList());
contrato.setType(listas.getTypeList());
contrato.setBehavior(comportamento);
CSPVerificationContract cspv = new CSPVerificationContract(contrato, listas);
cr = cspv.verificaBehaviorChecker();
if(cr.getResultado()){
listas.setProcessosAuxiliares(comportamento);
this.dispose();
}
else{
JOptionPane.showMessageDialog(null, "Não é possível concluir enquanto houver erros... \nErro: \n"+cr.getMensagem());
}
}
}//GEN-LAST:event_concluirActionPerformed

private void cancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelarActionPerformed
this.dispose(); // TODO add your handling code here:
}//GEN-LAST:event_cancelarActionPerformed
/**
* @param args the command line arguments
*/
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton cancelar;
private javax.swing.JButton concluir;
private javax.swing.JTextArea csp;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}