Beispiel #1
0
 public void messageChanged(MessageChangedEvent e) {
   Message changedMessage = e.getMessage();
   for (int i = 0; i < messages.size(); ++i) {
     if (messages.get(i) == changedMessage) {
       fireTableRowsUpdated(i, i);
     }
   }
 }
Beispiel #2
0
 public final Object getValueAt(int rowIndex, int colIndex) {
   try {
     Method[] m = (Method[]) voGetterMethods.get(attributeNames[colIndex]);
     Object obj = valueObjects.get(rowIndex);
     for (int i = 0; i < m.length - 1; i++) {
       obj = (ValueObject) m[i].invoke(obj, new Object[0]);
       if (obj == null) {
         return null;
       }
     }
     return m[m.length - 1].invoke(obj, new Object[0]);
   } catch (Exception ex) {
     ex.printStackTrace();
     return null;
   }
 }
Beispiel #3
0
 public void actionPerformed(ActionEvent e) {
   List<Resource> loadedDocuments;
   try {
     // get all the documents loaded in the system
     loadedDocuments = Gate.getCreoleRegister().getAllInstances("gate.Document");
   } catch (GateException ge) {
     // gate.Document is not registered in creole.xml....what is!?
     throw new GateRuntimeException(
         "gate.Document is not registered in the creole register!\n"
             + "Something must be terribly wrong...take a vacation!");
   }
   Vector<String> docNames = new Vector<String>();
   for (Resource loadedDocument : new ArrayList<Resource>(loadedDocuments)) {
     if (corpus.contains(loadedDocument)) {
       loadedDocuments.remove(loadedDocument);
     } else {
       docNames.add(loadedDocument.getName());
     }
   }
   JList docList = new JList(docNames);
   docList.getSelectionModel().setSelectionInterval(0, docNames.size() - 1);
   docList.setCellRenderer(renderer);
   final JOptionPane optionPane =
       new JOptionPane(
           new JScrollPane(docList), JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
   final JDialog dialog =
       optionPane.createDialog(CorpusEditor.this, "Add document(s) to this corpus");
   docList.addMouseListener(
       new MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           if (e.getClickCount() == 2) {
             optionPane.setValue(JOptionPane.OK_OPTION);
             dialog.dispose();
           }
         }
       });
   dialog.setVisible(true);
   if (optionPane.getValue().equals(JOptionPane.OK_OPTION)) {
     int[] selectedIndices = docList.getSelectedIndices();
     for (int selectedIndice : selectedIndices) {
       corpus.add((Document) loadedDocuments.get(selectedIndice));
     }
   }
   changeMessage();
 }
  private void okActionPerformed(java.awt.event.ActionEvent evt) {
    if (smtp.getText().trim().isEmpty()) {
      CommonFunctions.showErrorMessage(this, "You must enter a SMTP server.");
      return;
    } else if (smtpUsername.getText().trim().isEmpty()) {
      CommonFunctions.showErrorMessage(this, "You must enter the SMTP username.");
      return;
    } else {
      try {
        int port = Integer.parseInt(smtpPort.getText());
        if (port <= 0) throw new NumberFormatException();

        new InternetAddress(email.getText()).validate();
      } catch (NumberFormatException e) {
        CommonFunctions.showErrorMessage(this, "You must enter a valid SMTP port.");
        return;
      } catch (AddressException e) {
        CommonFunctions.showErrorMessage(this, "You must enter a valid source email address.");
        return;
      }
    }

    retval = 0;

    List<Student> selectedStudents = new ArrayList();
    for (int i = 0; i < studentsTbl.getRowCount(); i++) {
      if ((boolean) studentsTbl.getValueAt(i, 0)) {
        selectedStudents.add(students.get(studentsTbl.convertRowIndexToModel(i)));
      }
    }

    output =
        new Object[] {
          email.getText(),
          smtp.getText(),
          smtpPort.getText(),
          smtpUsername.getText(),
          new String(smtpPassword.getPassword()),
          selectedStudents
        };

    setVisible(false);
  }
Beispiel #5
0
 /**
  * @param row row number
  * @return ValueObject
  */
 public final ValueObject getValueObject(int row) {
   return (ValueObject) valueObjects.get(row);
 }
Beispiel #6
0
 /**
  * Constructs a TableModel, starting from the specified list of ValueObjects, having the specified
  * list of attributes
  *
  * @param valueObjects list of ValueObjects
  * @param attributeNames nome of attributes defined within the ValueObjects, used to define the
  *     TableModel
  */
 public VOTableModel(List valueObjects, String[] attributeNames) {
   this.valueObjects = valueObjects;
   this.attributeNames = attributeNames;
   this.valueObjectType = valueObjects.get(0).getClass();
   analyzeClassFields(new Hashtable(), "", new Method[0], valueObjectType);
 }
 private MetaProperty getMetaProperty(int i) {
   return (MetaProperty) metaProperties.get(i);
 }
Beispiel #8
0
 public Message getMessage(int row) {
   return messages.get(row);
 }