protected void export(OMGraphicList list,List<Object> masterRecord,boolean writeFiles){
  badGraphics=0;
  if (list == null) {
    return;
  }
 else   if (list instanceof EsriGraphicList) {
    export((EsriGraphicList)list);
    return;
  }
  int dbfIndex=0;
  for (  OMGraphic dtlGraphic : list) {
    List<Object> record=masterRecord;
    Integer recIndex=(Integer)dtlGraphic.getAttribute(SHAPE_INDEX_ATTRIBUTE);
    if (recIndex == null) {
      recIndex=dbfIndex;
    }
    if (record == null) {
      record=getMasterDBFRecord(recIndex);
    }
    dbfIndex++;
    if (dtlGraphic instanceof OMGraphicList) {
      if (DEBUG)       logger.fine("ESE: handling OMGraphicList");
      export((OMGraphicList)dtlGraphic,record,false);
      continue;
    }
    if (dtlGraphic.getRenderType() != RENDERTYPE_LATLON) {
      badGraphics++;
      continue;
    }
    if (dtlGraphic instanceof OMAreaList) {
      if (DEBUG) {
        logger.fine("ESE: handling OMAreaList");
      }
      addAreaList((OMAreaList)dtlGraphic,record);
    }
    if (dtlGraphic instanceof OMPoly) {
      OMPoly omPoly=(OMPoly)dtlGraphic;
      if (isPolygon(omPoly)) {
        if (DEBUG)         logger.fine("ESE: handling OMPoly polygon");
        addPolygon(dtlGraphic,record);
      }
 else {
        if (DEBUG)         logger.fine("ESE: handling OMPoly line");
        addLine(dtlGraphic,record);
      }
    }
 else     if (dtlGraphic instanceof OMRect) {
      if (DEBUG)       logger.fine("ESE: handling OMRect");
      addPolygon((OMGraphic)EsriPolygonList.convert((OMRect)dtlGraphic),record);
    }
 else     if (dtlGraphic instanceof OMCircle) {
      if (DEBUG)       logger.fine("ESE: handling OMCircle");
      addPolygon((OMGraphic)EsriPolygonList.convert((OMCircle)dtlGraphic,projection),record);
    }
 else     if (dtlGraphic instanceof OMRangeRings) {
      if (DEBUG)       logger.fine("ESE: handling OMRangeRings");
      export(EsriPolygonList.convert((OMRangeRings)dtlGraphic,projection),record,false);
    }
 else     if (dtlGraphic instanceof OMLine) {
      if (DEBUG)       logger.fine("ESE: handling OMLine");
      addLine((OMGraphic)EsriPolylineList.convert((OMLine)dtlGraphic),record);
    }
 else     if (dtlGraphic instanceof OMPoint) {
      if (DEBUG)       logger.fine("ESE: handling OMPoint");
      addPoint(dtlGraphic,record);
    }
  }
  if (badGraphics > 0) {
    DrawingToolRenderException.notifyUserOfNonLatLonGraphics(badGraphics);
  }
  if (!writeFiles) {
    return;
  }
  boolean needConfirmation=false;
  if (filePath == null) {
    filePath=getFilePathFromUser();
    if (filePath == null) {
      return;
    }
    needConfirmation=true;
  }
  if (DEBUG)   logger.fine("ESE: writing files...");
  boolean needTypeSuffix=false;
  if (polyList != null) {
    eseInterfaces.add(new ESEInterface(polyList,filePath,null));
    needTypeSuffix=true;
  }
  if (lineList != null) {
    eseInterfaces.add(new ESEInterface(lineList,filePath,(needTypeSuffix ? LineSuffix : null)));
    needTypeSuffix=true;
  }
  if (pointList != null) {
    eseInterfaces.add(new ESEInterface(pointList,filePath,(needTypeSuffix ? PointSuffix : null)));
  }
  if (needConfirmation) {
    showGUI();
  }
 else {
    writeFiles();
  }
}

