Example #1
0
  /**
   * Constructor method
   *
   * @param withTransparencySlider boolean that specifies if the user wants a slider with the color
   *     chooser panel to control the transparency of the selected color.
   * @param withNoFill boolean that specifies if the color chooser panel allows a null value for the
   *     color selected (true case). If this values is false, when the color selected is null then
   *     black color is assigned automatically.
   */
  public ColorChooserPanel(boolean withTransparencySlider, boolean withNoFill) {

    this.withTransp = withTransparencySlider;
    this.withTranspPerc = withTransparencySlider;
    this.withNoFill = withNoFill;

    try {
      if (withTransp) {
        sldTransparency = new JSlider(0, 255);
        sldTransparency.addChangeListener(sldAction);
        int width = withNoFill ? dim2.width - 40 : dim2.width;
        sldTransparency.setPreferredSize(new Dimension(width - 5, dim2.height / 2));
        sldTransparency.setToolTipText(PluginServices.getText(this, "transparencia"));

        if (withTranspPerc) {
          lblTransparency = new JLabel();
          int percValue = (int) (sldTransparency.getValue() * perc);
          lblTransparency.setText(String.valueOf(percValue) + "%");
          lblTransparency.setPreferredSize(new Dimension(40, 20));
        }

        sldTransparency.setValue(255);
      }
      jbInit();
      colorPanel.setLineColor(null);
      changeButton.setToolTipText(PluginServices.getText(this, "browse"));

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  /*
   * (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);
    }
  }
Example #3
0
 /*
  * (non-Javadoc)
  *
  * @see javax.swing.table.TableModel#getColumnName(int)
  */
 public String getColumnName(int columnIndex) {
   if (columnIndex == 0) {
     return PluginServices.getText(this, "layerName");
   } else {
     return PluginServices.getText(this, "layerType");
   }
 }
Example #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 registerIcons() {
    PluginServices.getIconTheme()
        .registerDefault(
            "edition-insert-geometry-polygon",
            this.getClass().getClassLoader().getResource("images/Poligon.png"));

    PluginServices.getIconTheme()
        .registerDefault(
            "edition-insert-geometry-rectangle",
            this.getClass().getClassLoader().getResource("images/Rectangle.png"));

    PluginServices.getIconTheme()
        .registerDefault(
            "edition-insert-geometry-circle",
            this.getClass().getClassLoader().getResource("images/Circle.png"));

    PluginServices.getIconTheme()
        .registerDefault(
            "edition-insert-geometry-ellipse",
            this.getClass().getClassLoader().getResource("images/Ellipse.png"));

    PluginServices.getIconTheme()
        .registerDefault(
            "edition-geometry-edit-vertex",
            this.getClass().getClassLoader().getResource("images/EditVertex.png"));
  }
 /*
  * (non-Javadoc)
  *
  * @see com.iver.cit.gvsig.gui.panels.AbstractWFSPanel#initialize()
  */
 protected void initialize() {
   setLabel(PluginServices.getText(this, "feature"));
   setLabelGroup(PluginServices.getText(this, "wfs"));
   this.setLayout(null);
   this.add(getFeaturesListPanel(), null);
   this.add(getChkExtendedNames(), null);
   this.add(getLayerNamePanel(), null);
 }
  /**
   * DOCUMENT ME!
   *
   * @param mapContext DOCUMENT ME!
   * @param layer DOCUMENT ME!
   * @param duplicate DOCUMENT ME!
   * @throws ReadDriverException
   * @throws EditionException DOCUMENT ME!
   * @throws DriverIOException DOCUMENT ME!
   */
  public void saveToShp(MapContext mapContext, Annotation_Layer layer, String duplicate)
      throws ReadDriverException {
    try {
      JFileChooser jfc = new JFileChooser();
      SimpleFileFilter filterShp =
          new SimpleFileFilter("shp", PluginServices.getText(this, "shp_files"));
      jfc.setFileFilter(filterShp);

      if (jfc.showSaveDialog((Component) PluginServices.getMainFrame())
          == JFileChooser.APPROVE_OPTION) {
        File newFile = jfc.getSelectedFile();
        String path = newFile.getAbsolutePath();

        if (newFile.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;
          }
        }

        if (!(path.toLowerCase().endsWith(".shp"))) {
          path = path + ".shp";
        }

        newFile = new File(path);

        SelectableDataSource sds = layer.getRecordset();
        FieldDescription[] fieldsDescrip = sds.getFieldsDescription();

        ShpWriter writer = (ShpWriter) LayerFactory.getWM().getWriter("Shape Writer");
        Driver driver = null;

        SHPLayerDefinition lyrDefPoint = new SHPLayerDefinition();
        lyrDefPoint.setFieldsDesc(fieldsDescrip);

        File filePoints = new File(path);
        lyrDefPoint.setFile(filePoints);
        lyrDefPoint.setName(filePoints.getName());
        lyrDefPoint.setShapeType(FShape.POINT);
        writer.setFile(filePoints);
        writer.initialize(lyrDefPoint);
        driver = getOpenAnnotationDriver(filePoints);
        writeFeatures(mapContext, layer, writer, driver, duplicate);
      }
    } catch (InitializeWriterException e) {
      throw new ReadDriverException(layerAnnotation.getName(), e);
    } catch (DriverLoadException e) {
      throw new ReadDriverException(layerAnnotation.getName(), e);
    } catch (IOException e) {
      throw new ReadDriverException(layerAnnotation.getName(), e);
    }
  }
  /**
   * Comprueba si un fichero VRT esta en correcto estado, en caso contrario lanza una excepcion
   * indicando el tipo de error en la apertura.
   *
   * @param file
   * @throws FileOpenVRTException
   */
  private void checkFileVRT(File file) throws FileOpenVRTException {
    KXmlParser parser = new KXmlParser();

    FileReader fileReader = null;
    try {
      fileReader = new FileReader(file);
      parser.setInput(fileReader);

      parser.nextTag();

      parser.require(XmlPullParser.START_TAG, null, "VRTDataset");

      while (parser.nextTag() != XmlPullParser.END_TAG) {
        parser.require(XmlPullParser.START_TAG, null, "VRTRasterBand");

        String name;
        while (parser.nextTag() != XmlPullParser.END_TAG) {
          parser.require(XmlPullParser.START_TAG, null, null);
          boolean relativePath = false;
          for (int i = 0; i < parser.getAttributeCount(); i++) {
            if (parser.getAttributeName(i).equals("relativetoVRT")
                && parser.getAttributeValue(i).equals("1")) relativePath = true;
          }
          name = parser.getName();
          String nameFile = parser.nextText();
          if (name.equals("SourceFilename")) {
            if (relativePath) nameFile = file.getParent() + File.separator + nameFile;
            File tryFile = new File(nameFile);
            if (!tryFile.exists())
              throw new FileOpenVRTException(
                  PluginServices.getText(this, "no_existe_fichero") + " " + nameFile);
          }
          parser.require(XmlPullParser.END_TAG, null, name);
        }

        parser.require(XmlPullParser.END_TAG, null, "VRTRasterBand");
      }
      parser.require(XmlPullParser.END_TAG, null, "VRTDataset");
      parser.next();
      parser.require(XmlPullParser.END_DOCUMENT, null, null);
    } catch (XmlPullParserException e) {
      throw new FileOpenVRTException(
          PluginServices.getText(this, "el_fichero")
              + " "
              + file.getName().toString()
              + " "
              + PluginServices.getText(this, "esta_formato_desconocido"));
    } catch (IOException e) {
      throw new FileOpenVRTException(
          PluginServices.getText(this, "no_puede_abrir_fichero") + " " + file.getName().toString());
    } finally {
      if (fileReader != null)
        try {
          fileReader.close();
        } catch (IOException e) {
        }
    }
  }
    protected void addOption(SplineCADToolContext context, String s) {
      SplineCADTool ctxt = context.getOwner();

      if (s.equals(PluginServices.getText(this, "cancel"))) {
        boolean loopbackFlag = context.getState().getName().equals(Spline.FirstPoint.getName());

        if (loopbackFlag == false) {
          (context.getState()).Exit(context);
        }

        context.clearState();
        try {
          ctxt.cancel();
        } finally {
          context.setState(Spline.FirstPoint);

          if (loopbackFlag == false) {
            (context.getState()).Entry(context);
          }
        }
      } else if (s.equals("")) {
        boolean loopbackFlag = context.getState().getName().equals(Spline.FirstPoint.getName());

        if (loopbackFlag == false) {
          (context.getState()).Exit(context);
        }

        context.clearState();
        try {
          ctxt.endGeometry();
        } finally {
          context.setState(Spline.FirstPoint);

          if (loopbackFlag == false) {
            (context.getState()).Entry(context);
          }
        }
      } else {
        boolean loopbackFlag = context.getState().getName().equals(Spline.FirstPoint.getName());

        if (loopbackFlag == false) {
          (context.getState()).Exit(context);
        }

        context.clearState();
        try {
          ctxt.throwOptionException(PluginServices.getText(this, "incorrect_option"), s);
        } finally {
          context.setState(Spline.FirstPoint);

          if (loopbackFlag == false) {
            (context.getState()).Entry(context);
          }
        }
      }

      return;
    }
 public void execute(ITocItem item, FLayer[] selectedItems) {
   FLayer lyr = getNodeLayer(item);
   if (!lyr.isAvailable()) return;
   ChangeName chn = new ChangeName(lyr.getName());
   PluginServices.getMDIManager().addWindow(chn);
   lyr.setName(chn.getName());
   Project project =
       ((ProjectExtension) PluginServices.getExtension(ProjectExtension.class)).getProject();
   project.setModified(true);
 }
