public Component getTableCellRendererComponent(
          JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        JLabel label =
            (JLabel)
                super.getTableCellRendererComponent(
                    table, value, isSelected, hasFocus, row, column);

        if (value instanceof Integer) {
          Icon icon = null;
          if (value.equals(2)) {
            label.setToolTipText(
                AppContext.getApplicationContext()
                    .getI18nString("alfresco.fileList.toolTip.ownAnnexation"));
            label.setIcon(iconGreenDoc);
          } else if (value.equals(1)) {
            label.setToolTipText(
                AppContext.getApplicationContext()
                    .getI18nString("alfresco.fileList.toolTip.alienAnnexation"));
            label.setIcon(iconOrangeDoc);
          } else {
            label.setToolTipText(
                AppContext.getApplicationContext()
                    .getI18nString("alfresco.fileList.toolTip.noAnnexation"));
            value = Color.red;
            label.setIcon(iconRedDoc);
          }
        }
        return label;
      }
  public void initialize(FeatureDialogHome fd) {
    GeopistaSchema esquema = (GeopistaSchema) fd.getFeature().getSchema();

    AppContext.getApplicationContext().getBlackboard().put("featureDialog", fd);

    Object obj = fd.getFeature().getAttribute(esquema.getAttributeByColumn("id"));
    if (obj != null
        && !obj.equals("")
        && ((esquema.getGeopistalayer() != null
                && !esquema.getGeopistalayer().isExtracted()
                && !esquema.getGeopistalayer().isLocal())
            || (esquema.getGeopistalayer() == null)
                && fd.getFeature() instanceof GeopistaFeature
                && !((GeopistaFeature) fd.getFeature()).getLayer().isExtracted())) {

      String codprov = null;
      if (fd.getFeature().getAttribute(esquema.getAttributeByColumn("codprov")) != null) {
        codprov =
            (fd.getFeature().getAttribute(esquema.getAttributeByColumn("codprov"))).toString();
      }

      String codmunic = null;
      if (fd.getFeature().getAttribute(esquema.getAttributeByColumn("codmunic")) != null) {
        codmunic =
            (fd.getFeature().getAttribute(esquema.getAttributeByColumn("codmunic"))).toString();
      }

      String entidad = null;
      if (fd.getFeature().getAttribute(esquema.getAttributeByColumn("codentidad")) != null) {
        entidad =
            (fd.getFeature().getAttribute(esquema.getAttributeByColumn("codentidad"))).toString();
      }

      String nucleo = null;
      if (fd.getFeature().getAttribute(esquema.getAttributeByColumn("codpoblamiento")) != null) {
        nucleo =
            (fd.getFeature().getAttribute(esquema.getAttributeByColumn("codpoblamiento")))
                .toString();
      }

      AppContext app = (AppContext) AppContext.getApplicationContext();
      Blackboard Identificadores = app.getBlackboard();
      EdicionOperations operations = new EdicionOperations();
      Identificadores.put(
          "propiedadesnucleosencuestados1_panel",
          operations.getPanelNucleosEncuestados1EIEL(codprov, codmunic, entidad, nucleo));
      Encuestados1Panel encuestados1Panel = new Encuestados1Panel();
      encuestados1Panel.loadDataIdentificacion(codprov, codmunic, entidad, nucleo);
      encuestados1Panel.loadData();
      this.encuestados1Panel = encuestados1Panel;
      fd.addPanel(encuestados1Panel);
    }
  }
  public void execute() throws Exception {
    if (encuestados1Panel != null) {
      if (encuestados1Panel.datosMinimosYCorrectos()) {
        GeopistaLayer geopistaLayer =
            (GeopistaLayer)
                GeopistaEditorPanel.getEditor()
                    .getLayerManager()
                    .getLayer(ConstantesLocalGISEIEL.ENCUESTADOS1_LAYER);
        String idLayer = geopistaLayer.getSystemId();
        encuestados1Panel.okPressed();
        Encuestados1EIEL encuestado1 =
            (Encuestados1EIEL)
                AppContext.getApplicationContext()
                    .getBlackboard()
                    .get("propiedadesnucleosencuestados1_panel");
        ConstantesLocalGISEIEL.clienteLocalGISEIEL.insertarElemento(
            encuestados1Panel.getEncuestados1(encuestado1),
            idLayer,
            ConstantesLocalGISEIEL.ENCUESTADOS1);

        if (EditingInfoPanel.getInstance() != null
            && EditingInfoPanel.getInstance().getJPanelTree() != null
            && EditingInfoPanel.getInstance().getJPanelTree().getPatronSelected() != null) {
          if (EditingInfoPanel.getInstance()
              .getJPanelTree()
              .getPatronSelected()
              .equals(ConstantesLocalGISEIEL.ENCUESTADOS1)) {
            EditingInfoPanel.getInstance().listarDatosTabla();
          }
        }
      }
    }
  }
  public void execute() throws Exception {
    if (captacionesPanel != null) {
      if (captacionesPanel.datosMinimosYCorrectos()) {
        GeopistaLayer geopistaLayer =
            (GeopistaLayer)
                GeopistaEditorPanel.getEditor()
                    .getLayerManager()
                    .getLayer(ConstantesLocalGISEIEL.CAPTACIONES_LAYER);
        String idLayer = geopistaLayer.getSystemId();
        captacionesPanel.okPressed();
        CaptacionesEIEL captacion =
            (CaptacionesEIEL) AppContext.getApplicationContext().getBlackboard().get("captacion");
        InitEIEL.clienteLocalGISEIEL.insertarElemento(
            captacionesPanel.getCaptacion(captacion), idLayer, ConstantesLocalGISEIEL.CAPTACIONES);

        if (EditingInfoPanel.getInstance() != null
            && EditingInfoPanel.getInstance().getJPanelTree() != null
            && EditingInfoPanel.getInstance().getJPanelTree().getPatronSelected() != null) {
          if (EditingInfoPanel.getInstance()
              .getJPanelTree()
              .getPatronSelected()
              .equals(ConstantesLocalGISEIEL.CAPTACIONES)) {
            EditingInfoPanel.getInstance().listarDatosTabla();
          }
        }
      }
    }
  }
 public ViasSistemaDialog(String nomVia, String tipoVia, String idMunicipio) {
   super(AppContext.getApplicationContext().getMainFrame());
   this.nomVia = nomVia;
   this.tipoVia = tipoVia;
   this.idMunicipio = idMunicipio;
   initialize();
 }
 public ViasSistemaDialog(String nomVia, String tipoVia, int codigoVia) {
   super(AppContext.getApplicationContext().getMainFrame());
   this.nomVia = nomVia;
   this.tipoVia = tipoVia;
   this.codigoVia = codigoVia;
   initialize();
 }
 public static String getUnidadTramitadoraOcupaciones() {
   ApplicationContext app = AppContext.getApplicationContext();
   return (UNIDAD_TRAMITADORA_OCUPACION.equalsIgnoreCase(
           app.getString(UNIDAD_TRAMITADORA_OCUPACION))
       ? ""
       : app.getString(UNIDAD_TRAMITADORA_OCUPACION));
 }
 public static String getUnidadTramitadoraActividades() {
   ApplicationContext app = AppContext.getApplicationContext();
   return (UNIDAD_TRAMITADORA_ACTIVIDAD.equalsIgnoreCase(
           app.getString(UNIDAD_TRAMITADORA_ACTIVIDAD))
       ? ""
       : app.getString(UNIDAD_TRAMITADORA_ACTIVIDAD));
 }
 /**
  * Funcion que carga los datos del arrayList pasado por parametro en la tabla. En este caso son o
  * fincasCatastro o Bienes inmuebles. Se hace un instanceof para saberlo.
  *
  * @param dirRefCatas La lista de referencias del expediente
  */
 public void cargaDatosTabla(ArrayList dirRefCatas) {
   AppContext app = (AppContext) AppContext.getApplicationContext();
   Estructuras.cargarEstructura("Tipos de via normalizados de Catastro");
   String[][] datos = new String[dirRefCatas.size()][6];
   for (int i = 0; i < dirRefCatas.size(); i++) {
     DireccionLocalizacion auxDir = null;
     if (dirRefCatas.get(i) instanceof FincaCatastro) {
       FincaCatastro parcela = (FincaCatastro) dirRefCatas.get(i);
       auxDir = parcela.getDirParcela();
       datos[i][0] = parcela.getRefFinca().getRefCatastral();
     } else if (dirRefCatas.get(i) instanceof BienInmuebleCatastro) {
       BienInmuebleCatastro bien = (BienInmuebleCatastro) dirRefCatas.get(i);
       auxDir = bien.getDomicilioTributario();
       datos[i][0] = bien.getIdBienInmueble().getIdBienInmueble();
     }
     if (auxDir != null
         && Estructuras.getListaTipos().getDomainNode(auxDir.getTipoVia()) != null) {
       datos[i][1] =
           Estructuras.getListaTipos()
               .getDomainNode(auxDir.getTipoVia())
               .getTerm(app.getString(AppContext.GEOPISTA_LOCALE_KEY, "es_ES"));
     } else {
       datos[i][1] = "";
     }
     if (auxDir != null) {
       datos[i][2] = auxDir.getNombreVia();
       datos[i][3] = String.valueOf(auxDir.getPrimerNumero());
       datos[i][4] = auxDir.getCodPoligono();
       datos[i][5] = auxDir.getCodParcela();
     }
   }
   modelo.setDataVector(datos, identificadores);
   tablaRefCatasTabel.setModel(modelo);
 }
  public void initialize(PlugInContext context) throws Exception {

    context
        .getFeatureInstaller()
        .addMainMenuItem(this, new String[] {"OpenGestorFip"}, getName(), false, null, null);

    context
        .getWorkbenchContext()
        .getIWorkbench()
        .getGuiComponent()
        .getToolBar("OpenGestorFip")
        .addPlugIn(
            getIcon(),
            this,
            createEnableCheck(context.getWorkbenchContext()),
            context.getWorkbenchContext());

    JPopupMenu popupMenu = context.getWorkbenchGuiComponent().getLayerViewPopupMenu();

    FeatureInstaller featureInstaller = new FeatureInstaller(context.getWorkbenchContext());
    featureInstaller.addPopupMenuItem(
        popupMenu,
        this,
        AppContext.getApplicationContext().getI18nString(this.getName()),
        false,
        null,
        createEnableCheck(context.getWorkbenchContext()));
  }
 /**
  * Este metodo solo se puede utilizar para la aplicacion de Inventario para el plugin interno que
  * se utiliza dentro del editor no funciona
  *
  * @return
  */
 private InventarioInternalFrame getInventarioFrame() {
   try {
     return ((InventarioInternalFrame)
         ((MainInventario) AppContext.getApplicationContext().getMainFrame()).getIFrame());
   } catch (Exception ex) {
     return null;
   }
 }
    /** Constructor */
    public DragTable() {
      setShowHorizontalLines(false);
      setShowVerticalLines(false);
      setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      setColumnModel(
          new DefaultTableColumnModel() {
            public void moveColumn(int columnIndex, int newIndex) {
              if (columnIndex == 0 || newIndex == 0) return;
              super.moveColumn(columnIndex, newIndex);
            }
          });
      // setAutoCreateColumnsFromModel(false);

      DefaultTableModel tableModel = new DefaultTableModel();
      tableModel.addColumn(
          AppContext.getApplicationContext().getI18nString("alfresco.fileList.columnName"));
      tableModel.addColumn("");
      setModel(tableModel);
      setTableColumnModel();

      setBackground(Color.WHITE);
      setDragEnabled(true);
      final DragTable dragTable = this;
      setTransferHandler(
          new TransferHandler() {

            public boolean canImport(TransferSupport support) {
              return false;
            }

            @Override
            public int getSourceActions(JComponent c) {
              return TransferHandler.COPY_OR_MOVE;
            }

            @Override
            protected Transferable createTransferable(JComponent c) {
              assert (c == dragTable);
              DefaultMutableTreeNode defaultMutableTreeNode = new DefaultMutableTreeNode();
              defaultMutableTreeNode.setUserObject(
                  (DefaultMutableTreeNode)
                      dragTable.getModel().getValueAt(dragTable.getSelectedRow(), 0));
              defaultMutableTreeNode.setAllowsChildren(false);
              defaultMutableTreeNode.setParent(null);
              draggedNode = defaultMutableTreeNode;
              return new DataHandler(
                  defaultMutableTreeNode, dragAndDropTree.dataFlavor.getMimeType());
            }

            @Override
            protected void exportDone(JComponent c, Transferable t, int act) {
              if (act == TransferHandler.MOVE) {
                dragTable.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                workDone();
              }
            }
          });
    }
