Author: lemovice Date: Sun Oct 13 14:22:34 2013 New Revision: 4623 Log: Add map view, based on OpenStreetMap
Modified: trunk/AncestrisExtensions/editors.place/nbproject/genfiles.properties trunk/AncestrisExtensions/editors.place/nbproject/project.xml trunk/AncestrisExtensions/editors.place/src/ancestris/modules/editors/placeeditor/panels/Bundle.properties trunk/AncestrisExtensions/editors.place/src/ancestris/modules/editors/placeeditor/panels/PlacesEditorPanel.form trunk/AncestrisExtensions/editors.place/src/ancestris/modules/editors/placeeditor/panels/PlacesEditorPanel.java Modified: trunk/AncestrisExtensions/editors.place/nbproject/genfiles.properties ============================================================================== --- trunk/AncestrisExtensions/editors.place/nbproject/genfiles.properties (original) +++ trunk/AncestrisExtensions/editors.place/nbproject/genfiles.properties Sun Oct 13 14:22:34 2013 @@ -3,6 +3,6 @@ [email protected] # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=1125e9f9 +nbproject/build-impl.xml.data.CRC32=780d373c nbproject/build-impl.xml.script.CRC32=0a4bed32 nbproject/[email protected] Modified: trunk/AncestrisExtensions/editors.place/nbproject/project.xml ============================================================================== --- trunk/AncestrisExtensions/editors.place/nbproject/project.xml (original) +++ trunk/AncestrisExtensions/editors.place/nbproject/project.xml Sun Oct 13 14:22:34 2013 @@ -31,6 +31,14 @@ </run-dependency> </dependency> <dependency> + <code-name-base>ancestris.libs.swingx</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>1.0</specification-version> + </run-dependency> + </dependency> + <dependency> <code-name-base>ancestris.modules.gedcom.utilities</code-name-base> <build-prerequisite/> <compile-dependency/> Modified: trunk/AncestrisExtensions/editors.place/src/ancestris/modules/editors/placeeditor/panels/Bundle.properties ============================================================================== --- trunk/AncestrisExtensions/editors.place/src/ancestris/modules/editors/placeeditor/panels/Bundle.properties (original) +++ trunk/AncestrisExtensions/editors.place/src/ancestris/modules/editors/placeeditor/panels/Bundle.properties Sun Oct 13 14:22:34 2013 @@ -33,3 +33,4 @@ PlacesEditorPanel.PlaceReferencesPanel.TabConstraints.tabTitle=References PlacesEditorPanel.latitudeLabel.text=Latitude PlacesEditorPanel.longitudeLabel.text=Longitude +PlacesEditorPanel.jScrollPane1.TabConstraints.tabTitle=Map Modified: trunk/AncestrisExtensions/editors.place/src/ancestris/modules/editors/placeeditor/panels/PlacesEditorPanel.form ============================================================================== --- trunk/AncestrisExtensions/editors.place/src/ancestris/modules/editors/placeeditor/panels/PlacesEditorPanel.form (original) +++ trunk/AncestrisExtensions/editors.place/src/ancestris/modules/editors/placeeditor/panels/PlacesEditorPanel.form Sun Oct 13 14:22:34 2013 @@ -1,6 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <Form version="1.6" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> + <Properties> + <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[537, 414]"/> + </Property> + </Properties> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> @@ -20,7 +25,7 @@ <EmptySpace min="-2" max="-2" attributes="0"/> <Group type="103" groupAlignment="1" attributes="0"> <Component id="jPanel1" max="32767" attributes="0"/> - <Component id="jTabbedPane1" max="32767" attributes="0"/> + <Component id="jTabbedPane1" pref="513" max="32767" attributes="0"/> </Group> <EmptySpace min="-2" max="-2" attributes="0"/> </Group> @@ -39,6 +44,123 @@ </DimensionLayout> </Layout> <SubComponents> + <Container class="javax.swing.JPanel" name="jPanel1"> + <Properties> + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> + <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo"> + <EtchetBorder/> + </Border> + </Property> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[513, 121]"/> + </Property> + </Properties> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace min="-2" pref="34" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel9" alignment="0" min="-2" max="-2" attributes="0"/> + <Component id="latitudeLabel" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel12" alignment="1" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="jTextField12" alignment="0" max="32767" attributes="0"/> + <Component id="latitudeTextField" alignment="0" max="32767" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="28" max="-2" attributes="0"/> + <Component id="longitudeLabel" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="longitudeTextField" max="32767" attributes="0"/> + </Group> + <Component id="jComboBox1" max="32767" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="35" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jComboBox1" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Group type="103" alignment="0" groupAlignment="3" attributes="0"> + <Component id="latitudeLabel" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="longitudeLabel" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="longitudeTextField" min="-2" max="-2" attributes="0"/> + </Group> + <Component id="latitudeTextField" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel12" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField12" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabel9"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="ancestris/modules/editors/placeeditor/panels/Bundle.properties" key="PlacesEditorPanel.jLabel9.text" replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}"), {arguments})"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="latitudeLabel"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="ancestris/modules/editors/placeeditor/panels/Bundle.properties" key="PlacesEditorPanel.latitudeLabel.text" replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}"), {arguments})"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="latitudeTextField"> + </Component> + <Component class="javax.swing.JLabel" name="longitudeLabel"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="ancestris/modules/editors/placeeditor/panels/Bundle.properties" key="PlacesEditorPanel.longitudeLabel.text" replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}"), {arguments})"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="longitudeTextField"> + </Component> + <Component class="javax.swing.JLabel" name="jLabel12"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="ancestris/modules/editors/placeeditor/panels/Bundle.properties" key="PlacesEditorPanel.jLabel12.text" replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}"), {arguments})"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField12"> + </Component> + <Component class="javax.swing.JComboBox" name="jComboBox1"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="placesComboBoxModel" type="code"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox1ActionPerformed"/> + </Events> + <AuxValues> + <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<Place>"/> + </AuxValues> + </Component> + </SubComponents> + </Container> <Container class="javax.swing.JTabbedPane" name="jTabbedPane1"> <Properties> <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> @@ -46,6 +168,9 @@ <EtchetBorder/> </Border> </Property> + <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[513, 263]"/> + </Property> </Properties> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/> @@ -83,7 +208,7 @@ </Group> <EmptySpace min="-2" max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jTextField7" alignment="0" pref="111" max="32767" attributes="0"/> + <Component id="jTextField7" alignment="0" pref="112" max="32767" attributes="0"/> <Component id="jTextField8" alignment="0" max="32767" attributes="0"/> <Component id="jTextField6" alignment="0" max="32767" attributes="0"/> <Component id="jTextField4" alignment="0" max="32767" attributes="0"/> @@ -98,7 +223,7 @@ <EmptySpace min="-2" max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> <Component id="jTextField3" alignment="0" max="32767" attributes="0"/> - <Component id="jTextField5" alignment="0" pref="118" max="32767" attributes="0"/> + <Component id="jTextField5" alignment="0" pref="119" max="32767" attributes="0"/> </Group> <EmptySpace min="-2" pref="53" max="-2" attributes="0"/> </Group> @@ -143,7 +268,7 @@ <Component id="jLabel8" alignment="3" min="-2" pref="17" max="-2" attributes="0"/> <Component id="jTextField8" alignment="3" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace max="32767" attributes="0"/> + <EmptySpace pref="24" max="32767" attributes="0"/> </Group> </Group> </DimensionLayout> @@ -230,24 +355,30 @@ <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Component id="jScrollPane1" pref="479" max="32767" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> + <Component id="placeReferenceScrollPane" max="32767" attributes="0"/> + <EmptySpace min="-2" pref="106" max="-2" attributes="0"/> </Group> </Group> </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Component id="jScrollPane1" pref="194" max="32767" attributes="0"/> + <Group type="102" attributes="0"> <EmptySpace max="-2" attributes="0"/> + <Component id="placeReferenceScrollPane" max="32767" attributes="0"/> </Group> </Group> </DimensionLayout> </Layout> <SubComponents> - <Container class="javax.swing.JScrollPane" name="jScrollPane1"> + <Container class="javax.swing.JScrollPane" name="placeReferenceScrollPane"> + <Properties> + <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[503, 218]"/> + </Property> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[503, 218]"/> + </Property> + </Properties> <AuxValues> <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> </AuxValues> @@ -265,120 +396,23 @@ </Container> </SubComponents> </Container> - </SubComponents> - </Container> - <Container class="javax.swing.JPanel" name="jPanel1"> - <Properties> - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> - <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo"> - <EtchetBorder/> - </Border> - </Property> - </Properties> + <Container class="javax.swing.JScrollPane" name="jScrollPane1"> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription"> + <JTabbedPaneConstraints tabName="Map"> + <Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="ancestris/modules/editors/placeeditor/panels/Bundle.properties" key="PlacesEditorPanel.jScrollPane1.TabConstraints.tabTitle" replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}"), {arguments})"/> + </Property> + </JTabbedPaneConstraints> + </Constraint> + </Constraints> - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace min="-2" pref="34" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jLabel9" alignment="0" min="-2" max="-2" attributes="0"/> - <Component id="latitudeLabel" alignment="1" min="-2" max="-2" attributes="0"/> - <Component id="jLabel12" alignment="1" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <Group type="103" groupAlignment="1" attributes="0"> - <Component id="jTextField12" alignment="0" max="32767" attributes="0"/> - <Component id="latitudeTextField" alignment="0" max="32767" attributes="0"/> - </Group> - <EmptySpace min="-2" pref="28" max="-2" attributes="0"/> - <Component id="longitudeLabel" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="longitudeTextField" max="32767" attributes="0"/> - </Group> - <Component id="jComboBox1" max="32767" attributes="0"/> - </Group> - <EmptySpace min="-2" pref="35" max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jComboBox1" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" max="-2" attributes="0"> - <Group type="103" alignment="0" groupAlignment="3" attributes="0"> - <Component id="latitudeLabel" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="longitudeLabel" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="longitudeTextField" min="-2" max="-2" attributes="0"/> - </Group> - <Component id="latitudeTextField" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel12" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jTextField12" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace max="32767" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - </Layout> - <SubComponents> - <Component class="javax.swing.JLabel" name="jLabel9"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="ancestris/modules/editors/placeeditor/panels/Bundle.properties" key="PlacesEditorPanel.jLabel9.text" replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}"), {arguments})"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="latitudeLabel"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="ancestris/modules/editors/placeeditor/panels/Bundle.properties" key="PlacesEditorPanel.latitudeLabel.text" replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}"), {arguments})"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="latitudeTextField"> - </Component> - <Component class="javax.swing.JLabel" name="longitudeLabel"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="ancestris/modules/editors/placeeditor/panels/Bundle.properties" key="PlacesEditorPanel.longitudeLabel.text" replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}"), {arguments})"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="longitudeTextField"> - </Component> - <Component class="javax.swing.JLabel" name="jLabel12"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="ancestris/modules/editors/placeeditor/panels/Bundle.properties" key="PlacesEditorPanel.jLabel12.text" replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}"), {arguments})"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="jTextField12"> - </Component> - <Component class="javax.swing.JComboBox" name="jComboBox1"> - <Properties> - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> - <Connection code="placesComboBoxModel" type="code"/> - </Property> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox1ActionPerformed"/> - </Events> - <AuxValues> - <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<Place>"/> - </AuxValues> - </Component> + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> + <SubComponents> + <Component class="org.jdesktop.swingx.JXMapKit" name="jXMapKit1"> + </Component> + </SubComponents> + </Container> </SubComponents> </Container> </SubComponents> Modified: trunk/AncestrisExtensions/editors.place/src/ancestris/modules/editors/placeeditor/panels/PlacesEditorPanel.java ============================================================================== --- trunk/AncestrisExtensions/editors.place/src/ancestris/modules/editors/placeeditor/panels/PlacesEditorPanel.java (original) +++ trunk/AncestrisExtensions/editors.place/src/ancestris/modules/editors/placeeditor/panels/PlacesEditorPanel.java Sun Oct 13 14:22:34 2013 @@ -13,13 +13,15 @@ import java.util.List; import java.util.Set; import javax.swing.DefaultComboBoxModel; +import org.jdesktop.swingx.JXMapKit; +import org.jdesktop.swingx.mapviewer.GeoPosition; /** * * @author dominique */ public class PlacesEditorPanel extends javax.swing.JPanel { - + GeonamePostalCodeListModel geonamePostalCodeListModel = new GeonamePostalCodeListModel(); String[] placeFormat; private ReferencesTableModel referencesTableModel; @@ -32,13 +34,13 @@ Object[] propertyPlaceArray = propertyPlaces.toArray(); referencesTableModel = new ReferencesTableModel(); placesComboBoxModel = new DefaultComboBoxModel(); - + this.placeFormat = placeFormat; String[] jurisdictions = ((PropertyPlace) propertyPlaceArray[0]).getJurisdictions(); if (jurisdictions.length > 1) { if (jurisdictions[1].isEmpty() == false) { List<Place> findPlaces = new GeonamesPlacesList().findPlace((PropertyPlace) propertyPlaceArray[0]); - + if (findPlaces != null) { for (Place place : findPlaces) { placesComboBoxModel.addElement(place); @@ -46,17 +48,25 @@ } } } - + for (PropertyPlace propertyPlace : propertyPlaces) { referencesTableModel.addRow(propertyPlace); } - + initComponents(); + + jXMapKit1.setDataProviderCreditShown(true); + jXMapKit1.getMainMap().setRecenterOnClickEnabled(true); + jXMapKit1.setDefaultProvider(JXMapKit.DefaultProviders.OpenStreetMaps); + jXMapKit1.setMiniMapVisible(false); + jXMapKit1.getZoomSlider().setValue(5); + placeReferencesTable.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { - int rowIndex = placeReferencesTable.convertRowIndexToModel(placeReferencesTable.getSelectedRow()); - Entity entity = ((ReferencesTableModel)placeReferencesTable.getModel()).getValueAt(rowIndex); + int rowIndex = placeReferencesTable.convertRowIndexToModel(placeReferencesTable.getSelectedRow()); + Entity entity = ((ReferencesTableModel) placeReferencesTable.getModel()).getValueAt(rowIndex); SelectionDispatcher.fireSelection(new Context(entity)); } }); @@ -65,8 +75,9 @@ if (selectedItem != null) { latitudeTextField.setText(selectedItem.getLatitude().toString()); longitudeTextField.setText(selectedItem.getLongitude().toString()); + jXMapKit1.setAddressLocation(new GeoPosition(selectedItem.getLatitude(), selectedItem.getLongitude())); } - + if (placeFormat.length > 0) { jLabel1.setText(placeFormat[0]); jTextField1.setVisible(true); @@ -75,7 +86,7 @@ jLabel1.setText(""); jTextField1.setVisible(false); } - + if (placeFormat.length > 1) { jLabel2.setText(placeFormat[1]); jTextField2.setVisible(true); @@ -84,7 +95,7 @@ jLabel2.setText(""); jTextField2.setVisible(false); } - + if (placeFormat.length > 2) { jLabel3.setText(placeFormat[2]); jTextField3.setVisible(true); @@ -93,7 +104,7 @@ jLabel3.setText(""); jTextField3.setVisible(false); } - + if (placeFormat.length > 3) { jLabel4.setText(placeFormat[3]); jTextField4.setVisible(true); @@ -102,7 +113,7 @@ jLabel4.setText(""); jTextField4.setVisible(false); } - + if (placeFormat.length > 4) { jLabel5.setText(placeFormat[4]); jTextField5.setVisible(true); @@ -111,7 +122,7 @@ jLabel5.setText(""); jTextField5.setVisible(false); } - + if (placeFormat.length > 5) { jLabel6.setText(placeFormat[5]); jTextField6.setVisible(true); @@ -120,7 +131,7 @@ jLabel6.setText(""); jTextField6.setVisible(false); } - + if (placeFormat.length > 6) { jLabel7.setText(placeFormat[6]); jTextField7.setVisible(true); @@ -129,7 +140,7 @@ jLabel7.setText(""); jTextField7.setVisible(false); } - + if (placeFormat.length > 7) { jLabel8.setText(placeFormat[7]); jTextField8.setVisible(true); @@ -139,49 +150,49 @@ jTextField8.setVisible(false); } } - + public String getPlaceString() { String placeString = ""; - + if (placeFormat.length > 0) { placeString = jTextField1.getText(); } - + if (placeFormat.length > 1) { placeString += PropertyPlace.JURISDICTION_SEPARATOR; placeString += jTextField2.getText(); } - + if (placeFormat.length > 2) { placeString += PropertyPlace.JURISDICTION_SEPARATOR; placeString += jTextField3.getText(); } - + if (placeFormat.length > 3) { placeString += PropertyPlace.JURISDICTION_SEPARATOR; placeString += jTextField4.getText(); } - + if (placeFormat.length > 4) { placeString += PropertyPlace.JURISDICTION_SEPARATOR; placeString += jTextField5.getText(); } - + if (placeFormat.length > 5) { placeString += PropertyPlace.JURISDICTION_SEPARATOR; placeString += jTextField6.getText(); } - + if (placeFormat.length > 6) { placeString += PropertyPlace.JURISDICTION_SEPARATOR; placeString += jTextField7.getText(); } - + if (placeFormat.length > 7) { placeString += PropertyPlace.JURISDICTION_SEPARATOR; placeString += jTextField8.getText(); } - + return placeString; } @@ -194,6 +205,15 @@ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { + jPanel1 = new javax.swing.JPanel(); + jLabel9 = new javax.swing.JLabel(); + latitudeLabel = new javax.swing.JLabel(); + latitudeTextField = new javax.swing.JTextField(); + longitudeLabel = new javax.swing.JLabel(); + longitudeTextField = new javax.swing.JTextField(); + jLabel12 = new javax.swing.JLabel(); + jTextField12 = new javax.swing.JTextField(); + jComboBox1 = new javax.swing.JComboBox<Place>(); jTabbedPane1 = new javax.swing.JTabbedPane(); PlaceEditorPanel = new javax.swing.JPanel(); jLabel8 = new javax.swing.JLabel(); @@ -213,19 +233,77 @@ jTextField4 = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); PlaceReferencesPanel = new javax.swing.JPanel(); - jScrollPane1 = new javax.swing.JScrollPane(); + placeReferenceScrollPane = new javax.swing.JScrollPane(); placeReferencesTable = new javax.swing.JTable(); - jPanel1 = new javax.swing.JPanel(); - jLabel9 = new javax.swing.JLabel(); - latitudeLabel = new javax.swing.JLabel(); - latitudeTextField = new javax.swing.JTextField(); - longitudeLabel = new javax.swing.JLabel(); - longitudeTextField = new javax.swing.JTextField(); - jLabel12 = new javax.swing.JLabel(); - jTextField12 = new javax.swing.JTextField(); - jComboBox1 = new javax.swing.JComboBox<Place>(); + jScrollPane1 = new javax.swing.JScrollPane(); + jXMapKit1 = new org.jdesktop.swingx.JXMapKit(); + + setMinimumSize(new java.awt.Dimension(537, 414)); + + jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + jPanel1.setPreferredSize(new java.awt.Dimension(513, 121)); + + org.openide.awt.Mnemonics.setLocalizedText(jLabel9, java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/placeeditor/panels/Bundle").getString("PlacesEditorPanel.jLabel9.text"), new Object[] {})); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(latitudeLabel, java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/placeeditor/panels/Bundle").getString("PlacesEditorPanel.latitudeLabel.text"), new Object[] {})); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(longitudeLabel, java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/placeeditor/panels/Bundle").getString("PlacesEditorPanel.longitudeLabel.text"), new Object[] {})); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel12, java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/placeeditor/panels/Bundle").getString("PlacesEditorPanel.jLabel12.text"), new Object[] {})); // NOI18N + + jComboBox1.setModel(placesComboBoxModel); + jComboBox1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(34, 34, 34) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel9) + .addComponent(latitudeLabel, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jTextField12, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(latitudeTextField, javax.swing.GroupLayout.Alignment.LEADING)) + .addGap(28, 28, 28) + .addComponent(longitudeLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(longitudeTextField)) + .addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(35, 35, 35)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel9) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(latitudeLabel) + .addComponent(longitudeLabel) + .addComponent(longitudeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(latitudeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel12) + .addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); jTabbedPane1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + jTabbedPane1.setMinimumSize(new java.awt.Dimension(513, 263)); PlaceEditorPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); @@ -268,7 +346,7 @@ .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(PlaceEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jTextField7, javax.swing.GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE) + .addComponent(jTextField7, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE) .addComponent(jTextField8) .addComponent(jTextField6) .addComponent(jTextField4) @@ -281,7 +359,7 @@ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(PlaceEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField3) - .addComponent(jTextField5, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)) + .addComponent(jTextField5, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE)) .addGap(53, 53, 53)) ); PlaceEditorPanelLayout.setVerticalGroup( @@ -316,93 +394,37 @@ .addGroup(PlaceEditorPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(24, Short.MAX_VALUE)) ); jTabbedPane1.addTab(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/placeeditor/panels/Bundle").getString("PlacesEditorPanel.PlaceEditorPanel.TabConstraints.tabTitle"), new Object[] {}), PlaceEditorPanel); // NOI18N + placeReferenceScrollPane.setMinimumSize(new java.awt.Dimension(503, 218)); + placeReferenceScrollPane.setPreferredSize(new java.awt.Dimension(503, 218)); + placeReferencesTable.setModel(referencesTableModel); - jScrollPane1.setViewportView(placeReferencesTable); + placeReferenceScrollPane.setViewportView(placeReferencesTable); javax.swing.GroupLayout PlaceReferencesPanelLayout = new javax.swing.GroupLayout(PlaceReferencesPanel); PlaceReferencesPanel.setLayout(PlaceReferencesPanelLayout); PlaceReferencesPanelLayout.setHorizontalGroup( PlaceReferencesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(PlaceReferencesPanelLayout.createSequentialGroup() - .addContainerGap() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 479, Short.MAX_VALUE) - .addContainerGap()) + .addComponent(placeReferenceScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(106, 106, 106)) ); PlaceReferencesPanelLayout.setVerticalGroup( PlaceReferencesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(PlaceReferencesPanelLayout.createSequentialGroup() .addContainerGap() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 194, Short.MAX_VALUE) - .addContainerGap()) + .addComponent(placeReferenceScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jTabbedPane1.addTab(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/placeeditor/panels/Bundle").getString("PlacesEditorPanel.PlaceReferencesPanel.TabConstraints.tabTitle"), new Object[] {}), PlaceReferencesPanel); // NOI18N - jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - - org.openide.awt.Mnemonics.setLocalizedText(jLabel9, java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/placeeditor/panels/Bundle").getString("PlacesEditorPanel.jLabel9.text"), new Object[] {})); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(latitudeLabel, java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/placeeditor/panels/Bundle").getString("PlacesEditorPanel.latitudeLabel.text"), new Object[] {})); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(longitudeLabel, java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/placeeditor/panels/Bundle").getString("PlacesEditorPanel.longitudeLabel.text"), new Object[] {})); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(jLabel12, java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/placeeditor/panels/Bundle").getString("PlacesEditorPanel.jLabel12.text"), new Object[] {})); // NOI18N + jScrollPane1.setViewportView(jXMapKit1); - jComboBox1.setModel(placesComboBoxModel); - jComboBox1.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jComboBox1ActionPerformed(evt); - } - }); - - javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(34, 34, 34) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel9) - .addComponent(latitudeLabel, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jTextField12, javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(latitudeTextField, javax.swing.GroupLayout.Alignment.LEADING)) - .addGap(28, 28, 28) - .addComponent(longitudeLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(longitudeTextField)) - .addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGap(35, 35, 35)) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel9) - .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(latitudeLabel) - .addComponent(longitudeLabel) - .addComponent(longitudeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(latitudeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel12) - .addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); + jTabbedPane1.addTab(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/placeeditor/panels/Bundle").getString("PlacesEditorPanel.jScrollPane1.TabConstraints.tabTitle"), new Object[] {}), jScrollPane1); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -412,7 +434,7 @@ .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jTabbedPane1)) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 513, Short.MAX_VALUE)) .addContainerGap()) ); layout.setVerticalGroup( @@ -421,7 +443,7 @@ .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jTabbedPane1) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents @@ -431,6 +453,7 @@ if (selectedItem != null) { latitudeTextField.setText(selectedItem.getLatitude().toString()); longitudeTextField.setText(selectedItem.getLongitude().toString()); + jXMapKit1.setAddressLocation(new GeoPosition(selectedItem.getLatitude(), selectedItem.getLongitude())); } }//GEN-LAST:event_jComboBox1ActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables @@ -459,10 +482,12 @@ private javax.swing.JTextField jTextField6; private javax.swing.JTextField jTextField7; private javax.swing.JTextField jTextField8; + private org.jdesktop.swingx.JXMapKit jXMapKit1; private javax.swing.JLabel latitudeLabel; private javax.swing.JTextField latitudeTextField; private javax.swing.JLabel longitudeLabel; private javax.swing.JTextField longitudeTextField; + private javax.swing.JScrollPane placeReferenceScrollPane; private javax.swing.JTable placeReferencesTable; // End of variables declaration//GEN-END:variables } --------------------------------------------------------------------- Site Web Ancestris : http://www.ancestris.org <*> Pour vous desinscrire de cette liste, envoyez un mail a : [email protected] <*> Pour obtenir de l'aide sur les commandes de la liste : [email protected] Pour obtenir tous les messages lies a ce fil de discussion, cliquez sur le lien ci-dessous, cela ouvrira votre logiciel de messagerie. Il vous suffira d'envoyer le message : [email protected]