Example #11
0
 /**
  * Inicializa el botn que muestra la informacin de CRS seleccionado
  *
  * @return
  */
 public JButton getInfoCrs() {
   if (infoCrs == null) {
     infoCrs = new JButton();
     infoCrs.setPreferredSize(new Dimension(85, 23));
     infoCrs.setText(PluginServices.getText(this, "infocrs"));
     infoCrs.setMnemonic('I');
     infoCrs.setToolTipText(PluginServices.getText(this, "more_info"));
   }
   return infoCrs;
 }
Example #12
0
 /**
  * Inicializa el botn 'Buscar'
  *
  * @return jButton
  */
 public JButton getSearchButton() {
   if (searchButton == null) {
     searchButton = new JButton();
     searchButton.setPreferredSize(new Dimension(75, 20));
     searchButton.setText(PluginServices.getText(this, "buscar"));
     searchButton.setMnemonic('S');
     searchButton.setToolTipText(PluginServices.getText(this, "buscar_por_criterio_seleccion"));
   }
   return searchButton;
 }
  public boolean isEnabled(ProjectDocument item, ProjectDocument[] selectedItems) {
    String sourceString = PluginServices.getFromClipboard();
    if (sourceString == null) return false;

    ProjectExtension projectExtension =
        (ProjectExtension) PluginServices.getExtension(ProjectExtension.class);
    Project project = projectExtension.getProject();
    String docType = ((ProjectWindow) projectExtension.getProjectWindow()).getDocumentSelected();

    return project.isValidXMLForImport(sourceString, docType);
  }
