Revision 29152

View differences:

tags/tmp_build/extensions/extDalTransformJoin/.project
1
<projectDescription>
2
  <name>org.gvsig.app.join</name>
3
  <comment>Base POM for all GvSIG extension projects. This pom knows
4
		how to build and made an extension for GvSIG. The property
5
		&quot;gvsig-path&quot; must be set up correctly.</comment>
6
  <projects>
7
    <project>appgvSIG</project>
8
    <project>libCorePlugin</project>
9
    <project>libIverUtiles</project>
10
    <project>libDXF</project>
11
    <project>_fwAndami</project>
12
    <project>extDalTransform</project>
13
    <project>libCompat</project>
14
    <project>libFMap_controls</project>
15
    <project>libFMap_dal</project>
16
    <project>libFMap_dalfile</project>
17
    <project>libFMap_dalindex</project>
18
    <project>libFMap_geometries</project>
19
    <project>libFMap_mapcontext</project>
20
    <project>libInternationalization</project>
21
    <project>libjni-gdal</project>
22
    <project>libMetadata</project>
23
    <project>libProjection</project>
24
    <project>libRaster</project>
25
    <project>libTools</project>
26
    <project>libEvaluator_SQLJEP</project>
27
    <project>libUIComponent</project>
28
  </projects>
29
  <buildSpec>
30
    <buildCommand>
31
      <name>org.eclipse.jdt.core.javabuilder</name>
32
    </buildCommand>
33
  </buildSpec>
34
  <natures>
35
    <nature>org.eclipse.jdt.core.javanature</nature>
36
  </natures>
37
</projectDescription>
0 38

  
tags/tmp_build/extensions/extDalTransformJoin/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<libraries library-dir="lib"/>
4
	<depends plugin-name="com.iver.cit.gvsig"/>
5
	<depends plugin-name="org.gvsig.app.daltransform"/>
6
	<resourceBundle name="text"/>
7
	<extensions>
8
		<extension class-name="org.gvsig.app.join.RemoveTableUnion"
9
			description="Extensi?n encargada de quitar uniones de las tablas."
10
			active="true">
11
			<menu text="Tabla/quitar_uniones"/>
12
		</extension>
13
		<extension class-name="org.gvsig.app.join.JoinToolExtension"
14
			description="Extensi?n encargada de gestionar las operaciones sobre las tablas."
15
			active="true">
16
			<menu text="Tabla/join" icon="table-join" action-command="JOIN"/>
17
			<tool-bar name="Herramientas" position="12">
18
				<action-tool icon="table-join" action-command="JOIN" tooltip="join" position="1"/>
19
			</tool-bar>
20
		</extension>	
21
		<extension class-name="org.gvsig.app.join.JoinTransformExtension"
22
			description="This extension loads the transformation."
23
			active="true">			
24
		</extension>		
25
	</extensions>
26
	<icon src="gvsig-logo-icon" text="gvSIG"/>
27
</plugin-config>
0 28

  
tags/tmp_build/extensions/extDalTransformJoin/target/maven-archiver/pom.properties
1
#Generated by Maven
2
#Tue May 19 15:57:33 CEST 2009
3
version=2.0-SNAPSHOT
4
groupId=org.gvsig
5
artifactId=org.gvsig.app.join
0 6

  
tags/tmp_build/extensions/extDalTransformJoin/target/extDalTransformJoin-distribution/extDalTransformJoin/gvSIG/extensiones/org.gvsig.app.join/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<libraries library-dir="lib"/>
4
	<depends plugin-name="com.iver.cit.gvsig"/>
5
	<depends plugin-name="org.gvsig.app.daltransform"/>
6
	<resourceBundle name="text"/>
7
	<extensions>
8
		<extension class-name="org.gvsig.app.join.RemoveTableUnion"
9
			description="Extensi?n encargada de quitar uniones de las tablas."
10
			active="true">
11
			<menu text="Tabla/quitar_uniones"/>
12
		</extension>
13
		<extension class-name="org.gvsig.app.join.JoinToolExtension"
14
			description="Extensi?n encargada de gestionar las operaciones sobre las tablas."
15
			active="true">
16
			<menu text="Tabla/join" icon="table-join" action-command="JOIN"/>
17
			<tool-bar name="Herramientas" position="12">
18
				<action-tool icon="table-join" action-command="JOIN" tooltip="join" position="1"/>
19
			</tool-bar>
20
		</extension>	
21
		<extension class-name="org.gvsig.app.join.JoinTransformExtension"
22
			description="This extension loads the transformation."
23
			active="true">			
24
		</extension>		
25
	</extensions>
26
	<icon src="gvsig-logo-icon" text="gvSIG"/>
27
</plugin-config>
0 28

  
tags/tmp_build/extensions/extDalTransformJoin/src/org/gvsig/app/join/JoinTransformExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2009 {Iver T.I.}   {Task}
26
*/
27
 
28
package org.gvsig.app.join;
29

  
30
import org.gvsig.app.daltransform.DataTransformLocator;
31
import org.gvsig.app.daltransform.DataTransformManager;
32
import org.gvsig.app.join.daltransform.JoinTransformGui;
33

  
34
import com.iver.andami.plugins.Extension;
35

  
36
/**
37
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
38
 */
