/*
   * (non-Javadoc)
   *
   * @see
   * com.iver.cit.gvsig.fmap.tools.Listeners.PolylineListener#polylineFinished
   * (com.iver.cit.gvsig.fmap.tools.Events.MeasureEvent)
   */
  public void polylineFinished(MeasureEvent event) throws BehaviorException {
    try {
      GeneralPathX gp = event.getGP();
      IGeometry geom = ShapeFactory.createPolyline2D(gp);
      FLayer[] actives = mapCtrl.getMapContext().getLayers().getActives();

      for (int i = 0; i < actives.length; i++) {
        if (actives[i] instanceof FLyrVect) {
          FLyrVect lyrVect = (FLyrVect) actives[i];
          FBitSet oldBitSet = lyrVect.getSource().getRecordset().getSelection();
          FBitSet newBitSet = lyrVect.queryByShape(geom, DefaultStrategy.INTERSECTS);
          if (event.getEvent().isControlDown()) newBitSet.xor(oldBitSet);
          lyrVect.getRecordset().setSelection(newBitSet);
        }
      }
    } catch (com.vividsolutions.jts.geom.TopologyException topEx) {
      NotificationManager.showMessageError(
          PluginServices.getText(
              null, "Failed_selecting_geometries_by_polyline_topology_exception_explanation"),
          topEx);
    } catch (Exception ex) {
      NotificationManager.showMessageError(
          PluginServices.getText(null, "Failed_selecting_geometries"), ex);
    }
  }
  /** DOCUMENT ME! */
  public void performAction() {
    myWizardComponents.getFinishButton().setEnabled(false);

    Annotation_FieldSelect panel1 = (Annotation_FieldSelect) myWizardComponents.getWizardPanel(0);
    Annotation_ConfigureLabel panel2 =
        (Annotation_ConfigureLabel) myWizardComponents.getWizardPanel(1);

    SelectableDataSource source;
    Annotation_Mapping mapping = new Annotation_Mapping();

    try {
      source = this.layerAnnotation.getRecordset();

      mapping.setColumnText(source.getFieldIndexByName(panel1.getField()));

      if (!panel2.getAngleFieldName().equals(ConfigureLabel.TEXT_FOR_DEFAULT_VALUE)) {
        mapping.setColumnRotate(source.getFieldIndexByName(panel2.getAngleFieldName()));
      }

      if (!panel2.getColorFieldName().equals(ConfigureLabel.TEXT_FOR_DEFAULT_VALUE)) {
        mapping.setColumnColor(source.getFieldIndexByName(panel2.getColorFieldName()));
      }

      if (!panel2.getSizeFieldName().equals(ConfigureLabel.TEXT_FOR_DEFAULT_VALUE)) {
        mapping.setColumnHeight(source.getFieldIndexByName(panel2.getSizeFieldName()));
      }

      if (!panel2.getFontFieldName().equals(ConfigureLabel.TEXT_FOR_DEFAULT_VALUE)) {
        mapping.setColumnTypeFont(source.getFieldIndexByName(panel2.getFontFieldName()));
      }
    } catch (ReadDriverException e) {
      NotificationManager.addError(e);
    }

    try {
      this.layerAnnotation.setMapping(mapping);
      // AttrInTableLabelingStrategy labeling = new
      // AttrInTableLabelingStrategy();
      ((Annotation_Legend) layerAnnotation.getLegend())
          .setUnits(panel2.getCmbUnits().getSelectedUnitIndex());
      // this.layerAnnotation.setLabelingStrategy(labeling);
      // ((FSymbol)
      // this.layerAnnotation.getLegend().getDefaultSymbol()).setFontSizeInPixels(panel2.sizeUnitsInPixels());
      saveToShp(map, this.layerAnnotation, panel1.getDuplicate());
    } catch (LegendLayerException e) {
      NotificationManager.addError(e);
    } catch (ReadDriverException e) {
      NotificationManager.addError(e);
    }

    this.myWizardComponents.getCancelAction().performAction();
  }
 public void execute(String actionCommand) {
   IProjectView model = vista.getModel();
   MapContext mapa = model.getMapContext();
   logger.debug("Comand : " + actionCommand);
   if (actionCommand.equals("INVERT_SELECTION")) {
     FLayer[] actives = mapa.getLayers().getActives();
     for (int i = 0; i < actives.length; i++) {
       FLayer lyr = actives[i];
       if (lyr.isAvailable() && lyr instanceof SingleLayer) {
         SingleLayer lyrSingle = (SingleLayer) lyr;
         DataStore ds = lyrSingle.getDataStore();
         if (ds instanceof FeatureStore) {
           try {
             ((FeatureStore) ds).getFeatureSelection().reverse();
             ((ProjectDocument) vista.getModel()).setModified(true);
           } catch (DataException e) {
             e.printStackTrace();
             NotificationManager.addError(e);
           }
         } else {
           // TODO Not supported yet
         }
       }
     }
     ((ProjectDocument) vista.getModel()).setModified(true);
   }
 }