Example #14
0
 /**
  * Creates a message with information about the message
  *
  * @param position An array with 2 elements: (row, column)
  */
 private void defineErrorPositionAsMessageAttribute(int position[]) {
   // Defines the error message
   errorPositionAsMessage =
       new String(
           PluginServices.getText(null, "line")
               + ": "
               + errorPosition[0]
               + ", "
               + PluginServices.getText(null, "column")
               + ": "
               + errorPosition[1]);
 }
Example #15
0
 public String getTooltip() {
   return PluginServices.getText(this, "operator")
       + ":  "
       + toString()
       + "("
       + PluginServices.getText(this, "parameter")
       + "[,"
       + PluginServices.getText(this, "format")
       + "])"
       + "\n"
       + getDescription();
 }
 @Override
 protected void Entry(PipeCADToolContext context) {
   PipeCADTool ctxt = context.getOwner();
   boolean deleteButton3 = CADStatus.getCADStatus().isDeleteButtonActivated();
   if (deleteButton3) {
     ctxt.setQuestion(PluginServices.getText(this, "insert_next_point_arc_or_del"));
   } else {
     ctxt.setQuestion(PluginServices.getText(this, "insert_next_point_or_arc"));
   }
   ctxt.setDescription(getDescription());
   return;
 }
Example #17
0
 public String getDescription() {
   return PluginServices.getText(this, "parameter")
       + ": "
       + PluginServices.getText(this, "value")
       + "\n"
       + PluginServices.getText(this, "returns")
       + ": "
       + PluginServices.getText(this, "string_value")
       + "\n"
       + PluginServices.getText(this, "description")
       + ": "
       + "Returns the string representation of the Object argument";
 }