39
public class JoinTransformExtension extends Extension{
40

  
41
	/* (non-Javadoc)
42
	 * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
43
	 */
44
	public void execute(String actionCommand) {
45
		// TODO Auto-generated method stub
46
		
47
	}
48

  
49
	/* (non-Javadoc)
50
	 * @see com.iver.andami.plugins.IExtension#initialize()
51
	 */
52
	public void initialize() {
53
		DataTransformManager dataTransformManager = DataTransformLocator.getDataTransformManager();
54
		dataTransformManager.registerDataTransform("join", JoinTransformGui.class);
55
	}
56

  
57
	/* (non-Javadoc)
58
	 * @see com.iver.andami.plugins.IExtension#isEnabled()
59
	 */
60
	public boolean isEnabled() {
61
		// TODO Auto-generated method stub
62
		return false;
63
	}
64

  
65
	/* (non-Javadoc)
66
	 * @see com.iver.andami.plugins.IExtension#isVisible()
67
	 */
68
	public boolean isVisible() {
69
		// TODO Auto-generated method stub
70
		return false;
71
	}
72

  
73
}
74

  
0 75

  
tags/tmp_build/extensions/extDalTransformJoin/src/org/gvsig/app/join/JoinToolExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.app.join;
29

  
30
import java.awt.Component;
31
import java.awt.Dimension;
32
import java.util.ArrayList;
33
import java.util.Iterator;
34

  
35
import javax.swing.JOptionPane;
36

  
37
import org.gvsig.app.join.dal.feature.JoinTransform;
38
import org.gvsig.fmap.dal.DALLocator;
39
import org.gvsig.fmap.dal.DataManager;
40
import org.gvsig.fmap.dal.DataTypes;
41
import org.gvsig.fmap.dal.exception.DataException;
42
import org.gvsig.fmap.dal.exception.ReadException;
43
import org.gvsig.fmap.dal.feature.DisposableIterator;
44
import org.gvsig.fmap.dal.feature.Feature;
45
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
46
import org.gvsig.fmap.dal.feature.FeatureQuery;
47
import org.gvsig.fmap.dal.feature.FeatureSelection;
48
import org.gvsig.fmap.dal.feature.FeatureSet;
49
import org.gvsig.fmap.dal.feature.FeatureStore;
50
import org.gvsig.project.document.table.FeatureTableDocument;
51
import org.gvsig.project.document.table.FeatureTableDocumentFactory;
52
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel;
53
import org.gvsig.project.document.table.gui.JoinWizardController;
54
import org.opengis.feature.FeatureCollection;
55

  
56
import com.iver.andami.PluginServices;
57
import com.iver.andami.messages.NotificationManager;
58
import com.iver.andami.plugins.Extension;
59
import com.iver.andami.ui.mdiManager.IWindow;
60
import com.iver.cit.gvsig.ProjectExtension;
61
import com.iver.cit.gvsig.TableOperations;
62
import com.iver.cit.gvsig.gui.filter.ExpressionListener;
63
import com.iver.cit.gvsig.project.documents.gui.AndamiWizard;
64
import com.iver.cit.gvsig.project.documents.gui.ObjectSelectionStep;
65
import com.iver.cit.gvsig.project.documents.table.FieldSelectionModel;
66
import com.iver.cit.gvsig.project.documents.table.TableSelectionModel;
67
import com.iver.utiles.swing.objectSelection.SelectionException;
68
import com.iver.utiles.swing.wizard.WizardControl;
69
import com.iver.utiles.swing.wizard.WizardEvent;
70
import com.iver.utiles.swing.wizard.WizardListener;
71

  
72
/**
73
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
74
 */
75
public class JoinToolExtension extends TableOperations {
76
	private FeatureStore featureStore = null;
77

  
78
	/**
79
	 * @see com.iver.mdiApp.plugins.IExtension#updateUI(java.lang.String)
80
	 */
81
	public void execute(String actionCommand) {
82
		ProjectExtension pe = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class);
83
		com.iver.cit.gvsig.project.Project project=pe.getProject();
84
		FeatureTableDocument[] pts = project.getDocumentsByType(FeatureTableDocumentFactory.registerName)
85
		.toArray(new FeatureTableDocument[0]);
86

  
87
		JoinWizardController wizardController = new JoinWizardController(this);
88
		wizardController.runWizard(pts);
89
	}	
90

  
91
	public void execJoin(FeatureTableDocument sourceProjectTable,
92
			String field1, String prefix1,
93
			FeatureTableDocument targetProjectTable, String field2,
94
			String prefix2) {
95

  
96
		FeatureStore fs1 = sourceProjectTable.getStore();
97

  
98
		FeatureStore fs2 = targetProjectTable.getStore();
99

  
100
		if (fs1 == fs2) {
101
			NotificationManager
102
					.addInfo("no_es_posible_aplicar_join_sobre_la_misma_fuente");
103
		}
104

  
105
		try {
106
			DataManager dm = DALLocator.getDataManager();
107
			JoinTransform jt = new JoinTransform();
108
			ArrayList<String> fields = new ArrayList<String>();
109
			Iterator iterator2 = fs2.getDefaultFeatureType().iterator();
110
			while (iterator2.hasNext()) {
111
				FeatureAttributeDescriptor descriptor = (FeatureAttributeDescriptor) iterator2
112
						.next();
113
				String name = descriptor.getName();
114
				if (!name.equals(field2)) {
115
					fields.add(name);
116
				}
117
			}
118
			jt.initialize(fs1, fs2, field1, field2, prefix1, prefix2, fields
119
					.toArray(new String[0]));
120
			fs1.getTransforms().add(jt);
121
			// featureStore=fs1;
122

  
123
		} catch (ReadException e) {
124
			NotificationManager.addError("Error leyendo del driver", e);
125
		} catch (DataException e) {
126
			NotificationManager.addError(e);
127
		}
128

  
129
	}
