Example #1
0
  private void enableRelationType() {
    disableAll();

    LABELS[] l = Constants.getLabels(relComponents[LABELS.rel.ordinal()].getAnnValue());
    for (int i = 0; i < l.length; i++) {
      relComponents[l[i].ordinal()].getJComponent().setEnabled(true);
      if (relComponents[l[i].ordinal()] instanceof LabelPair) {
        LabelPair lp = (LabelPair) relComponents[l[i].ordinal()];
        lp.getLabel().setEnabled(true);
      }
    }

    if (relComponents[LABELS.rel.ordinal()].getAnnValue().equals(RELTYPELABELS.Implicit.toString())
        && relComponents[LABELS.conn1.ordinal()].getAnnValue().equals("")) {
      relComponents[LABELS.sClass1B.ordinal()].getJComponent().setEnabled(false);
      relComponents[LABELS.conn2.ordinal()].getJComponent().setEnabled(false);
      relComponents[LABELS.sClass2A.ordinal()].getJComponent().setEnabled(false);
      relComponents[LABELS.sClass2B.ordinal()].getJComponent().setEnabled(false);
    }
    if (relComponents[LABELS.sClass1A.ordinal()].getAnnValue().equals("")) {
      relComponents[LABELS.sClass1B.ordinal()].getJComponent().setEnabled(false);
    }
    if (relComponents[LABELS.rel.ordinal()].getAnnValue().equals(RELTYPELABELS.Implicit.toString())
        && relComponents[LABELS.conn2.ordinal()].getAnnValue().equals("")) {
      relComponents[LABELS.sClass2A.ordinal()].getJComponent().setEnabled(false);
      relComponents[LABELS.sClass2B.ordinal()].getJComponent().setEnabled(false);
    }
    if (relComponents[LABELS.sClass2A.ordinal()].getAnnValue().equals("")) {
      relComponents[LABELS.sClass2B.ordinal()].getJComponent().setEnabled(false);
    }
    /** Remove connective span/site if it violates the relation type */
    String relType = relComponents[LABELS.rel.ordinal()].getAnnValue();
    String connSpanList = relComponents[LABELS.connSpanList.ordinal()].getAnnValue();
    if (SpanList.isSpanList(connSpanList)
        && (relType.equals(RELTYPELABELS.Implicit.toString())
            || relType.equals(RELTYPELABELS.EntRel.toString())
            || relType.equals(RELTYPELABELS.NoRel.toString()))) {
      relComponents[LABELS.connSpanList.ordinal()].setAnnValue("");
    } else if (!SpanList.isSpanList(connSpanList)
        && (relType.equals(RELTYPELABELS.Explicit.toString())
            || relType.equals(RELTYPELABELS.AltLex.toString()))) {
      relComponents[LABELS.connSpanList.ordinal()].setAnnValue("");
    }
    commentPane.setEnabled(true);
  }
Example #2
0
 public void actionPerformed(ActionEvent e) {
   SpanButton b = (SpanButton) e.getSource();
   /**
    * For the Implicit/EntRel/NoRel case where we do not have a spanlist for the conn, we do
    * not want to do anything when the button is clicked
    */
   // TODO: This is probably the place to calculate the sentence
   // position if the spanbutton is arg2
   String relType = relComponents[LABELS.rel.ordinal()].getAnnValue();
   SpanButton connSpanListButton = (SpanButton) relComponents[LABELS.connSpanList.ordinal()];
   if (relType.equals(RELTYPELABELS.Explicit.toString())
       || relType.equals(RELTYPELABELS.AltLex.toString())
       || b != connSpanListButton) {
     mainFrame.spanAction(b);
     mainFrame.inputAction((JComponent) e.getSource(), spanButtons);
   } else {
     b.setSelected(!b.isSelected());
   }
 }