Example #18
0
 /*
  *  (non-Javadoc)
  * @see com.iver.andami.plugins.Extension#initialize()
  */
 public void initialize() {
   getPersistedStatus();
   SelectableToolBar[] toolBars = PluginServices.getMainFrame().getToolbars();
   for (int i = toolBars.length - 1; i > 0; i--) {
     Menu menu = new Menu();
     menu.setActionCommand(ACTIONCOMMANDBASE + toolBars[i].getName());
     // menu.setTooltip(PluginServices.getText(this, "muestra_oculta_la_toolbar"));
     menu.setText(MENUBASE + toolBars[i].getName());
     if (toolBars[i].getAndamiVisibility()) menu.setIcon(ENABLEDIMAGE);
     PluginServices.getMainFrame()
         .addMenu(menu, this, PluginServices.getPluginServices(this).getClassLoader());
   }
 }
Example #19
0
  private void getNewCrs(int code) {
    if (code != -1) {
      //		Eliminar filas en cada nueva bsqueda
      int numRow = dtm.getRowCount();
      while (numRow != 0) {
        numRow = numRow - 1;
        dtm.removeRow(numRow);
      }
      String sentence =
          "SELECT usr_code, usr_wkt, usr_proj, usr_geog, usr_datum "
              + "FROM USR "
              + "WHERE usr_code = "
              + code;
      connect = new EpsgConnection();
      connect.setConnectionUsr();
      ResultSet result = Query.select(sentence, connect.getConnection());
      try {
        connect.shutdown();
      } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }

      Object[] data = new Object[4];
      try {
        while (result.next()) {
          data[0] = result.getString("usr_code");
          data[1] = result.getString("usr_wkt");
          String proj = result.getString("usr_proj");
          if (!proj.equals("")) {
            data[1] = proj;
            data[2] = PluginServices.getText(this, "si");
          } else {
            data[1] = result.getString("usr_geog");
            data[2] = PluginServices.getText(this, "no");
          }

          data[3] = result.getString("usr_datum");
          dtm.addRow(data);
        }
      } catch (SQLException e1) {
        e1.printStackTrace();
      }
      int numr = dtm.getRowCount();
      if (numr == 0) {
        searchButton();
      } else {
        this.getJTable().setRowSelectionInterval(0, 0);
      }
    }
  }
Example #20
0
  /**
   * Inicializa la tabla que se utiliza para mostrar los resultados de la bsqueda
   *
   * @return
   */
  public JTable getJTable() {
    if (jTable == null) {
      // TODO: Poner los titulos de las columnas correspondientes
      String[] columnNames = {
        PluginServices.getText(this, "codigo"),
        PluginServices.getText(this, "nombre"),
        PluginServices.getText(this, "projected"),
        PluginServices.getText(this, "datum")
      };
      Object[][] data = {};
      dtm =
          new DefaultTableModel(data, columnNames) {
            private static final long serialVersionUID = 1L;

            public boolean isCellEditable(int row, int column) {
              return false;
            }
            /*
             * metodo necesario para cuando utilizamos tablas ordenadas
             * ya que sino al ordenar por algun campo no se queda con el orden
             * actual al seleccionar una fila (non-Javadoc)
             * @see javax.swing.table.TableModel#getColumnClass(int)
             */
            public Class getColumnClass(int column) {
              return getValueAt(0, column).getClass();
            }
          };
      sorter = new TableSorter(dtm);

      jTable = new JTable(sorter);
      sorter.setTableHeader(jTable.getTableHeader());
      jTable.setCellSelectionEnabled(false);
      jTable.setRowSelectionAllowed(true);
      jTable.setColumnSelectionAllowed(false);
      jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      TableColumn column = null;
      for (int i = 0; i < columnNames.length; i++) {
        column = jTable.getColumnModel().getColumn(i);
        if (i == 0) {
          column.setPreferredWidth(80); // code column is shorter
        } else if (i == 2) {
          column.setPreferredWidth(50);
        } else {
          column.setPreferredWidth(175);
        }
      }
      initializeTable();
    }

    return jTable;
  }
Example #21
0
 public String getDescription() {
   return PluginServices.getText(this, "parameter")
       + ": "
       + PluginServices.getText(this, "date_value")
       + "\n"
       + PluginServices.getText(this, "format")
       + " ("
       + PluginServices.getText(this, "optional")
       + "): "
       + PluginServices.getText(this, "string_value")
       + "\n"
       + PluginServices.getText(this, "returns")
       + ": "
       + PluginServices.getText(this, "string_value")
       + "\n"
       + PluginServices.getText(this, "description")
       + ": "
       + "Returns the string representation of the Object date parameter\n"
       + "formatted according to the parameter format, if it is supplied.\n\n"
       + "The format should follow the specifications of\n"
       + "'http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html'.\n\n"
       + "Examples: (for the date of December 23, 2008)\n"
       + "  'dd/MM/yy'     23/12/08\n"
       + "  'dd/MM/yyyy'   23/12/2008\n"
       + "  'dd/MMM/yyyy'  23/dec/2008\n"
       + "  'dd/MMMM/yyyy' 23/december/2008\n";
 }
