Revision: 1249
http://jump-pilot.svn.sourceforge.net/jump-pilot/?rev=1249&view=rev
Author: stranger
Date: 2007-11-23 07:23:57 -0800 (Fri, 23 Nov 2007)
Log Message:
-----------
Cleaned up the code, made it type safe etc., renamed classes etc.
Modified Paths:
--------------
plug-ins/WFSPlugin/trunk/ChangeLog
plug-ins/WFSPlugin/trunk/lib/deegree2.jar
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/AbstractWFSWrapper.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/PropertyCriteriaPanel.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/PropertySelectionPanel.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/RequestTextArea.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/SpatialCriteriaPanel.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSDialog.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSLayer.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSLayerListener.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSOptionsPanel2.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSPanel.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSPanelButtons.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSPlugIn.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFServiceWrapper_1_0_0.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFServiceWrapper_1_1_0.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/transaction/TransactionFactory.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/transaction/UpdateWFSLayerPlugIn.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/ui/ExtensibleComboBox.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/ui/messages_de.properties
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/ui/messages_en.properties
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/ui/messages_fi.properties
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/ui/messages_fr.properties
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/util/data/WFSClientHelper.java
Added Paths:
-----------
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/WFSExtension.java
Removed Paths:
-------------
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/DeeJUMPExtension.java
plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/MiniMenu.java
Modified: plug-ins/WFSPlugin/trunk/ChangeLog
===================================================================
--- plug-ins/WFSPlugin/trunk/ChangeLog 2007-11-23 09:56:04 UTC (rev 1248)
+++ plug-ins/WFSPlugin/trunk/ChangeLog 2007-11-23 15:23:57 UTC (rev 1249)
@@ -1,4 +1,8 @@
2007-11-23 Andreas Schmitz <schmitz@...>
+ (almost all files):
+ Cleaned up the code, made it type safe etc., renamed classes etc.
+
+2007-11-23 Andreas Schmitz <schmitz@...>
src/de/latlon/deejump/plugin/wfs/transaction/UpdateWFSLayerPlugIn.java:
Better error handling for transactions.
Modified: plug-ins/WFSPlugin/trunk/lib/deegree2.jar
===================================================================
(Binary files differ)
Deleted: plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/DeeJUMPExtension.java
===================================================================
--- plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/DeeJUMPExtension.java 2007-11-23 09:56:04 UTC (rev 1248)
+++ plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/DeeJUMPExtension.java 2007-11-23 15:23:57 UTC (rev 1249)
@@ -1,36 +0,0 @@
-/*
- * (c) 2007 by lat/lon GmbH
- *
- * @author Ugo Taddei (taddei@...)
- *
- * This program is free software under the GPL (v2.0)
- * Read the file LICENSE.txt coming with the sources for details.
- */
-package de.latlon.deejump.plugin;
-
-import com.vividsolutions.jump.workbench.plugin.Extension;
-import com.vividsolutions.jump.workbench.plugin.PlugInContext;
-
-import de.latlon.deejump.plugin.wfs.WFSPlugIn;
-import de.latlon.deejump.plugin.wfs.transaction.UpdateWFSLayerPlugIn;
-
-
-/**
- * Installs WFS and WFS Update plugin.
- *
- * @author <a href="mailto:taddei@... Taddei</a>
- *
- */
-public class DeeJUMPExtension extends Extension {
-
- /**
- * @see com.vividsolutions.jump.workbench.plugin.Configuration#configure(com.vividsolutions.jump.workbench.plugin.PlugInContext)
- */
- public void configure( PlugInContext context ) throws Exception {
- System.out.println( "Installing latlon WFSPlugin" );
- new WFSPlugIn(null).install(context);
- System.out.println( "Installing latlon WFSUpdatePlugin" );
- new UpdateWFSLayerPlugIn().install(context);
- }
-
-}
Copied: plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/WFSExtension.java (from rev 1247, plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/DeeJUMPExtension.java)
===================================================================
--- plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/WFSExtension.java (rev 0)
+++ plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/WFSExtension.java 2007-11-23 15:23:57 UTC (rev 1249)
@@ -0,0 +1,31 @@
+/*
+ * (c) 2007 by lat/lon GmbH
+ *
+ * @author Ugo Taddei (taddei@...)
+ *
+ * This program is free software under the GPL (v2.0)
+ * Read the file LICENSE.txt coming with the sources for details.
+ */
+package de.latlon.deejump.plugin;
+
+import com.vividsolutions.jump.workbench.plugin.Extension;
+import com.vividsolutions.jump.workbench.plugin.PlugInContext;
+
+import de.latlon.deejump.plugin.wfs.WFSPlugIn;
+import de.latlon.deejump.plugin.wfs.transaction.UpdateWFSLayerPlugIn;
+
+/**
+ * Installs WFS and WFS Update plugin.
+ *
+ * @author <a href="mailto:taddei@... Taddei</a>
+ *
+ */
+public class WFSExtension extends Extension {
+
+ public void configure( PlugInContext context )
+ throws Exception {
+ new WFSPlugIn().initialize( context );
+ new UpdateWFSLayerPlugIn().initialize( context );
+ }
+
+}
Modified: plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/AbstractWFSWrapper.java
===================================================================
--- plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/AbstractWFSWrapper.java 2007-11-23 09:56:04 UTC (rev 1248)
+++ plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/AbstractWFSWrapper.java 2007-11-23 15:23:57 UTC (rev 1249)
@@ -17,9 +17,6 @@
import java.util.Map;
import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.params.HttpClientParams;
import org.apache.log4j.Logger;
import org.deegree.datatypes.QualifiedName;
@@ -54,17 +51,11 @@
protected Map<String, WFSFeatureType> ftNameToWfsFT;
- /**
- * Maps a feature type to its schem. Geometry property is not held here!
- */
private Map<String, GMLSchema> featureTypeToSchema;
// hmmm, this is repating the above, really...
private Map<String, String> featureTypeToSchemaXML;
- /**
- * Maps a feature type to its geometry!
- */
private Map<String, QualifiedName[]> geoPropsNameToQNames;
private HttpClient httpClient;
@@ -75,24 +66,14 @@
public abstract String[] getFeatureTypes();
- // public abstract String[] getProperties(String featureType);
-
- // public abstract QualifiedName[] getGeometryProperties(String featureType);
-
public abstract String getGetFeatureURL();
- // public abstract QualifiedName getQualiNameByFeatureTypeName( String ftName );
-
- // abstract protected String createCapabilitiesOnlineResource();
-
- // perhaps use a map for these???
abstract protected String createDescribeFTOnlineResource();
public String getBaseWfsURL() {
return this.baseURL;
}
- // not abs
public abstract String getCapabilitesAsString();
protected AbstractWFSWrapper( UserData logins, String baseUrl ) {
@@ -108,7 +89,7 @@
}
- public String getCapabilitiesURL() {
+ protected String getCapabilitiesURL() {
StringBuffer sb = new StringBuffer( OWSUtils.validateHTTPGetBaseURL( this.baseURL ) );
sb.append( "SERVICE=WFS&REQUEST=GetCapabilities&VERSION=" );
@@ -192,60 +173,6 @@
}
- // protected String loadSchemaForFeatureType2(String featureType) throws DeeJUMPException {
- //
- // //unfortunately no time for moving this out of here
- // boolean isGet = true;
- //
- // String descrFtUrl = createDescribeFTOnlineResource();
- //
- // if( descrFtUrl == null ){
- // throw new RuntimeException( "Service does not have a DescribeFeatureType operation accessible
- // by HTTP GET or POST." );
- // }
- //
- // WFSFeatureType wfsFt = getFeatureTypeByName( featureType );
- // if ( wfsFt == null ){
- // return null;
- // }
- //
- // QualifiedName ft = wfsFt.getName();
- //
- // String serverReq = getDescribeTypeURL( ft );
- // String httpProtocolMethod = isGet ? "HTTP_GET" : "HTTP_POST" ;
- //
- // LOG.debug( "Using " + httpProtocolMethod + " to get feature type description from " +
- // descrFtUrl + serverReq);
- //
- // HttpMethod httpMethod = createHttpMethod( httpProtocolMethod );//new GetMethod( serverUrl );
- // URI uri;
- // try {
- //
- // uri = new URI( getBaseWfsURL(), true );
- // httpMethod.setURI( uri );
- //
- // } catch ( URIException e ) {
- // throw new DeeJUMPException(e);
- // }
- //
- // //only input here what's after the '?'
- // // httpMethod.setQueryString( serverReq.split( "\\?" )[1] );
- // try {
- // httpClient.executeMethod(httpMethod);
- // GMLSchemaDocument xsdDoc = new GMLSchemaDocument();
- // xsdDoc.load( new URL(serverReq ) );//httpMethod.getResponseBodyAsStream(), serverReq );
- //
- // return DOMPrinter.nodeToString( xsdDoc.getRootElement(), null );
- // } catch ( Exception e ) {
- // e.printStackTrace();
- // String mesg = "Error fetching FeatureType description";
- // LOG.error( mesg + " for " + featureType + " from "
- // + uri + " using " + serverReq);
- // throw new DeeJUMPException( mesg,e);
- // }
- //
- // }
-
/**
* Creates an String[] containing the attributes of a given feature type
*
@@ -290,7 +217,7 @@
PropertyType[] props = fts[i].getProperties();
for ( int j = 0; j < props.length; j++ ) {
if ( !( props[j].getType() == Types.GEOMETRY || props[j].getType() == 10014 ) ) {
- propsList.add( props[j].getName().getAsString() );
+ propsList.add( props[j].getName().getPrefixedName() );
}
}
}
@@ -303,47 +230,19 @@
return propsList.toArray( new String[propsList.size()] );
}
- public WFSFeatureType getFeatureTypeByName( String ftName ) {
+ public synchronized WFSFeatureType getFeatureTypeByName( String ftName ) {
if ( ftNameToWfsFT == null ) {
getFeatureTypes(); // side effects in functions that return lists are wonderful
}
return ftNameToWfsFT.get( ftName );
}
- /**
- * guess which property might be "the" geometry property
- *
- * @param propNames
- * @return a list of qualified names
- */
- protected QualifiedName[] guessGeomProperty2( GMLSchema schema ) {
-
+ private static QualifiedName[] guessGeomProperty( GMLSchema schema, String featureTypeName ) {
QualifiedName[] geoPropNames = null;
List<QualifiedName> tmpList = new ArrayList<QualifiedName>( 20 );
FeatureType[] fts = schema.getFeatureTypes();
for ( int i = 0; i < fts.length; i++ ) {
- PropertyType[] props = fts[i].getProperties();
- for ( int j = 0; j < props.length; j++ ) {
-
- if ( props[j].getType() == Types.GEOMETRY ) {
- tmpList.add( props[j].getName() );
-
- }
- }
- }
-
- geoPropNames = tmpList.toArray( new QualifiedName[tmpList.size()] );
-
- return geoPropNames;
- }
-
- protected static QualifiedName[] guessGeomProperty( GMLSchema schema, String featureTypeName ) {
- QualifiedName[] geoPropNames = null;
- List<QualifiedName> tmpList = new ArrayList<QualifiedName>( 20 );
-
- FeatureType[] fts = schema.getFeatureTypes();
- for ( int i = 0; i < fts.length; i++ ) {
if ( !fts[i].getName().getLocalName().equals( featureTypeName ) ) {
continue;
}
@@ -376,19 +275,4 @@
}
- protected HttpMethod createHttpMethod( String methodName ) {
-
- HttpMethod httpMethod = null;
-
- if ( "HTTP_GET".equals( methodName ) ) {
- httpMethod = new GetMethod();
- } else if ( "HTTP_POST".equals( methodName ) ) {
- httpMethod = new PostMethod();
- } else {
- throw new IllegalArgumentException( "method mame must be either 'HTTP_GET' or 'HTTP_POST'" );
- }
-
- return httpMethod;
- }
-
}
Deleted: plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/MiniMenu.java
===================================================================
--- plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/MiniMenu.java 2007-11-23 09:56:04 UTC (rev 1248)
+++ plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/MiniMenu.java 2007-11-23 15:23:57 UTC (rev 1249)
@@ -1,85 +0,0 @@
-/*
- * (c) 2007 by lat/lon GmbH
- *
- * @author Ugo Taddei (taddei@...)
- *
- * This program is free software under the GPL (v2.0)
- * Read the file LICENSE.txt coming with the sources for details.
- */
-
-package de.latlon.deejump.plugin.wfs;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-import javax.swing.JFileChooser;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-
-/**
- * My minimalistic version of a Menu. It only has menu items for saving
- * a request, a response and exiting the application.
- *
- * @author <a href="mailto:taddei@... Taddei</a>
- * @author last edited by: $Author$
- *
- * @version $Revision$, $Date$
- */
-class MiniMenu extends JMenuBar {
-
- public MiniMenu( final WFSPanel wfsPanel ) {
- super();
-
- JMenu topMenu = new JMenu("File");
-
- JMenuItem subMenu = new JMenuItem( "Save Request" );
- topMenu.add( subMenu );
- subMenu.addActionListener( new ActionListener(){
- public void actionPerformed( ActionEvent e ) {
- WFSPanel.saveTextToFile( MiniMenu.this, wfsPanel.getRequest() );
- }
- } );
-
- subMenu = new JMenuItem( "Save Response" );
- topMenu.add( subMenu );
- subMenu.addActionListener( new ActionListener(){
- public void actionPerformed( ActionEvent e ) {
- WFSPanel.saveTextToFile( MiniMenu.this, wfsPanel.getResponse() );
- }
- } );
-
-
- topMenu.addSeparator();
-
- subMenu = new JMenuItem( "Exit" );
- subMenu.addActionListener( new ActionListener(){
- public void actionPerformed( ActionEvent e ) {
- System.exit( 0 );
- }
- } );
- topMenu.add( subMenu );
- add( topMenu );
-
-
- }
-}
-
-/* ********************************************************************
-Changes to this class. What the people have been up to:
-
-$Log$
-Revision 1.3 2007/05/02 07:59:40 taddei
-Moved saveTextToFile() to WFSPanel
-
-Revision 1.2 2007/04/27 07:27:29 taddei
-More major refactoring to use WFSPanel the WFSFrame) and in the WFSDialog. Also some GUI improvements.
-
-Revision 1.1 2007/04/26 09:19:26 taddei
-Added initial working version of classes and complementary files.
-
-********************************************************************** */
\ No newline at end of file
Modified: plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/PropertyCriteriaPanel.java
===================================================================
--- plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/PropertyCriteriaPanel.java 2007-11-23 09:56:04 UTC (rev 1248)
+++ plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/PropertyCriteriaPanel.java 2007-11-23 15:23:57 UTC (rev 1249)
@@ -9,7 +9,6 @@
package de.latlon.deejump.plugin.wfs;
-import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.LayoutManager;
@@ -34,8 +33,6 @@
import javax.swing.JTextField;
import org.deegree.datatypes.QualifiedName;
-import org.deegree.framework.xml.DOMPrinter;
-import org.deegree.model.feature.schema.GMLSchema;
import org.deegree.model.filterencoding.AbstractOperation;
import org.deegree.model.filterencoding.Literal;
import org.deegree.model.filterencoding.PropertyIsCOMPOperation;
@@ -44,57 +41,67 @@
import de.latlon.deejump.ui.I18N;
-
-
/**
- * This panel is a graphical user interface to attribute-based feature search.
- * It is intended to be used inside a <code>FeatureResearchDialog</code><p/>
- * Original design: Poth
+ * This panel is a graphical user interface to attribute-based feature search. It is intended to be
+ * used inside a <code>FeatureResearchDialog</code><p/> Original design: Poth
+ *
* @author <a href="mailto:taddei@... Taddei</a>
*
*/
class PropertyCriteriaPanel extends JPanel {
-
- /**The possible logical relationships between operations*/
- public static final String[] logicalRelationships = new String[]{"And", "Or"}; //$NON-NLS-1$ //$NON-NLS-2$
-
- /**The current realtionship between attribute clauses*/
+
+ private static final long serialVersionUID = -8442782775743228607L;
+
+ /** The possible logical relationships between operations */
+ public static final String[] logicalRelationships = new String[] { "And", "Or" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+ /** The current realtionship between attribute clauses */
protected String currentRelationship = logicalRelationships[0];
-
+
protected String _featureTypeName = "dummyType"; //$NON-NLS-1$
- protected String[] _attributeNames = new String[]{""}; //$NON-NLS-1$
-
+
+ protected String[] _attributeNames = new String[] { "" }; //$NON-NLS-1$
+
// will be NONE, BBOX, SEL_GEOM
- private String spatialSearchCriteria = WFSPanel.NONE;
-
- /**A list containing the criteria */
- private ArrayList criteriaList = new ArrayList();
-
- /**The parent dialog. Keep this reference to make matters simple */
- private WFSPanel researchDialog;
+ String spatialSearchCriteria = WFSPanel.NONE;
+ /** A list containing the criteria */
+ ArrayList<AttributeComparisonPanel> criteriaList = new ArrayList<AttributeComparisonPanel>();
+
+ /** The parent dialog. Keep this reference to make matters simple */
+ WFSPanel wfsPanel;
+
protected JComboBox featureTypeCombo;
-
+
protected JLabel attLabel;
+
protected JLabel operLabel;
+
protected JLabel valLabel;
+
protected JButton newCriteriaButton;
- protected JButton remCriteriaButton;
- protected JButton describeFTButton;
+
+ protected JButton remCriteriaButton;
+
+ protected JButton describeFTButton;
+
protected JComponent criteriaListPanel;
+
protected JRadioButton selecGeoButton;
+
protected JRadioButton noCritButton;
+
protected JPanel criteriaPanel;
-
// Layout Constants
protected static final int LEFT_MARGIN = 10;
+
protected static final int SECOND_COL = 140;
+
protected static final int THIRD_COL = 200;
-
+
protected static final int STD_HEIGHT = 22;
-
-
+
protected JCheckBox editableCheckBox;
private JRadioButton bboxCritButton;
@@ -102,462 +109,469 @@
private AbstractButton andButton;
private JRadioButton orButton;
-
-
+
/**
* Creates an AttributeResearchPanel.
- * @param rd the parent FeatureResearchDialog
+ *
+ * @param panel
+ * @param jcb
*/
- public PropertyCriteriaPanel( WFSPanel rd, JComboBox jcb) {
+ public PropertyCriteriaPanel( WFSPanel panel, JComboBox jcb ) {
super();
- this.researchDialog = rd;
- initGUI(jcb);
+ this.wfsPanel = panel;
+ initGUI( jcb );
}
/** Initialize GUI */
- private void initGUI(JComboBox jcb){
-
- LayoutManager lm = new BoxLayout( this, BoxLayout.PAGE_AXIS);
+ private void initGUI( JComboBox jcb ) {
+
+ LayoutManager lm = new BoxLayout( this, BoxLayout.PAGE_AXIS );
setLayout( lm );
JPanel p = new JPanel();
- describeFTButton = new JButton(I18N.getString("AttributeResearchPanel.describeFeatType"));
+ describeFTButton = new JButton( I18N.getString( "AttributeResearchPanel.describeFeatType" ) );
describeFTButton.setEnabled( false );
- describeFTButton.addActionListener( new ActionListener(){
+ describeFTButton.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e ) {
- QualifiedName ft = PropertyCriteriaPanel.this.researchDialog.getFeatureType();
- String schema = PropertyCriteriaPanel.this.researchDialog.getWfService().getRawSchemaForFeatureType( ft.getLocalName() );
- researchDialog.createXMLFrame( PropertyCriteriaPanel.this, schema );
+ QualifiedName ft = PropertyCriteriaPanel.this.wfsPanel.getFeatureType();
+ String schema = PropertyCriteriaPanel.this.wfsPanel.getWfService().getRawSchemaForFeatureType(
+ ft.getLocalName() );
+ wfsPanel.createXMLFrame( PropertyCriteriaPanel.this, schema );
}
- });
+ } );
p.add( describeFTButton );
- add( p );
- //FIXME this is bad, keeping a ref
+ add( p );
+
featureTypeCombo = jcb;
- //featureTypeCombo.setBounds(90,40,120,STD_HEIGHT);
-
- featureTypeCombo.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
+
+ featureTypeCombo.addActionListener( new java.awt.event.ActionListener() {
+ public void actionPerformed( java.awt.event.ActionEvent evt ) {
refreshPanel();
}
- });
-
- add( createCriteriaPanel() );
+ } );
+
+ add( createCriteriaPanel() );
add( createCriteriaButtons() );
JPanel innerPanel = new JPanel();
- innerPanel.add( createLogicalButtons() );
- innerPanel.add( Box.createHorizontalStrut( 10 ) );
+ innerPanel.add( createLogicalButtons() );
+ innerPanel.add( Box.createHorizontalStrut( 10 ) );
innerPanel.add( createSpatialButtons() );
add( innerPanel );
-// add( createEditableCheckBox());
}
-
+
public void refreshPanel() {
criteriaListPanel.removeAll();
criteriaList.clear();
criteriaListPanel.revalidate();
criteriaListPanel.repaint();
- setHeadersEnabled(false);
+ setHeadersEnabled( false );
}
- /**Creates the panel where the criteria list will be shown*/
- private JComponent createCriteriaPanel(){
+
+ /** Creates the panel where the criteria list will be shown */
+ private JComponent createCriteriaPanel() {
JPanel criteriaPanel = new JPanel();
- criteriaPanel.setLayout(null);
- criteriaPanel.setPreferredSize( new Dimension(360,125));
- criteriaPanel.setBorder(BorderFactory.createTitledBorder(I18N.getString("AttributeResearchPanel.attributeBasedCriteria")));
- criteriaPanel.setBounds(LEFT_MARGIN,70,360,125);
-
- attLabel = new JLabel( I18N.getString("AttributeResearchPanel.attribute"));
- attLabel.setBounds(LEFT_MARGIN, 18, SECOND_COL - LEFT_MARGIN, STD_HEIGHT);
- criteriaPanel.add(attLabel);
-
- operLabel = new JLabel( I18N.getString("AttributeResearchPanel.operator"));
- operLabel.setBounds(LEFT_MARGIN + SECOND_COL + 5, 18, THIRD_COL - SECOND_COL, STD_HEIGHT);
- criteriaPanel.add(operLabel);
-
- valLabel = new JLabel( I18N.getString( "AttributeResearchPanel.comparisonValue") ); //$NON-NLS-1$
-
- valLabel.setBounds(LEFT_MARGIN + THIRD_COL + 5, 18, SECOND_COL - LEFT_MARGIN, STD_HEIGHT);
- criteriaPanel.add(valLabel);
-
- setHeadersEnabled(false);
-
- criteriaListPanel = new JPanel(){
- public Dimension getPreferredSize(){return new Dimension(300,400);}
+ criteriaPanel.setLayout( null );
+ criteriaPanel.setPreferredSize( new Dimension( 360, 125 ) );
+ criteriaPanel.setBorder( BorderFactory.createTitledBorder( I18N.getString( "AttributeResearchPanel.attributeBasedCriteria" ) ) );
+ criteriaPanel.setBounds( LEFT_MARGIN, 70, 360, 125 );
+
+ attLabel = new JLabel( I18N.getString( "AttributeResearchPanel.attribute" ) );
+ attLabel.setBounds( LEFT_MARGIN, 18, SECOND_COL - LEFT_MARGIN, STD_HEIGHT );
+ criteriaPanel.add( attLabel );
+
+ operLabel = new JLabel( I18N.getString( "AttributeResearchPanel.operator" ) );
+ operLabel.setBounds( LEFT_MARGIN + SECOND_COL + 5, 18, THIRD_COL - SECOND_COL, STD_HEIGHT );
+ criteriaPanel.add( operLabel );
+
+ valLabel = new JLabel( I18N.getString( "AttributeResearchPanel.comparisonValue" ) ); //$NON-NLS-1$
+
+ valLabel.setBounds( LEFT_MARGIN + THIRD_COL + 5, 18, SECOND_COL - LEFT_MARGIN, STD_HEIGHT );
+ criteriaPanel.add( valLabel );
+
+ setHeadersEnabled( false );
+
+ criteriaListPanel = new JPanel() {
+ private static final long serialVersionUID = -7342449173372211027L;
+
+ @Override
+ public Dimension getPreferredSize() {
+ return new Dimension( 300, 400 );
+ }
};
- criteriaListPanel.setBounds(LEFT_MARGIN,40,360,400);
- criteriaListPanel.setOpaque(false);
- criteriaListPanel.setLayout(null);
-
+ criteriaListPanel.setBounds( LEFT_MARGIN, 40, 360, 400 );
+ criteriaListPanel.setOpaque( false );
+ criteriaListPanel.setLayout( null );
+
criteriaPanel.add( criteriaListPanel );
-
+
return criteriaPanel;
}
- /**Creates the And/Or radio buttons, their button group and a panel for them*/
+ /** Creates the And/Or radio buttons, their button group and a panel for them */
private JComponent createLogicalButtons() {
-
- andButton = new JRadioButton( I18N.getString("AttributeResearchPanel.logicalAnd") );
- andButton.setBorder(
- BorderFactory.createEmptyBorder(2,10,2,10));
- andButton.setActionCommand(logicalRelationships[0]);
+
+ andButton = new JRadioButton( I18N.getString( "AttributeResearchPanel.logicalAnd" ) );
+ andButton.setBorder( BorderFactory.createEmptyBorder( 2, 10, 2, 10 ) );
+ andButton.setActionCommand( logicalRelationships[0] );
andButton.doClick();
-
- orButton = new JRadioButton( I18N.getString("AttributeResearchPanel.logicalOr"));
- orButton.setBorder(
- BorderFactory.createEmptyBorder(2,10,5,10));
- orButton.setActionCommand(logicalRelationships[1]);
-
+
+ orButton = new JRadioButton( I18N.getString( "AttributeResearchPanel.logicalOr" ) );
+ orButton.setBorder( BorderFactory.createEmptyBorder( 2, 10, 5, 10 ) );
+ orButton.setActionCommand( logicalRelationships[1] );
+
ActionListener bal = new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- JRadioButton rb = (JRadioButton)e.getSource();
+ public void actionPerformed( ActionEvent e ) {
+ JRadioButton rb = (JRadioButton) e.getSource();
currentRelationship = rb.getActionCommand();
}
};
andButton.addActionListener( bal );
orButton.addActionListener( bal );
-
-
+
ButtonGroup bg = new ButtonGroup();
- bg.add(andButton);
- bg.add(orButton);
+ bg.add( andButton );
+ bg.add( orButton );
JPanel b = new JPanel();
- LayoutManager lm = new BoxLayout( b, BoxLayout.PAGE_AXIS);
+ LayoutManager lm = new BoxLayout( b, BoxLayout.PAGE_AXIS );
b.setLayout( lm );
b.setAlignmentX( Component.LEFT_ALIGNMENT );
- b.setBorder(
- BorderFactory.createTitledBorder(I18N.getString("AttributeResearchPanel.logicalLink") ));
-
+ b.setBorder( BorderFactory.createTitledBorder( I18N.getString( "AttributeResearchPanel.logicalLink" ) ) );
+
// add a bit of space
- b.add( Box.createRigidArea( new Dimension(20,10) ) );
- b.add(andButton);
- b.add( Box.createRigidArea( new Dimension(20,10) ) );
- b.add(orButton);
- b.setPreferredSize( new Dimension(150, 100) );
-
+ b.add( Box.createRigidArea( new Dimension( 20, 10 ) ) );
+ b.add( andButton );
+ b.add( Box.createRigidArea( new Dimension( 20, 10 ) ) );
+ b.add( orButton );
+ b.setPreferredSize( new Dimension( 150, 100 ) );
+
return b;
}
-
- /** Creates buttons for adding and removing criteria and a panel for them */
- private JComponent createCriteriaButtons(){
- newCriteriaButton = new JButton( I18N.getString("AttributeResearchPanel.addCriteria"));
-
+ /** Creates buttons for adding and removing criteria and a panel for them */
+ private JComponent createCriteriaButtons() {
+
+ newCriteriaButton = new JButton( I18N.getString( "AttributeResearchPanel.addCriteria" ) );
+
newCriteriaButton.addActionListener( new ActionListener() {
- public void actionPerformed(ActionEvent e) {
+ public void actionPerformed( ActionEvent e ) {
// no do something useful
int i = criteriaListPanel.getComponentCount();
- if ( i == 0 ){
+ if ( i == 0 ) {
// make it pretty
- setHeadersEnabled(true);
- remCriteriaButton.setEnabled(true);
+ setHeadersEnabled( true );
+ remCriteriaButton.setEnabled( true );
}
- if ( i >= 4 ){
- newCriteriaButton.setEnabled(false);
+ if ( i >= 4 ) {
+ newCriteriaButton.setEnabled( false );
}
- AttributeComparisonPanel ac = new AttributeComparisonPanel( researchDialog.attributeNames );
- ac.setBounds(0, (STD_HEIGHT + 4)* (i), 340, STD_HEIGHT );
- criteriaList.add(ac);
- criteriaListPanel.add(ac);
+ AttributeComparisonPanel ac = new AttributeComparisonPanel( wfsPanel.attributeNames );
+ ac.setBounds( 0, ( STD_HEIGHT + 4 ) * ( i ), 340, STD_HEIGHT );
+ criteriaList.add( ac );
+ criteriaListPanel.add( ac );
criteriaListPanel.revalidate();
criteriaListPanel.repaint();
}
- });
-
- remCriteriaButton = new JButton( I18N.getString("AttributeResearchPanel.delCriteria"));
- remCriteriaButton.setEnabled(false);
+ } );
+
+ remCriteriaButton = new JButton( I18N.getString( "AttributeResearchPanel.delCriteria" ) );
+ remCriteriaButton.setEnabled( false );
remCriteriaButton.addActionListener( new ActionListener() {
- public void actionPerformed(ActionEvent e) {
-
- int i = criteriaListPanel.getComponentCount();
-
- //Component c = criteriaListPanel.getComponent(i-1);
- if ( i > 0 ){// && c instanceof AttributeComparison ){
+ public void actionPerformed( ActionEvent e ) {
+
+ int i = criteriaListPanel.getComponentCount();
+
+ // Component c = criteriaListPanel.getComponent(i-1);
+ if ( i > 0 ) {// && c instanceof AttributeComparison ){
Object o = criteriaListPanel.getComponent( i - 1 );
- criteriaListPanel.remove((Component)o);
- criteriaList.remove(o);
- criteriaListPanel.revalidate();
- criteriaListPanel.repaint();
- newCriteriaButton.setEnabled(true);
+ criteriaListPanel.remove( (Component) o );
+ criteriaList.remove( o );
+ criteriaListPanel.revalidate();
+ criteriaListPanel.repaint();
+ newCriteriaButton.setEnabled( true );
}
- if ( i == 1 ){
+ if ( i == 1 ) {
// make it pretty
- setHeadersEnabled(false);
- remCriteriaButton.setEnabled(false);
+ setHeadersEnabled( false );
+ remCriteriaButton.setEnabled( false );
}
}
- });
-
-
+ } );
+
Box b = Box.createHorizontalBox();
- b.setBounds(LEFT_MARGIN, 290,300,100);
- b.add(newCriteriaButton);
- b.add( Box.createHorizontalStrut( 10 ));
- b.add(remCriteriaButton);
- //add(b);
+ b.setBounds( LEFT_MARGIN, 290, 300, 100 );
+ b.add( newCriteriaButton );
+ b.add( Box.createHorizontalStrut( 10 ) );
+ b.add( remCriteriaButton );
+ // add(b);
return b;
}
- private JComponent createEditableCheckBox(){
-
- editableCheckBox = new JCheckBox(I18N.getString("AttributeResearchPanel.editable"), true);
- Box b = Box.createHorizontalBox();
- b.add(editableCheckBox);
- return b;
- }
+ boolean isEditable() {
+ return editableCheckBox.isSelected();
+ }
- boolean isEditable(){
- return editableCheckBox.isSelected();
- }
-
- /**Create buttons for choosing the spatial criteria and a panel for them*/
+ /** Create buttons for choosing the spatial criteria and a panel for them */
private JComponent createSpatialButtons() {
- //JLabel label = new JLabel( GUIMessages.SPATIAL_CRITERIA );
- //label.setBounds(LEFT_MARGIN + 2, 370,200,18);
- //add(label);
+ // JLabel label = new JLabel( GUIMessages.SPATIAL_CRITERIA );
+ // label.setBounds(LEFT_MARGIN + 2, 370,200,18);
+ // add(label);
- noCritButton = new JRadioButton( I18N.getString("AttributeResearchPanel.none") );
+ noCritButton = new JRadioButton( I18N.getString( "AttributeResearchPanel.none" ) );
noCritButton.setActionCommand( WFSPanel.NONE );
- noCritButton.doClick();
- bboxCritButton = new JRadioButton( I18N.getString("AttributeResearchPanel.bbox"));
+ noCritButton.doClick();
+ bboxCritButton = new JRadioButton( I18N.getString( "AttributeResearchPanel.bbox" ) );
bboxCritButton.setActionCommand( WFSPanel.BBOX );
- bboxCritButton.setBounds(10,30,200, STD_HEIGHT);
- selecGeoButton = new JRadioButton( I18N.getString("AttributeResearchPanel.selectedGeometry") );
+ bboxCritButton.setBounds( 10, 30, 200, STD_HEIGHT );
+ selecGeoButton = new JRadioButton( I18N.getString( "AttributeResearchPanel.selectedGeometry" ) );
selecGeoButton.setActionCommand( WFSPanel.SELECTED_GEOM );
-
+
ActionListener bal = new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- JRadioButton rb = (JRadioButton)e.getSource();
+ public void actionPerformed( ActionEvent e ) {
+ JRadioButton rb = (JRadioButton) e.getSource();
spatialSearchCriteria = rb.getActionCommand();
}
};
noCritButton.addActionListener( bal );
bboxCritButton.addActionListener( bal );
selecGeoButton.addActionListener( bal );
-
-
+
ButtonGroup bg = new ButtonGroup();
- bg.add(noCritButton);
- bg.add(bboxCritButton);
- bg.add(selecGeoButton);
-
+ bg.add( noCritButton );
+ bg.add( bboxCritButton );
+ bg.add( selecGeoButton );
+
Box b = Box.createVerticalBox();
- b.setAlignmentX(0.95f);
- b.setBorder(
- BorderFactory.createTitledBorder( I18N.getString("AttributeResearchPanel.spatialCriteria") ));
- // b.setBounds(LEFT_MARGIN, 390,250,100);
- b.add(noCritButton);
- b.add(bboxCritButton);
- b.add(selecGeoButton);
- b.setPreferredSize( new Dimension(150, 100) );
-
+ b.setAlignmentX( 0.95f );
+ b.setBorder( BorderFactory.createTitledBorder( I18N.getString( "AttributeResearchPanel.spatialCriteria" ) ) );
+
+ b.add( noCritButton );
+ b.add( bboxCritButton );
+ b.add( selecGeoButton );
+ b.setPreferredSize( new Dimension( 150, 100 ) );
+
return b;
}
+ /** Turns label on/off. */
+ void setHeadersEnabled( boolean on ) {
+ attLabel.setEnabled( on );
+ operLabel.setEnabled( on );
+ valLabel.setEnabled( on );
+ }
-
- /**Turns label on/off. */
- private void setHeadersEnabled(boolean on){
- attLabel.setEnabled(on);
- operLabel.setEnabled(on);
- valLabel.setEnabled(on);
- }
-
/**
- * Gets the logical relationship tag. This is used in concatenating the XML
- * GetFeature request. Valid logical relationship tags are <code><ogc:And></code>
- * or <code><ogc:Or></code>
+ * Gets the logical relationship tag. This is used in concatenating the XML GetFeature request.
+ * Valid logical relationship tags are <code><ogc:And></code> or
+ * <code><ogc:Or></code>
+ *
* @return the start and end xml tags
*/
- public String[] getLogicalRelationshipTags(){
- return WFSPanel.createStartStopTags( currentRelationship );
+ public String[] getLogicalRelationshipTags() {
+ return WFSPanel.createStartStopTags( currentRelationship );
}
-
+
/**
- * Returns an XML fragment containing some attribute-only filter clauses
- * @return the XML fragment containing some attribute-only filter clauses
+ * Returns an XML fragment containing some attribute-only filter clauses
+ *
+ * @return the XML fragment containing some attribute-only filter clauses
*/
- public StringBuffer getXmlElement(){
-
+ public StringBuffer getXmlElement() {
+
StringBuffer sb = new StringBuffer( 5000 );
- for (Iterator iter = criteriaList.iterator(); iter.hasNext();) {
- sb.append( ((AttributeComparisonPanel) iter.next()).getXmlElement() );
+ for ( Iterator<AttributeComparisonPanel> iter = criteriaList.iterator(); iter.hasNext(); ) {
+ sb.append( iter.next().getXmlElement() );
}
- if ( criteriaList.size() > 1){
+ if ( criteriaList.size() > 1 ) {
String[] logRels = getLogicalRelationshipTags();
sb.insert( 0, logRels[0] ).append( logRels[1] );
}
-
- return sb;
+
+ return sb;
}
-
- /** Gets the number of attribute conditions. This is needed because if there is a
- * BBOX and at least one codition, then an <Andgt; is needed.
+
+ /**
+ * Gets the number of attribute conditions. This is needed because if there is a BBOX and at
+ * least one codition, then an <Andgt; is needed.
*
* @return the number of attribute-based conditions
*/
- public int getListSize(){ return criteriaList.size(); }
-
+ public int getListSize() {
+ return criteriaList.size();
+ }
+
/**
* Returns the current spatial criteria. This can be NONE, BBOX or SELECTED_GEOMETRY
+ *
* @return the chosen spatial criteria
*/
- public String getSpatialCriteria(){return this.spatialSearchCriteria;}
+ public String getSpatialCriteria() {
+ return this.spatialSearchCriteria;
+ }
- /**Turns the "selected Geometry" button on/off. This is used when the selected geometry
- * is null and the button should be disabled (as clicking on it would have no effect
- * @param enabled whether the button should be on/off
+ /**
+ * Turns the "selected Geometry" button on/off. This is used when the selected geometry is null
+ * and the button should be disabled (as clicking on it would have no effect
+ *
+ * @param enabled
+ * whether the button should be on/off
*/
- public void setSelGeoButtonEnabled( boolean enabled){
- selecGeoButton.setEnabled(enabled);
- //noCritButton.setSelected( );
- if ( !enabled ){
- if( noCritButton.isSelected() ){
+ public void setSelGeoButtonEnabled( boolean enabled ) {
+ selecGeoButton.setEnabled( enabled );
+ // noCritButton.setSelected( );
+ if ( !enabled ) {
+ if ( noCritButton.isSelected() ) {
noCritButton.doClick();
} else {
bboxCritButton.doClick();
}
}
}
-
- public void setEnabled(boolean enabled){
+
+ @Override
+ public void setEnabled( boolean enabled ) {
super.setEnabled( enabled );
describeFTButton.setEnabled( enabled );
newCriteriaButton.setEnabled( enabled );
remCriteriaButton.setEnabled( enabled );
andButton.setEnabled( enabled );
orButton.setEnabled( enabled );
-
+
noCritButton.setEnabled( enabled );
bboxCritButton.setEnabled( enabled );
selecGeoButton.setEnabled( enabled );
-
+
refreshPanel();
}
- public void setFeatureTypeComboEnabled(boolean enabled){
+
+ public void setFeatureTypeComboEnabled( boolean enabled ) {
featureTypeCombo.setEnabled( enabled );
}
-
+
/**
- * A convenience class encapsulating an abstract filter operation, i.e. a clause
- * such as PropertyIsLike.<br/>
- * This panel includes a combo box conataining all attributes of a given feature
- * type, a combo box containing operators and a text field for the user to
- * input a comparison value.
+ * A convenience class encapsulating an abstract filter operation, i.e. a clause such as
+ * PropertyIsLike.<br/> This panel includes a combo box conataining all attributes of a given
+ * feature type, a combo box containing operators and a text field for the user to input a
+ * comparison value.
*
* @author <a href="mailto:taddei@... Taddei</a>
- *
+ *
*/
- class AttributeComparisonPanel extends JPanel{
-
+ class AttributeComparisonPanel extends JPanel {
+
+ private static final long serialVersionUID = 1790895442898585153L;
+
private JComboBox attributeCombo;
+
private JComboBox operatorCombo;
+
private JTextField valueField;
-
+
// these should move to top type; perhaps the whole widget should
- private final String[] OPERATORS = new String[]{"=", "<", ">", "<=", ">=", "<>", "LIKE", "NOT LIKE" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
-
+ private final String[] OPERATORS = new String[] { "=", "<", ">", "<=", ">=", "<>", "LIKE", "NOT LIKE" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
+
/**
* Creates an AttributeComparisonPanel from a list of attributes
- * @param attributes the list of attributes of some feature type
+ *
+ * @param attributes
+ * the list of attributes of some feature type
*/
- AttributeComparisonPanel(String[] attributes){
+ AttributeComparisonPanel( String[] attributes ) {
super();
- attributeCombo = new JComboBox(attributes);
- attributeCombo.setSelectedIndex(0);
- operatorCombo = new JComboBox(OPERATORS);
- operatorCombo.setSelectedIndex(0);
- valueField = new JTextField(""); //$NON-NLS-1$
+ attributeCombo = new JComboBox( attributes );
+ attributeCombo.setSelectedIndex( 0 );
+ operatorCombo = new JComboBox( OPERATORS );
+ operatorCombo.setSelectedIndex( 0 );
+ valueField = new JTextField( "" ); //$NON-NLS-1$
initGUI();
}
-
- /**Initialize the GUI */
- private void initGUI(){
- setLayout(null);
- attributeCombo.setBounds(0, 0, SECOND_COL , STD_HEIGHT);
- add(attributeCombo);
-
- operatorCombo.setBounds(SECOND_COL + 5, 0, THIRD_COL - SECOND_COL , STD_HEIGHT);
- add(operatorCombo);
-
- valueField.setColumns(16);
- valueField.setBounds(THIRD_COL + 10, 0, 130, STD_HEIGHT);
- add(valueField);
+
+ /** Initialize the GUI */
+ private void initGUI() {
+ setLayout( null );
+ attributeCombo.setBounds( 0, 0, SECOND_COL, STD_HEIGHT );
+ add( attributeCombo );
+
+ operatorCombo.setBounds( SECOND_COL + 5, 0, THIRD_COL - SECOND_COL, STD_HEIGHT );
+ add( operatorCombo );
+
+ valueField.setColumns( 16 );
+ valueField.setBounds( THIRD_COL + 10, 0, 130, STD_HEIGHT );
+ add( valueField );
}
-
+
/**
* Gets the XML fragment representing this operation/clause
+ *
* @return the XML fragment
*/
- public StringBuffer getXmlElement(){
-
+ public StringBuffer getXmlElement() {
+
String localName = (String) attributeCombo.getSelectedItem();
String val = valueField.getText();
-
+
int opIndex = operatorCombo.getSelectedIndex();
AbstractOperation oper = null;
-
- QualifiedName ftQualiName = researchDialog.getFeatureType();
- QualifiedName propName = new QualifiedName( ftQualiName.getPrefix(), localName, ftQualiName.getNamespace());
-
+
+ QualifiedName ftQualiName = wfsPanel.getFeatureType();
+ QualifiedName propName = new QualifiedName( ftQualiName.getPrefix(), localName, ftQualiName.getNamespace() );
+
try {
- oper = createOperation( opIndex, propName, val);
- } catch (Exception e) {
- JOptionPane.showMessageDialog(this, e.getMessage(), "Error!", JOptionPane.ERROR_MESSAGE); //$NON-NLS-1$
+ oper = createOperation( opIndex, propName, val );
+ } catch ( Exception e ) {
+ JOptionPane.showMessageDialog( this, e.getMessage(), "Error!", JOptionPane.ERROR_MESSAGE ); //$NON-NLS-1$
}
-
-
+
return oper.toXML();
}
-
- /** There should be a way to construct an operation from its name;
- * haven't found one; when I find should use that method or put this one
- * in deegree's core*/
- private AbstractOperation createOperation(int opCode, QualifiedName propName, String propVal)
- throws Exception{
+
+ /**
+ * There should be a way to construct an operation from its name; haven't found one; when I
+ * find should use that method or put this one in deegree's core
+ */
+ private AbstractOperation createOperation( int opCode, QualifiedName propName, String propVal )
+ throws Exception {
AbstractOperation oper = null;
- switch (opCode) {
+ switch ( opCode ) {
case 0:
case 1:
case 2:
case 3:
case 4:
- oper = new PropertyIsCOMPOperation( opCode + 100, new PropertyName(propName), new Literal(propVal) );
+ oper = new PropertyIsCOMPOperation( opCode + 100, new PropertyName( propName ), new Literal( propVal ) );
break;
- case 5:
- oper = new PropertyIsCOMPOperation( 100, new PropertyName(propName), new Literal(propVal) ){
- public StringBuffer toXML(){
- return super.toXML().insert(0, "<ogc:Not>").append("</ogc:Not>"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- };
- break;
-
- case 6:
- oper = new PropertyIsLikeOperation(
- new PropertyName(propName),
- new Literal(propVal),
- '*', '#', '!');
+ case 5:
+ oper = new PropertyIsCOMPOperation( 100, new PropertyName( propName ), new Literal( propVal ) ) {
+ @Override
+ public StringBuffer toXML() {
+ return super.toXML().insert( 0, "<ogc:Not>" ).append( "</ogc:Not>" ); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ };
break;
- case 7: //PropertyIsNOTLikeOperation!
- oper = new PropertyIsLikeOperation(
- new PropertyName(propName),
- new Literal(propVal),
- '*', '#', '!'){
- public StringBuffer toXML(){
- return super.toXML().insert(0, "<ogc:Not>").append("</ogc:Not>"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- };
+ case 6:
+ oper = new PropertyIsLikeOperation( new PropertyName( propName ), new Literal( propVal ), '*', '#', '!' );
break;
-
- default:
- throw new Exception("Operation not defined!"); //$NON-NLS-1$
- }
+
+ case 7: // PropertyIsNOTLikeOperation!
+ oper = new PropertyIsLikeOperation( new PropertyName( propName ), new Literal( propVal ), '*', '#', '!' ) {
+ @Override
+ public StringBuffer toXML() {
+ return super.toXML().insert( 0, "<ogc:Not>" ).append( "</ogc:Not>" ); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ };
+ break;
+
+ default:
+ throw new Exception( "Operation not defined!" ); //$NON-NLS-1$
+ }
return oper;
}
-
- public Dimension getPreferredSize(){return new Dimension(300,18);}
- }
+
+ @Override
+ public Dimension getPreferredSize() {
+ return new Dimension( 300, 18 );
+ }
+ }
}
Modified: plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/PropertySelectionPanel.java
===================================================================
--- plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/PropertySelectionPanel.java 2007-11-23 09:56:04 UTC (rev 1248)
+++ plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/PropertySelectionPanel.java 2007-11-23 15:23:57 UTC (rev 1249)
@@ -10,8 +10,7 @@
package de.latlon.deejump.plugin.wfs;
import java.awt.Dimension;
-import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Arrays;
import java.util.List;
import javax.swing.BorderFactory;
@@ -24,7 +23,6 @@
import javax.swing.JScrollPane;
import org.deegree.datatypes.QualifiedName;
-import org.deegree.model.feature.FeatureProperty;
import org.deegree.model.feature.schema.FeatureType;
import org.deegree.model.feature.schema.GMLSchema;
import org.deegree.model.feature.schema.PropertyType;
@@ -32,7 +30,7 @@
import de.latlon.deejump.ui.I18N;
/**
- * ...
+ * ...
*
* @author <a href="mailto:taddei@... Taddei</a>
* @author last edited by: $Author$
@@ -44,66 +42,65 @@
public class PropertySelectionPanel extends JPanel {
-
+ private static final long serialVersionUID = 2886180413810632383L;
+
private WFSPanel parentDialog;
protected JList propertiesList;
- protected JComboBox geoPropsCombo;
-
- public PropertySelectionPanel( WFSPanel parentDialog ){
+ protected JComboBox geoPropsCombo;
+
+ public PropertySelectionPanel( WFSPanel parentDialog ) {
super();
this.parentDialog = parentDialog;
initGUI();
setEnabled( false );
}
-
+
private void initGUI() {
-
+
JPanel p = new JPanel();
- p.setLayout( new BoxLayout(p, BoxLayout.Y_AXIS ));
- p.setBorder( BorderFactory.createTitledBorder( I18N.getString( "PropertySelectionPanel.downloadProps") ) );
+ p.setLayout( new BoxLayout( p, BoxLayout.Y_AXIS ) );
+ p.setBorder( BorderFactory.createTitledBorder( I18N.getString( "PropertySelectionPanel.downloadProps" ) ) );
propertiesList = new JList();
JScrollPane scrollPane = new JScrollPane( propertiesList );
-
+
Dimension dim = new Dimension( 400, 200 );
-
+
scrollPane.setMaximumSize( dim );
scrollPane.setPreferredSize( dim );
scrollPane.setMinimumSize( dim );
-
-
+
p.add( scrollPane );
-
+
add( p );
-
+
geoPropsCombo = new JComboBox();
-
+
dim = new Dimension( 200, 40 );
geoPropsCombo.setMaximumSize( dim );
geoPropsCombo.setPreferredSize( dim );
geoPropsCombo.setMinimumSize( dim );
-
-
- geoPropsCombo.setBorder( BorderFactory.createTitledBorder( I18N.getString( "SpatialResearchPanel.geometryName") ) );
-
+
+ geoPropsCombo.setBorder( BorderFactory.createTitledBorder( I18N.getString( "SpatialResearchPanel.geometryName" ) ) );
+
add( geoPropsCombo );
-
+
}
- public void setProperties( String[] simpleProps, QualifiedName[] geoProps ){
+ public void setProperties( String[] simpleProps, QualifiedName[] geoProps ) {
resetPropsList( simpleProps );
resetGeoCombo( geoProps );
}
-
+
private void resetGeoCombo( QualifiedName[] geoProps ) {
geoPropsCombo.removeAllItems();
- if( geoProps != null ){
+ if ( geoProps != null ) {
for ( int i = 0; i < geoProps.length; i++ ) {
-
- if( i == 0 ){
+
+ if ( i == 0 ) {
this.parentDialog.setGeoProperty( geoProps[i] );
}
geoPropsCombo.addItem( geoProps[i] );
@@ -111,83 +108,71 @@
}
}
-
- private void resetPropsList( String[] props ){
+ private void resetPropsList( String[] props ) {
propertiesList.removeAll();
DefaultListModel listModel = new DefaultListModel();
- int[] selIndices = new int[ props.length ];
+ int[] selIndices = new int[props.length];
for ( int i = 0; i < props.length; i++ ) {
listModel.addElement( props[i] );
selIndices[i] = i;
}
propertiesList.setModel( listModel );
propertiesList.setSelectedIndices( selIndices );
-
+
}
-
-
- public StringBuffer getXmlElement(){
-
+
+ public StringBuffer getXmlElement() {
+
StringBuffer sb = new StringBuffer( 5000 );
-
+
QualifiedName ftQualiName = parentDialog.getFeatureType();
- GMLSchema schema =
- this.parentDialog.getWfService().getSchemaForFeatureType( ftQualiName.getPrefix() + ":" + ftQualiName.getLocalName() );
-
- if( schema == null ){
+ GMLSchema schema = parentDialog.getWfService().getSchemaForFeatureType( ftQualiName.getPrefixedName() );
+
+ if ( schema == null ) {
return sb;
}
FeatureType[] featTypes = schema.getFeatureTypes();
-
- if( featTypes.length < 1 ){
- throw new RuntimeException( "Schema doesn't define any FeatureType. Must have at least one.");
+
+ if ( featTypes.length < 1 ) {
+ throw new RuntimeException( "Schema doesn't define any FeatureType. Must have at least one." );
}
-
+
// put what's been chosen in a list
Object[] objs = propertiesList.getSelectedValues();
- List chosenProps = new ArrayList( objs.length );
- for ( int i = 0; i < objs.length; i++ ) {
- chosenProps.add( objs[i] );
- }
-
+ List<Object> chosenProps = Arrays.asList( objs );
+
// and loop over the correct order, seing what's in the list
PropertyType[] featProperties = featTypes[0].getProperties();
for ( int i = 0; i < featProperties.length; i++ ) {
-
- if ( chosenProps.contains( featProperties[i].getName().getLocalName() ) ){
- sb.append( "<wfs:PropertyName>" )
- .append( ftQualiName.getPrefix() )
- .append( ":" )
- .append( featProperties[i].getName().getLocalName() )
- .append( "</wfs:PropertyName>" );
+ if ( chosenProps.contains( featProperties[i].getName().getLocalName() ) ) {
+ sb.append( "<wfs:PropertyName>" ).append( ftQualiName.getPrefix() ).append( ":" );
+ sb.append( featProperties[i].getName().getLocalName() ).append( "</wfs:PropertyName>" );
}
-
- //geom prop
+
+ // geom prop
QualifiedName qn = (QualifiedName) geoPropsCombo.getSelectedItem();
if ( qn.equals( featProperties[i].getName() ) ) {
- sb.append( "<wfs:PropertyName>" )
- .append( ftQualiName.getPrefix() )
- .append( ":" )
- .append( qn.getLocalName() )
- .append( "</wfs:PropertyName>" );
+ sb.append( "<wfs:PropertyName>" ).append( ftQualiName.getPrefix() ).append( ":" );
+ sb.append( qn.getLocalName() ).append( "</wfs:PropertyName>" );
}
-
+
}
-
- return sb;
+
+ return sb;
}
-
- public void setEnabled( boolean enabled ){
+
+ @Override
+ public void setEnabled( boolean enabled ) {
super.setEnabled( enabled );
geoPropsCombo.setEnabled( enabled );
propertiesList.setEnabled( enabled );
-
- if( !enabled ){
+
+ if ( !enabled ) {
propertiesList.removeAll();
- geoPropsCombo.setModel( new DefaultComboBoxModel(new String[0]) );
+ geoPropsCombo.setModel( new DefaultComboBoxModel( new String[0] ) );
}
-
+
}
-
+
}
\ No newline at end of file
Modified: plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/RequestTextArea.java
===================================================================
--- plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/RequestTextArea.java 2007-11-23 09:56:04 UTC (rev 1248)
+++ plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/RequestTextArea.java 2007-11-23 15:23:57 UTC (rev 1249)
@@ -28,37 +28,37 @@
import de.latlon.deejump.ui.I18N;
/**
- * TODO add documentation here
- *
+ * Shows the GetFeature requests.
+ *
* @author <a href="mailto:taddei@... Taddei</a>
* @author last edited by: $Author$
- *
+ *
* @version $Revision$, $Date$
*/
class RequestTextArea extends JPanel {
-
+
+ private static final long serialVersionUID = 8173462624638666293L;
+
final WFSPanel wfsPanel;
-
- private JTextArea requestTextArea;
+ JTextArea requestTextArea;
+
private JButton createReqButton;
private JButton validateReq;
-
+
RequestTextArea( WFSPanel wfsPanel ) {
this.wfsPanel = wfsPanel;
-
+
createTextArea();
createRequestButton();
-
- //TODO i18n
-
+
JPanel innerPanel = new JPanel();
innerPanel.add( createReqButton );
innerPanel.add( createValidationtButton() );
add( innerPanel );
-
+
}
private JComponent createValidationtButton() {
@@ -66,25 +66,24 @@
validateReq.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e ) {
-
+
String reqTxt = requestTextArea.getText();
- if( reqTxt == null || reqTxt.length() == 0 ){
+ if ( reqTxt == null || reqTxt.length() == 0 ) {
return;
}
try {
-
- //simple test for well-formedness
+
+ // simple test for well-formedness
XMLFragment xf = new XMLFragment();
xf.load( new StringReader( reqTxt ), "http://empty" );
- if( "1.1.0".equals( wfsPanel.wfService.getServiceVersion() ) ){
+ if ( "1.1.0".equals( wfsPanel.wfService.getServiceVersion() ) ) {
// use deegree to validate request
GetFeature.create( null, xf.getRootElement() );
- }
+ }
} catch ( Exception ex ) {
- ex.printStackTrace();
- JOptionPane.showMessageDialog( wfsPanel, ex.getMessage(),
- I18N.getString( "error"),
+ ex.printStackTrace();
+ JOptionPane.showMessageDialog( wfsPanel, ex.getMessage(), I18N.getString( "error" ),
JOptionPane.ERROR_MESSAGE );
}
}
@@ -93,8 +92,7 @@
}
private JComponent createRequestButton() {
- createReqButton = new JButton(
- I18N.getString( "FeatureResearchDialog.createWFSRequest" ) );
+ createReqButton = new JButton( I18N.getString( "FeatureResearchDialog.createWFSRequest" ) );
createReqButton.setBounds( 260, 20, 80, 20 );
createReqButton.setAlignmentX( 0.5f );
createReqButton.addActionListener( new ActionListener() {
@@ -112,39 +110,25 @@
requestTextArea.setWrapStyleWord( true );
requestTextArea.setBorder( BorderFactory.createEmptyBorder( 10, 10, 10, 10 ) );
JScrollPane jsp = new JScrollPane( requestTextArea );
- jsp.setPreferredSize( new Dimension(390,475) );
+ jsp.setPreferredSize( new Dimension( 390, 475 ) );
add( jsp );
}
- void setRequestText( String txt ){
- this.requestTextArea.setText( txt.replaceAll( ">", ">\n" ) );
+ void setRequestText( String txt ) {
+ this.requestTextArea.setText( txt.replaceAll( ">", ">\n" ) );
}
String getText() {
return this.requestTextArea.getText();
}
-
- public void setEnabled( boolean enabled ){
+
+ @Override
+ public void setEnabled( boolean enabled ) {
super.setEnabled( enabled );
this.createReqButton.setEnabled( enabled );
this.validateReq.setEnabled( enabled );
this.requestTextArea.setEnabled( enabled );
}
-
-}
-/* ********************************************************************
-Changes to this class. What the people have been up to:
-
-$Log$
-Revision 1.3 2007/05/16 14:43:33 taddei
-Externalisation of i18n
-
-Revision 1.2 2007/05/14 08:49:02 taddei
-Removed println
-
-Revision 1.1 2007/05/10 07:36:34 taddei
-Added
-
-********************************************************************** */
\ No newline at end of file
+}
Modified: plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/SpatialCriteriaPanel.java
===================================================================
--- plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/SpatialCriteriaPanel.java 2007-11-23 09:56:04 UTC (rev 1248)
+++ plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/SpatialCriteriaPanel.java 2007-11-23 15:23:57 UTC (rev 1249)
@@ -15,12 +15,8 @@
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.List;
import javax.swing.AbstractButton;
import javax.swing.BorderFactory;
@@ -32,14 +28,12 @@
import javax.swing.JComponent;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
-import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.border.Border;
import org.deegree.datatypes.QualifiedName;
import org.deegree.model.crs.CRSFactory;
-import org.deegree.model.crs.CoordinateSystem;
import org.deegree.model.crs.UnknownCRSException;
import org.deegree.model.filterencoding.OperationDefines;
import org.deegree.model.filterencoding.PropertyName;
@@ -50,185 +44,121 @@
import de.latlon.deejump.ui.I18N;
/**
- * This panel provides a user interface to spatial filter operations.<p/>
- * Original design: Poth
+ * This panel provides a user interface to spatial filter operations.<p/> Original design: Poth
*
* @author <a href="mailto:taddei@... Taddei</a>
*
*/
class SpatialCriteriaPanel extends JPanel {
-
- /**Operation names as defined by the OGC*/
- public static final String[] OPERATION_NAMES = new String[]{
- "Intersects",
- "Within",
- "DWithin",
- "Contains",
- "Beyond",
- "Touches",
- "Crosses",
- "Overlaps",
- "Equals",
- "Disjoint",
- };
-
-
- /**A Distance input filed for the DWithin operation*/
- private DistanceInputField dWithinDistanceField = new DistanceInputField("0");
- /**A Distance input filed for the Beyond operation*/
- private DistanceInputField beyondDistanceField = new DistanceInputField("0");
-
- /**The currently selected operation*/
- private String selectedOperation = "Intersects";
-
- /**The parent dialog. Keep this reference to make matters simple */
+ private static final long serialVersionUID = 7173251547630376008L;
+
+ /** Operation names as defined by the OGC */
+ public static final String[] OPERATION_NAMES = new String[] { "Intersects", "Within", "DWithin", "Contains",
+ "Beyond", "Touches", "Crosses", "Overlaps", "Equals",
+ "Disjoint", };
+
+ /** A Distance input filed for the DWithin operation */
+ private DistanceInputField dWithinDistanceField = new DistanceInputField();
+
+ /** A Distance input filed for the Beyond operation */
+ private DistanceInputField beyondDistanceField = new DistanceInputField();
+
+ /** The currently selected operation */
+ String selectedOperation = "Intersects";
+
+ /** The parent dialog. Keep this reference to make matters simple */
private WFSPanel wfsPanel;
private JComboBox geomPropsCombo;
private JComboBox srsCombo;
-
+
private AbstractButton[] opButtons;
-
- /** Create a SpatialResearchPanel.
+
+ /**
+ * Create a SpatialResearchPanel.
*
- * @param rd the parent FeatureResearchDialog
+ * @param panel
*/
- public SpatialCriteriaPanel(WFSPanel panel) {
+ public SpatialCriteriaPanel( WFSPanel panel ) {
super();
this.wfsPanel = panel;
initGUI();
}
-
- /**Initialize the GUI*/
- private void initGUI(){
-
- //setLayout( null );
- LayoutManager lm = new BoxLayout( this, BoxLayout.Y_AXIS);
+
+ /** Initialize the GUI */
+ private void initGUI() {
+
+ // setLayout( null );
+ LayoutManager lm = new BoxLayout( this, BoxLayout.Y_AXIS );
setLayout( lm );
-
+
add( createGeomPropCombo() );
add( createSRSCombo() );
-
+
add( createOperationButtons() );
}
- private JComponent createGeomPropCombo(){
-
- //FIXME is the user allowed to input own geometry???
- String[] gg = new String[0];
-
+ private JComponent createGeomPropCombo() {
+
+ String[] gg = new String[0];
+
geomPropsCombo = new JComboBox( gg );
-
- /*
- geomPropsCombo.addItemListener(
- new ItemListener() {
- public void itemStateChanged(ItemEvent e) {
- QualifiedName geoProp = (QualifiedName)e.getItem();
-
- researchDialog.setGeoProp( geoProp );
-
- // create a new entry
- if ( e.getStateChange() == ItemEvent.SELECTED ){
- if ( !"".equals( newName )){
- addGeoPropName( newName );
- }
- }
- }
- }
- );
-*/
-
+
JPanel p = new JPanel();
- p.add( new JLabel(I18N.getString("SpatialResearchPanel.geometryName") ) );
+ p.add( new JLabel( I18N.getString( "SpatialResearchPanel.geometryName" ) ) );
p.add( geomPropsCombo );
add( p );
return p;
}
-
- private JComponent createSRSCombo(){
-
- srsCombo = new JComboBox( new DefaultComboBoxModel(new String[0]) );
+
+ private JComponent createSRSCombo() {
+
+ srsCombo = new JComboBox( new DefaultComboBoxModel( new String[0] ) );
srsCombo.setEnabled( false );
- //UT nothing happens if user selects combo
- /*
- srsCombo.addItemListener(
- new ItemListener() {
- public void itemStateChanged(ItemEvent e) {
- String newSRS = (String)e.getItem();
- CoordinateSystem cs = null;
- try {
- cs = CRSFactory.create( newSRS );
- } catch ( UnknownCRSException e1 ) {
- e1.printStackTrace();
- }
-
- wfsPanel.setGMLGeometrySRS( cs );
-// FIXME this is not qut nice here, but JUMP is lacking
- //a mechanism for srs, anyway
- String srs = (String)srsCombo.getSelectedItem();
-
- //UT TODO
- //this is bad -> dependency
- JOptionPane.showMessageDialog( null, "FIX ME" );
- //TransactionFactory.setCrs( srs );
- // create a new entry
- if ( e.getStateChange() == ItemEvent.SELECTED ){
- if ( !"".equals( newSRS )){
- srsCombo.addItem( newSRS );
- }
- }
- }
- }
- );
- */
- //UT combo is not editable. There should be one SRS to rule them all
-// srsCombo.setEditable( true );
-
JPanel p = new JPanel();
- p.add( new JLabel( I18N.getString("SpatialResearchPanel.srs")) );
+ p.add( new JLabel( I18N.getString( "SpatialResearchPanel.srs" ) ) );
p.add( srsCombo );
add( p );
return p;
}
-
- public void setCrs( String[] crs ){
- this.srsCombo.setModel( new DefaultComboBoxModel(crs) );
+
+ public void setCrs( String[] crs ) {
+ this.srsCombo.setModel( new DefaultComboBoxModel( crs ) );
srsCombo.setEnabled( true );
}
-
- /**Creates a panel containing the radio buttons representaing the spatial operations*/
+
+ /** Creates a panel containing the radio buttons representaing the spatial operations */
private JComponent createOperationButtons() {
JPanel b = new JPanel();
- LayoutManager lm = new BoxLayout( this, BoxLayout.Y_AXIS);
+ LayoutManager lm = new BoxLayout( this, BoxLayout.Y_AXIS );
setLayout( lm );
-
+
JPanel opsPanel = new JPanel();
JPanel opsFieldPanel = new JPanel();
- Border bo = BorderFactory.createEmptyBorder(10,10,10,10);
+ Border bo = BorderFactory.createEmptyBorder( 10, 10, 10, 10 );
opsPanel.setBorder( bo );
opsFieldPanel.setBorder( bo );
-
- LayoutManager lm2 = new GridLayout( OPERATION_NAMES.length, 1);
+
+ LayoutManager lm2 = new GridLayout( OPERATION_NAMES.length, 1 );
opsPanel.setLayout( lm2 );
opsFieldPanel.setLayout( lm2 );
-
+
ActionListener bal = new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- JRadioButton rb = (JRadioButton)e.getSource();
+ public void actionPerformed( ActionEvent e ) {
+ JRadioButton rb = (JRadioButton) e.getSource();
selectedOperation = rb.getActionCommand();
}
};
ButtonGroup bg = new ButtonGroup();
-
-
- opButtons = new JRadioButton[ OPERATION_NAMES.length ];
- String simpleName = getClass().getSimpleName();
- for (int i = 0; i < OPERATION_NAMES.length; i++) {
+
+ opButtons = new JRadioButton[OPERATION_NAMES.length];
+ String simpleName = getClass().getSimpleName();
+ for ( int i = 0; i < OPERATION_NAMES.length; i++ ) {
String txt = simpleName + "." + OPERATION_NAMES[i];
String buttonTxt = I18N.getString( txt );
opButtons[i] = new JRadioButton( buttonTxt );
@@ -237,154 +167,123 @@
opButtons[i].setToolTipText( buttonTxt );
opButtons[i].setActionCommand( OPERATION_NAMES[i] );
opButtons[i].addActionListener( bal );
- opButtons[i].setBounds( PropertyCriteriaPanel.LEFT_MARGIN + 10, (i*25) + 25, 270, 20);
+ opButtons[i].setBounds( PropertyCriteriaPanel.LEFT_MARGIN + 10, ( i * 25 ) + 25, 270, 20 );
opButtons[i].setAlignmentX( Component.LEFT_ALIGNMENT );
- bg.add(opButtons[i]);
-
- if ( "DWithin".equals( OPERATION_NAMES[i] ) ){
+ bg.add( opButtons[i] );
+
+ if ( "DWithin".equals( OPERATION_NAMES[i] ) ) {
opsFieldPanel.add( dWithinDistanceField );
- } else if ( "Beyond".equals( OPERATION_NAMES[i] ) ){
- beyondDistanceField.setEnabled( false );
- opsFieldPanel.add( beyondDistanceField);
- }else{
- opsFieldPanel.add( Box.createHorizontalStrut(1) );
+ } else if ( "Beyond".equals( OPERATION_NAMES[i] ) ) {
+ beyondDistanceField.setEnabled( false );
+ opsFieldPanel.add( beyondDistanceField );
+ } else {
+ opsFieldPanel.add( Box.createHorizontalStrut( 1 ) );
}
-
+
opsPanel.add( opButtons[i] );
-
+
}
-
+
opButtons[0].doClick();
JPanel combiPanel = new JPanel();
- combiPanel.setBorder(
- BorderFactory.createTitledBorder( I18N.getString("SpatialResearchPanel.spatialOperation") ));
- combiPanel.setLayout( new GridLayout( 1, 2) );
+ combiPanel.setBorder( BorderFactory.createTitledBorder( I18N.getString( "SpatialResearchPanel.spatialOperation" ) ) );
+ combiPanel.setLayout( new GridLayout( 1, 2 ) );
combiPanel.add( opsPanel );
combiPanel.add( opsFieldPanel );
- combiPanel.setPreferredSize( new Dimension(300,380));
+ combiPanel.setPreferredSize( new Dimension( 300, 380 ) );
b.add( combiPanel );
return b;
}
-
- /* public void addGeoPropName(String name){
-
- int size = geomPropsCombo.getModel().getSize();
- List candidateGeoProps = new ArrayList( size );
- for (int i = 0; i < size; i++) {
- candidateGeoProps.add( geomPropsCombo.getModel().getElementAt( i ) );
- }
- if( name != null && !candidateGeoProps.contains( name ) ){
- geomPropsCombo.addItem(name);
- }
- geomPropsCombo.setSelectedItem( name );
- }*/
-
- /**Returns the XML fragment conating the spatial operation
+
+ /**
+ * Returns the XML fragment conating the spatial operation
*
* @return the XML description of the spatial operation
*/
- public StringBuffer getXmlElement(){
-
+ public StringBuffer getXmlElement() {
+
int opType = OperationDefines.getIdByName( selectedOperation );
double dist = 0;
- if( "DWithin".equals(selectedOperation) ){
+ if ( "DWithin".equals( selectedOperation ) ) {
dist = dWithinDistanceField.getDistance();
- } else if( "Beyond".equals(selectedOperation) ){
+ } else if ( "Beyond".equals( selectedOperation ) ) {
dist = beyondDistanceField.getDistance();
}
StringBuffer sb = new StringBuffer();
Geometry geometry = wfsPanel.getSelectedGeometry();
- if (geometry == null){
+ if ( geometry == null ) {
return sb;
}
try {
- ((GeometryImpl)geometry).setCoordinateSystem( CRSFactory.create( (String)this.srsCombo.getSelectedItem() ) );
+ ( (GeometryImpl) geometry ).setCoordinateSystem( CRSFactory.create( (String) this.srsCombo.getSelectedItem() ) );
} catch ( UnknownCRSException e ) {
e.printStackTrace();
}
-
- //TODO when JUMP accepts more than one geo pro, should offer it in a combo
- // only that is returning the string only, need the wualified name here
-// String geoProp = this.geomPropsCombo.getSelectedItem();
-
+
QualifiedName qn = this.wfsPanel.getFeatureType();
- QualifiedName geoQn = (QualifiedName)geomPropsCombo.getSelectedItem();
-
- geoQn = new QualifiedName ( qn.getPrefix(),
- geoQn.getLocalName() ,
- qn.getNamespace() );
- SpatialOperation spatialOp =
- new SpatialOperation( opType,
- new PropertyName( geoQn ),
- geometry, dist);
+ QualifiedName geoQn = (QualifiedName) geomPropsCombo.getSelectedItem();
- // ad-hoc stuff -> will add this to deegree core
- // but not like this ;-)
- sb = spatialOp.toXML();
-/*
- * This is not needed anymore since it is included in deegree somewhere,
- * otherwise the request is wrong and it has doubled ogc:Distance-tags.
- * SH: 18.05.2007
- if( "DWithin".equals(selectedOperation) || "Beyond".equals(selectedOperation) ){
- String d = "<ogc:Distance unit='http://www.uomdict.com/uom.html#meters' units='m'>" +
- dist + "</ogc:Distance>";
- String insert = "</ogc:" + selectedOperation + ">";
- int i = sb.indexOf(insert);
- sb.insert( i, d);
- }
-*/
-
- return sb;
+ geoQn = new QualifiedName( qn.getPrefix(), geoQn.getLocalName(), qn.getNamespace() );
+ SpatialOperation spatialOp = new SpatialOperation( opType, new PropertyName( geoQn ), geometry, dist );
+
+ sb = spatialOp.toXML();
+
+ return sb;
}
-
- /**A conveniece class containing a text field for value input and a label. This
- * class is used for the operations DWithin and Beyond.*/
- class DistanceInputField extends JPanel{
-
- private JFormattedTextField distanceField;
- private double distance = 0d;
-
- DistanceInputField(String text){
+
+ /**
+ * A conveniece class containing a text field for value input and a label. This class is used
+ * for the operations DWithin and Beyond.
+ */
+ class DistanceInputField extends JPanel {
+
+ private static final long serialVersionUID = 6119874124692251085L;
+
+ JFormattedTextField distanceField;
+
+ double distance = 0d;
+
+ DistanceInputField() {
super();
- distanceField =
- new JFormattedTextField( new Float( 0.0 ) );
- distanceField.addPropertyChangeListener("value", new PropertyChangeListener(){
- public void propertyChange(PropertyChangeEvent evt) {
- distance = ((Number)distanceField.getValue()).doubleValue();
+ distanceField = new JFormattedTextField( new Float( 0.0 ) );
+ distanceField.addPropertyChangeListener( "value", new PropertyChangeListener() {
+ public void propertyChange( PropertyChangeEvent evt ) {
+ distance = ( (Number) distanceField.getValue() ).doubleValue();
}
- });
-
- distanceField.setColumns(5);
- add(distanceField);
- add( new JLabel("m"));
-
-
- }
-
- public double getDistance(){
+ } );
+
+ distanceField.setColumns( 5 );
+ add( distanceField );
+ add( new JLabel( "m" ) );
+
+ }
+
+ public double getDistance() {
return distance;
}
- public void setEnabled( boolean enabled){
- distanceField.setEnabled(enabled);
+ @Override
+ public void setEnabled( boolean enabled ) {
+ distanceField.setEnabled( enabled );
}
}
public void resetGeoCombo( QualifiedName[] geometryProperties ) {
this.geomPropsCombo.removeAllItems();
- if( geometryProperties != null ){
+ if ( geometryProperties != null ) {
for ( int i = 0; i < geometryProperties.length; i++ ) {
- this.geomPropsCombo.addItem( geometryProperties[i] );
+ this.geomPropsCombo.addItem( geometryProperties[i] );
}
}
}
-
- public void setEnabled(boolean enabled){
+
+ @Override
+ public void setEnabled( boolean enabled ) {
super.setEnabled( enabled );
- if( !enabled ){
+ if ( !enabled ) {
resetGeoCombo( new QualifiedName[0] );
setCrs( new String[0] );
}
@@ -394,5 +293,5 @@
b.setEnabled( enabled );
}
}
-
+
}
Modified: plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSDialog.java
===================================================================
--- plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSDialog.java 2007-11-23 09:56:04 UTC (rev 1248)
+++ plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSDialog.java 2007-11-23 15:23:57 UTC (rev 1249)
@@ -22,72 +22,74 @@
import com.vividsolutions.jump.workbench.WorkbenchContext;
/**
- * This dialog presents a graphical user interface to OGC Filter operations. It
- * encapsulates two panels, one for attribute-based feature search and the other
- * for geometry-based search. Both search methods can be combined. The dialog
- * generates a GetFeature request as an XML string. This can be used to query a
- * WFS.
+ * This dialog presents a graphical user interface to OGC Filter operations. It encapsulates two
+ * panels, one for attribute-based feature search and the other for geometry-based search. Both
+ * search methods can be combined. The dialog generates a GetFeature request as an XML string. This
+ * can be used to query a WFS.
*
* @author <a href="mailto:taddei@... Taddei </a>
- *
+ *
*/
public class WFSDialog extends JDialog {
-
+
+ private static final long serialVersionUID = 5540535312268661105L;
+
public static final String WFS_URL_LIST = "WFS_URL_LIST";
-
+
/**
- * Whether the dialog has enough info to produce a search or it makes sense
- * to carry on. For example, when the user closed (cancelled) the dialog.
+ * Whether the dialog has enough info to produce a search or it makes sense to carry on. For
+ * example, when the user closed (cancelled) the dialog.
*/
- private boolean canSearch = false;
+ boolean canSearch = false;
private WFSPanel wfsPanel;
private WorkbenchContext context;
-
+
/**
* Creates a dialog from an owner, with a title and a WFS server address.
*
+ * @param context
+ *
* @param owner
* the parent window
* @param title
* the name to appear on the window bar
- * @param wfsServer
+ * @param urls
* the address of the server. This is something like
* http://my.domain.com/deegreewfs/wfs
* @throws java.awt.HeadlessException
*/
- public WFSDialog( WorkbenchContext context, Frame owner, String title, String[] urls ) throws Exception {
+ public WFSDialog( WorkbenchContext context, Frame owner, String title, String[] urls ) {
super( owner, title, true );
this.context = context;
setTitle( "WFSPlugin v. " + WFSPanel.releaseVersion );
setLocation( 0, 50 );
- // setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
addWindowListener( new WindowAdapter() {
+ @Override
public void windowClosing( WindowEvent we ) {
canSearch = false;
dispose();
}
} );
- initGUI(urls);
+ initGUI( urls );
}
+ /** Initialize main GUI and its children */
+ private void initGUI( String[] wfsURLs ) {
- /** Initialize main GUI and its children */
- private void initGUI(String[] wfsURLs) {
-
getContentPane().setLayout( new FlowLayout() );
-
+
this.wfsPanel = new WFSPanel( context, Arrays.asList( wfsURLs ) );
-
+
// remove response tab from dialog
this.wfsPanel.getTabs().removeTabAt( 4 );
-
+
add( this.wfsPanel );
-
+
WFSPanelButtons buttons = new WFSPanelButtons( this, this.wfsPanel );
this.wfsPanel.controlButtons = buttons;
buttons.okButton.addActionListener( new ActionListener() {
@@ -98,7 +100,7 @@
}
} );
buttons.okButton.setEnabled( false );
-
+
buttons.cancelButton.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e ) {
setVisible( false );
@@ -113,10 +115,9 @@
}
/**
- * Whether it makes sense to ask for a GetFeature request. This is generally
- * true, but clicking on the Cancel or clisong the dialog will return
- * <code>false</code>, meaning that the user changed his mind and no
- * requst should be sent.
+ * Whether it makes sense to ask for a GetFeature request. This is generally true, but clicking
+ * on the Cancel or clisong the dialog will return <code>false</code>, meaning that the user
+ * changed his mind and no requst should be sent.
*
* @return a boolean value hinting whether to carry on or not
*/
Modified: plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSLayer.java
===================================================================
--- plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSLayer.java 2007-11-23 09:56:04 UTC (rev 1248)
+++ plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSLayer.java 2007-11-23 15:23:57 UTC (rev 1249)
@@ -1,30 +1,30 @@
/*---------------- FILE HEADER ------------------------------------------
-Copyright (C) 2001-2005 by:
-lat/lon GmbH
-http://www.lat-lon.de
+ Copyright (C) 2001-2005 by:
+ lat/lon GmbH
+ http://www.lat-lon.de
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-Contact:
+ Contact:
-Andreas Poth
-lat/lon GmbH
-Aennchenstra�e 19
-53177 Bonn
-Germany
+ Andreas Poth
+ lat/lon GmbH
+ Aennchenstra�e 19
+ 53177 Bonn
+ Germany
---------------------------------------------------------------------------*/
@@ -39,26 +39,22 @@
import com.vividsolutions.jump.workbench.model.Layer;
import com.vividsolutions.jump.workbench.model.LayerManager;
-
/**
- * This class represents a WFS layer. The important difference to a common
- * Layer is that a WFS layer keeps hold of its original WFS name no matter
- * how JUMP changes it. This original name (FeatureType name)is used for
- * transactions.<br/>
- * Another addition concerns a layer listener. By setting the WFSLayerListener
- * one can keep track of the changes performed to the layer and use those
- * changes for creation transaction statements.
- * <br/>
+ * This class represents a WFS layer. The important difference to a common Layer is that a WFS layer
+ * keeps hold of its original WFS name no matter how JUMP changes it. This original name
+ * (FeatureType name)is used for transactions.<br/> Another addition concerns a layer listener. By
+ * setting the WFSLayerListener one can keep track of the changes performed to the layer and use
+ * those changes for creation transaction statements. <br/>
+ *
* @author <a href="mailto:taddei@... Taddei</a>
*
*/
public class WFSLayer extends Layer {
-
+
private QualifiedName origName;
-
- // FIXME remove is now in datasource
- private String serverURL;
-
+
+ private String serverURL;
+
private QualifiedName geoPropertyName;
private String crs;
@@ -66,67 +62,81 @@
private WFSLayerListener layerListener;
private AbstractWFSWrapper wfs;
-
+
/**
- * Creates a new WFS layer from its display name, a color, some data, and
- * using a layer manager ad an original (WFS) layer name. This constructor
- * is similar to one of <code>Layer</code>, but include the original layer
- * name as parameter.
- * @param displayName name to be displayed and used by JUMP
- * @param fillColor start-up fill color
- * @param featureCollection the data
- * @param layerManager the layer manager responsible for this layer
- * @param origName the WFS layer name (the name of the FeatureType)
+ * Creates a new WFS layer from its display name, a color, some data, and using a layer manager
+ * ad an original (WFS) layer name. This constructor is similar to one of <code>Layer</code>,
+ * but include the original layer name as parameter.
+ *
+ * @param displayName
+ * name to be displayed and used by JUMP
+ * @param fillColor
+ * start-up fill color
+ * @param featureCollection
+ * the data
+ * @param layerManager
+ * the layer manager responsible for this layer
+ * @param origName
+ * the WFS layer name (the name of the FeatureType)
+ * @param geoPropertyName
+ * @param crs
+ * @param wfs
*/
- public WFSLayer(String displayName, Color fillColor,
- FeatureCollection featureCollection, LayerManager layerManager,
- QualifiedName origName, QualifiedName geoPropertyName, String crs, AbstractWFSWrapper wfs){
- super(displayName, fillColor,featureCollection, layerManager);
+ public WFSLayer( String displayName, Color fillColor, FeatureCollection featureCollection,
+ LayerManager layerManager, QualifiedName origName, QualifiedName geoPropertyName, String crs,
+ AbstractWFSWrapper wfs ) {
+ super( displayName, fillColor, featureCollection, layerManager );
this.origName = origName;
this.geoPropertyName = geoPropertyName;
this.crs = crs;
this.wfs = wfs;
}
-
- public QualifiedName getQualifiedName(){ return this.origName; }
-
+
+ public QualifiedName getQualifiedName() {
+ return this.origName;
+ }
+
/**
* Gets the layer listener
+ *
* @return the layer listener associated with this WFSLayer
*/
public WFSLayerListener getLayerListener() {
return layerListener;
}
-
+
/**
* Sets the layer listener
- * @param layerListener the layer listener
+ *
+ * @param layerListener
+ * the layer listener
*/
- public void setLayerListener(WFSLayerListener layerListener) {
+ public void setLayerListener( WFSLayerListener layerListener ) {
this.layerListener = layerListener;
}
-
-
+
public String getServerURL() {
return serverURL;
}
-
- public void setServerURL(String serverURL) {
+
+ public void setServerURL( String serverURL ) {
this.serverURL = serverURL;
}
+
public QualifiedName getGeoPropertyName() {
return geoPropertyName;
}
-
- public String getGeoPropertyNameAsString(){
- return this.geoPropertyName.getAsString();
+
+ public String getGeoPropertyNameAsString() {
+ return this.geoPropertyName.getPrefixedName();
}
-
+
+ @Override
public boolean hasReadableDataSource() {
- return false;
+ return false;
}
- public void setGeoPropertyName( QualifiedName geoPropertyName) {
+ public void setGeoPropertyName( QualifiedName geoPropertyName ) {
this.geoPropertyName = geoPropertyName;
}
@@ -134,15 +144,15 @@
throw new UnsupportedOperationException( "Must implement getNamespace..." );
}
- public String getCrs(){
+ public String getCrs() {
return this.crs;
}
-
+
/**
* @return the WFS
*/
public AbstractWFSWrapper getServer() {
return wfs;
}
-
+
}
Modified: plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSLayerListener.java
===================================================================
--- plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSLayerListener.java 2007-11-23 09:56:04 UTC (rev 1248)
+++ plug-ins/WFSPlugin/trunk/src/de/latlon/deejump/plugin/wfs/WFSLayerListener.java 2007-11-23 15:23:57 UTC (rev 1249)
@@ -1,30 +1,30 @@
/*---------------- FILE HEADER ------------------------------------------
-Copyright (C) 2001-2005 by:
-lat/lon GmbH
-http://www.lat-lon.de
+ Copyright (C) 2001-2005 by:
+ lat/lon GmbH
+ http://www.lat-lon.de
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-Contact:
+ Contact:
-Andreas Poth
-lat/lon GmbH
-Aennchenstraße 19
-53177 Bonn
-Germany
+ Andreas Poth
+ lat/lon GmbH
+ Aennchenstraße 19
+ 53177 Bonn
+ Germany
---------------------------------------------------------------------------*/
@@ -44,236 +44,199 @@
import com.vividsolutions.jump.workbench.model.LayerListener;
/**
- * This class keeps track of changes to its layer. It is intended to be used
- * with a WFSLayer only. Getters allow access to list and maps with the changed features.
- * These are used by the UpdataWFSLayerPlugIn (and TransactionFactory) to generated the
- * WFS Transaction requests.
+ * This class keeps track of changes to its layer. It is intended to be used with a WFSLayer only.
+ * Getters allow access to list and maps with the changed features. These are used by the
+ * UpdataWFSLayerPlugIn (and TransactionFactory) to generated the WFS Transaction requests.
*
* @author <a href="mailto:taddei@... Taddei</a>
*
*/
public class WFSLayerListener implements LayerListener {
-
- /** list of features with changes geometries */
- private ArrayList changedGeomFeatures = new ArrayList();
- /** list of features with changes features */
- private ArrayList changedAttrFeatures = new ArrayList();
-
- /** list of features which should be deleted from server */
- private ArrayList changedDelFeatures = new ArrayList();
+ private ArrayList<Feature> changedGeomFeatures = new ArrayList<Feature>();
- /** list of features which should be added to the server */
- private ArrayList changedAddFeatures = new ArrayList();
-
- /** map containing reference to original feature (to use as Filter)*/
- private HashMap oldGeomFeatures = new HashMap();
+ private ArrayList<Feature> changedAttrFeatures = new ArrayList<Feature>();
- /** map containing reference to original feature (to use as Filter)*/
- private HashMap oldAttrFeatures = new HashMap();
-
- /** the JUMP layer name*/
+ private ArrayList<Feature> changedDelFeatures = new ArrayList<Feature>();
+
+ private ArrayList<Feature> changedAddFeatures = new ArrayList<Feature>();
+
+ /** map containing reference to original feature (to use as Filter) */
+ private HashMap<Feature, Feature> oldGeomFeatures = new HashMap<Feature, Feature>();
+
+ /** map containing reference to original feature (to use as Filter) */
+ private HashMap<Feature, Feature> oldAttrFeatures = new HashMap<Feature, Feature>();
+
+ /** the JUMP layer name */
private String layerName;
-
+
/**
- * Creates a WfsLayerListener using the layer name. This layer name is
- * the JUMP layer name and <b>not<b/> the original WFS layer name.
- * @param layerName the JUMP layer name
+ * Creates a WfsLayerListener using the layer name. This layer name is the JUMP layer name and
+ * <b>not<b/> the original WFS layer name.
+ *
+ * @param layerName
+ * the JUMP layer name
*/
- public WFSLayerListener( String layerName ){
- this.layerName = layerName;
+ public WFSLayerListener( String layerName ) {
+ this.layerName = layerName;
}
/**
- * Keeps tracks of changes to the associated layer (the layer is
- * associated using its display name). The four
- * <code>FeatureEventType</code>s are treated separatedly.
- * <code>GEOMETRY_MODIFIED</code> <code>ATTRIBUTE_MODIFIED</code> are
- * combined by the <code>TransactionFactory</code> into one UPDATE
- * statement.<br/>
- * Changed features (and the reference to their riginal features) can
- * be retrieved with the methods getChangedFeaturesMap(),
- * getOldGeomFeaturesMap() and getAttrGeomFeaturesMap().
- * <br/>
+ * Keeps tracks of changes to the associated layer (the layer is associated using its display
+ * name). The four <code>FeatureEventType</code>s are treated separatedly.
+ * <code>GEOMETRY_MODIFIED</code> <code>ATTRIBUTE_MODIFIED</code> are combined by the
+ * <code>TransactionFactory</code> into one UPDATE statement.<br/> Changed features (and the
+ * reference to their riginal features) can be retrieved with the methods
+ * getChangedFeaturesMap(), getOldGeomFeaturesMap() and getAttrGeomFeaturesMap(). <br/>
+ *
* @see com.vividsolutions.jump.workbench.model.LayerListener#featuresChanged(com.vividsolutions.jump.workbench.model.FeatureEvent)
*/
- public void featuresChanged(FeatureEvent e) {
-
- if( !(e.getLayer() instanceof WFSLayer) ){
+ public void featuresChanged( FeatureEvent e ) {
+
+ if ( !( e.getLayer() instanceof WFSLayer ) ) {
return;
}
- if( !((WFSLayer)e.getLayer()).getName().equals( layerName )){
+ if ( !( (WFSLayer) e.getLayer() ).getName().equals( layerName ) ) {
return;
}
-
+
FeatureEventType fet = e.getType();
-System.out.println("**----* EVENT: " + fet);
- Collection collec = e.getFeatures();
-
- if( fet == FeatureEventType.GEOMETRY_MODIFIED ) {
-
- Iterator oldFeatIter = null;
- Collection oldFeatures = null;
- for (Iterator iter = collec.iterator(); iter.hasNext();) {
- Object modifiedFeature = iter.next();
+ Collection<?> collec = e.getFeatures();
- if ( changedGeomFeatures.contains( modifiedFeature ) ){
+ if ( fet == FeatureEventType.GEOMETRY_MODIFIED ) {
+
+ Iterator<?> oldFeatIter = null;
+ Collection<?> oldFeatures = null;
+
+ for ( Iterator<?> iter = collec.iterator(); iter.hasNext(); ) {
+ Feature modifiedFeature = (Feature)iter.next();
+
+ if ( changedGeomFeatures.contains( modifiedFeature ) ) {
changedGeomFeatures.remove( modifiedFeature );
}
changedGeomFeatures.add( modifiedFeature );
-
-
+
// old features
- if ( oldFeatures == null){
+ if ( oldFeatures == null ) {
oldFeatures = e.getOldFeatureClones();
oldFeatIter = oldFeatures.iterator();
}
Feature f = (Feature)oldFeatIter.next();
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|