Author: lemovice
Date: Wed Dec 11 23:17:39 2013
New Revision: 4743
Log:
Add linktoPlace Button for linking to an existing place in event editor
Added:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/PlacesListPanel.form
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/PlacesListPanel.java
Modified:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/Bundle.properties
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventEditorPanel.form
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventEditorPanel.java
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/PlaceEditorPanel.form
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/PlaceEditorPanel.java
Modified:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/Bundle.properties
==============================================================================
---
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/Bundle.properties
(original)
+++
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/Bundle.properties
Wed Dec 11 23:17:39 2013
@@ -183,3 +183,8 @@
SourceEditorPanel.registeredEventsPanel.TabConstraints.tabTitle=Registered
Events
EventsListPanel.eventTypeComboBox.toolTipText=Type of event
EventsListPanel.jLabel1.text=Add Event
+EventEditorPanel.linkToPlaceButton.toolTipText=Link to an existing note
+PlacesListPanel.clearFilterGedcomPlaceButton.text=Clear
+PlacesListPanel.filterGedcomPlaceButton.text=Filter
+PlacesListPanel.filterGedcomPlaceTextField.text=
+PlacesListPanel.searchPlaceLabel.text=Filter by
Modified:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventEditorPanel.form
==============================================================================
---
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventEditorPanel.form
(original)
+++
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventEditorPanel.form
Wed Dec 11 23:17:39 2013
@@ -76,6 +76,8 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="addPlaceButton" min="-2" max="-2"
attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
+ <Component id="linkToPlaceButton" min="-2" max="-2"
attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
<Component id="editPlaceButton" min="-2" max="-2"
attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="removePlaceButton" min="-2" max="-2"
attributes="0"/>
@@ -113,8 +115,11 @@
<Component id="eventPlaceLabel" min="-2" max="-2"
attributes="0"/>
<Component id="eventPlaceTextField" min="-2" max="-2"
attributes="0"/>
<Component id="addPlaceButton" min="-2" max="-2"
attributes="0"/>
- <Component id="editPlaceButton" min="-2" max="-2"
attributes="0"/>
<Component id="removePlaceButton" min="-2" max="-2"
attributes="0"/>
+ <Group type="103" alignment="0" groupAlignment="1"
attributes="0">
+ <Component id="linkToPlaceButton" min="-2" pref="26"
max="-2" attributes="0"/>
+ <Component id="editPlaceButton" min="-2" max="-2"
attributes="0"/>
+ </Group>
</Group>
</Group>
</Group>
@@ -249,6 +254,22 @@
<Property name="editable" type="boolean" value="false"/>
</Properties>
</Component>
+ <Component class="javax.swing.JButton" name="linkToPlaceButton">
+ <Properties>
+ <Property name="icon" type="javax.swing.Icon"
editor="org.netbeans.modules.form.editors2.IconEditor">
+ <Image iconType="3"
name="/ancestris/modules/editors/genealogyeditor/resources/link_add.png"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="ancestris/modules/editors/genealogyeditor/panels/Bundle.properties"
key="EventEditorPanel.linkToPlaceButton.toolTipText"
replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}"),
{arguments})"/>
+ </Property>
+ <Property name="focusable" type="boolean" value="false"/>
+ <Property name="horizontalTextPosition" type="int" value="0"/>
+ <Property name="verticalTextPosition" type="int" value="3"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed"
listener="java.awt.event.ActionListener"
parameters="java.awt.event.ActionEvent"
handler="linkToPlaceButtonActionPerformed"/>
+ </Events>
+ </Component>
</SubComponents>
</Container>
<Container class="javax.swing.JTabbedPane"
name="eventInformationTabbedPane">
Modified:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventEditorPanel.java
==============================================================================
---
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventEditorPanel.java
(original)
+++
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventEditorPanel.java
Wed Dec 11 23:17:39 2013
@@ -1,6 +1,5 @@
package ancestris.modules.editors.genealogyeditor.panels;
-import
ancestris.modules.editors.genealogyeditor.models.EventsTypeComboBoxModelModel;
import ancestris.modules.gedcom.utilities.PropertyTag2Name;
import ancestris.util.swing.DialogManager;
import genj.gedcom.*;
@@ -54,6 +53,7 @@
aDateBean = new ancestris.modules.beans.ADateBean();
eventTypeLabel = new javax.swing.JLabel();
eventTypeTextField = new javax.swing.JTextField();
+ linkToPlaceButton = new javax.swing.JButton();
eventInformationTabbedPane = new javax.swing.JTabbedPane();
sourcesPanel = new javax.swing.JPanel();
sourcesListPanel = new
ancestris.modules.editors.genealogyeditor.panels.SourcesListPanel();
@@ -114,6 +114,17 @@
eventTypeTextField.setEditable(false);
+ linkToPlaceButton.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/ancestris/modules/editors/genealogyeditor/resources/link_add.png")));
// NOI18N
+
linkToPlaceButton.setToolTipText(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/panels/Bundle").getString("EventEditorPanel.linkToPlaceButton.toolTipText"),
new Object[] {})); // NOI18N
+ linkToPlaceButton.setFocusable(false);
+
linkToPlaceButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+
linkToPlaceButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ linkToPlaceButton.addActionListener(new
java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ linkToPlaceButtonActionPerformed(evt);
+ }
+ });
+
javax.swing.GroupLayout jPanel1Layout = new
javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
@@ -145,6 +156,8 @@
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(addPlaceButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(linkToPlaceButton)
+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(editPlaceButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(removePlaceButton))))
@@ -173,8 +186,10 @@
.addComponent(eventPlaceLabel)
.addComponent(eventPlaceTextField,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(addPlaceButton)
- .addComponent(editPlaceButton)
- .addComponent(removePlaceButton)))
+ .addComponent(removePlaceButton)
+
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(linkToPlaceButton,
javax.swing.GroupLayout.PREFERRED_SIZE, 26,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(editPlaceButton))))
);
sourcesListPanel.setPreferredSize(null);
@@ -255,11 +270,13 @@
if (placeEditorDialog.show() == DialogDescriptor.OK_OPTION) {
mPlace = placeEditorPanel.commit();
addPlaceButton.setVisible(false);
+ linkToPlaceButton.setVisible(false);
editPlaceButton.setVisible(true);
removePlaceButton.setVisible(true);
eventPlaceTextField.setText(mPlace.format("all"));
} else {
addPlaceButton.setVisible(true);
+ linkToPlaceButton.setVisible(true);
editPlaceButton.setVisible(false);
removePlaceButton.setVisible(false);
eventPlaceTextField.setText("");
@@ -289,13 +306,14 @@
if (placeEditorDialog.show() == DialogDescriptor.OK_OPTION) {
placeEditorPanel.commit();
addPlaceButton.setVisible(false);
+ linkToPlaceButton.setVisible(false);
editPlaceButton.setVisible(true);
removePlaceButton.setVisible(true);
eventPlaceTextField.setText(mPlace.format("all"));
} else {
mRoot.getGedcom().undoUnitOfWork(false);
-
addPlaceButton.setVisible(true);
+ linkToPlaceButton.setVisible(true);
editPlaceButton.setVisible(false);
removePlaceButton.setVisible(false);
eventPlaceTextField.setText("");
@@ -313,6 +331,7 @@
}
}); // end of doUnitOfWork
addPlaceButton.setVisible(true);
+ linkToPlaceButton.setVisible(true);
editPlaceButton.setVisible(false);
removePlaceButton.setVisible(false);
eventPlaceTextField.setText("");
@@ -320,6 +339,42 @@
Exceptions.printStackTrace(ex);
}
}//GEN-LAST:event_removePlaceButtonActionPerformed
+
+ private void linkToPlaceButtonActionPerformed(java.awt.event.ActionEvent
evt) {//GEN-FIRST:event_linkToPlaceButtonActionPerformed
+ PlacesListPanel placesListPanel = new
PlacesListPanel(mRoot.getGedcom());
+ DialogManager.ADialog placesListPanelDialog = new
DialogManager.ADialog(
+ NbBundle.getMessage(PlacesListPanel.class,
"NoteEditorPanel.title"),
+ placesListPanel);
+ placesListPanelDialog.setDialogId(NoteEditorPanel.class.getName());
+
+ if (placesListPanelDialog.show() == DialogDescriptor.OK_OPTION) {
+ final PropertyPlace selectedPlace =
placesListPanel.getSelectedPlace();
+
+ try {
+ mRoot.getGedcom().doUnitOfWork(new UnitOfWork() {
+
+ @Override
+ public void perform(Gedcom gedcom) throws GedcomException {
+ mPlace = (PropertyPlace) mEvent.addProperty("PLAC",
selectedPlace.format("all"));
+ }
+ }); // end of doUnitOfWork
+ addPlaceButton.setVisible(false);
+ linkToPlaceButton.setVisible(false);
+ editPlaceButton.setVisible(true);
+ removePlaceButton.setVisible(true);
+ eventPlaceTextField.setText(mPlace.format("all"));
+ } catch (GedcomException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ } else {
+ mRoot.getGedcom().undoUnitOfWork(false);
+ addPlaceButton.setVisible(true);
+ linkToPlaceButton.setVisible(true);
+ editPlaceButton.setVisible(false);
+ removePlaceButton.setVisible(false);
+ eventPlaceTextField.setText("");
+ }
+ }//GEN-LAST:event_linkToPlaceButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private ancestris.modules.beans.ADateBean aDateBean;
private javax.swing.JButton addPlaceButton;
@@ -337,6 +392,7 @@
private javax.swing.JTextField eventTypeTextField;
private javax.swing.JPanel galleryPanel;
private javax.swing.JPanel jPanel1;
+ private javax.swing.JButton linkToPlaceButton;
private
ancestris.modules.editors.genealogyeditor.panels.MultimediaObjectsListPanel
multimediaObjectsListPanel;
private ancestris.modules.editors.genealogyeditor.panels.NotesListPanel
notesListPanel;
private javax.swing.JPanel notesPanel;
@@ -358,11 +414,13 @@
PropertyPlace place = (PropertyPlace)
mEvent.getProperty(PropertyPlace.TAG);
if (place != null) {
addPlaceButton.setVisible(false);
+ linkToPlaceButton.setVisible(false);
editPlaceButton.setVisible(true);
removePlaceButton.setVisible(true);
eventPlaceTextField.setText(place.format("all"));
} else {
addPlaceButton.setVisible(true);
+ linkToPlaceButton.setVisible(true);
editPlaceButton.setVisible(false);
removePlaceButton.setVisible(false);
eventPlaceTextField.setText("");
Modified:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/PlaceEditorPanel.form
==============================================================================
---
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/PlaceEditorPanel.form
(original)
+++
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/PlaceEditorPanel.form
Wed Dec 11 23:17:39 2013
@@ -25,7 +25,7 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="gedcomPlacePanel" pref="737" max="32767"
attributes="0"/>
- <Component id="jTabbedPane1" max="32767" attributes="0"/>
+ <Component id="jTabbedPane1" pref="737" max="32767"
attributes="0"/>
<Component id="placeEditorToolBar" alignment="1" max="32767"
attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
@@ -337,7 +337,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
- <Component id="MapScrollPane" pref="227" max="32767"
attributes="0"/>
+ <Component id="MapScrollPane" pref="225" max="32767"
attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -381,18 +381,16 @@
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
- <Group type="102" attributes="0">
- <Component id="geonamesScrollPane" pref="190"
max="32767" attributes="0"/>
- <EmptySpace min="-2" max="-2" attributes="0"/>
- <Component id="geonamesPlacePanel" max="32767"
attributes="0"/>
- </Group>
- <Group type="102" attributes="0">
- <Component id="searchPlaceTextField" min="-2"
pref="559" max="-2" attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="searchPlaceTextField" max="32767"
attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="searchPlaceButton" min="-2"
max="-2" attributes="0"/>
</Group>
+ <Component id="geonamesScrollPane" pref="265"
max="32767" attributes="0"/>
</Group>
- <EmptySpace min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="geonamesPlacePanel" min="-2" max="-2"
attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -400,16 +398,15 @@
<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="searchPlaceTextField" alignment="3"
min="-2" max="-2" attributes="0"/>
- <Component id="searchPlaceButton" alignment="3"
min="-2" max="-2" attributes="0"/>
- </Group>
- <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
- <Component id="geonamesScrollPane" max="32767"
attributes="0"/>
+ <Component id="geonamesPlacePanel" max="32767"
attributes="0"/>
<Group type="102" attributes="0">
- <Component id="geonamesPlacePanel" min="-2"
max="-2" attributes="0"/>
- <EmptySpace min="0" pref="0" max="32767"
attributes="0"/>
+ <Group type="103" groupAlignment="3"
attributes="0">
+ <Component id="searchPlaceTextField"
alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="searchPlaceButton"
alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="geonamesScrollPane" pref="190"
max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
@@ -476,7 +473,7 @@
<Component id="field1TextField"
alignment="0" pref="0" max="32767" attributes="0"/>
<Component id="field4TextField"
alignment="0" pref="0" max="32767" attributes="0"/>
<Component id="field5TextField"
alignment="0" pref="0" max="32767" attributes="0"/>
- <Component id="latitudeTextField"
alignment="0" pref="160" max="32767" attributes="0"/>
+ <Component id="latitudeTextField"
alignment="0" pref="0" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2"
attributes="0"/>
<Group type="103" groupAlignment="0"
attributes="0">
@@ -489,14 +486,14 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0"
attributes="0">
<Component id="field6TextField"
alignment="0" pref="0" max="32767" attributes="0"/>
- <Component id="field3TextField"
alignment="0" pref="159" max="32767" attributes="0"/>
+ <Component id="field3TextField"
alignment="0" pref="0" max="32767" attributes="0"/>
<Component id="field2TextField"
alignment="0" pref="0" max="32767" attributes="0"/>
<Component id="field7TextField"
alignment="0" pref="0" max="32767" attributes="0"/>
<Component id="longitudeTextField"
alignment="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
- <Component id="jLabel1" min="-2" pref="229"
max="-2" attributes="0"/>
+ <Component id="jLabel1" pref="291"
max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="copyButton" min="-2" max="-2"
attributes="0"/>
</Group>
@@ -507,6 +504,7 @@
<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="field0TextField" alignment="3"
min="-2" max="-2" attributes="0"/>
<Component id="field2Label" alignment="3"
min="-2" max="-2" attributes="0"/>
@@ -546,6 +544,7 @@
<Component id="copyButton" alignment="3"
min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2"
max="-2" attributes="0"/>
</Group>
+ <EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -668,6 +667,7 @@
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
+ <Property name="horizontalAlignment" type="int" value="4"/>
<Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString
bundle="ancestris/modules/editors/genealogyeditor/panels/Bundle.properties"
key="PlaceEditorPanel.jLabel1.text"
replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}"),
{arguments})"/>
</Property>
@@ -711,7 +711,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
- <Component id="placeReferenceScrollPane" pref="227"
max="32767" attributes="0"/>
+ <Component id="placeReferenceScrollPane" pref="225"
max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
Modified:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/PlaceEditorPanel.java
==============================================================================
---
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/PlaceEditorPanel.java
(original)
+++
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/PlaceEditorPanel.java
Wed Dec 11 23:17:39 2013
@@ -281,7 +281,7 @@
mapPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mapPanelLayout.createSequentialGroup()
.addContainerGap()
- .addComponent(MapScrollPane,
javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE)
+ .addComponent(MapScrollPane,
javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)
.addContainerGap())
);
@@ -351,6 +351,7 @@
org.openide.awt.Mnemonics.setLocalizedText(copyButton,
java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/panels/Bundle").getString("PlaceEditorPanel.copyButton.text"),
new Object[] {})); // NOI18N
+ jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
org.openide.awt.Mnemonics.setLocalizedText(jLabel1,
java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/panels/Bundle").getString("PlaceEditorPanel.jLabel1.text"),
new Object[] {})); // NOI18N
field5Label.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
@@ -375,7 +376,7 @@
.addComponent(field1TextField,
javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
.addComponent(field4TextField,
javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
.addComponent(field5TextField,
javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
- .addComponent(latitudeTextField,
javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE))
+ .addComponent(latitudeTextField,
javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(geonamesPlacePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(field2Label,
javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 73,
javax.swing.GroupLayout.PREFERRED_SIZE)
@@ -386,18 +387,19 @@
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(geonamesPlacePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(field6TextField,
javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
- .addComponent(field3TextField,
javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
+ .addComponent(field3TextField,
javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
.addComponent(field2TextField,
javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
.addComponent(field7TextField,
javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)
.addComponent(longitudeTextField,
javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
geonamesPlacePanelLayout.createSequentialGroup()
- .addComponent(jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 229,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jLabel1,
javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(copyButton))))
);
geonamesPlacePanelLayout.setVerticalGroup(
geonamesPlacePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(geonamesPlacePanelLayout.createSequentialGroup()
+ .addContainerGap()
.addGroup(geonamesPlacePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(field0TextField,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(field2Label)
@@ -430,7 +432,8 @@
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(geonamesPlacePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(copyButton)
- .addComponent(jLabel1)))
+ .addComponent(jLabel1))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
javax.swing.GroupLayout searchPlacePanelLayout = new
javax.swing.GroupLayout(searchPlacePanel);
@@ -441,28 +444,26 @@
.addContainerGap()
.addGroup(searchPlacePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(searchPlacePanelLayout.createSequentialGroup()
- .addComponent(geonamesScrollPane,
javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE)
-
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(geonamesPlacePanel,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
- .addGroup(searchPlacePanelLayout.createSequentialGroup()
- .addComponent(searchPlaceTextField,
javax.swing.GroupLayout.PREFERRED_SIZE, 559,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(searchPlaceTextField)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(searchPlaceButton)))
+ .addComponent(searchPlaceButton))
+ .addComponent(geonamesScrollPane,
javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE))
+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(geonamesPlacePanel,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
searchPlacePanelLayout.setVerticalGroup(
searchPlacePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(searchPlacePanelLayout.createSequentialGroup()
.addContainerGap()
-
.addGroup(searchPlacePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(searchPlaceTextField,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(searchPlaceButton))
-
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(searchPlacePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(geonamesScrollPane)
+ .addComponent(geonamesPlacePanel,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addGroup(searchPlacePanelLayout.createSequentialGroup()
- .addComponent(geonamesPlacePanel,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(0, 0, Short.MAX_VALUE)))
+
.addGroup(searchPlacePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(searchPlaceTextField,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(searchPlaceButton))
+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(geonamesScrollPane,
javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE)))
.addContainerGap())
);
@@ -487,7 +488,7 @@
placeReferencesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(placeReferencesPanelLayout.createSequentialGroup()
.addContainerGap()
- .addComponent(placeReferenceScrollPane,
javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE)
+ .addComponent(placeReferenceScrollPane,
javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)
.addContainerGap())
);
@@ -501,7 +502,7 @@
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(gedcomPlacePanel,
javax.swing.GroupLayout.DEFAULT_SIZE, 737, Short.MAX_VALUE)
- .addComponent(jTabbedPane1,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
+ .addComponent(jTabbedPane1,
javax.swing.GroupLayout.DEFAULT_SIZE, 737, Short.MAX_VALUE)
.addComponent(placeEditorToolBar,
javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addContainerGap())
);
Added:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/PlacesListPanel.form
==============================================================================
--- (empty file)
+++
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/PlacesListPanel.form
Wed Dec 11 23:17:39 2013
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.6" maxVersion="1.8"
type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer"
value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName"
type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean"
value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode"
type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean"
value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer"
value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle"
type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean"
value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer"
value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Component id="searchPlaceLabel" min="-2" max="-2"
attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="searchPlaceComboBox" max="32767"
attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="filterGedcomPlaceTextField" min="-2"
pref="215" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="filterGedcomPlaceButton" min="-2"
max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="clearFilterGedcomPlaceButton" min="-2"
max="-2" attributes="0"/>
+ </Group>
+ <Component id="placesScrollPane" pref="516" max="32767"
attributes="0"/>
+ </Group>
+ <EmptySpace 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="searchPlaceLabel" alignment="3" min="-2"
max="-2" attributes="0"/>
+ <Component id="filterGedcomPlaceTextField" alignment="3"
min="-2" max="-2" attributes="0"/>
+ <Component id="filterGedcomPlaceButton" alignment="3"
min="-2" max="-2" attributes="0"/>
+ <Component id="clearFilterGedcomPlaceButton" alignment="3"
min="-2" max="-2" attributes="0"/>
+ <Component id="searchPlaceComboBox" alignment="3" min="-2"
max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="placesScrollPane" pref="273" max="32767"
attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="searchPlaceLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="ancestris/modules/editors/genealogyeditor/panels/Bundle.properties"
key="PlacesListPanel.searchPlaceLabel.text"
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class,
"{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField"
name="filterGedcomPlaceTextField">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="ancestris/modules/editors/genealogyeditor/panels/Bundle.properties"
key="PlacesListPanel.filterGedcomPlaceTextField.text"
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class,
"{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="keyTyped" listener="java.awt.event.KeyListener"
parameters="java.awt.event.KeyEvent"
handler="filterGedcomPlaceTextFieldKeyTyped"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="searchPlaceComboBox">
+ <Properties>
+ <Property name="model" type="javax.swing.ComboBoxModel"
editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="new DefaultComboBoxModel(mPlaceFormat)"
type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JButton" name="filterGedcomPlaceButton">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="ancestris/modules/editors/genealogyeditor/panels/Bundle.properties"
key="PlacesListPanel.filterGedcomPlaceButton.text"
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class,
"{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed"
listener="java.awt.event.ActionListener"
parameters="java.awt.event.ActionEvent"
handler="filterGedcomPlaceButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JButton" name="clearFilterGedcomPlaceButton">
+ <Properties>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString
bundle="ancestris/modules/editors/genealogyeditor/panels/Bundle.properties"
key="PlacesListPanel.clearFilterGedcomPlaceButton.text"
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class,
"{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed"
listener="java.awt.event.ActionListener"
parameters="java.awt.event.ActionEvent"
handler="clearFilterGedcomPlaceButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <Container class="javax.swing.JScrollPane" name="placesScrollPane">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+
+ <Layout
class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JTable" name="placesListTable">
+ <Properties>
+ <Property name="autoCreateRowSorter" type="boolean" value="true"/>
+ <Property name="model" type="javax.swing.table.TableModel"
editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="mPlacesListTableModel" type="code"/>
+ </Property>
+ <Property name="selectionModel"
type="javax.swing.ListSelectionModel"
editor="org.netbeans.modules.form.editors2.JTableSelectionModelEditor">
+ <JTableSelectionModel selectionMode="0"/>
+ </Property>
+ <Property name="showHorizontalLines" type="boolean" value="false"/>
+ <Property name="showVerticalLines" type="boolean" value="false"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
Added:
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/PlacesListPanel.java
==============================================================================
--- (empty file)
+++
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/PlacesListPanel.java
Wed Dec 11 23:17:39 2013
@@ -0,0 +1,183 @@
+package ancestris.modules.editors.genealogyeditor.panels;
+
+import ancestris.modules.editors.genealogyeditor.models.GedcomPlaceTableModel;
+import ancestris.modules.gedcom.utilities.GedcomUtilities;
+import genj.gedcom.Gedcom;
+import genj.gedcom.PropertyPlace;
+import java.util.*;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.RowFilter;
+import javax.swing.table.TableModel;
+import javax.swing.table.TableRowSorter;
+
+/**
+ *
+ * @author dominique
+ */
+public class PlacesListPanel extends javax.swing.JPanel {
+
+ String[] mPlaceFormat = null;
+ private GedcomPlaceTableModel mPlacesListTableModel;
+ private TableRowSorter<TableModel> mPlaceTableSorter;
+ private Gedcom mGedcom = null;
+
+ /**
+ * Creates new form PlacesListPanel
+ */
+ public PlacesListPanel(final Gedcom gedcom) {
+ this.mGedcom = gedcom;
+ mPlaceFormat = PropertyPlace.getFormat(gedcom);
+
+ mPlacesListTableModel = new GedcomPlaceTableModel(mPlaceFormat);
+ initComponents();
+ this.mGedcom = gedcom;
+ List<PropertyPlace> gedcomPlacesList =
GedcomUtilities.searchProperties(gedcom, PropertyPlace.class,
GedcomUtilities.ENT_ALL);
+ Map<String, Set<PropertyPlace>> placesMap = new HashMap<String,
Set<PropertyPlace>>();
+ for (PropertyPlace propertyPlace : gedcomPlacesList) {
+ String gedcomPlace = propertyPlace.getDisplayValue();
+
+ Set<PropertyPlace> propertySet = placesMap.get(gedcomPlace);
+ if (propertySet == null) {
+ propertySet = new HashSet<PropertyPlace>();
+ placesMap.put(gedcomPlace, propertySet);
+ }
+ propertySet.add((PropertyPlace) propertyPlace);
+ }
+
+ mPlacesListTableModel.update(placesMap);
+ mPlaceTableSorter = new
TableRowSorter<TableModel>(placesListTable.getModel());
+ placesListTable.setRowSorter(mPlaceTableSorter);
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the
form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated
Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ searchPlaceLabel = new javax.swing.JLabel();
+ filterGedcomPlaceTextField = new javax.swing.JTextField();
+ searchPlaceComboBox = new javax.swing.JComboBox();
+ filterGedcomPlaceButton = new javax.swing.JButton();
+ clearFilterGedcomPlaceButton = new javax.swing.JButton();
+ placesScrollPane = new javax.swing.JScrollPane();
+ placesListTable = new javax.swing.JTable();
+
+
searchPlaceLabel.setText(org.openide.util.NbBundle.getMessage(PlacesListPanel.class,
"PlacesListPanel.searchPlaceLabel.text")); // NOI18N
+
+
filterGedcomPlaceTextField.setText(org.openide.util.NbBundle.getMessage(PlacesListPanel.class,
"PlacesListPanel.filterGedcomPlaceTextField.text")); // NOI18N
+ filterGedcomPlaceTextField.addKeyListener(new
java.awt.event.KeyAdapter() {
+ public void keyTyped(java.awt.event.KeyEvent evt) {
+ filterGedcomPlaceTextFieldKeyTyped(evt);
+ }
+ });
+
+ searchPlaceComboBox.setModel(new DefaultComboBoxModel(mPlaceFormat));
+
+
filterGedcomPlaceButton.setText(org.openide.util.NbBundle.getMessage(PlacesListPanel.class,
"PlacesListPanel.filterGedcomPlaceButton.text")); // NOI18N
+ filterGedcomPlaceButton.addActionListener(new
java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ filterGedcomPlaceButtonActionPerformed(evt);
+ }
+ });
+
+
clearFilterGedcomPlaceButton.setText(org.openide.util.NbBundle.getMessage(PlacesListPanel.class,
"PlacesListPanel.clearFilterGedcomPlaceButton.text")); // NOI18N
+ clearFilterGedcomPlaceButton.addActionListener(new
java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ clearFilterGedcomPlaceButtonActionPerformed(evt);
+ }
+ });
+
+ placesListTable.setAutoCreateRowSorter(true);
+ placesListTable.setModel(mPlacesListTableModel);
+
placesListTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
+ placesListTable.setShowHorizontalLines(false);
+ placesListTable.setShowVerticalLines(false);
+ placesScrollPane.setViewportView(placesListTable);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(searchPlaceLabel)
+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(searchPlaceComboBox, 0,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(filterGedcomPlaceTextField,
javax.swing.GroupLayout.PREFERRED_SIZE, 215,
javax.swing.GroupLayout.PREFERRED_SIZE)
+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(filterGedcomPlaceButton)
+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(clearFilterGedcomPlaceButton))
+ .addComponent(placesScrollPane,
javax.swing.GroupLayout.DEFAULT_SIZE, 516, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(searchPlaceLabel)
+ .addComponent(filterGedcomPlaceTextField,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(filterGedcomPlaceButton)
+ .addComponent(clearFilterGedcomPlaceButton)
+ .addComponent(searchPlaceComboBox,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(placesScrollPane,
javax.swing.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void filterGedcomPlaceTextFieldKeyTyped(java.awt.event.KeyEvent
evt) {//GEN-FIRST:event_filterGedcomPlaceTextFieldKeyTyped
+ if (evt.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) {
+ newFilter(filterGedcomPlaceTextField.getText());
+ }
+ }//GEN-LAST:event_filterGedcomPlaceTextFieldKeyTyped
+
+ private void
filterGedcomPlaceButtonActionPerformed(java.awt.event.ActionEvent evt)
{//GEN-FIRST:event_filterGedcomPlaceButtonActionPerformed
+ newFilter(filterGedcomPlaceTextField.getText());
+ }//GEN-LAST:event_filterGedcomPlaceButtonActionPerformed
+
+ private void
clearFilterGedcomPlaceButtonActionPerformed(java.awt.event.ActionEvent evt)
{//GEN-FIRST:event_clearFilterGedcomPlaceButtonActionPerformed
+ filterGedcomPlaceTextField.setText("");
+ newFilter(filterGedcomPlaceTextField.getText());
+ }//GEN-LAST:event_clearFilterGedcomPlaceButtonActionPerformed
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton clearFilterGedcomPlaceButton;
+ private javax.swing.JButton filterGedcomPlaceButton;
+ private javax.swing.JTextField filterGedcomPlaceTextField;
+ private javax.swing.JTable placesListTable;
+ private javax.swing.JScrollPane placesScrollPane;
+ private javax.swing.JComboBox searchPlaceComboBox;
+ private javax.swing.JLabel searchPlaceLabel;
+ // End of variables declaration//GEN-END:variables
+
+ private void newFilter(String filter) {
+ RowFilter<TableModel, Integer> rf;
+ //If current expression doesn't parse, don't update.
+ try {
+ rf = RowFilter.regexFilter(filter,
searchPlaceComboBox.getSelectedIndex());
+ } catch (java.util.regex.PatternSyntaxException e) {
+ return;
+ }
+
+ mPlaceTableSorter.setRowFilter(rf);
+ }
+
+ public PropertyPlace getSelectedPlace() {
+ int selectedRow = placesListTable.getSelectedRow();
+ if (selectedRow != -1) {
+ int rowIndex = placesListTable.convertRowIndexToModel(selectedRow);
+ Set<PropertyPlace> valueAt =
mPlacesListTableModel.getValueAt(rowIndex);
+ return (PropertyPlace)
mPlacesListTableModel.getValueAt(rowIndex).toArray()[0];
+ } else {
+ return null;
+ }
+ }
+}
---------------------------------------------------------------------
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]