Exemple #4
0
 public void layerRemoved(LayerCollectionEvent e) {
   VectorialLayerEdited vle = (VectorialLayerEdited) getActiveLayerEdited();
   if (vle != null && vle.getLayer().isActive()) {
     // FLayers layers=getMapControl().getMapContext().getLayers();
     // if (layers.getLayersCount()>0)
     //	layers.getLayer(0).setActive(true);
     try {
       vle.clearSelection();
     } catch (DataException e1) {
       NotificationManager.addError(e1);
     }
     editedLayers.remove(vle);
     getMapControl().setTool("zoomIn");
     FLyrVect lv = (FLyrVect) vle.getLayer();
     if (e.getAffectedLayer().equals(lv)) {
       IWindow window = PluginServices.getMDIManager().getActiveWindow();
       if (window instanceof View) {
         View view = (View) window;
         view.hideConsole();
         view.validate();
         view.repaint();
       }
     }
   }
   PluginServices.getMainFrame().enableControls();
 }
  private void refreshTextHeight() {
    getCmbHeightField().removeAllItems();

    boolean enabled = numericFieldNames.length > 0;
    // getCmbHeightField().setEnabled(enabled);
    // getRdBtnHeightField().setEnabled(enabled);

    if (!enabled) {
      getRdBtnFixedHeight().setSelected(true);
    }

    for (int i = 0; i < numericFieldNames.length; i++) {
      getCmbHeightField().addItem(numericFieldNames[i]);
    }

    if (layer.getLabelingStrategy() instanceof AttrInTableLabelingStrategy) {
      AttrInTableLabelingStrategy aux = (AttrInTableLabelingStrategy) layer.getLabelingStrategy();
      try {
        getTxtHeightField().setText(String.valueOf(aux.getFixedSize()));
        getRdBtnFixedHeight().setSelected(aux.usesFixedSize());
        getRdBtnHeightField().setSelected(!aux.usesFixedSize());

        String item = aux.getHeightField();
        getCmbHeightField().setSelectedItem(item);

      } catch (ReadDriverException e) {
        // should never happen
        NotificationManager.addWarning(
            PluginServices.getText(this, "could_not_restore_text_height_field"), e);
      }
    }
  }
  private void refreshColorFont() {

    getCmbColorField().removeAllItems();

    boolean enabled = integerFieldNames.length > 0;
    // getCmbColorField().setEnabled(enabled);
    // getRdBtnColorField().setEnabled(enabled);

    if (!enabled) {
      getRdBtnFixedColor().setSelected(true);
    }

    for (int i = 0; i < integerFieldNames.length; i++) {
      getCmbColorField().addItem(integerFieldNames[i]);
    }

    if (layer.getLabelingStrategy() instanceof AttrInTableLabelingStrategy) {
      AttrInTableLabelingStrategy aux = (AttrInTableLabelingStrategy) layer.getLabelingStrategy();
      try {

        getRdBtnFixedColor().setSelected(aux.usesFixedColor());
        getRdBtnColorField().setSelected(!aux.usesFixedColor());

        String item = aux.getColorField();
        getCmbColorField().setSelectedItem(item);
        getColorChooser().setColor(aux.getFixedColor());

      } catch (ReadDriverException e) {
        // should never happen
        NotificationManager.addWarning(
            PluginServices.getText(this, "could_not_restore_color_field"), e);
      }
    }
  }
  @Override
  public void export(MapContext mapContext, FLyrVect layer) {
    try {
      JFileChooser jfc = new JFileChooser(lastPath);
      SimpleFileFilter filterShp =
          new SimpleFileFilter("dxf", PluginServices.getText(this, "dxf_files"));
      jfc.setFileFilter(filterShp);
      if (jfc.showSaveDialog((Component) PluginServices.getMainFrame())
          == JFileChooser.APPROVE_OPTION) {
        File newFile = jfc.getSelectedFile();
        String path = newFile.getAbsolutePath();
        if (!(path.toLowerCase().endsWith(".dxf"))) {
          path = path + ".dxf";
        }
        newFile = new File(path);

        DxfWriter writer = (DxfWriter) LayerFactory.getWM().getWriter("DXF Writer");
        SHPLayerDefinition lyrDef = new SHPLayerDefinition();
        SelectableDataSource sds = layer.getRecordset();
        FieldDescription[] fieldsDescrip = sds.getFieldsDescription();
        lyrDef.setFieldsDesc(fieldsDescrip);
        lyrDef.setFile(newFile);
        lyrDef.setName(newFile.getName());
        lyrDef.setShapeType(layer.getShapeType());
        writer.setFile(newFile);
        writer.initialize(lyrDef);
        writer.setProjection(layer.getProjection());
        DxfFieldsMapping fieldsMapping = new DxfFieldsMapping();
        // TODO: Recuperar aqu� los campos del cuadro de di�logo.
        writer.setFieldMapping(fieldsMapping);
        DXFMemoryDriver dxfDriver = new DXFMemoryDriver();
        dxfDriver.open(newFile);
        writeFeatures(mapContext, layer, writer, dxfDriver);
        String fileName = newFile.getAbsolutePath();
        lastPath = fileName.substring(0, fileName.lastIndexOf(File.separatorChar));
      }

    } catch (ReadDriverException e) {
      NotificationManager.addError(e.getMessage(), e);
    } catch (InitializeWriterException e) {
      NotificationManager.addError(e.getMessage(), e);
    } catch (DriverLoadException e) {
      NotificationManager.addError(e.getMessage(), e);
    }
  }
      /**
       * Gets the layer at the specified position.
       *
       * @param rowNumber row position
       * @return <i>WFS</i> layer node
       */
      public WFSLayerNode getLayerAt(int rowNumber) {
        try {
          if (rowNumber == -1) return null;

          return (WFSLayerNode) layers.get(rowNumber);
        } catch (ArrayIndexOutOfBoundsException e) {
          NotificationManager.addError(e);
          return null;
        }
      }
