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 void initialize(PlugInContext context) throws Exception { String pluginCategory = aplicacion.getString(toolBarCategory); ((WorkbenchGuiComponent) context.getWorkbenchContext().getIWorkbench().getGuiComponent()) .getToolBar(pluginCategory) .addPlugIn( getIcon(), this, createEnableCheck(context.getWorkbenchContext()), context.getWorkbenchContext()); JPopupMenu popupMenu = context.getWorkbenchGuiComponent().getLayerViewPopupMenu(); // JPopupMenu layerNamePopupMenu = context.getWorkbenchContext().getIWorkbench() // .getGuiComponent() // .getLayerNamePopupMenu(); FeatureInstaller featureInstaller = new FeatureInstaller(context.getWorkbenchContext()); featureInstaller.addPopupMenuItem( popupMenu, this, aplicacion.getI18nString(getName()), false, GUIUtil.toSmallIcon(ICON), createEnableCheck(context.getWorkbenchContext())); // null); }
public boolean execute(PlugInContext context) throws Exception { reportNothingToUndoYet(context); // limpiamos lo que haya podido quedar de ejecuciones anteriores emptyBlackboard(); WizardDialog d = new WizardDialog( GeopistaUtil.getFrame(context.getWorkbenchGuiComponent()), Constants.APLICACION.getI18nString("ExtractDialogGestionar"), context.getErrorHandler()); d.init( new WizardPanel[] { new MobileModifyPanel01("MobileModifyPanel01", null, context), }); d.setSize(520, 650); d.setLocation(10, 20); d.setVisible(true); if (!d.wasFinishPressed()) { LayerManager layerManager = context.getLayerManager(); if (layerManager != null) { Layer graticuleLayer = layerManager.getLayer(GraticuleCreatorEngine.getGraticuleName()); // si existe una cuadrícula la borramos if (graticuleLayer != null) { layerManager.remove(graticuleLayer); } } return false; } return true; }
public void initialize(PlugInContext context) throws Exception { saveDatasetDialog = new DriverDialog( GeopistaFunctionUtils.getFrame(context.getWorkbenchGuiComponent()), "Save Dataset", true); saveDatasetDialog.initialize(context.getDriverManager().getOutputDrivers()); GUIUtil.centreOnWindow(saveDatasetDialog); }
public InfoRouteDialog( PlugInContext context, String title, ArrayList<InfoRouteStretchBean> list) { super(context.getWorkbenchGuiComponent().getMainFrame(), title, false); WriteRoutePathInfoWithDialog.inicializarIdiomaAvisosPanels(); this.infoRoutesStretchBeansCollection = list; this.initialize(); this.pluginContext = context; this.pack(); this.setSize(this.getWidth() + 20, this.getHeight()); this.setResizable(false); this.setVisible(true); }
public boolean execute(PlugInContext context) throws Exception { // Don't make this plug-in undoable -- it's a lot of data to store in memory [Jon Aquino] context.getLayerManager().getUndoableEditReceiver().reportIrreversibleChange(); CoordinateSystem destination = (CoordinateSystem) JOptionPane.showInputDialog( (Component) context.getWorkbenchGuiComponent(), AppContext.getApplicationContext().getI18nString("SelectCoordinateReferenceSystem"), AppContext.getApplicationContext().getI18nString("CoordinateReferenceSystem"), JOptionPane.PLAIN_MESSAGE, null, new ArrayList( CoordinateSystemRegistry.instance( context.getWorkbenchContext().getBlackboard()) .getCoordinateSystems()) .toArray(), context.getLayerManager().getCoordinateSystem()); if (destination == null) { return false; } if (context.getLayerManager().getCoordinateSystem() == destination) { return true; } if (Reprojector.instance() .wouldChangeValues(context.getLayerManager().getCoordinateSystem(), destination)) { // Two-phase commit [Jon Aquino] ArrayList transactions = new ArrayList(); for (Iterator i = context.getLayerManager().iterator(); i.hasNext(); ) { Layer layer = (Layer) i.next(); EditTransaction transaction = new EditTransaction( layer.getFeatureCollectionWrapper().getFeatures(), getName(), layer, isRollingBackInvalidEdits(context), false, context.getLayerViewPanel()); for (int j = 0; j < transaction.size(); j++) { Reprojector.instance() .reproject( transaction.getGeometry(j), context.getLayerManager().getCoordinateSystem(), destination); } transactions.add(transaction); } EditTransaction.commit(transactions); } // cambia for (Iterator i = context.getLayerManager().iterator(); i.hasNext(); ) { Layer layer = (Layer) i.next(); layer.getFeatureCollectionWrapper().getFeatureSchema().setCoordinateSystem(destination); DataSourceQuery dsq = layer.getDataSourceQuery(); if (dsq != null) dsq.getDataSource() .getProperties() .put(DataSource.COORDINATE_SYSTEM_KEY, destination.getName()); } context.getLayerManager().setCoordinateSystem(destination); if (context.getLayerViewPanel() != null) { context.getLayerViewPanel().getViewport().zoomToFullExtent(); } return true; }
public boolean execute(PlugInContext context) throws Exception { LineString a = null; List capasVisibles = context.getWorkbenchContext().getLayerNamePanel().getLayerManager().getVisibleLayers(true); context.getLayerViewPanel().getLayerManager().getVisibleLayers(true); context.getLayerNamePanel().getLayerManager().getVisibleLayers(false); Iterator capasVisiblesIter = capasVisibles.iterator(); boolean cancelWhile = false; final LockManager lockManager = (LockManager) context .getActiveTaskComponent() .getLayerViewPanel() .getBlackboard() .get(LockManager.LOCK_MANAGER_KEY); while (capasVisiblesIter.hasNext()) { Layer capaActual = (Layer) capasVisiblesIter.next(); Collection featuresSeleccionadas = context .getWorkbenchContext() .getLayerViewPanel() .getSelectionManager() .getFeaturesWithSelectedItems(capaActual); // Almacenamos en este ArrayList el resultado de la operacion de // bloqueo Iterator featuresSeleccionadasIter = featuresSeleccionadas.iterator(); while (featuresSeleccionadasIter.hasNext()) { if (cancelWhile == true) { if (JOptionPane.showConfirmDialog( (Component) context.getWorkbenchGuiComponent(), aplicacion.getI18nString("GeopistaFeatureSchemaPlugIn.RestoFeatures"), aplicacion.getI18nString("GeopistaFeatureSchemaPlugIn.EditarMultiplesEntidades"), JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) return false; else cancelWhile = false; } localFeature = (Feature) featuresSeleccionadasIter.next(); String systemId = ((GeopistaFeature) localFeature).getSystemId(); final ArrayList lockResultaArrayList = new ArrayList(); // capa de sistema. La feature debe bloquearse if (capaActual instanceof GeopistaLayer && !((GeopistaLayer) capaActual).isLocal() && !((GeopistaLayer) capaActual).isExtracted() && capaActual.isEditable() && systemId != null && !((GeopistaFeature) localFeature).isTempID() && !systemId.equals("")) { final TaskMonitorDialog progressDialog = new TaskMonitorDialog(aplicacion.getMainFrame(), context.getErrorHandler()); progressDialog.setTitle(aplicacion.getI18nString("LockFeatures")); progressDialog.addComponentListener( new ComponentAdapter() { public void componentShown(ComponentEvent e) { // Wait for the dialog to appear before starting the // task. Otherwise // the task might possibly finish before the dialog // appeared and the // dialog would never close. [Jon Aquino] new Thread( new Runnable() { public void run() { try { Integer lockID = lockManager.lockFeature(localFeature, progressDialog); lockResultaArrayList.add(lockID); } catch (Exception e) { } finally { progressDialog.setVisible(false); } } }) .start(); } }); GUIUtil.centreOnWindow(progressDialog); progressDialog.setVisible(true); } FeatureDialog featureDialog = new FeatureDialog( GeopistaFunctionUtils.getFrame(context.getWorkbenchGuiComponent()), "Atributos", true, localFeature, context.getWorkbenchContext().getLayerViewPanel(), capaActual); Integer tempLockID = null; Iterator lockResultaArrayListIter = lockResultaArrayList.iterator(); if (lockResultaArrayListIter.hasNext()) { tempLockID = (Integer) lockResultaArrayListIter.next(); } final Integer lockID = tempLockID; try { ImageIcon icon = IconLoader.icon("logo_geopista.png"); featureDialog.setSideBarImage(null); } catch (NullPointerException e) { e.printStackTrace(); } if (capaActual instanceof GeopistaLayer) { String extendedForm = ((GeopistaLayer) capaActual).getFieldExtendedForm(); if (extendedForm == null) extendedForm = ""; if (!extendedForm.equals("")) { featureDialog.setExtendedForm(extendedForm); } } featureDialog.buildDialog(); if ((capaActual instanceof GeopistaLayer && (((GeopistaLayer) capaActual).isLocal() || ((GeopistaLayer) capaActual).isExtracted()) && !capaActual.isEditable()) || (lockID == null && capaActual instanceof GeopistaLayer && !((GeopistaLayer) capaActual).isLocal() && !((GeopistaLayer) capaActual).isExtracted() && !capaActual.isEditable() && systemId != null && !((GeopistaFeature) localFeature).isTempID() && !systemId.equals(""))) { featureDialog.setLock(); } featureDialog.setVisible(true); // solo para GeopistaLayer if (featureDialog.wasOKPressed()) { if (capaActual.isEditable()) { if (capaActual instanceof GeopistaLayer && !((GeopistaLayer) capaActual).isLocal() && lockID == null) continue; // obtenemos la feature con los cambios introducidos por // el usuario clonefeature = featureDialog.getModifiedFeature(); // Actualiza los parámetros execute( new UndoableCommand(getName()) { public void execute() { localFeature.setAttributes(clonefeature.getAttributes()); } public void unexecute() { ((GeopistaFeature) clonefeature).setFireDirtyEvents(false); clonefeature.setAttributes(localFeature.getAttributes()); ((GeopistaFeature) clonefeature).setFireDirtyEvents(true); } }, context); } } else { // el usuario ha pedido cancelar la edición cancelWhile = true; } if (lockID != null) { final TaskMonitorDialog progressDialogFinal = new TaskMonitorDialog(aplicacion.getMainFrame(), context.getErrorHandler()); progressDialogFinal.setTitle(aplicacion.getI18nString("UnlockFeatures")); progressDialogFinal.addComponentListener( new ComponentAdapter() { public void componentShown(ComponentEvent e) { // Wait for the dialog to appear before starting // the // task. Otherwise // the task might possibly finish before the // dialog // appeared and the // dialog would never close. [Jon Aquino] new Thread( new Runnable() { public void run() { try { lockManager.unlockFeaturesByLockId(lockID, progressDialogFinal); } catch (Exception e) { } finally { progressDialogFinal.setVisible(false); } } }) .start(); } }); GUIUtil.centreOnWindow(progressDialogFinal); progressDialogFinal.setVisible(true); } } } return false; }