130
	
131
	
132
}
0 133

  
tags/tmp_build/extensions/extDalTransformJoin/src/org/gvsig/app/join/daltransform/JoinTransformGui.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.app.join.daltransform;
29

  
30
import java.util.ArrayList;
31
import java.util.List;
32

  
33
import javax.swing.JPanel;
34

  
35
import org.gvsig.app.daltransform.gui.DataTransformGui;
36
import org.gvsig.app.daltransform.gui.DataTransformWizard;
37
import org.gvsig.app.daltransform.gui.DataTransformWizardModel;
38
import org.gvsig.app.join.dal.feature.JoinTransform;
39
import org.gvsig.fmap.dal.exception.DataException;
40
import org.gvsig.fmap.dal.feature.FeatureStore;
41
import org.gvsig.fmap.dal.feature.FeatureStoreTransform;
42

  
43
import com.iver.andami.PluginServices;
44

  
45
/**
46
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
47
 */
48
public class JoinTransformGui implements DataTransformGui {
49
	private SelectSecondDataStoreWizard secondDataStoreWizard = null;
50
	private SelectParametersWizard parametersWizard = null;
51
	private List<DataTransformWizard> panels = null;	
52
	
53
	public JoinTransformGui() {
54
		super();			
55
	}
56
	
57
	/* (non-Javadoc)
58
	 * @see org.gvsig.app.daltransform.gui.FeatureTransformGui#createFeatureStoreTransform(org.gvsig.fmap.dal.feature.FeatureStore)
59
	 */
60
	public FeatureStoreTransform createFeatureStoreTransform(
61
			FeatureStore featureStore) throws DataException {
62
		JoinTransform transform = new JoinTransform();
63
		transform.initialize(featureStore,
64
				secondDataStoreWizard.getSelectedFeatureStore(),
65
				parametersWizard.getKeyAttr1(),
66
				parametersWizard.getkeyAtrr2(),
67
				parametersWizard.getPrefix1(),
68
				parametersWizard.getPrefix2(),
69
				parametersWizard.getAttributes()
70
		);
71
		return transform;
72
	}
73

  
74
	/* (non-Javadoc)
75
	 * @see org.gvsig.app.daltransform.gui.FeatureTransformGui#getDescription()
76
	 */
77
	public String getDescription() {
78
		return PluginServices.getText(this, "join_description");
79
	}
80

  
81
	/* (non-Javadoc)
82
	 * @see org.gvsig.app.daltransform.gui.FeatureTransformGui#createPanels(org.gvsig.app.daltransform.gui.FeatureTransformWizardModel)
83
	 */
84
	public List<DataTransformWizard> createPanels(
85
			DataTransformWizardModel featureTransformWizardModel) {
86
		if (panels == null){
87
			parametersWizard = new SelectParametersWizard(featureTransformWizardModel);
88
			secondDataStoreWizard = new SelectSecondDataStoreWizard(featureTransformWizardModel);
89
			panels = new ArrayList<DataTransformWizard>();
90
			panels.add(secondDataStoreWizard);
91
			panels.add(parametersWizard);				
92
		}	
93
		return panels;		
94
	}
95

  
96
	/* (non-Javadoc)
97
	 * @see org.gvsig.app.daltransform.gui.FeatureTransformGui#getName()
98
	 */
99
	public String getName() {
100
		return PluginServices.getText(this, "join_name");
101
	}
102

  
103
}
104

  
0 105

  
tags/tmp_build/extensions/extDalTransformJoin/src/org/gvsig/app/join/daltransform/SelectSecondDataStoreWizard.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.app.join.daltransform;
29

  
30
import java.util.List;
31

  
32
import org.gvsig.app.daltransform.gui.DataTransformWizard;
33
import org.gvsig.app.daltransform.gui.DataTransformWizardModel;
34
import org.gvsig.app.daltransform.gui.SelectDataStoreWizard;
35
import org.gvsig.fmap.dal.exception.DataException;
36

  
37
import com.iver.andami.PluginServices;
38

  
39
/**
40
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
41
 */