Exemple #9
0
  public void setValue(Object obj, int i) {
    // VectorialEditableAdapter vea = (VectorialEditableAdapter) lv.getSource();
    Value value = getValue(obj);
    IRow feat = null;
    try {
      feat = ies.getRow(i).getLinkedRow().cloneRow();
    } catch (ExpansionFileReadException e) {
      NotificationManager.addError(e);
    } catch (ReadDriverException e) {
      NotificationManager.addError(e);
    }
    Value[] values = feat.getAttributes();
    values[selectedIndex] = value;
    feat.setAttributes(values);

    IRowEdited edRow = new DefaultRowEdited(feat, IRowEdited.STATUS_MODIFIED, i);
    try {
      ies.modifyRow(edRow.getIndex(), edRow.getLinkedRow(), "", EditionEvent.ALPHANUMERIC);
    } catch (ExpansionFileWriteException e) {
      NotificationManager.addError(e);
    } catch (ExpansionFileReadException e) {
      NotificationManager.addError(e);
    } catch (ValidateRowException e) {
      NotificationManager.addError(e);
    } catch (ReadDriverException e) {
      NotificationManager.addError(e);
    }
  }
 public Object clone() {
   FMapWMSStyle clone = new FMapWMSStyle();
   Field[] fields = FMapWMSStyle.class.getFields();
   for (int i = 0; i < fields.length; i++) {
     try {
       Class clazz = getClass();
       String fieldName = fields[i].getName();
       // int entry
       if (fields[i].getType().equals(Integer.class)) {
         clazz.getField(fieldName).setInt(clone, clazz.getField(fieldName).getInt(this));
         // double entry
       } else if (fields[i].getType().equals(Double.class)) {
         clazz.getField(fieldName).setDouble(clone, clazz.getField(fieldName).getDouble(this));
         // any object entry
       } else {
         clazz.getField(fieldName).set(clone, clazz.getField(fieldName).get(this));
       }
     } catch (NullPointerException e) {
       NotificationManager.addWarning(
           "Cloning "
               + "'"
               + fields[i].getName()
               + "' field is null"
               + "(FMapWMSStyle: "
               + name
               + ")",
           e);
     } catch (Exception e) {
       NotificationManager.addWarning(
           "Reflect error when cloning "
               + "'"
               + fields[i].getName()
               + "' field "
               + "(FMapWMSStyle)",
           e);
     }
   }
   return clone;
 }
