コード例 #1
0
 @Override
 public void setValueAt(Object value, int row, int column) {
   if (column == 0) { // RowNo.
     if (row == IS_SELECTED_ROW) {
       for (AttributeColumn col : reader.getAllAttributeColumns()) {
         col.activateColumn((Boolean) value);
       }
       repaint();
     }
     return;
   }
   column--;
   if (row == ATTRIBUTE_NAME_ROW) {
     reader.setAttributeNamesDefinedByUser(true);
     reader.getAttributeColumn(column).setName((String) value);
   }
   if (row == VALUE_TYPE_ROW) {
     // update only if its not the same value
     if (reader.getAttributeColumn(column).getValueType()
         != Ontology.ATTRIBUTE_VALUE_TYPE.mapName(value.toString())) {
       reader
           .getAttributeColumn(column)
           .setValueType(Ontology.ATTRIBUTE_VALUE_TYPE.mapName(value.toString()));
     }
   }
   if (row == IS_SELECTED_ROW) {
     reader.getAttributeColumn(column).activateColumn((Boolean) value);
   }
   if (row == ROLE_ROW) {
     String role = (String) value;
     if (role.equals(AttributeColumn.REGULAR)) {
       reader.getAttributeColumn(column).setRole(role);
     } else {
       for (AttributeColumn attColumn : reader.getAllAttributeColumns()) {
         if (attColumn.getRole().equals(role)) {
           attColumn.setRole(AttributeColumn.REGULAR);
         }
       }
       reader.getAttributeColumn(column).setRole(role);
       fireTableDataChanged();
     }
   }
   repaint();
 }