42
public class SelectSecondDataStoreWizard extends SelectDataStoreWizard{
43

  
44
	/**
45
	 * @param featureTransformWizardModel
46
	 */
47
	public SelectSecondDataStoreWizard(
48
			DataTransformWizardModel featureTransformWizardModel) {
49
		super(featureTransformWizardModel);			
50
	}
51

  
52
	/* (non-Javadoc)
53
	 * @see org.gvsig.app.daltransform.gui.SelectDataStoreWizard#getPanelTitle()
54
	 */	
55
	public String getPanelTitle() {
56
		return PluginServices.getText(this, "transform_second_datastore_selection");
57
	}
58

  
59
	/* (non-Javadoc)
60
	 * @see jwizardcomponent.JWizardPanel#next()
61
	 */	
62
	public void next() {
63
		List<DataTransformWizard> wizards = getAddedFeatureTransformWizards();
64
		for (int i=0 ; i<wizards.size() ; i++){
65
			if (wizards.get(i) instanceof SelectParametersWizard){
66
				try {
67
					((SelectParametersWizard)wizards.get(i)).updateFeatureStores(getSelectedFeatureStore());
68
				} catch (DataException e) {
69
					logger.error("Updating the combos", e);
70
				}
71

  
72
			}
73
		}
74
		super.next();
75
	}
76

  
77
	/* (non-Javadoc)
78
	 * @see org.gvsig.app.daltransform.gui.SelectDataStoreWizard#update()
79
	 */
80
	public void update() {
81
		removeFeatureStore(getFeatureStore());
82
		super.update();
83
	}
84
	
85
	
86
}
87

  
0 88

  
tags/tmp_build/extensions/extDalTransformJoin/src/org/gvsig/app/join/daltransform/SelectParametersWizard.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.app.join.daltransform;
29

  
30
import org.gvsig.app.daltransform.gui.DataTransformWizard;
31
import org.gvsig.app.daltransform.gui.DataTransformWizardModel;
32
import org.gvsig.app.daltransform.gui.components.FeatureTypeAttributeWrapper;
33
import org.gvsig.app.daltransform.gui.components.FeatureTypeAttributesCombo;
34
import org.gvsig.app.daltransform.gui.components.FeatureTypeAttributesList;
35
import org.gvsig.fmap.dal.exception.DataException;
36
import org.gvsig.fmap.dal.feature.FeatureStore;
37

  
38
import com.iver.andami.PluginServices;
39

  
40
/**
41
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
42
 */
43
public class SelectParametersWizard extends DataTransformWizard{
44
	private javax.swing.JLabel attributesLabel;
45
	private FeatureTypeAttributesList attributesList;
46
	private javax.swing.JScrollPane attributesScroll;
47
	private FeatureTypeAttributesCombo key1Combo;
48
	private javax.swing.JLabel key1Label;
49
	private FeatureTypeAttributesCombo key2Combo;
50
	private javax.swing.JLabel key2Label;
51
	private javax.swing.JLabel prefix1Label;
52
	private javax.swing.JTextField prefix1Text;
53
	private javax.swing.JLabel prefix2Label;
54
	private javax.swing.JTextField prefix2Text; 
55

  
56
	/**
57
	 * @param featureTransformWizardModel
58
	 */
59
	public SelectParametersWizard(
60
			DataTransformWizardModel featureTransformWizardModel) {
61
		super(featureTransformWizardModel);	
62
		initComponents();
63
		initLabels();
64
	}
65
	
66
	private void initLabels(){
67
		key1Label.setText(PluginServices.getText(this,"join_first_key"));
68
		key2Label.setText(PluginServices.getText(this,"join_second_key"));
69
		prefix1Label.setText(PluginServices.getText(this,"join_first_prefix"));
70
		prefix2Label.setText(PluginServices.getText(this,"join_second_prefix"));
71
		attributesLabel.setText(PluginServices.getText(this,"join_select_attributes"));
72
	}
73

  
74
	private void initComponents() {
75
		java.awt.GridBagConstraints gridBagConstraints;
76

  
77
		prefix2Text = new javax.swing.JTextField();
78
		key2Combo = new FeatureTypeAttributesCombo();
79
		prefix1Text = new javax.swing.JTextField();
80
		key1Label = new javax.swing.JLabel();
81
		key1Combo = new FeatureTypeAttributesCombo();
82
		key2Label = new javax.swing.JLabel();
83
		prefix1Label = new javax.swing.JLabel();
84
		prefix2Label = new javax.swing.JLabel();
85
		attributesLabel = new javax.swing.JLabel();
86
		attributesScroll = new javax.swing.JScrollPane();
87
		attributesList = new FeatureTypeAttributesList();
88

  
89
		setLayout(new java.awt.GridBagLayout());
90
		gridBagConstraints = new java.awt.GridBagConstraints();
91
		gridBagConstraints.gridx = 0;
92
		gridBagConstraints.gridy = 7;
93
		gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
94
		gridBagConstraints.weightx = 1.0;
95
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 3, 2);
96
		add(prefix2Text, gridBagConstraints);
97

  
98
		gridBagConstraints = new java.awt.GridBagConstraints();
99
		gridBagConstraints.gridx = 0;
100
		gridBagConstraints.gridy = 3;
101
		gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
102
		gridBagConstraints.weightx = 1.0;
103
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 3, 2);
104
		add(key2Combo, gridBagConstraints);
105
		gridBagConstraints = new java.awt.GridBagConstraints();
106
		gridBagConstraints.gridx = 0;
107
		gridBagConstraints.gridy = 5;
108
		gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
109
		gridBagConstraints.weightx = 1.0;
110
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 3, 2);
111
		add(prefix1Text, gridBagConstraints);
112

  
113
		key1Label.setText("jLabel1");
114
		gridBagConstraints = new java.awt.GridBagConstraints();
115
		gridBagConstraints.gridx = 0;
116
		gridBagConstraints.gridy = 0;
117
		gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
118
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
119
		add(key1Label, gridBagConstraints);
120

  
121
		gridBagConstraints = new java.awt.GridBagConstraints();
122
		gridBagConstraints.gridx = 0;
123
		gridBagConstraints.gridy = 1;
124
		gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
125
		gridBagConstraints.weightx = 1.0;
126
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 3, 2);
127
		add(key1Combo, gridBagConstraints);
128

  
129
		key2Label.setText("jLabel2");
