Пример #1
0
 /**
  * DOCUMENT ME!
  *
  * @return DOCUMENT ME!
  */
 public boolean allMappingsComplete() {
   tblMappings.clearColors();
   final List<Mapping> content = getContent();
   for (final Mapping m : content) {
     if (m.getContent().equals(STRING_EMPTY) && !m.isAutoIncrement()) {
       return false;
     }
   }
   return true;
 }
Пример #2
0
 /**
  * Gibt den Eintrag an der Stelle columnIndex und rowIndex zurueck.
  *
  * @param rowIndex DOCUMENT ME!
  * @param columnIndex DOCUMENT ME!
  * @return DOCUMENT ME!
  */
 @Override
 public Object getValueAt(final int rowIndex, final int columnIndex) {
   final Mapping m = getRows().get(rowIndex);
   switch (columnIndex) {
     case COLUMN_TAGRET:
       {
         return m.getCompleteTarget();
       }
     case COLUMN_SOURCE:
       {
         return m.getContent();
       }
     case COLUMN_RELATIONPATH:
       {
         final String relNa = m.getPath();
         if (relNa == null) {
           return "";
         } else {
           return String.valueOf(relNa);
         }
       }
     case COLUMN_COUNTER:
       {
         return m.isAutoIncrement();
       }
     case COLUMN_COMPARE:
       {
         return m.isComparing();
       }
     case COLUMN_STRINGDATE:
       {
         final Boolean stringOrDate;
         if ((m.getEnclosingChar() == null) || (m.getEnclosingChar().length() == 0)) {
           stringOrDate = false;
         } else {
           stringOrDate = true;
         }
         return stringOrDate;
       }
   }
   return null;
 }
Пример #3
0
 /**
  * Setzt den Wert an die gegebene Stelle.
  *
  * @param aValue DOCUMENT ME!
  * @param rowIndex DOCUMENT ME!
  * @param columnIndex DOCUMENT ME!
  */
 @Override
 public void setValueAt(final Object aValue, final int rowIndex, final int columnIndex) {
   final Mapping m = getRow(rowIndex);
   try {
     switch (columnIndex) {
       case COLUMN_TAGRET:
         {
           final String tableAndField = ((String) aValue);
           final String[] s = tableAndField.split(SPLITT_DOT);
           if (s.length == 2) {
             m.setTargetTable(s[0]);
             m.setTargetField(s[1]);
           }
           //                    //---Auto Path---
           //                    int max = -1;
           //                    Mapping cur;
           //                    for (int i = 0; i < mappings.size(); ++i) {
           //                        cur = mappings.get(i);
           //                        if (cur != null &&
           // cur.getTargetTable().equals(m.getTargetTable())) {
           //                            if (cur.getTargetField().equals(m.getTargetField())) {
           //                                if (cur != m) {
           //                                //found another mapping with the same target.
           //                                    if (cur.getPath().length() > 0) {
           //                                        final Integer test =
           // Integer.parseInt(cur.getPath());
           //                                        if (test > max) {
           //                                            max = test;
           //                                        }
           //                                    } else {
           //                                        //if we found another mapping with the same
           // target, that has no path, it has to become path "0"!
           //                                        cur.setPath("0");
           //                                        fireTableRowsUpdated(i, i);
           //                                        max = 0;
           //                                    }
           //                                }
           //                            }
           //                        }
           //                    }
           //                    if (++max > 0) {
           //                        //our path value is now the highest among all other mappings
           // with the same target +1
           //                        m.setPath(max + "");
           //                    }
           //                    //--------------
           break;
         }
       case COLUMN_SOURCE:
         {
           final String source = ((String) aValue);
           m.setContent(source);
           //                    //TODO wenns aerger macht -> raus, aber increment un content
           // zusammen = sinnlos
           m.setAutoIncrement(false);
           break;
         }
       case COLUMN_RELATIONPATH:
         {
           if ((aValue != null) && (aValue instanceof String)) {
             m.setPath((String) aValue);
           }
           break;
         }
       case COLUMN_COUNTER:
         {
           final Boolean autoInc = ((Boolean) aValue);
           m.setAutoIncrement(autoInc.booleanValue());
           //                    //TODO wenns aerger macht -> raus, aber increment un content
           // zusammen = sinnlos
           m.setContent("");
           break;
         }
       case COLUMN_COMPARE:
         {
           final Boolean comp = ((Boolean) aValue);
           m.setComparing(comp.booleanValue());
           break;
         }
       case COLUMN_STRINGDATE:
         {
           final Boolean enclChar = ((Boolean) aValue);
           if (enclChar.booleanValue()) {
             m.setEnclosingChar(ENCLOSING_CHARACTER);
           } else {
             m.setEnclosingChar(null);
           }
           break;
         }
     }
   } catch (Exception e) {
     // keine Veraenderung vornehmen;
   }
   setRow(m, rowIndex);
   fireTableRowsUpdated(rowIndex, rowIndex);
 }