Exemple #11
0
  public void endGeometry() {
    try {
      if (((FLyrVect) getVLE().getLayer()).getShapeType() == Geometry.TYPES.SURFACE && !close) {
        closeGeometry();
      }
    } catch (ReadException e) {
      NotificationManager.addError(e.getMessage(), e);
    }

    // No queremos guardar FGeometryCollections:
    Geometry newGeom = createSpline((Point2D[]) list.toArray(new Point2D[0]));
    insertAndSelectGeometry(newGeom);
    _fsm = new SplineCADToolContext(this);
    list.clear();
    clearTemporalCache();
    close = false;
  }
  private void refreshCmbTextField() {
    getCmbTextField().removeAllItems();
    for (int i = 0; i < fieldNames.length; i++) {
      getCmbTextField().addItem(fieldNames[i]);
    }

    if (layer.getLabelingStrategy() instanceof AttrInTableLabelingStrategy) {
      AttrInTableLabelingStrategy aux = (AttrInTableLabelingStrategy) layer.getLabelingStrategy();
      try {
        String item = aux.getTextField();
        getCmbTextField().setSelectedItem(item != null ? item : NO_FIELD_ITEM);
      } catch (ReadDriverException e) {
        // should never happen
        NotificationManager.addWarning(
            PluginServices.getText(this, "could_not_restore_text_field"), e);
      }
    }
  }
  /**
   * Refreshes the wizard components data each time a feature is selected. The
   * <i>describeFeatureType</i> operation must be sent.
   */
  public void refreshData() {
    WFSLayerNode lyr = (WFSLayerNode) getLstFeatures().getSelectedValue();

    try {
      getTxtName().setText(lyr.getTitle());
    } catch (NullPointerException e) {
      getTxtName().setText(PluginServices.getText(this, "default_name"));
      NotificationManager.addError(PluginServices.getText(this, "default_name"), e);
    }

    IPanelGroup panelGroup = getPanelGroup();

    if (panelGroup == null) return;

    ((WFSParamsPanel) panelGroup).refresh(lyr);

    repaint();
  }
  /** @see com.iver.andami.plugins.IExtension#isEnabled() */
  public boolean isEnabled() {

    try {
      if (EditionUtilities.getEditionStatus()
          == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE) {
        view = (View) PluginServices.getMDIManager().getActiveWindow();
        mapControl = view.getMapControl();
        if (CADExtension.getEditionManager().getActiveLayerEdited() == null) return false;
        FLyrVect lv = (FLyrVect) CADExtension.getEditionManager().getActiveLayerEdited().getLayer();
        if (polygon.isApplicable(lv.getShapeType())) {
          return true;
        }
      }
    } catch (ReadDriverException e) {
      NotificationManager.addError(e.getMessage(), e);
    }
    return false;
  }
  /*
   * (non-Javadoc)
   *
   * @see
   * org.gvsig.fmap.tools.Listeners.PointListener#point(org.gvsig.fmap.tools
   * .Events.PointEvent) The PointEvent method bring you a point in pixel
   * coordinates. You need to transform it to world coordinates. The class to
   * do conversions is ViewPort, obtained thru the MapContext of mapCtrl.
   */
  public void point(PointEvent event) throws BehaviorException {
    com.iver.cit.gvsig.fmap.ViewPort vp = mapCtrl.getViewPort();
    Point2D pReal = vp.toMapPoint(event.getPoint());

    SingleLayerIterator it = new SingleLayerIterator(mapCtrl.getMapContext().getLayers());
    while (it.hasNext()) {
      FLayer aux = it.next();
      if (!aux.isActive()) continue;
      Network net = (Network) aux.getProperty("network");

      if (net != null) {

        double realTol = vp.toMapDistance(pixelTolerance);
        Point2D pReal2 =
            vp.toMapPoint(
                (int) event.getPoint().getX() + pixelTolerance,
                (int) event.getPoint().getY() + pixelTolerance);

        // if ((vp.getProjection() != null) &&
        // !(vp.getProjection().isProjected())) {
        // realTol = vp.distanceWorld(pReal, pReal2);
        // }

        GvFlag flag;
        try {
          if (mode == TO_ARC) flag = net.addFlag(pReal.getX(), pReal.getY(), realTol);
          else flag = net.addFlagToNode(pReal.getX(), pReal.getY(), realTol);
          if (flag == null) {
            JOptionPane.showMessageDialog(
                null, PluginServices.getText(this, "point_not_on_the_network"));
            return;
          }
          NetworkUtils.addGraphicFlag(mapCtrl, flag);
          mapCtrl.drawGraphics();
          PluginServices.getMainFrame().enableControls();
        } catch (GraphException e) {
          e.printStackTrace();
          NotificationManager.addError(e);
        }
      }
    }
  }