130
		gridBagConstraints = new java.awt.GridBagConstraints();
131
		gridBagConstraints.gridx = 0;
132
		gridBagConstraints.gridy = 2;
133
		gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
134
		gridBagConstraints.insets = new java.awt.Insets(3, 2, 2, 2);
135
		add(key2Label, gridBagConstraints);
136

  
137
		prefix1Label.setText("jLabel1");
138
		gridBagConstraints = new java.awt.GridBagConstraints();
139
		gridBagConstraints.gridx = 0;
140
		gridBagConstraints.gridy = 4;
141
		gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
142
		gridBagConstraints.insets = new java.awt.Insets(3, 2, 2, 2);
143
		add(prefix1Label, gridBagConstraints);
144

  
145
		prefix2Label.setText("jLabel2");
146
		gridBagConstraints = new java.awt.GridBagConstraints();
147
		gridBagConstraints.gridx = 0;
148
		gridBagConstraints.gridy = 6;
149
		gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
150
		gridBagConstraints.insets = new java.awt.Insets(3, 2, 2, 2);
151
		add(prefix2Label, gridBagConstraints);
152

  
153
		attributesLabel.setText("attributesLabel");
154
		gridBagConstraints = new java.awt.GridBagConstraints();
155
		gridBagConstraints.gridx = 0;
156
		gridBagConstraints.gridy = 8;
157
		gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
158
		gridBagConstraints.insets = new java.awt.Insets(3, 2, 2, 2);
159
		add(attributesLabel, gridBagConstraints);
160

  
161
		attributesScroll.setViewportView(attributesList);
162

  
163
		gridBagConstraints = new java.awt.GridBagConstraints();
164
		gridBagConstraints.gridx = 0;
165
		gridBagConstraints.gridy = 9;
166
		gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
167
		gridBagConstraints.weightx = 1.0;
168
		gridBagConstraints.weighty = 1.0;
169
		gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
170
		add(attributesScroll, gridBagConstraints);
171
	}
172

  
173
	/**
174
	 * @return
175
	 */
176
	public String getKeyAttr1() {
177
		return key1Combo.getSelectedFeatureAttributeDescriptor().getName();
178
	}
179

  
180
	/**
181
	 * @return
182
	 */
183
	public String getkeyAtrr2() {
184
		return key2Combo.getSelectedFeatureAttributeDescriptor().getName();
185
	}
186

  
187
	/**
188
	 * @return
189
	 */
190
	public String getPrefix1() {
191
		return prefix1Text.getText();
192
	}
193

  
194
	/**
195
	 * @return
196
	 */
197
	public String getPrefix2() {
198
		return prefix2Text.getText();
199
	}
200

  
201
	/**
202
	 * @return
203
	 */
204
	public String[] getAttributes() {
205
		return attributesList.getAttributesName();
206
	}
207
	
208
	/**
209
	 * @param selectedFeatureStore
210
	 * @throws DataException 
211
	 */
212
	public void updateFeatureStores(FeatureStore selectedFeatureStore) throws DataException {
213
		key1Combo.addFeatureAttributes(getFeatureStore().getDefaultFeatureType());
214
		key2Combo.addFeatureAttributes(selectedFeatureStore.getDefaultFeatureType());
215
		attributesList.addFeatureAttributes(selectedFeatureStore.getDefaultFeatureType());
216
	}
217
}
218

  
0 219

  
tags/tmp_build/extensions/extDalTransformJoin/src/org/gvsig/app/join/RemoveTableUnion.java
1
package org.gvsig.app.join;
2

  
3
import org.gvsig.app.join.dal.feature.JoinTransform;
4
import org.gvsig.fmap.dal.feature.FeatureStore;
5
import org.gvsig.fmap.dal.feature.FeatureStoreTransform;
6
import org.gvsig.fmap.dal.feature.FeatureStoreTransforms;
7
import org.gvsig.project.document.table.FeatureTableDocument;
8
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel;
9

  
10
import com.iver.andami.PluginServices;
11
import com.iver.andami.plugins.Extension;
12
import com.iver.andami.ui.mdiManager.IWindow;
13

  
14
/**
15
 * @author Fernando Gonz?lez Cort?s
16
 */