public class OpenGestorPlugIn extends AbstractPlugIn {

  private static AppContext appContext = (AppContext) AppContext.getApplicationContext();

  public boolean execute(PlugInContext context) throws Exception {

    JSplitPane splitpane =
        (JSplitPane) appContext.getBlackboard().get(ConstantesGestorFIP.OPEN_GESTORFIP);

    if (splitpane.getDividerLocation() <= 1) {
      splitpane.setDividerLocation(400);
    } else {
      splitpane.setDividerLocation(0);
    }

    return true;
  }

  public void initialize(PlugInContext context) throws Exception {

    context
        .getFeatureInstaller()
        .addMainMenuItem(this, new String[] {"OpenGestorFip"}, getName(), false, null, null);

    context
        .getWorkbenchContext()
        .getIWorkbench()
        .getGuiComponent()
        .getToolBar("OpenGestorFip")
        .addPlugIn(
            getIcon(),
            this,
            createEnableCheck(context.getWorkbenchContext()),
            context.getWorkbenchContext());

    JPopupMenu popupMenu = context.getWorkbenchGuiComponent().getLayerViewPopupMenu();

    FeatureInstaller featureInstaller = new FeatureInstaller(context.getWorkbenchContext());
    featureInstaller.addPopupMenuItem(
        popupMenu,
        this,
        AppContext.getApplicationContext().getI18nString(this.getName()),
        false,
        null,
        createEnableCheck(context.getWorkbenchContext()));
  }