Exemple #16
0
  public void addElement(Object element, String elementName, Object containerFolder) {
    if (element instanceof ISymbol) {
      ISymbol sym = (ISymbol) element;
      if (containerFolder == null) {
        containerFolder = rootDir;
      }

      String fExtension = SymbolLibrary.SYMBOL_FILE_EXTENSION;
      File targetFile =
          new File(((File) containerFolder).getAbsolutePath() + File.separator + elementName);
      // save it
      XMLEntity xml = sym.getXMLEntity();
      if (!targetFile.getAbsolutePath().toLowerCase().endsWith(fExtension))
        targetFile = new File(targetFile.getAbsolutePath() + fExtension);
      if (targetFile.exists()) {
        int resp =
            JOptionPane.showConfirmDialog(
                (Component) PluginServices.getMainFrame(),
                PluginServices.getText(this, "fichero_ya_existe_seguro_desea_guardarlo"),
                PluginServices.getText(this, "guardar"),
                JOptionPane.YES_NO_OPTION);
        if (resp != JOptionPane.YES_OPTION) {
          return;
        }
      }
      FileWriter writer;
      try {
        writer = new FileWriter(targetFile.getAbsolutePath());
        Marshaller m = new Marshaller(writer);
        m.setEncoding("ISO-8859-1");
        m.marshal(xml.getXmlTag());

      } catch (Exception ex) {
        NotificationManager.addError(PluginServices.getText(this, "save_error"), ex);
      }
    } else {
      throw new IllegalArgumentException(
          PluginServices.getText(this, "adding_a_non_symbol_as_element"));
    }
  }
  public void setModel(FLayer layer, ILabelingStrategy str) {
    this.layer = (FLyrVect) layer;
    // to allow the labeling of non-FLyrVect layers
    if (layer instanceof FLyrVect) {
      FLyrVect lv = (FLyrVect) layer;
      try {
        fieldNames = lv.getRecordset().getFieldNames();

        // detect the numeric fields
        ArrayList<String> l = new ArrayList<String>();
        ArrayList<String> lColors = new ArrayList<String>();

        for (int i = 0; i < fieldNames.length; i++) {
          switch (lv.getRecordset().getFieldType(i)) {
            case Types.DECIMAL:
            case Types.NUMERIC:
            case Types.FLOAT:
            case Types.REAL:
            case Types.DOUBLE:
              l.add(fieldNames[i]);
              break;
            case Types.INTEGER:
            case Types.SMALLINT:
            case Types.TINYINT:
            case Types.BIGINT:
              lColors.add(fieldNames[i]);
              l.add(fieldNames[i]);
              break;
          }
        }
        numericFieldNames = l.toArray(new String[l.size()]);
        integerFieldNames = lColors.toArray(new String[lColors.size()]);
      } catch (ReadDriverException e) {
        NotificationManager.addError(PluginServices.getText(this, "accessing_file_structure"), e);
      }

      refreshControls();
    }
  }
 /** @see com.iver.andami.plugins.IExtension#isEnabled() */
 public boolean isEnabled() {
   DisposableIterator iterator = null;
   try {
     if (EditionUtilities.getEditionStatus()
         == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE) {
       view = (View) PluginServices.getMDIManager().getActiveWindow();
       mapControl = view.getMapControl();
       EditionManager em = CADExtension.getEditionManager();
       if (em.getActiveLayerEdited() == null) {
         return false;
       }
       VectorialLayerEdited vle = (VectorialLayerEdited) em.getActiveLayerEdited();
       //				FLyrVect lv=(FLyrVect)vle.getLayer();
       if (((FeatureSelection) vle.getFeatureStore().getSelection()).getSize() < 1) {
         return false;
       }
       //				ArrayList selectedRows=vle.getSelectedRow();
       //				if (selectedRows.size()<1) {
       //					return false;
       //				}
       iterator = ((FeatureSelection) vle.getFeatureStore().getSelection()).iterator();
       if (iterator.hasNext()) {
         Feature feature = (Feature) iterator.next();
         if (feature.getDefaultGeometry() != null
             && exploit.isApplicable((feature.getDefaultGeometry()).getType())) {
           return true;
         }
       }
     }
   } catch (DataException e) {
     NotificationManager.addError(e.getMessage(), e);
   } finally {
     if (iterator != null) {
       iterator.dispose();
     }
   }
   return false;
 }
  public void execute(String actionCommand) {
    ImportFieldParams param = new ImportFieldParams();

    IWindow v = PluginServices.getMDIManager().getActiveWindow();
    if (v instanceof Table) {
      Table table = (Table) v;
      param.setLockTable(true);
      try {
        param.setTable(table.getModel());
      } catch (ReadDriverException e) {
        NotificationManager.showMessageError(
            PluginServices.getText(null, "Failed_filling_table"), e);
      }
    }

    ImageIcon logo =
        new javax.swing.ImageIcon(
            this.getClass().getClassLoader().getResource("images/package_graphics.png"));

    WizardAndami wizard = new WizardAndami(logo);
    // Adds the wizard panels:

    LinkDefinitionPanel linkPanel = new LinkDefinitionPanel(wizard.getWizardComponents(), param);
    wizard.getWizardComponents().addWizardPanel(linkPanel);

    ImportFieldPanel fieldsPanel = new ImportFieldPanel(wizard.getWizardComponents(), param);
    wizard.getWizardComponents().addWizardPanel(fieldsPanel);

    wizard.getWizardComponents().getFinishButton().setEnabled(false);
    wizard.getWindowInfo().setWidth(640);
    wizard.getWindowInfo().setHeight(350);
    wizard.getWindowInfo().setTitle(PluginServices.getText(this, "import_fields"));

    wizard.getWizardComponents().setFinishAction(new ImportFieldsAction(wizard, param));

    PluginServices.getMDIManager().addWindow(wizard);
  }