17
public class RemoveTableUnion extends Extension{
18

  
19
	/**
20
	 * @see com.iver.andami.plugins.IExtension#initialize()
21
	 */
22
	public void initialize() {
23
		// TODO Auto-generated method stub
24

  
25
	}
26

  
27
	/**
28
	 * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
29
	 */
30
	public void execute(String actionCommand) {
31
		FeatureTableDocumentPanel t = (FeatureTableDocumentPanel) PluginServices.getMDIManager().getActiveWindow();
32
		FeatureTableDocument pt = t.getModel();
33
		FeatureStore fs = pt.getStore();
34
		this.removeJoinTransfor(fs);
35

  
36
		//		TODO
37
		//		if (fs instanceof JoinFeatureStore) {
38
		//			DataManager dm = DALLocator.getDataManager();
39
		//			DataStoreParameters originalParams = ((JoinFeatureStoreParameters) fs
40
		//					.getParameters()).getStorePrimary();
41
		//			FeatureStore original = null;
42
		//			try {
43
		//				original = (FeatureStore) dm.createStore(originalParams);
44
		//			} catch (InitializeException e) {
45
		//				NotificationManager.addError(e.getMessage(), e);
46
		//				return;
47
		//			}
48
		//
49
		//			pt.setStore(original);
50
		//			try {
51
		//				fs.dispose();
52
		//			} catch (CloseException e) {
53
		//				NotificationManager.addError(e);
54
		//			}
55
		//			t.setModel(pt);
56
		//
57
		//		}
58

  
59
		//		t.clearSelectedFields();
60
		t.getModel().setModified(true);
61
	}
62

  
63
	public void removeJoinTransfor(FeatureStore store) {
64
		FeatureStoreTransforms transforms = store.getTransforms();
65
		int size = transforms.size();
66
		if (size < 1) {
67
			return;
68
		}
69
		FeatureStoreTransform join = transforms.getTransform(size - 1);
70
		if (join instanceof JoinTransform) {
71
			transforms.remove(join);
72
		} else {
73
			return;
74
		}
75

  
76

  
77

  
78
	}
79

  
80
	public boolean hasJoinTransform(FeatureStore store) {
81

  
82
		FeatureStoreTransforms transforms = store.getTransforms();
83
		int size = transforms.size();
84
		if (size < 1) {
85
			return false;
86
		}
87
		return (transforms.getTransform(size - 1) instanceof JoinTransform);
88

  
89
	}
90

  
91
	/**
92
	 * @see com.iver.andami.plugins.IExtension#isEnabled()
93
	 */
94
	public boolean isEnabled() {
95
		IWindow v = PluginServices.getMDIManager().getActiveWindow();
96

  
97
		if (v == null) {
98
			return false;
99
		}
100

  
101
		if (v.getClass() == FeatureTableDocumentPanel.class) {
102
			FeatureTableDocumentPanel t = (FeatureTableDocumentPanel) v;
103
			// FIXME !!!! Asi se hacia antes
104
			//			if (t.getModel().getOriginal() != null){
105
			//				return true;
106
			//			}
107

  
108
			FeatureTableDocument pt = t.getModel();
109
			FeatureStore fs = pt.getStore();
110

  
111
			return this.hasJoinTransform(fs);
112
//			TODO
113
//			if (fs instanceof JoinFeatureStore) {
114
//				return true;
115
//			}
116

  
117
		}
118
		return false;
119
	}
120

  
121
	/**
122
	 * @see com.iver.andami.plugins.IExtension#isVisible()
123
	 */
124
	public boolean isVisible() {
125
		IWindow v = PluginServices.getMDIManager().getActiveWindow();
126

  
127
		if (v == null) {
128
			return false;
129
		}
130

  
131
		if (v instanceof FeatureTableDocumentPanel) {
132
			return true;
133
		} else {
134
			return false;
135
		}
136

  
137
	}
138

  
139
}
0 140

  
tags/tmp_build/extensions/extDalTransformJoin/src/org/gvsig/app/join/dal/feature/JoinTransform.java
1
package org.gvsig.app.join.dal.feature;
2

  
3
import java.util.ArrayList;
4
import java.util.Arrays;
5
import java.util.HashMap;
6
import java.util.Iterator;
7
import java.util.Map;
8
import java.util.Map.Entry;
9

  
10
import org.gvsig.fmap.dal.exception.DataException;
11
import org.gvsig.fmap.dal.feature.AbstractFeatureStoreTransform;
12
import org.gvsig.fmap.dal.feature.DisposableIterator;
13
import org.gvsig.fmap.dal.feature.EditableFeature;
14
import org.gvsig.fmap.dal.feature.EditableFeatureType;
15
import org.gvsig.fmap.dal.feature.Feature;
16
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
17
import org.gvsig.fmap.dal.feature.FeatureQuery;
18
import org.gvsig.fmap.dal.feature.FeatureSet;
19
import org.gvsig.fmap.dal.feature.FeatureStore;
20
import org.gvsig.fmap.dal.feature.FeatureType;
21
import org.gvsig.tools.evaluator.Evaluator;
22
import org.gvsig.tools.evaluator.EvaluatorData;
23
import org.gvsig.tools.evaluator.EvaluatorException;
24
import org.gvsig.tools.evaluator.EvaluatorFieldsInfo;
25
import org.gvsig.tools.persistence.PersistenceException;
26
import org.gvsig.tools.persistence.PersistentState;
27

  
28
public class JoinTransform extends AbstractFeatureStoreTransform {
29

  
30
	/**
31
	 * Store from which the join transform will get the additional attributes
32
	 */
33
	private FeatureStore store2;
34

  
35
	/**
36
	 * name of the key attr in store1 that will be used to match features in
37
	 * store2
38
	 */
39
	private String keyAttr1;
40

  
41
	/**
42
	 * name of the key attr in store2 that will be used to match features in
43
	 * store1
44
	 */
45
	private String keyAttr2;
46

  
47
	/**
48
	 * names of the attributes to join from store2 to store1
49
	 */
50
	private String[] attrs;
51

  
52
	/**
53
	 * Attribute names may change after transformation if they are repeated in
54
	 * both stores. This map keeps correspondence between store2 original names
55
	 * and their transformed counterparts.
56
	 */
57
	private Map targetNamesMap;
58

  
59
	private JoinTransformEvaluator evaluator = null;
60

  
61
	private FeatureType originalFeatureType;
62

  
63
	private String[] attrsForQuery;
64

  
65
	private String prefix1;
66

  
67
	private String prefix2;
68

  
69
	/**
70
	 * A default constructor
71
	 */
72
	public JoinTransform() {
73
		targetNamesMap = new HashMap();
74
	}
75

  
76
	/**
77
	 * Initializes all the necessary data for this transform
78
	 *
79
	 * @param store1
80
	 *            store whose default feature type is the target of this
81
	 *            transform
82
	 *
83
	 * @param store2
84
	 *            store whose default feature type will provide the new
85
	 *            attributes to join
86
	 *
87
	 * @param keyAttr1
88
	 *            key attribute in store1 that matches keyAttr2 in store2
89
	 *            (foreign key), used for joining both stores.
90
	 *
91
	 * @param keyAttr2
92
	 *            key attribute in store2 that matches keyAttr1 in store2
93
	 *            (foreign key), used for joining both stores.
94
	 *
95
	 * @param attrs
96
	 *            names of the attributes in store2 that will be joined to
97
	 *            store1.
98
	 */
99
	public void initialize(FeatureStore store1, FeatureStore store2,
100
			String keyAttr1, String keyAttr2, String prefix1, String prefix2,
101
			String[] attrs)
102
			throws DataException {
103

  
104
		if (store1 == store2) {
105
			throw new IllegalArgumentException("store1 == store2");
106
		}
107

  
108
		// Initialize needed data
109
		this.setFeatureStore(store1);
110
		this.store2 = store2;
111
		this.keyAttr1 = keyAttr1;
112
		this.keyAttr2 = keyAttr2;
113
		this.prefix1 = prefix1; // TODO
114
		this.prefix2 = prefix2; // TODO
115
		this.attrs = attrs;
116

  
117
		// calculate this transform resulting feature type
118
		// by adding all specified attrs from store2 to store1's default
119
		// feature type
120
		// FIXME for more than one FTypes ??
121
		this.originalFeatureType = this.getFeatureStore()
122
				.getDefaultFeatureType();
123

  
124
		// TODO tener en cuenta prefix1
125
		EditableFeatureType type = this.getFeatureStore().getDefaultFeatureType().getEditable();
126

  
127
		FeatureType type2 = store2.getDefaultFeatureType();
128

  
129
		// TODO tener en cuenta prefix2
130
		for (int i = 0; i < attrs.length; i++) {
131
			String name = attrs[i];
132

  
133
			// If an attribute already exists with the same name in store1's
134
			// default feature type,
135
			// calculate an alternate name and add it to our type
136
			int j = 0;
137
			while (type.getIndex(name) >= 0) {
138
				name = attrs[i] + "_" + ++j;
139
			}
140
			type.add(name,
141
					type2.getAttributeDescriptor(attrs[i]).getDataType());
142

  
143
			// keep correspondence between original name and transformed name
144
			this.targetNamesMap.put(attrs[i], name);
145
		}
146
		if (this.targetNamesMap.containsKey(keyAttr2)) {
147
			this.attrsForQuery = this.attrs;
148
		} else {
149
			ArrayList list = new ArrayList(this.attrs.length + 1);
150
			list.addAll(Arrays.asList(this.attrs));
151
			list.add(keyAttr2);
152
			this.attrsForQuery = (String[]) list.toArray(new String[] {});
153
		}
154

  
155
		// assign calculated feature type as this transform's feature type
156
		FeatureType[] types = new FeatureType[] { type.getNotEditableCopy() };
157
		setFeatureTypes(Arrays.asList(types), types[0]);
158
	}
159

  
160
	/**
161
	 *
162
	 *
163
	 * @param source
164
	 *
165
	 * @param target
166
	 *
167
	 * @throws DataException
168
	 */
169
	public void applyTransform(Feature source, EditableFeature target)
170
			throws DataException {
171

  
172
		// copy the data from store1 into the resulting feature
173
		this.copySourceToTarget(source, target);
174

  
175
		// ask store2 for the specified attributes, filtering by the key
176
		// attribute value
177
		// from the source feature
178
		JoinTransformEvaluator eval = this.getEvaluator();
179
		eval.updateValue(source.get(this.keyAttr1));
180

  
181
		FeatureQuery query = store2.createFeatureQuery();
182
		query.setAttributeNames(attrsForQuery);
183
		query.setFilter(eval);
184
		FeatureSet set = null;
185
		DisposableIterator itFeat = null;
186

  
187
		try {
188

  
189
		set = store2.getFeatureSet(query);
190
		// In this join implementation, we will take only the first matching
191
		// feature found in store2
192

  
193
		Feature feat;
194

  
195

  
196
		itFeat = set.iterator();
197
		if (itFeat.hasNext()) {
198
			feat = (Feature) itFeat.next();
199

  
200
			// copy all attributes from joined feature to target
201
			this.copyJoinToTarget(feat, target);
202
		}
203
		} finally {
204
			if (itFeat != null) {
205
				itFeat.dispose();
206
			}
207
			if (set != null) {
208
				set.dispose();
209
			}
210
		}
211
	}
212

  
213
	/**
214
	 * @param feat
215
	 * @param target
216
	 */
217
	private void copyJoinToTarget(Feature join, EditableFeature target) {
218
		Iterator iter = targetNamesMap.entrySet()
219
				.iterator();
220
		Entry entry;
221
		FeatureType trgType = target.getType();
222
		FeatureAttributeDescriptor attr;
223
		while (iter.hasNext()) {
224
			entry = (Entry) iter.next();
225
			attr = trgType.getAttributeDescriptor((String) entry.getValue());
226
			if (attr != null) {
227
				target.set(attr.getIndex(), join.get((String) entry.getKey()));
228
			}
229
		}
230

  
231

  
232
	}
233

  
234
	/**
235
	 * @param source
236
	 * @param target
237
	 */
238
	private void copySourceToTarget(Feature source, EditableFeature target) {
239
		FeatureAttributeDescriptor attr, attrTrg;
240
		FeatureType ftSrc = source.getType();
241
		FeatureType ftTrg = target.getType();
242

  
243

  
244
		for (int i = 0; i < source.getType().size(); i++) {
245
			attr = ftSrc.getAttributeDescriptor(i);
246
			attrTrg = ftTrg.getAttributeDescriptor(attr.getName());
247
			if (attrTrg != null) {
248
				try {
249
					target.set(attrTrg.getIndex(), source.get(i));
250
				} catch (IllegalArgumentException e) {
251
					attrTrg = ftTrg.getAttributeDescriptor(attr.getName());
252
					target.set(attrTrg.getIndex(), attrTrg.getDefaultValue());
253
				}
254

  
255
			}
256
		}
257

  
258
	}
259

  
260
	private JoinTransformEvaluator getEvaluator() {
261
		if (this.evaluator == null){
262
			this.evaluator = new JoinTransformEvaluator(keyAttr2);
263
		}
264
		return evaluator;
265

  
266
	}
267

  
268
	private class JoinTransformEvaluator implements Evaluator {
269

  
270
		private String attribute;
271
		private Object value;
272
		private String cql;
273
		private EvaluatorFieldsInfo info = null;
274

  
275
		//		private int attributeIndex;
276

  
277
		public JoinTransformEvaluator(String attribute) {
278
			this.attribute = attribute;
279
			this.value = null;
280
			this.info = new EvaluatorFieldsInfo();
281

  
282
			//			this.attributeIndex = attrIndex;
283
		}
284

  
285
		public void updateValue(Object value) {
286
			this.value = value;
287
			this.cql = this.attribute + "= '" + this.value + "'";
288
			this.info = new EvaluatorFieldsInfo();
289
			this.info.addMatchFieldValue(this.attribute, value);
290
		}
291

  
292
		public Object evaluate(EvaluatorData arg0) throws EvaluatorException {
293
			Object curValue = arg0.getDataValue(attribute);
294
			if (curValue == null) {
295
				return value == null;
296
			}
297
			return curValue.equals(value);
298
		}
299

  
300
		public String getCQL() {
301
			return this.cql;
302
		}
303

  
304
		public String getDescription() {
305
			return "Evaluates join transform match";
306
		}
307

  
308
		public String getName() {
309
			return "JoinTransformEvaluator";
310
		}
311

  
312
		public EvaluatorFieldsInfo getFieldsInfo() {
313
			return this.info;
314
		}
315

  
316
	}
317

  
318
	public void saveToState(PersistentState state) throws PersistenceException {
319
		// TODO Auto-generated method stub
320

  
321
	}
322

  
323
	public void loadFromState(PersistentState state) throws PersistenceException {
324
		// TODO Auto-generated method stub
325

  
326
	}
327

  
328
	public FeatureType getSourceFeatureTypeFrom(FeatureType arg0) {
329
		EditableFeatureType orgType = originalFeatureType.getEditable();
330
		Iterator iter = arg0.iterator();
331
		FeatureAttributeDescriptor attr;
332
		ArrayList toRetain = new ArrayList();
333
		while (iter.hasNext()) {
334
			attr = (FeatureAttributeDescriptor) iter.next();
335
			if (this.targetNamesMap.containsValue(attr.getName())) {
336
				continue;
337
			}
338
			toRetain.add(attr.getName());
339
		}
340

  
341
		if (!toRetain.contains(keyAttr1)) {
342
			toRetain.add(keyAttr1);
343
		}
344

  
345
		iter = originalFeatureType.iterator();
346
		while (iter.hasNext()) {
347
			attr = (FeatureAttributeDescriptor) iter.next();
348
			if (!toRetain.contains(attr.getName())) {
349
				orgType.remove(attr.getName());
350
			}
351

  
352
		}
353

  
354
		return orgType.getNotEditableCopy();
355
	}
356

  
357
	public boolean isTransformsOriginalValues() {
358
		return false;
359
	}
360

  
361
}
0 362

  
tags/tmp_build/extensions/extDalTransformJoin/src/org/gvsig/project/document/table/gui/JoinWizardController.java
1
/**
2
 *
3
 */
4
package org.gvsig.project.document.table.gui;
5

  
6
import java.awt.Dimension;
7
import java.awt.event.ItemEvent;
8
import java.awt.event.ItemListener;
9

  
10
import javax.swing.ImageIcon;
11

  
12
import jwizardcomponent.FinishAction;
13

  
14
import org.gvsig.app.join.JoinToolExtension;
15
import org.gvsig.fmap.dal.exception.DataException;
16
import org.gvsig.fmap.dal.exception.ReadException;
17
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
18
import org.gvsig.fmap.dal.feature.FeatureStore;
19
import org.gvsig.project.document.table.FeatureTableDocument;
20

  
21
import com.iver.andami.PluginServices;
22
import com.iver.andami.messages.NotificationManager;
23
import com.iver.cit.gvsig.gui.simpleWizard.SimpleWizard;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff