Search in sources :

Example 1 with ESpatialiteGeometryType

use of org.hortonmachine.dbs.datatypes.ESpatialiteGeometryType in project hortonmachine by TheHortonMachine.

the class GeopaparazziSpatialiteCreator method process.

// VARS DOCS END
@Execute
public void process() throws Exception {
    checkNull(inGeopaparazzi, inShapefilesFolder);
    if (pEncoding == null || pEncoding.trim().length() == 0) {
        pEncoding = "UTF-8";
    }
    if (pSizeFactor < 1) {
        pSizeFactor = 3;
    }
    if (pLinesWidthFactor < 1) {
        pLinesWidthFactor = 6;
    }
    File shpFolder = new File(inShapefilesFolder);
    File[] shpfiles = shpFolder.listFiles(new FilenameFilter() {

        @Override
        public boolean accept(File dir, String name) {
            return name.endsWith(".shp");
        }
    });
    if (shpfiles.length == 0) {
        throw new ModelsIOException("The supplied folder doesn't contain any shapefile.", this);
    }
    try (ASpatialDb db = new GTSpatialiteThreadsafeDb()) {
        if (!db.open(inGeopaparazzi)) {
            db.initSpatialMetadata(null);
        }
        if (!db.hasTable(SqlName.m(GeopaparazziDatabaseProperties.PROPERTIESTABLE))) {
            GeopaparazziDatabaseProperties.createPropertiesTable(db);
        } else {
            QueryResult qres1 = db.getTableRecordsMapFromRawSql("select * from dataproperties", 10);
            pm.message("Dataproperties already existing: ");
            for (Object[] objs : qres1.data) {
                pm.message(Arrays.toString(objs));
            }
            pm.message("----------------------------------");
        }
        pm.beginTask("Importing shapefiles...", shpfiles.length);
        for (File shpFile : shpfiles) {
            SqlName name = SqlName.m(FileUtilities.getNameWithoutExtention(shpFile));
            if (db.hasTable(name)) {
                pm.errorMessage("Table already existing: " + name);
                continue;
            }
            SimpleFeatureCollection fc = OmsVectorReader.readVector(shpFile.getAbsolutePath());
            SimpleFeatureType schema = fc.getSchema();
            CoordinateReferenceSystem crs = schema.getCoordinateReferenceSystem();
            String epsgStr = CrsUtilities.getCodeFromCrs(crs);
            String sirdStr = epsgStr.substring(5);
            int srid = Integer.parseInt(sirdStr);
            EGeometryType geomType = EGeometryType.forGeometryDescriptor(schema.getGeometryDescriptor());
            ESpatialiteGeometryType spatialiteGeometryType = geomType.toSpatialiteGeometryType();
            HMImportExportUtils.importShapefileThroughVirtualTable(db, name, shpFile.getAbsolutePath(), pEncoding, srid, spatialiteGeometryType);
            Style style = SldUtilities.getStyleFromFile(shpFile);
            if (style != null) {
                String uniqueName = "/#" + name + "#geometry";
                StyleWrapper styleWrapper = new StyleWrapper(style);
                List<FeatureTypeStyleWrapper> featureTypeStylesWrapperList = styleWrapper.getFeatureTypeStylesWrapperList();
                if (featureTypeStylesWrapperList.size() > 0) {
                    List<RuleWrapper> rulesWrapperList = new ArrayList<>();
                    for (FeatureTypeStyleWrapper ftsWrapper : featureTypeStylesWrapperList) {
                        List<RuleWrapper> rulesWrappers = ftsWrapper.getRulesWrapperList();
                        rulesWrapperList.addAll(rulesWrappers);
                    }
                    if (rulesWrapperList.size() == 1) {
                        RuleWrapper ruleWrapper = rulesWrapperList.get(0);
                        SymbolizerWrapper geometrySymbolizersWrapper = ruleWrapper.getGeometrySymbolizersWrapper();
                        if (geometrySymbolizersWrapper != null) {
                            org.hortonmachine.dbs.utils.BasicStyle gpStyle = createBaseStyle(db, uniqueName, rulesWrapperList);
                            populateStyleObject(gpStyle, geometrySymbolizersWrapper);
                            GeopaparazziDatabaseProperties.updateStyle(db, gpStyle);
                        }
                    } else if (rulesWrapperList.size() > 1) {
                        org.hortonmachine.dbs.utils.BasicStyle gpStyle = createBaseStyle(db, uniqueName, rulesWrapperList);
                        gpStyle.themeMap = new HashMap<>();
                        for (RuleWrapper ruleWrapper : rulesWrapperList) {
                            SymbolizerWrapper geometrySymbolizersWrapper = ruleWrapper.getGeometrySymbolizersWrapper();
                            org.hortonmachine.dbs.utils.BasicStyle themeStyle = createBaseStyle(null, uniqueName, rulesWrapperList);
                            populateStyleObject(themeStyle, geometrySymbolizersWrapper);
                            Filter filter = ruleWrapper.getRule().getFilter();
                            if (filter instanceof IsEqualsToImpl) {
                                IsEqualsToImpl equalsFilter = (IsEqualsToImpl) filter;
                                Expression expression1 = equalsFilter.getExpression1();
                                Expression expression2 = equalsFilter.getExpression2();
                                setFilter(gpStyle, themeStyle, expression1);
                                setFilter(gpStyle, themeStyle, expression2);
                            }
                        }
                        GeopaparazziDatabaseProperties.updateStyle(db, gpStyle);
                    } else {
                        pm.errorMessage("Unable to export SLD for: " + shpFile);
                        continue;
                    }
                }
            }
            pm.worked(1);
        }
        pm.done();
        QueryResult qres = db.getTableRecordsMapFromRawSql("select * from dataproperties", 100);
        pm.message("Dataproperties inserted: ");
        int theme = qres.names.indexOf(org.hortonmachine.dbs.utils.BasicStyle.THEME);
        for (Object[] objs : qres.data) {
            String themeString = objs[theme].toString().replaceAll("\\s+", " ");
            if (themeString.length() > 20) {
                objs[theme] = themeString.substring(0, 15) + "...";
            }
            pm.message(Arrays.toString(objs));
        }
    }
}
Also used : HashMap(java.util.HashMap) FeatureTypeStyleWrapper(org.hortonmachine.gears.utils.style.FeatureTypeStyleWrapper) ArrayList(java.util.ArrayList) RuleWrapper(org.hortonmachine.gears.utils.style.RuleWrapper) FilenameFilter(java.io.FilenameFilter) QueryResult(org.hortonmachine.dbs.compat.objects.QueryResult) SqlName(org.hortonmachine.dbs.utils.SqlName) Style(org.geotools.styling.Style) CoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem) ASpatialDb(org.hortonmachine.dbs.compat.ASpatialDb) GTSpatialiteThreadsafeDb(org.hortonmachine.gears.spatialite.GTSpatialiteThreadsafeDb) LineSymbolizerWrapper(org.hortonmachine.gears.utils.style.LineSymbolizerWrapper) TextSymbolizerWrapper(org.hortonmachine.gears.utils.style.TextSymbolizerWrapper) PolygonSymbolizerWrapper(org.hortonmachine.gears.utils.style.PolygonSymbolizerWrapper) PointSymbolizerWrapper(org.hortonmachine.gears.utils.style.PointSymbolizerWrapper) SymbolizerWrapper(org.hortonmachine.gears.utils.style.SymbolizerWrapper) IsEqualsToImpl(org.geotools.filter.IsEqualsToImpl) SimpleFeatureCollection(org.geotools.data.simple.SimpleFeatureCollection) ESpatialiteGeometryType(org.hortonmachine.dbs.datatypes.ESpatialiteGeometryType) SimpleFeatureType(org.opengis.feature.simple.SimpleFeatureType) StyleWrapper(org.hortonmachine.gears.utils.style.StyleWrapper) FeatureTypeStyleWrapper(org.hortonmachine.gears.utils.style.FeatureTypeStyleWrapper) FilenameFilter(java.io.FilenameFilter) Filter(org.opengis.filter.Filter) Expression(org.opengis.filter.expression.Expression) ModelsIOException(org.hortonmachine.gears.libs.exceptions.ModelsIOException) File(java.io.File) EGeometryType(org.hortonmachine.gears.utils.geometry.EGeometryType) Execute(oms3.annotations.Execute)