Exemple #20
0
  /** This method initializes this */
  private void initialize() {

    cmbTypeActionListener =
        new ActionListener() {
          int prevIndex = -2;

          public void actionPerformed(ActionEvent e) {
            int index = getCmbType().getSelectedIndex();
            if (prevIndex != index) {
              // needs to refresh
              prevIndex = index;

              AbstractTypeSymbolEditor options =
                  (AbstractTypeSymbolEditor) getCmbType().getSelectedItem();

              //////////			/-------------------------------------
              if (layerManager != null) {
                //////////			/-------------------------------------
                ISymbol l = layerManager.getSelectedLayer();

                // if the symbol is not null and is it managed by the "options" class
                // refresh the controls
                if (l != null && l.getClass().equals(options.getSymbolClass())) {
                  if (l instanceof CartographicSupport) {
                    CartographicSupport cs = (CartographicSupport) l;
                    getCmbUnits().setSelectedUnitIndex(cs.getUnit());
                    getCmbUnitsReferenceSystem().setSelectedIndex(cs.getReferenceSystem());
                  }
                  options.refreshControls(l);
                }

                replaceOptions(options);
                //////////			/-------------------------------------
              } else {
                replaceOptions(options);
              }
              //////////			/-------------------------------------

            }
          }
        };

    Comparator tabComparator =
        new Comparator() {
          public int compare(Object o1, Object o2) {
            if (!(o1 instanceof AbstractTypeSymbolEditor || o1 instanceof AbstractTypeSymbolEditor))
              throw new IllegalArgumentException(
                  PluginServices.getText(this, "trying_to_add_a_non_TypeSymbolEditor_panel"));
            AbstractTypeSymbolEditor pnl1 = (AbstractTypeSymbolEditor) o1,
                pnl2 = (AbstractTypeSymbolEditor) o2;
            int result = pnl1.getName().compareTo(pnl2.getName());
            if (result == 0)
              throw new IllegalArgumentException(
                  PluginServices.getText(this, "two_panels_with_the_same_name"));
            return result;
          }
        };

    TreeSet set = new TreeSet(tabComparator);
    ArrayList editors = (ArrayList) editorsByType.get(new Integer(shapeType));
    Class[] constrLocator = new Class[] {SymbolEditor.class};
    Object[] constrInitargs = new Object[] {this};
    for (int i = 0; i < editors.size(); i++) {
      Class editorClass = (Class) editors.get(i);
      try {
        Constructor c = editorClass.getConstructor(constrLocator);
        set.add(c.newInstance(constrInitargs));
      } catch (Exception e) {
        NotificationManager.addError(
            PluginServices.getText(this, "failed_installing_symbol_editor")
                + " "
                + editorClass.getName(),
            e);
      }
    }
    ;
    tabs = (AbstractTypeSymbolEditor[]) set.toArray(new AbstractTypeSymbolEditor[0]);

    this.setLayout(new BorderLayout());
    this.add(getPnlWest(), BorderLayout.WEST);
    this.add(getPnlCenter(), BorderLayout.CENTER);
    this.add(getOkCancelPanel(), BorderLayout.SOUTH);

    cmbTypeActionListener.actionPerformed(null);
    refresh();
  }