  public static MultiEnableCheck createEnableCheck(WorkbenchContext workbenchContext) {
    EnableCheckFactory checkFactory = new EnableCheckFactory(workbenchContext);

    return new MultiEnableCheck();
  }

  public ImageIcon getIcon() {
    return IconLoader.icon("OpenGestorFip.gif");
  }
}
 public JRCementerioDataSource(ElemCementerioBean elem, String locale) {
   this.locale = locale;
   Vector<ElemCementerioBean> elementos = new Vector<ElemCementerioBean>();
   elementos.add(elem);
   this.elementosCementerio = elementos.toArray();
   documentClient =
       new CementerioDocumentClient(
           ((AppContext) AppContext.getApplicationContext())
                   .getString(UserPreferenceConstants.LOCALGIS_SERVER_ADMCAR_SERVLET_URL)
               + ServletConstants.DOCUMENT_SERVLET_NAME);
 }
public class GeopistaSystemLayers {
  // Constante que contiene el sysmtemId de la capa parcelas
  static ApplicationContext appContext = AppContext.getApplicationContext();
  public static final String PARCELAS = appContext.getString("lyrParcelas");
  public static final String NUMEROSPOLICIA = appContext.getString("lyrNumerosPolicia");
  public static final String INMUEBLES = appContext.getString("lyrInmuebles");
  public static final String TRAMOSVIAS = appContext.getString("lyrTramosVia");
  public static final String VIAS = appContext.getString("lyrVias");
  public static final String AMBITOSGESTION = appContext.getString("lyrAmbitosGestion");