Example 2 with ESpatialiteGeometryType

use of org.hortonmachine.dbs.datatypes.ESpatialiteGeometryType in project hortonmachine by TheHortonMachine.

the class DatabaseController method addDataTableContextMenu.

private void addDataTableContextMenu(JTable table) {
    JPopupMenu popupMenu = new JPopupMenu();
    popupMenu.setBorder(new BevelBorder(BevelBorder.RAISED));
    popupMenu.addPopupMenuListener(new PopupMenuListener() {

        @Override
        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            int[] selectedRows = table.getSelectedRows();
            int[] selectedCols = table.getSelectedColumns();
            boolean isGeom = false;
            boolean isBinary = false;
            boolean proposeChart = false;
            ESpatialiteGeometryType geomType = null;
            if (selectedCols.length == 1 && selectedRows.length > 0) {
                // check content
                Object valueObj = table.getValueAt(selectedRows[0], selectedCols[0]);
                if (valueObj instanceof byte[] || valueObj instanceof JdbcBlob) {
                    isBinary = true;
                }
                String valueAt = valueObj.toString();
                String checkString = valueAt.split("\\(")[0].trim();
                checkString = removeSrid(checkString);
                if (ESpatialiteGeometryType.isGeometryName(checkString)) {
                    isGeom = true;
                    geomType = ESpatialiteGeometryType.forName(checkString);
                }
            }
            if (selectedCols.length > 1 && selectedRows.length > 1) {
                proposeChart = true;
            }
            JMenuItem item = new JMenuItem(new AbstractAction("Copy cells content") {

                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                    table.getTransferHandler().exportToClipboard(table, clipboard, TransferHandler.COPY);
                }
            });
            item.setHorizontalTextPosition(JMenuItem.RIGHT);
            popupMenu.add(item);
            if (isBinary) {
                JMenuItem item1 = new JMenuItem(new AbstractAction("View as image") {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        for (int r : selectedRows) {
                            Object valueObj = table.getValueAt(r, selectedCols[0]);
                            byte[] bytes = null;
                            if (valueObj instanceof JdbcBlob) {
                                JdbcBlob blob = (JdbcBlob) valueObj;
                                try {
                                    bytes = blob.getBytes(0, (int) blob.length());
                                } catch (SQLException e1) {
                                    Logger.INSTANCE.e("error reading image bytes", e1);
                                    continue;
                                }
                            } else if (valueObj instanceof byte[]) {
                                bytes = (byte[]) valueObj;
                            }
                            if (bytes != null) {
                                try {
                                    BufferedImage image = ImageIO.read(new ByteArrayInputStream(bytes));
                                    GuiUtilities.showImage(popupMenu, valueObj.toString(), image);
                                } catch (IOException e1) {
                                    GuiUtilities.showWarningMessage(popupMenu, "Not an image.");
                                    break;
                                }
                            }
                        }
                    }
                });
                item1.setHorizontalTextPosition(JMenuItem.RIGHT);
                popupMenu.add(item1);
                JMenuItem itemToString = new JMenuItem(new AbstractAction("View as string") {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        for (int r : selectedRows) {
                            Object valueObj = table.getValueAt(r, selectedCols[0]);
                            byte[] bytes = null;
                            if (valueObj instanceof JdbcBlob) {
                                JdbcBlob blob = (JdbcBlob) valueObj;
                                try {
                                    bytes = blob.getBytes(0, (int) blob.length());
                                } catch (SQLException e1) {
                                    Logger.INSTANCE.e("error reading image bytes", e1);
                                    continue;
                                }
                            } else if (valueObj instanceof byte[]) {
                                bytes = (byte[]) valueObj;
                            }
                            if (bytes != null) {
                                String string = new String(bytes);
                                JTextArea tArea = new JTextArea(string, 10, 20);
                                JPanel p = new JPanel(new BorderLayout());
                                final JScrollPane scroll = new JScrollPane(tArea);
                                p.add(scroll, BorderLayout.CENTER);
                                tArea.setLineWrap(true);
                                GuiUtilities.openDialogWithPanel(p, "Cell as string", new Dimension(600, 500), false);
                            }
                        }
                    }
                });
                itemToString.setHorizontalTextPosition(JMenuItem.RIGHT);
                popupMenu.add(itemToString);
            }
            if (proposeChart) {
                JMenuItem item1 = new JMenuItem(new AbstractAction("Chart values") {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        try {
                            int chartsCount = selectedCols.length - 1;
                            String xLabel = table.getColumnName(selectedCols[0]);
                            Scatter scatterChart = null;
                            CategoryHistogram categoryHistogram = null;
                            for (int i = 0; i < chartsCount; i++) {
                                Object tmpX = table.getValueAt(0, selectedCols[0]);
                                boolean doCat = true;
                                if (tmpX instanceof Number) {
                                    doCat = false;
                                }
                                Object tmpY = table.getValueAt(0, selectedCols[i + 1]);
                                if (!(tmpY instanceof Number)) {
                                    break;
                                }
                                if (doCat) {
                                    if (categoryHistogram == null) {
                                        String[] xStr = new String[selectedRows.length];
                                        double[] y = new double[selectedRows.length];
                                        for (int r : selectedRows) {
                                            Object xObj = table.getValueAt(r, selectedCols[0]);
                                            Object yObj = table.getValueAt(r, selectedCols[i + 1]);
                                            xStr[r] = xObj.toString();
                                            y[r] = ((Number) yObj).doubleValue();
                                        }
                                        categoryHistogram = new CategoryHistogram(xStr, y);
                                    }
                                } else {
                                    if (scatterChart == null) {
                                        scatterChart = new Scatter("");
                                        List<Boolean> showLines = new ArrayList<Boolean>();
                                        for (int j = 0; j < chartsCount; j++) {
                                            showLines.add(true);
                                        }
                                        scatterChart.setShowLines(showLines);
                                        scatterChart.setXLabel(xLabel);
                                        scatterChart.setYLabel("");
                                    }
                                    double[] x = new double[selectedRows.length];
                                    double[] y = new double[selectedRows.length];
                                    String seriesName = table.getColumnName(selectedCols[i + 1]);
                                    for (int r : selectedRows) {
                                        Object xObj = table.getValueAt(r, selectedCols[0]);
                                        Object yObj = table.getValueAt(r, selectedCols[i + 1]);
                                        x[r] = ((Number) xObj).doubleValue();
                                        y[r] = ((Number) yObj).doubleValue();
                                    }
                                    scatterChart.addSeries(seriesName, x, y);
                                }
                            }
                            Dimension dimension = new Dimension(800, 600);
                            if (scatterChart != null) {
                                JFreeChart chart = scatterChart.getChart();
                                ChartPanel chartPanel = new ChartPanel(chart, true);
                                chartPanel.setPreferredSize(dimension);
                                JPanel p = new JPanel(new BorderLayout());
                                p.add(chartPanel, BorderLayout.CENTER);
                                GuiUtilities.openDialogWithPanel(p, "Chart from cells", dimension, false);
                            } else if (categoryHistogram != null) {
                                JFreeChart chart = categoryHistogram.getChart();
                                ChartPanel chartPanel = new ChartPanel(chart, true);
                                chartPanel.setPreferredSize(dimension);
                                JPanel p = new JPanel(new BorderLayout());
                                p.add(chartPanel, BorderLayout.CENTER);
                                GuiUtilities.openDialogWithPanel(p, "Chart from cells", dimension, false);
                            } else {
                                GuiUtilities.showWarningMessage(popupMenu, "Charting of selected data not possible.");
                            }
                        } catch (Exception ex) {
                            Logger.INSTANCE.insertError("", "ERROR", ex);
                        }
                    }
                });
                item1.setHorizontalTextPosition(JMenuItem.RIGHT);
                popupMenu.add(item1);
            }
            if (isGeom) {
                JMenuItem item1 = new JMenuItem(new AbstractAction("View geometry") {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        WKTReader wktReader = new WKTReader();
                        List<Geometry> geomsList = new ArrayList<>();
                        for (int r : selectedRows) {
                            try {
                                String valueAt = table.getValueAt(r, selectedCols[0]).toString();
                                valueAt = removeSrid(valueAt);
                                Geometry geometry = wktReader.read(valueAt);
                                if (geometry instanceof GeometryCollection) {
                                    int numGeometries = geometry.getNumGeometries();
                                    for (int j = 0; j < numGeometries; j++) {
                                        Geometry geometryN = geometry.getGeometryN(j);
                                        geomsList.add(geometryN);
                                    }
                                } else {
                                    geomsList.add(geometry);
                                }
                            } catch (ParseException e1) {
                                Logger.INSTANCE.insertError("", "ERROR", e1);
                            }
                        }
                        if (geomsList.size() > 0) {
                            List<SimpleFeatureCollection> fcs = FeatureUtilities.featureCollectionsFromGeometry(null, geomsList.toArray(new Geometry[0]));
                            showInMapFrame(false, fcs.toArray(new SimpleFeatureCollection[0]), null);
                        }
                    }
                });
                item1.setHorizontalTextPosition(JMenuItem.RIGHT);
                popupMenu.add(item1);
                JMenuItem item2 = new JMenuItem(new AbstractAction("Plot geometry") {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        WKTReader wktReader = new WKTReader();
                        List<Geometry> geomsList = new ArrayList<>();
                        for (int r : selectedRows) {
                            try {
                                String valueAt = table.getValueAt(r, selectedCols[0]).toString();
                                valueAt = removeSrid(valueAt);
                                Geometry geometry = wktReader.read(valueAt);
                                if (geometry instanceof GeometryCollection) {
                                    int numGeometries = geometry.getNumGeometries();
                                    for (int j = 0; j < numGeometries; j++) {
                                        Geometry geometryN = geometry.getGeometryN(j);
                                        geomsList.add(geometryN);
                                    }
                                } else {
                                    geomsList.add(geometry);
                                }
                            } catch (ParseException e1) {
                                Logger.INSTANCE.insertError("", "ERROR", e1);
                            }
                        }
                        if (geomsList.size() > 0) {
                            HM.plotJtsGeometries(null, geomsList);
                        }
                    }
                });
                item2.setHorizontalTextPosition(JMenuItem.RIGHT);
                popupMenu.add(item2);
                if (geomType != null && !geomType.isPoint()) {
                    JMenuItem item3 = new JMenuItem(new AbstractAction("View geometry with directions hint") {

                        private static final long serialVersionUID = 1L;

                        @Override
                        public void actionPerformed(ActionEvent e) {
                            WKTReader wktReader = new WKTReader();
                            List<Geometry> geomsList = new ArrayList<>();
                            for (int r : selectedRows) {
                                try {
                                    String valueAt = table.getValueAt(r, selectedCols[0]).toString();
                                    valueAt = removeSrid(valueAt);
                                    Geometry geometry = wktReader.read(valueAt);
                                    if (geometry instanceof GeometryCollection) {
                                        int numGeometries = geometry.getNumGeometries();
                                        for (int j = 0; j < numGeometries; j++) {
                                            Geometry geometryN = geometry.getGeometryN(j);
                                            List<Polygon> simpleDirectionArrows = GeometryUtilities.createSimpleDirectionArrow(geometryN);
                                            geomsList.add(geometryN);
                                            geomsList.addAll(simpleDirectionArrows);
                                        }
                                    } else {
                                        List<Polygon> simpleDirectionArrows = GeometryUtilities.createSimpleDirectionArrow(geometry);
                                        geomsList.add(geometry);
                                        geomsList.addAll(simpleDirectionArrows);
                                    }
                                } catch (ParseException e1) {
                                    Logger.INSTANCE.insertError("", "ERROR", e1);
                                }
                            }
                            if (geomsList.size() > 0) {
                                List<SimpleFeatureCollection> fcs = FeatureUtilities.featureCollectionsFromGeometry(null, geomsList.toArray(new Geometry[0]));
                                showInMapFrame(false, fcs.toArray(new SimpleFeatureCollection[0]), null);
                            }
                        }
                    });
                    item3.setHorizontalTextPosition(JMenuItem.RIGHT);
                    popupMenu.add(item3);
                }
            }
        }

        private String removeSrid(String valueAt) {
            if (valueAt.startsWith("SRID=")) {
                valueAt = valueAt.split(";")[1];
            }
            return valueAt;
        }

        @Override
        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            popupMenu.removeAll();
        }

        @Override
        public void popupMenuCanceled(PopupMenuEvent e) {
            popupMenu.removeAll();
        }
    });
    table.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (SwingUtilities.isRightMouseButton(e)) {
                popupMenu.show(e.getComponent(), e.getX(), e.getY());
            }
        }
    });
}
Also used : JPanel(javax.swing.JPanel) JTextArea(javax.swing.JTextArea) ChartPanel(org.jfree.chart.ChartPanel) BevelBorder(javax.swing.border.BevelBorder) SQLException(java.sql.SQLException) JdbcSQLException(org.h2.jdbc.JdbcSQLException) ActionEvent(java.awt.event.ActionEvent) PopupMenuListener(javax.swing.event.PopupMenuListener) ArrayList(java.util.ArrayList) JdbcBlob(org.h2.jdbc.JdbcBlob) WKTReader(org.locationtech.jts.io.WKTReader) PopupMenuEvent(javax.swing.event.PopupMenuEvent) BufferedImage(java.awt.image.BufferedImage) GeometryCollection(org.locationtech.jts.geom.GeometryCollection) BorderLayout(java.awt.BorderLayout) JMenuItem(javax.swing.JMenuItem) Polygon(org.locationtech.jts.geom.Polygon) AbstractAction(javax.swing.AbstractAction) CategoryHistogram(org.hortonmachine.gears.utils.chart.CategoryHistogram) JScrollPane(javax.swing.JScrollPane) MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter) IOException(java.io.IOException) Dimension(java.awt.Dimension) JPopupMenu(javax.swing.JPopupMenu) JFreeChart(org.jfree.chart.JFreeChart) ParseException(org.locationtech.jts.io.ParseException) SQLException(java.sql.SQLException) IOException(java.io.IOException) JdbcSQLException(org.h2.jdbc.JdbcSQLException) SimpleFeatureCollection(org.geotools.data.simple.SimpleFeatureCollection) Geometry(org.locationtech.jts.geom.Geometry) ESpatialiteGeometryType(org.hortonmachine.dbs.datatypes.ESpatialiteGeometryType) ByteArrayInputStream(java.io.ByteArrayInputStream) JSONObject(org.json.JSONObject) Clipboard(java.awt.datatransfer.Clipboard) ParseException(org.locationtech.jts.io.ParseException) Scatter(org.hortonmachine.gears.utils.chart.Scatter)

Aggregations

ArrayList (java.util.ArrayList)2 SimpleFeatureCollection (org.geotools.data.simple.SimpleFeatureCollection)2 ESpatialiteGeometryType (org.hortonmachine.dbs.datatypes.ESpatialiteGeometryType)2 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 Clipboard (java.awt.datatransfer.Clipboard)1 ActionEvent (java.awt.event.ActionEvent)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 BufferedImage (java.awt.image.BufferedImage)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 FilenameFilter (java.io.FilenameFilter)1 IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1 HashMap (java.util.HashMap)1 AbstractAction (javax.swing.AbstractAction)1 JMenuItem (javax.swing.JMenuItem)1 JPanel (javax.swing.JPanel)1 JPopupMenu (javax.swing.JPopupMenu)1