Example #22
0
  public void initializeTable() {
    // Eliminar filas en cada nueva bsqueda
    int numRow = dtm.getRowCount();
    while (numRow != 0) {
      numRow = numRow - 1;
      dtm.removeRow(numRow);
    }

    String sentence =
        "SELECT usr_code, usr_wkt, usr_proj, usr_geog, usr_datum "
            + "FROM USR ORDER BY usr_code ASC";

    connect = new EpsgConnection();
    connect.setConnectionUsr();
    ResultSet result = Query.select(sentence, connect.getConnection());
    try {
      connect.shutdown();
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    Object[] data = new Object[4];
    try {
      while (result.next()) {
        data[0] = result.getString("usr_code");
        data[1] = result.getString("usr_wkt");
        String proj = result.getString("usr_proj");
        if (!proj.equals("")) {
          data[1] = proj;
          data[2] = PluginServices.getText(this, "si");
        } else {
          data[1] = result.getString("usr_geog");
          data[2] = PluginServices.getText(this, "no");
        }

        data[3] = result.getString("usr_datum");
        dtm.addRow(data);
      }
    } catch (SQLException e1) {
      e1.printStackTrace();
    }

    int numr = dtm.getRowCount();
    if (numr > 0) {
      this.getJTable().setRowSelectionInterval(0, 0);
      // getBtnEditar().setEnabled(true);
      // getBtnEliminar().setEnabled(true);
    }
  }
Example #23
0
 /*
  *  (non-Javadoc)
  * @see com.iver.andami.plugins.Extension#initialize()
  */
 public void postInitialize() {
   // restores previous session' state
   getPersistedStatus();
   // now add a menu entry for each toolbar
   SelectableToolBar[] toolBars = PluginServices.getMainFrame().getToolbars();
   for (int i = toolBars.length - 1; i > 0; i--) {
     Menu menu = new Menu();
     menu.setActionCommand(ACTIONCOMMANDBASE + toolBars[i].getName());
     menu.setText(MENUBASE + toolBars[i].getName());
     if (toolBars[i].getAndamiVisibility()) menu.setIcon(ENABLEDIMAGE);
     PluginServices.getMainFrame()
         .addMenu(menu, this, PluginServices.getPluginServices(this).getClassLoader());
   }
 }
  /**
   * This method initializes jTextField
   *
   * @return javax.swing.JTextField
   */
  public JTextField getTxtName() {
    if (txtName == null) {
      txtName = new JTextField();
      txtName.setBounds(6, 19, 472, 20);
      txtName.setText(PluginServices.getText(this, "WFSLayer"));
      txtName.setEditable(false);
      txtName.setBackground(Color.WHITE);
      txtName.setToolTipText(PluginServices.getText(txtName, "feature_to_load"));

      txtName
          .getDocument()
          .addDocumentListener(
              new DocumentListener() {
                /*
                 * (non-Javadoc)
                 *
                 * @see
                 * javax.swing.event.DocumentListener#changedUpdate(javax.swing
                 * .event.DocumentEvent)
                 */
                public void changedUpdate(DocumentEvent e) {}

                /*
                 * (non-Javadoc)
                 *
                 * @see
                 * javax.swing.event.DocumentListener#insertUpdate(javax.swing
                 * .event.DocumentEvent)
                 */
                public void insertUpdate(DocumentEvent e) {
                  IPanelGroup panelGroup = getPanelGroup();

                  if (panelGroup == null) return;

                  ((WFSParamsPanel) panelGroup).setApplicable(true);
                }

                /*
                 * (non-Javadoc)
                 *
                 * @see
                 * javax.swing.event.DocumentListener#removeUpdate(javax.swing
                 * .event.DocumentEvent)
                 */
                public void removeUpdate(DocumentEvent e) {}
              });
    }

    return txtName;
  }
  public void execute(String actionCommand) {
    if (actionCommand.compareToIgnoreCase("NEW_ORACLE_SPATIAL") == 0) {

      IWindow w = PluginServices.getMDIManager().getActiveWindow();
      if (w instanceof View) {
        try {
          String _file = createResourceUrl("images/new_geodb_table.png").getFile();
          ImageIcon iicon = new ImageIcon(_file);

          DriverManager writerManager = LayerFactory.getDM();
          WizardAndami wizard = new WizardAndami(iicon);
          RepeatedChooseGeometryTypePanel panelChoose =
              new RepeatedChooseGeometryTypePanel(wizard.getWizardComponents());
          RepeatedFieldDefinitionPanel panelFields =
              new RepeatedFieldDefinitionPanel(wizard.getWizardComponents());
          NewVectorDBConnectionPanel connPanel =
              new NewVectorDBConnectionPanel(
                  wizard.getWizardComponents(),
                  OracleSpatialDriver.NAME,
                  OracleSpatialDriver.MAX_ID_LENGTH);

          wizard.getWizardComponents().addWizardPanel(panelChoose);
          wizard.getWizardComponents().addWizardPanel(panelFields);
          wizard.getWizardComponents().addWizardPanel(connPanel);

          Driver driver = new OracleSpatialDriver();
          panelFields.setWriter(((IWriteable) driver).getWriter());
          panelChoose.setDriver(driver);

          View theView = (View) w;
          MapContext mc = theView.getMapControl().getMapContext();

          NewOracleSpatialTableFinishAction action =
              new NewOracleSpatialTableFinishAction(
                  wizard.getWizardComponents(), wizard, connPanel, mc);

          wizard.getWizardComponents().setFinishAction(action);
          wizard.getWizardComponents().getFinishButton().setEnabled(false);
          wizard.getWindowInfo().setWidth(640);
          wizard.getWindowInfo().setHeight(350);
          wizard.getWindowInfo().setTitle(PluginServices.getText(this, "new_layer"));
          PluginServices.getMDIManager().addWindow(wizard);

        } catch (Exception ex) {
          logger.error("While showing new oracle spatial table wizard: " + ex.getMessage());
        }
      }
    }
  }
Example #26
0
 public static ICrsUIFactory getUIFactory() {
   ICrsUIFactory factory;
   try {
     factory = (ICrsUIFactory) uiFactory.newInstance();
   } catch (InstantiationException e) {
     PluginServices.getLogger()
         .error("Error creating CRS UI factory. Switching to default factory", e);
     factory = new CrsUIFactory();
   } catch (IllegalAccessException e) {
     PluginServices.getLogger()
         .error("Error creating CRS UI factory. Switching to default factory", e);
     factory = new CrsUIFactory();
   }
   return factory;
 }
 private JButton getBtnCloseTool() {
   if (btnCloseTool == null) {
     btnCloseTool =
         new JButton(
             new AbstractAction(PluginServices.getText(this, "Close")) {
               @Override
               public void actionPerformed(ActionEvent evt) {
                 PluginServices.getMDIManager().closeWindow(RasterToModLayerInterpolator.this);
               }
             });
     btnCloseTool.setBounds(162, 203, 66, 22);
     btnCloseTool.setToolTipText(PluginServices.getText(this, "Close_window"));
   }
   return btnCloseTool;
 }
Example #28
0
 public void initializeValues() {
   PluginServices ps = PluginServices.getPluginServices(this);
   XMLEntity xml = ps.getPersistentXML();
   if (xml.contains(PROJECTS_FOLDER_PROPERTY_NAME)) {
     txtProjectsFolder.setText(xml.getStringProperty(PROJECTS_FOLDER_PROPERTY_NAME));
   }
   if (xml.contains(DATA_FOLDER_PROPERTY_NAME)) {
     txtDataFolder.setText(xml.getStringProperty(DATA_FOLDER_PROPERTY_NAME));
   }
   if (xml.contains(TEMPLATES_FOLDER_PROPERTY_NAME)) {
     txtTemplatesFolder.setText(xml.getStringProperty(TEMPLATES_FOLDER_PROPERTY_NAME));
   }
   if (xml.contains(SYMBOL_LIBRARY_FOLDER_PROPERTY_NAME)) {
     txtSymbolLibraryFolder.setText(xml.getStringProperty(SYMBOL_LIBRARY_FOLDER_PROPERTY_NAME));
   }
 }
Example #29
0
 /** This is the default constructor */
 public ExtensionPage(Extension extension) {
   super();
   icon = PluginServices.getIconTheme().get("emblem-work");
   this.extension = extension;
   setParentID(ExtensionsPage.class.getName());
   initialize();
 }
  public boolean isEnabled() {

    if (!ORACLE_JAR_PRESENT) return false;

    IWindow w = PluginServices.getMDIManager().getActiveWindow();
    return (w instanceof View);
  }