protected void export ( OMGraphicList list , List < Object > masterRecord , boolean writeFiles ) { badGraphics = 0 ; if ( list == null ) { return ; } else if ( list instanceof EsriGraphicList ) { export ( ( EsriGraphicList ) list ) ; return ; } int dbfIndex = 0 ; for ( OMGraphic dtlGraphic : list ) { List < Object > record = masterRecord ; Integer recIndex = ( Integer ) dtlGraphic . getAttribute ( SHAPE_INDEX_ATTRIBUTE ) ; if ( recIndex == null ) { recIndex = dbfIndex ; } if ( record == null ) { record = getMasterDBFRecord ( recIndex ) ; } dbfIndex ++ ; if ( dtlGraphic instanceof OMGraphicList ) { if ( DEBUG ) logger . fine ( "ESE: handling OMGraphicList" ) ; export ( ( OMGraphicList ) dtlGraphic , record , false ) ; continue ; } if ( dtlGraphic . getRenderType ( ) != RENDERTYPE_LATLON ) { badGraphics ++ ; continue ; } if ( dtlGraphic instanceof OMAreaList ) { if ( DEBUG ) { logger . fine ( "ESE: handling OMAreaList" ) ; } addAreaList ( ( OMAreaList ) dtlGraphic , record ) ; } if ( dtlGraphic instanceof OMPoly ) { OMPoly omPoly = ( OMPoly ) dtlGraphic ; if ( isPolygon ( omPoly ) ) { if ( DEBUG ) logger . fine ( "ESE: handling OMPoly polygon" ) ; addPolygon ( dtlGraphic , record ) ; } else { if ( DEBUG ) logger . fine ( "ESE: handling OMPoly line" ) ; addLine ( dtlGraphic , record ) ; } } else if ( dtlGraphic instanceof OMRect ) { if ( DEBUG ) logger . fine ( "ESE: handling OMRect" ) ; addPolygon ( ( OMGraphic ) EsriPolygonList . convert ( ( OMRect ) dtlGraphic ) , record ) ; } else if ( dtlGraphic instanceof OMCircle ) { if ( DEBUG ) logger . fine ( "ESE: handling OMCircle" ) ; addPolygon ( ( OMGraphic ) EsriPolygonList . convert ( ( OMCircle ) dtlGraphic , projection ) , record ) ; } else if ( dtlGraphic instanceof OMRangeRings ) { if ( DEBUG ) logger . fine ( "ESE: handling OMRangeRings" ) ; export ( EsriPolygonList . convert ( ( OMRangeRings ) dtlGraphic , projection ) , record , false ) ; } else if ( dtlGraphic instanceof OMLine ) { if ( DEBUG ) logger . fine ( "ESE: handling OMLine" ) ; addLine ( ( OMGraphic ) EsriPolylineList . convert ( ( OMLine ) dtlGraphic ) , record ) ; } else if ( dtlGraphic instanceof OMPoint ) { if ( DEBUG ) logger . fine ( "ESE: handling OMPoint" ) ; addPoint ( dtlGraphic , record ) ; } } if ( badGraphics > 0 ) { DrawingToolRenderException . notifyUserOfNonLatLonGraphics ( badGraphics ) ; } if ( ! writeFiles ) { return ; } boolean needConfirmation = false ; if ( filePath == null ) { filePath = getFilePathFromUser ( ) ; if ( filePath == null ) { return ; } needConfirmation = true ; } if ( DEBUG ) logger . fine ( "ESE: writing files..." ) ; boolean needTypeSuffix = false ; if ( polyList != null ) { eseInterfaces . add ( new ESEInterface ( polyList , filePath , null ) ) ; needTypeSuffix = true ; } if ( lineList != null ) { eseInterfaces . add ( new ESEInterface ( lineList , filePath , ( needTypeSuffix ? LineSuffix : null ) ) ) ; needTypeSuffix = true ; } if ( pointList != null ) { eseInterfaces . add ( new ESEInterface ( pointList , filePath , ( needTypeSuffix ? PointSuffix : null ) ) ) ; } if ( needConfirmation ) { showGUI ( ) ; } else { writeFiles ( ) ; } }
this method is intended to allow embedded omgraphiclists to be handled . the record should be set if the list is an embedded list , reusing a record from the top level iteration . set the record to null at the top level iteration to cause the method to fetch the record from the masterdbf , if it exists . if the list is an esrigraphiclist , then the export for esrigraphiclists will be called . the dbftablemodel for the list should be stored as an attribute in the esrigraphiclist under the dbf_attribute key .