  public GeopistaSystemLayers() {}
}
  public void initialize(FeatureDialogHome fd) {

    GeopistaSchema esquema = (GeopistaSchema) fd.getFeature().getSchema();

    Object obj = fd.getFeature().getAttribute(esquema.getAttributeByColumn("id"));
    if (obj != null
        && !obj.equals("")
        && ((esquema.getGeopistalayer() != null
                && !esquema.getGeopistalayer().isExtracted()
                && !esquema.getGeopistalayer().isLocal())
            || (esquema.getGeopistalayer() == null)
                && fd.getFeature() instanceof GeopistaFeature
                && !((GeopistaFeature) fd.getFeature()).getLayer().isExtracted())) {
      String clave = null;
      if (fd.getFeature().getAttribute(esquema.getAttributeByColumn("clave")) != null) {
        clave = (fd.getFeature().getAttribute(esquema.getAttributeByColumn("clave"))).toString();
      }

      String codprov = null;
      if (fd.getFeature().getAttribute(esquema.getAttributeByColumn("codprov")) != null) {
        codprov =
            (fd.getFeature().getAttribute(esquema.getAttributeByColumn("codprov"))).toString();
      }

      String codmunic = null;
      if (fd.getFeature().getAttribute(esquema.getAttributeByColumn("codmunic")) != null) {
        codmunic =
            (fd.getFeature().getAttribute(esquema.getAttributeByColumn("codmunic"))).toString();
      }

      String orden_ca = null;
      if (fd.getFeature().getAttribute(esquema.getAttributeByColumn("orden_ca")) != null) {
        orden_ca =
            (fd.getFeature().getAttribute(esquema.getAttributeByColumn("orden_ca"))).toString();
      }

      int ID =
          Integer.parseInt(
              fd.getFeature().getAttribute(esquema.getAttributeByColumn("id")).toString());
      AppContext app = (AppContext) AppContext.getApplicationContext();
      Blackboard Identificadores = app.getBlackboard();
      Identificadores.put("ID_Captacion", ID);

      EdicionOperations operations = new EdicionOperations();
      Identificadores.put("captacion", operations.getCaptacionEIEL(ID));
      CaptacionesPanel captaciones = new CaptacionesPanel();
      captaciones.loadDataIdentificacion(clave, codprov, codmunic, orden_ca);
      captaciones.loadData();
      this.captacionesPanel = captaciones;
      fd.addPanel(captaciones);
    }
  }
  public void initialize(PlugInContext context) throws Exception {

    FeatureInstaller featureInstaller = new FeatureInstaller(context.getWorkbenchContext());

    featureInstaller.addMainMenuItem(
        this,
        new String[] {MenuNames.EDIT, "CoordSys"},
        AppContext.getApplicationContext().getI18nString(this.getName()),
        false,
        null,
        this.createEnableCheck(context.getWorkbenchContext()));

    JPopupMenu layerNamePopupMenu =
        context.getWorkbenchContext().getIWorkbench().getGuiComponent().getLayerNamePopupMenu();
    featureInstaller.addPopupMenuItem(
        layerNamePopupMenu,
        this,
        AppContext.getApplicationContext().getI18nString(this.getName()) + "...",
        false,
        null,
        this.createEnableCheck(context.getWorkbenchContext()));
  }
 public void setTableColumnModel() {
   if (getColumnModel().getColumnCount() > 0) {
     getColumnModel()
         .getColumn(0)
         .setHeaderValue(
             AppContext.getApplicationContext().getI18nString("alfresco.fileList.columnName"));
     getColumnModel().getColumn(1).setCellRenderer(getDragTableCellRenderer());
     getColumnModel().getColumn(1).setPreferredWidth(24);
     getColumnModel().getColumn(1).setWidth(24);
     getColumnModel().getColumn(1).setMaxWidth(24);
     getColumnModel().getColumn(1).setMinWidth(24);
   }
 }
  public EIELDominioPanelTree(int modoSeleccion) {

    super(new GridLayout(1, 0));

    this.locale =
        AppContext.getApplicationContext()
            .getUserPreference(AppContext.GEOPISTA_LOCALE_KEY, "es_ES", true);

    try {
      logger.info("Recuperando dominios de la EIEL");

      EIELDominioPanelTree.lstReferencias =
          ConstantesLocalGISEIEL.clienteLocalGISEIEL.getDominiosEIEL(
              ConstantesLocalGISEIEL.DOMAIN_NAME, locale);

      referenciasTraidas = new boolean[lstReferencias.size()];

      for (int i = 0; i < referenciasTraidas.length; i++) {
        referenciasTraidas[i] = false;
      }

      DefaultMutableTreeNode top = new DefaultMutableTreeNode();

      // Crea los nodos
      createNodes(top);

      // Crea un arbol que permite la seleccion indicada en modoSeleccion
      HideableTreeModel ml = new HideableTreeModel(top);
      ml.activateFilter(true);
      tree = new JTree(ml);

      tree.getSelectionModel().setSelectionMode(modoSeleccion);

      // Aspecto del arbol (renderer)
      tree.setCellRenderer(new TreeRendereEIELDomains(locale));

      tree.setName("Información de la EIEL");
      tree.setEditable(false);

      if (playWithLineStyle) {
        System.out.println("line style = " + lineStyle);
        tree.putClientProperty("JTree.lineStyle", lineStyle);
      }

      add(tree, null);
      tree.setSelectionRow(0);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  public Connection abrirConexion() throws SQLException {
    Connection conn = null;
    try {
      // Quitamos los drivers
      Class.forName("com.geopista.sql.GEOPISTADriver");
      String sConn = aplicacion.getString(UserPreferenceConstants.LOCALGIS_DATABASE_URL);
      conn = DriverManager.getConnection(sConn);
      AppContext app = (AppContext) AppContext.getApplicationContext();
      conn = app.getConnection();
      conn.setAutoCommit(false);
    } catch (Exception e) {
      return null;
    }

    return conn;
  }
  public String getNombreNucleo(String codentidad, String codnucleo) {

    String nombreNucleo = codentidad;
    aplicacion = (AppContext) AppContext.getApplicationContext();

    HashMap map = (HashMap) aplicacion.getBlackboard().get("HASH_NUCLEOS_MUNICIPIO");

    String claveBusqueda = codentidad + "_" + codnucleo;

    LCGNucleoEIEL nucleoEIEL = (LCGNucleoEIEL) map.get(claveBusqueda);
    if (nucleoEIEL != null) {
      nombreNucleo = "(" + claveBusqueda + ") " + nucleoEIEL.getDenominacion();
    }

    return nombreNucleo;
  }
  /** This method initializes */
  public SaneamientoAutonomoDialog(SaneamientoAutonomoEIEL elemento, boolean isEditable) {
    super(AppContext.getApplicationContext().getMainFrame());

    initialize(I18N.get("LocalGISEIEL", "localgiseiel.dialog.titulo.sa"));
    this.isEditable = isEditable;
    getSaneamientoAutonomoPanel().loadData(elemento);
    EdicionUtils.enablePanel(getSaneamientoAutonomoPanel(), isEditable);
    if (elemento != null)
      EdicionUtils.enablePanel(getSaneamientoAutonomoPanel().getJPanelDatosIdentificacion(), false);

    getSaneamientoAutonomoPanel().getjTextFieldClave().setEnabled(false);
    getSaneamientoAutonomoPanel().getJComboBoxProvincia().setEnabled(false);
    getSaneamientoAutonomoPanel().getJComboBoxMunicipio().setEnabled(false);

    this.setLocationRelativeTo(null);
  }
 /** Actualiza la version */
 private void updateVersion() {
   try {
     String hora = (String) inventarioClient.getHora(Const.ACTION_GET_HORA);
     String fechaVersion =
         (String) new SimpleDateFormat("yyyy-MM-dd").format(new Date()) + " " + hora;
     Version version = new Version();
     version.setFecha(fechaVersion);
     version.setFeaturesActivas(true);
     AppContext.getApplicationContext().getBlackboard().put(AppContext.VERSION, version);
     com.geopista.protocol.inventario.Const.fechaVersion = fechaVersion;
     if (getInventarioFrame() != null)
       getInventarioFrame()
           .setFecha((String) new SimpleDateFormat("dd-MM-yyyy").format(new Date()) + " " + hora);
   } catch (Exception ex) {
     logger.error("Error al actualizar la version despues de la carga:", ex);
   }
 }
/**
 * GeopistaMultiSelectionPatrimonioDialog Cuadro de Dialogo del Panel de Selección Multicriterio de
 * Patrimonio
 */
public class GeopistaMultiSelectionPatrimonioDialog extends JDialog {
  ApplicationContext appContext = AppContext.getApplicationContext();

  public GeopistaMultiSelectionPatrimonioDialog(PlugInContext context) {

    this.setTitle(appContext.getI18nString("GeopistaMultiSelectionPatrimonioPlugInDescription"));

    this.setResizable(false);
    GeopistaMultiSelectionPatrimonioPanel multiPanel =
        new GeopistaMultiSelectionPatrimonioPanel(context);
    this.setResizable(false);
    this.getContentPane().add(multiPanel);
    this.setSize(425, 325);
    this.setModal(true);
    this.setVisible(true);
    this.setLocation(150, 150);
  }
}
  public JRCementerioDataSource(Collection<ElemCementerioBean> elementosCementerio, String locale) {
    this.locale = locale;
    Vector<ElemCementerioBean> elemsSinVersion = new Vector<ElemCementerioBean>();

    for (java.util.Iterator<ElemCementerioBean> it = elementosCementerio.iterator();
        it.hasNext(); ) {
      ElemCementerioBean elemento = (ElemCementerioBean) it.next();
      //    		if (!bien.isVersionado()){
      //    			bienesSinVersion.add(bien);
      //    		}
      elemsSinVersion.add(elemento);
    }
    this.elementosCementerio = elemsSinVersion != null ? elemsSinVersion.toArray() : null;
    documentClient =
        new CementerioDocumentClient(
            ((AppContext) AppContext.getApplicationContext())
                    .getString(UserPreferenceConstants.LOCALGIS_SERVER_ADMCAR_SERVLET_URL)
                + ServletConstants.DOCUMENT_SERVLET_NAME);
  }
  public void enter() {
    // Recuperamos el ID_Parcela y el ID_UnidadConstruccion
    AppContext app = (AppContext) AppContext.getApplicationContext();
    Blackboard Identificadores = app.getBlackboard();
    ID_Parcela = Integer.parseInt(Identificadores.get("ID_Parcela").toString());
    // ID_Unidad= Integer.parseInt(Identificadores.get("ID_Unidad").toString());

    // Rellenamos el Listbox
    lstCons.clear();
    try {
      CatastroActualizarPostgre Cons = new CatastroActualizarPostgre();
      ArrayList Datos = Cons.Cons(ID_Parcela);
      Iterator alIt = Datos.iterator();
      while (alIt.hasNext()) {
        lstCons.addElement(alIt.next());
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Beispiel #27
0
public class DataException extends Exception {
  /** Contexto de la aplicación */
  private static AppContext aplicacion = (AppContext) AppContext.getApplicationContext();

  public DataException() {
    super();
    ErrorDialog.show(
        aplicacion.getMainFrame(),
        I18N.get("Importacion", "DataError.Titulo"),
        I18N.get("Importacion", "DataError.Aviso"),
        StringUtil.stackTrace(this));
  }

  public DataException(String msg) {
    super(msg);
    ErrorDialog.show(
        aplicacion.getMainFrame(),
        I18N.get("Importacion", "DataError.Titulo"),
        msg,
        StringUtil.stackTrace(this));
  }

  public DataException(String msg, Throwable cause) {
    super(msg, cause);
    ErrorDialog.show(
        aplicacion.getMainFrame(),
        I18N.get("Importacion", "DataError.Titulo"),
        msg,
        StringUtil.stackTrace(this));
  }

  public DataException(Throwable cause) {
    super(cause);
    ErrorDialog.show(
        aplicacion.getMainFrame(),
        I18N.get("Importacion", "DataError.Titulo"),
        I18N.get("Importacion", "DataError.Aviso"),
        StringUtil.stackTrace(this));
  }
}
  public void reproject(
      Coordinate coordinate, final CoordinateSystem source, final CoordinateSystem destiny) {
    try {

      // CRSAuthorityFactory crsFactory = FactoryFinder.getCRSAuthorityFactory("EPSG", null);
      CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:" + source.getEPSGCode());
      CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:" + destiny.getEPSGCode());
      MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS);
      GeometryFactory h = AppContext.getApplicationContext().getGeometryFactory();
      h = new GeometryFactory(h.getPrecisionModel(), destiny.getEPSGCode());
      Coordinate coordinateFinal = coordinate;
      JTS.transform(coordinate, coordinateFinal, transform);
    } catch (NoSuchAuthorityCodeException e) {
      JOptionPane.showMessageDialog(null, e.getMessage());
    } catch (FactoryException e) {
      JOptionPane.showMessageDialog(null, e.getMessage());
    } catch (VerifyError e) {
      JOptionPane.showMessageDialog(null, e.getMessage());
    } catch (Exception e) {
      JOptionPane.showMessageDialog(null, e.getMessage());
    }
  }
  private void aceptar() {
    ApplicationContext app = AppContext.getApplicationContext();
    if (descApp.equalsIgnoreCase("LICENCIAS_OBRA")) {
      app.setUserPreference(SERVICIO, jTextFieldServicio.getText());
      app.setUserPreference(INICIO, jTextFieldInicio.getText());
      app.setUserPreference(RESPONSABLE, jTextFieldResponsable.getText());
      app.setUserPreference(UNIDAD_TRAMITADORA, jTextFieldUTramitadora.getText());
      app.setUserPreference(UNIDAD_REGISTRO, jTextFieldURegistro.getText());
    } else if (descApp.equalsIgnoreCase("LICENCIAS_ACTIVIDAD")) {
      app.setUserPreference(SERVICIO_ACTIVIDAD, jTextFieldServicio.getText());
      app.setUserPreference(INICIO_ACTIVIDAD, jTextFieldInicio.getText());
      app.setUserPreference(RESPONSABLE_ACTIVIDAD, jTextFieldResponsable.getText());
      app.setUserPreference(UNIDAD_TRAMITADORA_ACTIVIDAD, jTextFieldUTramitadora.getText());
      app.setUserPreference(UNIDAD_REGISTRO_ACTIVIDAD, jTextFieldURegistro.getText());
    } else if (descApp.equalsIgnoreCase("LICENCIAS_OCUPACION")) {
      app.setUserPreference(SERVICIO_OCUPACION, jTextFieldServicio.getText());
      app.setUserPreference(INICIO_OCUPACION, jTextFieldInicio.getText());
      app.setUserPreference(RESPONSABLE_OCUPACION, jTextFieldResponsable.getText());
      app.setUserPreference(UNIDAD_TRAMITADORA_OCUPACION, jTextFieldUTramitadora.getText());
      app.setUserPreference(UNIDAD_REGISTRO_OCUPACION, jTextFieldURegistro.getText());
    }

    dispose();
  }
/** @author Enxenio S.L. */
public class DefineFileExportUserStylePanel extends AbstractPanel implements ActionForward {

  SLDStyle sldStyle = null;
  Object[] selectedStyles = null;
  String importar = "";
  Layer layer = null;
  String layerName = null;

  private static AppContext aplicacion = (AppContext) AppContext.getApplicationContext();

  public void configure(Request request) {
    selectedStyles = (Object[]) request.getAttribute("selectedStyles");
    sldStyle = (SLDStyle) request.getAttribute("SLDStyle");
    // Para saber si estamos eligiendo fichero para una importación o exportación
    importar = (String) request.getAttribute("importar");
    layer = (Layer) request.getAttribute("Layer");
    layerName = (String) request.getAttribute("LayerName");
    String etiqueta = aplicacion.getI18nString("SLDStyle.SeleccionFichero");
    if (importar.equals("true"))
      etiqueta += aplicacion.getI18nString("SLDStyle.ImportarFicheroEstilo");
    else etiqueta += aplicacion.getI18nString("SLDStyle.ExportarFicheroEstilo");
    fileLbl.setText(etiqueta);
  }

  public boolean windowClosing() {
    Request theRequest = FrontControllerFactory.createRequest();
    FrontController fc = FrontControllerFactory.getFrontController();
    Action theAction = fc.getAction("GetBack");
    ActionForward theActionForward = theAction.doExecute(theRequest);
    _container.forward(theActionForward, theRequest);
    return false;
  }

  public String getTitle() {
    if (importar.equals("true"))
      return aplicacion.getI18nString("SLDStyle.ImportacionEstiloFichero");
    else return aplicacion.getI18nString("SLDStyle.ExportacionEstiloFichero");
  }

  /** Creates new form InsertUpdateScaleRangePanel */
  public DefineFileExportUserStylePanel() {
    initComponents();
  }

  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  private void initComponents() { // GEN-BEGIN:initComponents
    java.awt.GridBagConstraints gridBagConstraints;

    filePanel = new javax.swing.JPanel();
    fileLbl = new javax.swing.JLabel();
    fileTxt = new javax.swing.JTextField();
    fileBtn = new javax.swing.JButton();
    buttonPanel = new javax.swing.JPanel();
    okBtn = new javax.swing.JButton();
    cancelBtn = new javax.swing.JButton();

    setLayout(new java.awt.BorderLayout());

    setPreferredSize(new java.awt.Dimension(400, 125));
    filePanel.setLayout(new java.awt.GridBagLayout());

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
    filePanel.add(fileLbl, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    filePanel.add(fileTxt, gridBagConstraints);

    fileBtn.setText(aplicacion.getI18nString("SLDStyle.Examinar") + "...");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
    fileBtn.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            fileBtnActionPerformed(evt);
          }
        });
    filePanel.add(fileBtn, gridBagConstraints);

    add(filePanel, java.awt.BorderLayout.CENTER);

    okBtn.setText(aplicacion.getI18nString("SLDStyle.Aceptar"));
    okBtn.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            okBtnActionPerformed(evt);
          }
        });

    buttonPanel.add(okBtn);

    cancelBtn.setText(aplicacion.getI18nString("SLDStyle.Cancelar"));
    cancelBtn.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelBtnActionPerformed(evt);
          }
        });

    buttonPanel.add(cancelBtn);

    add(buttonPanel, java.awt.BorderLayout.SOUTH);
  } // GEN-END:initComponents

  private void fileBtnActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_fileBtnActionPerformed
    if (importar.equals("true")) {
      fileChooser = GUIUtil.createJFileChooserWithExistenceChecking();
      if (JFileChooser.APPROVE_OPTION == fileChooser.showOpenDialog(aplicacion.getMainFrame())) {
        fileTxt.setText(fileChooser.getSelectedFile().getAbsolutePath());
      } else
        JOptionPane.showMessageDialog(null, aplicacion.getI18nString("SLDStyle.SeleccionFichero"));
    } else {
      fileChooser = GUIUtil.createJFileXMLChooserWithOverwritePrompting();
      FileFilter fileFilter = new MyFileFilter(".xml", "XML");
      fileChooser.setFileFilter(fileFilter);
      fileChooser.setAcceptAllFileFilterUsed(false);
      if (JFileChooser.APPROVE_OPTION == fileChooser.showSaveDialog(aplicacion.getMainFrame())) {
        if (fileChooser.getSelectedFile().getAbsolutePath().endsWith(".xml"))
          fileTxt.setText(fileChooser.getSelectedFile().getAbsolutePath());
        else
          JOptionPane.showMessageDialog(
              null, AppContext.getMessage("SLDStyle.SeleccionFicheroXML"));
      } else
        JOptionPane.showMessageDialog(null, aplicacion.getI18nString("SLDStyle.SeleccionFichero"));
    }
  } // GEN-LAST:event_fileBtnActionPerformed

  private void okBtnActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_okBtnActionPerformed
    if (importar.equals("true") && !new File(fileTxt.getText()).exists())
      JOptionPane.showMessageDialog(null, aplicacion.getI18nString("SLDStyle.FicheroNoExiste"));
    else {
      Request theRequest = FrontControllerFactory.createRequest();
      theRequest.setAttribute("FileExport", fileTxt.getText());
      theRequest.setAttribute("selectedStyles", selectedStyles);
      theRequest.setAttribute("SLDStyle", sldStyle);
      theRequest.setAttribute("Layer", layer);
      theRequest.setAttribute("LayerName", layerName);
      FrontController fc = FrontControllerFactory.getFrontController();
      Action theAction;
      if (importar.equals("true")) theAction = fc.getAction("ImportCustomUserStyle");
      else theAction = fc.getAction("ExportCustomUserStyle");
      ActionForward theActionForward = theAction.doExecute(theRequest);
      _container.forward(theActionForward, theRequest);
    }
  } // GEN-LAST:event_okBtnActionPerformed

  private void cancelBtnActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_cancelBtnActionPerformed
    Request theRequest = FrontControllerFactory.createRequest();
    FrontController fc = FrontControllerFactory.getFrontController();
    Action theAction = fc.getAction("GetBack");
    ActionForward theActionForward = theAction.doExecute(theRequest);
    _container.forward(theActionForward, theRequest);
  } // GEN-LAST:event_cancelBtnActionPerformed

  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JPanel buttonPanel;
  private javax.swing.JButton cancelBtn;
  private javax.swing.JButton okBtn;
  private javax.swing.JLabel fileLbl;
  private javax.swing.JFileChooser fileChooser;
  private javax.swing.JTextField fileTxt;
  private javax.swing.JButton fileBtn;
  private javax.swing.JPanel filePanel;
  // End of variables declaration//GEN-END:variables

  private static class MyFileFilter extends FileFilter {
    private FileFilter fileFilter;
    private String format;

    public MyFileFilter(String description, String format) {
      fileFilter = GUIUtil.createFileFilter(description, new String[] {format});
      this.format = format;
    }

    public boolean accept(File f) {
      return fileFilter.accept(f);
    }

    public String getDescription() {
      return fileFilter.getDescription();
    }

    public String getFormat() {
      return format;
    }
  }
}