Author: lemovice Date: Mon Dec 9 21:15:53 2013 New Revision: 4732 Log: Event editing is now possible, however places a not editable
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/EventsListPanel.form trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventsListPanel.java 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 Mon Dec 9 21:15:53 2013 @@ -17,7 +17,6 @@ EventEditorPanel.eventDescriptionTextArea.toolTipText=Event description EventEditorPanel.eventPlaceTextField.toolTipText=event place tooltip EventEditorPanel.eventTypeLabel.text=Event type -EventEditorPanel.eventTypeComboBox.toolTipText=Type of event FamilyEditorPanel.title= Edit Family FamilyEditorPanel.familyIDLabel.text=ID @@ -126,8 +125,6 @@ NameEditorPanel.familyNamePrefixTextField.toolTipText=Surname prefix or article used in a family name.\nDifferent surname articles are separated by a comma,\nfor example in the name "de la Cruz", this value would be "de, la". NameEditorPanel.firstNamePrefixTextField.toolTipText=name piece that appears preceding the given name and surname parts.\nDifferent name prefix parts are separated by a comma. NameEditorPanel.firstNameSuffixTextField.text= - -EventsListPanel.addEventButton.toolTipText=Add event EventsListPanel.deleteEventButton.toolTipText=Delete event EventsListPanel.editEventButton.toolTipText=Edit event @@ -184,3 +181,5 @@ IndividualsListPanel.title.select.wife=Select wife IndividualsListPanel.title.select.husband=Select husband SourceEditorPanel.registeredEventsPanel.TabConstraints.tabTitle=Registered Events +EventsListPanel.eventTypeComboBox.toolTipText=Type of event +EventsListPanel.jLabel1.text=Add Event 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 Mon Dec 9 21:15:53 2013 @@ -51,22 +51,26 @@ <EmptySpace min="0" pref="0" max="32767" attributes="0"/> </Group> <Group type="102" alignment="0" attributes="0"> - <Component id="eventTypeLabel" min="-2" max="-2" attributes="0"/> - <EmptySpace type="separate" max="-2" attributes="0"/> - <Component id="eventTypeComboBox" min="-2" pref="189" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="dateLabel" min="-2" max="-2" attributes="0"/> - <EmptySpace min="-2" max="-2" attributes="0"/> - <Component id="aDateBean" max="32767" attributes="0"/> - <EmptySpace min="-2" pref="6" max="-2" attributes="0"/> - </Group> - <Group type="102" alignment="0" attributes="0"> - <Group type="103" groupAlignment="0" max="-2" attributes="0"> - <Component id="eventDescriptionLabel" max="32767" attributes="0"/> - <Component id="eventPlaceLabel" max="32767" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="103" alignment="0" groupAlignment="0" max="-2" attributes="0"> + <Component id="eventDescriptionLabel" max="32767" attributes="0"/> + <Component id="eventPlaceLabel" max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="6" max="-2" attributes="0"/> + <Component id="eventTypeLabel" min="-2" max="-2" attributes="0"/> + </Group> </Group> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Component id="eventTypeTextField" min="-2" pref="183" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="19" max="-2" attributes="0"/> + <Component id="dateLabel" min="-2" max="-2" attributes="0"/> + <EmptySpace min="-2" max="-2" attributes="0"/> + <Component id="aDateBean" max="32767" attributes="0"/> + <EmptySpace min="-2" pref="6" max="-2" attributes="0"/> + </Group> <Component id="eventDescriptionScrollPane" alignment="1" max="32767" attributes="0"/> <Group type="102" alignment="0" attributes="0"> <Component id="eventPlaceTextField" max="32767" attributes="0"/> @@ -89,15 +93,11 @@ <Component id="eventIDTextField" alignment="3" min="-2" max="-2" attributes="0"/> </Group> <EmptySpace min="-2" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="103" alignment="1" groupAlignment="3" attributes="0"> - <Component id="eventTypeLabel" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="eventTypeComboBox" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <Group type="103" alignment="1" groupAlignment="2" attributes="0"> - <Component id="dateLabel" alignment="2" min="-2" max="-2" attributes="0"/> - <Component id="aDateBean" alignment="2" min="-2" max="-2" attributes="0"/> - </Group> + <Group type="103" groupAlignment="2" attributes="0"> + <Component id="dateLabel" alignment="2" min="-2" max="-2" attributes="0"/> + <Component id="aDateBean" alignment="2" min="-2" max="-2" attributes="0"/> + <Component id="eventTypeTextField" alignment="2" min="-2" max="-2" attributes="0"/> + <Component id="eventTypeLabel" alignment="2" min="-2" max="-2" attributes="0"/> </Group> <EmptySpace min="-2" max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> @@ -245,21 +245,7 @@ </Property> </Properties> </Component> - <Component class="javax.swing.JComboBox" name="eventTypeComboBox"> - <Properties> - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> - <Connection code="eventsTypeComboBoxModelModel" type="code"/> - </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.eventTypeComboBox.toolTipText" replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}"), {arguments})"/> - </Property> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="eventTypeComboBoxActionPerformed"/> - </Events> - <AuxValues> - <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> - </AuxValues> + <Component class="javax.swing.JTextField" name="eventTypeTextField"> </Component> </SubComponents> </Container> 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 Mon Dec 9 21:15:53 2013 @@ -19,7 +19,7 @@ private EventsTypeComboBoxModelModel eventsTypeComboBoxModelModel = new EventsTypeComboBoxModelModel(); private PropertyEvent mEvent = null; private Property mRoot; - private boolean mEventTypeCanChange = false; + PropertyPlace mPlace; /** * Creates new form EventEditorPanel @@ -54,7 +54,7 @@ eventDescriptionTextArea = new javax.swing.JTextArea(); aDateBean = new ancestris.modules.beans.ADateBean(); eventTypeLabel = new javax.swing.JLabel(); - eventTypeComboBox = new javax.swing.JComboBox<String>(); + eventTypeTextField = new javax.swing.JTextField(); eventInformationTabbedPane = new javax.swing.JTabbedPane(); sourcesPanel = new javax.swing.JPanel(); sourcesListPanel = new ancestris.modules.editors.genealogyeditor.panels.SourcesListPanel(); @@ -113,14 +113,6 @@ eventTypeLabel.setText(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/panels/Bundle").getString("EventEditorPanel.eventTypeLabel.text"), new Object[] {})); // NOI18N - eventTypeComboBox.setModel(eventsTypeComboBoxModelModel); - eventTypeComboBox.setToolTipText(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/panels/Bundle").getString("EventEditorPanel.eventTypeComboBox.toolTipText"), new Object[] {})); // NOI18N - eventTypeComboBox.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - eventTypeComboBoxActionPerformed(evt); - } - }); - javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( @@ -131,20 +123,22 @@ .addComponent(eventIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(eventTypeLabel) - .addGap(18, 18, 18) - .addComponent(eventTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(dateLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(aDateBean, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(6, 6, 6)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(eventDescriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(eventPlaceLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(eventDescriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(eventPlaceLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(6, 6, 6) + .addComponent(eventTypeLabel))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(eventTypeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(19, 19, 19) + .addComponent(dateLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(aDateBean, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(6, 6, 6)) .addComponent(eventDescriptionScrollPane, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(eventPlaceTextField) @@ -162,13 +156,11 @@ .addComponent(eventIdLabel) .addComponent(eventIDTextField, 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) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(eventTypeLabel) - .addComponent(eventTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) - .addComponent(dateLabel) - .addComponent(aDateBean, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) + .addComponent(dateLabel) + .addComponent(aDateBean, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(eventTypeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(eventTypeLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() @@ -266,38 +258,38 @@ }//GEN-LAST:event_editPlaceButtonActionPerformed private void addPlaceButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPlaceButtonActionPerformed - final PlaceEditorPanel placeEditorPanel = new PlaceEditorPanel(); - placeEditorPanel.set(new PropertyPlace("PLAC")); - - DialogManager.ADialog placeEditorDialog = new DialogManager.ADialog( - NbBundle.getMessage(PlaceEditorPanel.class, "PlaceEditorPanel.title"), - placeEditorPanel); - placeEditorDialog.setDialogId(EventEditorPanel.class.getName()); - - if (placeEditorDialog.show() == DialogDescriptor.OK_OPTION) { - try { - mEvent.getGedcom().doUnitOfWork(new UnitOfWork() { + try { + mRoot.getGedcom().doUnitOfWork(new UnitOfWork() { - @Override - public void perform(Gedcom gedcom) throws GedcomException { - mEvent.copyProperties(placeEditorPanel.get(), true); - } - }); // end of doUnitOfWork - PropertyPlace place = (PropertyPlace) mEvent.getProperty(PropertyPlace.TAG); - if (place != null) { - addPlaceButton.setVisible(false); - editPlaceButton.setVisible(true); - removePlaceButton.setVisible(true); - eventPlaceTextField.setText(place.format("all")); - } else { - addPlaceButton.setVisible(true); - editPlaceButton.setVisible(false); - removePlaceButton.setVisible(false); - eventPlaceTextField.setText(""); + @Override + public void perform(Gedcom gedcom) throws GedcomException { + mPlace = (PropertyPlace) mEvent.addProperty("PLAC", ""); } + }); // end of doUnitOfWork + } catch (GedcomException ex) { + Exceptions.printStackTrace(ex); + } finally { + PlaceEditorPanel placeEditorPanel = new PlaceEditorPanel(); + placeEditorPanel.set(mPlace); + + DialogManager.ADialog placeEditorDialog = new DialogManager.ADialog( + NbBundle.getMessage(PlaceEditorPanel.class, "PlaceEditorPanel.title"), + placeEditorPanel); + placeEditorDialog.setDialogId(EventEditorPanel.class.getName()); + + if (placeEditorDialog.show() == DialogDescriptor.OK_OPTION) { + placeEditorPanel.commit(); + addPlaceButton.setVisible(false); + editPlaceButton.setVisible(true); + removePlaceButton.setVisible(true); + eventPlaceTextField.setText(mPlace.format("all")); + } else { + mRoot.getGedcom().undoUnitOfWork(false); - } catch (GedcomException ex) { - Exceptions.printStackTrace(ex); + addPlaceButton.setVisible(true); + editPlaceButton.setVisible(false); + removePlaceButton.setVisible(false); + eventPlaceTextField.setText(""); } } }//GEN-LAST:event_addPlaceButtonActionPerformed @@ -320,29 +312,6 @@ } }//GEN-LAST:event_removePlaceButtonActionPerformed - private void eventTypeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_eventTypeComboBoxActionPerformed - if (mEventTypeCanChange == true) { - try { - if (mEvent != null) { - mRoot.getGedcom().undoUnitOfWork(); - } - mRoot.getGedcom().doUnitOfWork(new UnitOfWork() { - - @Override - public void perform(Gedcom gedcom) throws GedcomException { - mEvent = (PropertyEvent) mRoot.addProperty(PropertyTag2Name.getPropertyTag(eventTypeComboBox.getSelectedItem().toString()), ""); - PropertyDate date = (PropertyDate) mEvent.getProperty("DATE"); - if (date == null) { - date = (PropertyDate) mEvent.addProperty("DATE", ""); - } - aDateBean.setContext(date); - } - }); // end of doUnitOfWork - } catch (GedcomException ex) { - Exceptions.printStackTrace(ex); - } - } - }//GEN-LAST:event_eventTypeComboBoxActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private ancestris.modules.beans.ADateBean aDateBean; private javax.swing.JButton addPlaceButton; @@ -356,8 +325,8 @@ private javax.swing.JTabbedPane eventInformationTabbedPane; private javax.swing.JLabel eventPlaceLabel; private javax.swing.JTextField eventPlaceTextField; - private javax.swing.JComboBox<String> eventTypeComboBox; private javax.swing.JLabel eventTypeLabel; + private javax.swing.JTextField eventTypeTextField; private javax.swing.JPanel galleryPanel; private javax.swing.JPanel jPanel1; private ancestris.modules.editors.genealogyeditor.panels.MultimediaObjectsListPanel multimediaObjectsListPanel; @@ -375,8 +344,7 @@ this.mRoot = root; this.mEvent = event; if (mEvent != null) { - eventTypeComboBox.setSelectedItem(PropertyTag2Name.getTagName(mEvent.getTag())); - eventTypeComboBox.setEnabled(false); + eventTypeTextField.setText(PropertyTag2Name.getTagName(mEvent.getTag())); eventDescriptionTextArea.setText(mEvent.getDisplayValue()); PropertyPlace place = (PropertyPlace) mEvent.getProperty(PropertyPlace.TAG); Modified: trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventsListPanel.form ============================================================================== --- trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventsListPanel.form (original) +++ trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventsListPanel.form Mon Dec 9 21:15:53 2013 @@ -17,15 +17,15 @@ <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> <Component id="eventsToolBar" alignment="0" pref="400" max="32767" attributes="0"/> - <Component id="eventsScrollPane" alignment="0" pref="0" max="32767" attributes="0"/> + <Component id="eventsScrollPane" alignment="1" pref="0" max="32767" attributes="0"/> </Group> </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0"> - <Component id="eventsToolBar" min="-2" pref="25" max="-2" attributes="0"/> + <Component id="eventsToolBar" min="-2" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/> - <Component id="eventsScrollPane" pref="269" max="32767" attributes="0"/> + <Component id="eventsScrollPane" pref="261" max="32767" attributes="0"/> </Group> </Group> </DimensionLayout> @@ -39,21 +39,28 @@ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/> <SubComponents> - <Component class="javax.swing.JButton" name="addEventButton"> + <Component class="javax.swing.JLabel" name="jLabel1"> <Properties> - <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> - <Image iconType="3" name="/ancestris/modules/editors/genealogyeditor/resources/edit_add.png"/> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="ancestris/modules/editors/genealogyeditor/panels/Bundle.properties" key="EventsListPanel.jLabel1.text" replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}"), {arguments})"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JComboBox" name="eventTypeComboBox"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="eventsTypeComboBoxModelModel" type="code"/> </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="EventsListPanel.addEventButton.toolTipText" replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}"), {arguments})"/> + <ResourceString bundle="ancestris/modules/editors/genealogyeditor/panels/Bundle.properties" key="EventsListPanel.eventTypeComboBox.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="addEventButtonActionPerformed"/> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="eventTypeComboBoxActionPerformed"/> </Events> + <AuxValues> + <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> + </AuxValues> </Component> <Component class="javax.swing.JButton" name="editEventButton"> <Properties> Modified: trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventsListPanel.java ============================================================================== --- trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventsListPanel.java (original) +++ trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventsListPanel.java Mon Dec 9 21:15:53 2013 @@ -1,10 +1,10 @@ package ancestris.modules.editors.genealogyeditor.panels; import ancestris.modules.editors.genealogyeditor.models.EventsTableModel; +import ancestris.modules.editors.genealogyeditor.models.EventsTypeComboBoxModelModel; +import ancestris.modules.gedcom.utilities.PropertyTag2Name; import ancestris.util.swing.DialogManager.ADialog; -import genj.gedcom.GedcomException; -import genj.gedcom.Property; -import genj.gedcom.PropertyEvent; +import genj.gedcom.*; import java.util.ArrayList; import java.util.List; import javax.swing.table.TableModel; @@ -20,6 +20,7 @@ public class EventsListPanel extends javax.swing.JPanel { private Property mRoot; + private EventsTypeComboBoxModelModel eventsTypeComboBoxModelModel = new EventsTypeComboBoxModelModel(); private EventsTableModel mEventsTableModel = new EventsTableModel(); private ArrayList<PropertyEvent> mEditedEvents = new ArrayList<PropertyEvent>(); private ArrayList<PropertyEvent> mAddedEvents = new ArrayList<PropertyEvent>(); @@ -45,7 +46,8 @@ private void initComponents() { eventsToolBar = new javax.swing.JToolBar(); - addEventButton = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + eventTypeComboBox = new javax.swing.JComboBox<String>(); editEventButton = new javax.swing.JButton(); deleteEventButton = new javax.swing.JButton(); eventsScrollPane = new javax.swing.JScrollPane(); @@ -54,17 +56,17 @@ eventsToolBar.setFloatable(false); eventsToolBar.setRollover(true); - addEventButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ancestris/modules/editors/genealogyeditor/resources/edit_add.png"))); // NOI18N - addEventButton.setToolTipText(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/panels/Bundle").getString("EventsListPanel.addEventButton.toolTipText"), new Object[] {})); // NOI18N - addEventButton.setFocusable(false); - addEventButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - addEventButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - addEventButton.addActionListener(new java.awt.event.ActionListener() { + jLabel1.setText(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/panels/Bundle").getString("EventsListPanel.jLabel1.text"), new Object[] {})); // NOI18N + eventsToolBar.add(jLabel1); + + eventTypeComboBox.setModel(eventsTypeComboBoxModelModel); + eventTypeComboBox.setToolTipText(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/panels/Bundle").getString("EventsListPanel.eventTypeComboBox.toolTipText"), new Object[] {})); // NOI18N + eventTypeComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - addEventButtonActionPerformed(evt); + eventTypeComboBoxActionPerformed(evt); } }); - eventsToolBar.add(addEventButton); + eventsToolBar.add(eventTypeComboBox); editEventButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ancestris/modules/editors/genealogyeditor/resources/edit.png"))); // NOI18N editEventButton.setToolTipText(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/panels/Bundle").getString("EventsListPanel.editEventButton.toolTipText"), new Object[] {})); // NOI18N @@ -107,40 +109,17 @@ layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(eventsToolBar, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) - .addComponent(eventsScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addComponent(eventsScrollPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(eventsToolBar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(eventsToolBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(eventsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 269, Short.MAX_VALUE)) + .addComponent(eventsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 261, Short.MAX_VALUE)) ); }// </editor-fold>//GEN-END:initComponents - private void addEventButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addEventButtonActionPerformed - /* - * try { mRoot.getGedcom().doUnitOfWork(new UnitOfWork() { - * - * @Override public void perform(Gedcom gedcom) throws GedcomException { - * mEvent = (PropertyEvent) mRoot.addProperty("", ""); - * mEvent.addProperty("DATE", ""); } }); // end of doUnitOfWork } catch - * (GedcomException ex) { Exceptions.printStackTrace(ex); } finally { - * EventEditorPanel eventEditorPanel = new EventEditorPanel(); - * - * eventEditorPanel.set(mRoot, mEvent); - * - * ADialog eventEditorDialog = new ADialog( - * NbBundle.getMessage(EventEditorPanel.class, - * "EventEditorPanel.title"), eventEditorPanel); - * - * eventEditorDialog.setDialogId(EventEditorPanel.class.getName()); if - * (eventEditorDialog.show() == DialogDescriptor.OK_OPTION) { - * mEventsTableModel.add(eventEditorPanel.commit()); } else { - * mRoot.getGedcom().undoUnitOfWork(false); } } - */ - }//GEN-LAST:event_addEventButtonActionPerformed - private void editEventButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editEventButtonActionPerformed int selectedRow = eventsTable.getSelectedRow(); if (selectedRow != -1) { @@ -186,13 +165,44 @@ } } }//GEN-LAST:event_eventsTableMouseClicked + + private void eventTypeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_eventTypeComboBoxActionPerformed + try { + mRoot.getGedcom().doUnitOfWork(new UnitOfWork() { + + @Override + public void perform(Gedcom gedcom) throws GedcomException { + mEvent = (PropertyEvent) mRoot.addProperty(PropertyTag2Name.getPropertyTag(eventTypeComboBox.getSelectedItem().toString()), ""); + mEvent.addProperty("DATE", ""); + } + }); // end of doUnitOfWork + } catch (GedcomException ex) { + Exceptions.printStackTrace(ex); + } finally { + EventEditorPanel eventEditorPanel = new EventEditorPanel(); + + eventEditorPanel.set(mRoot, mEvent); + + ADialog eventEditorDialog = new ADialog( + NbBundle.getMessage(EventEditorPanel.class, + "EventEditorPanel.title"), eventEditorPanel); + + eventEditorDialog.setDialogId(EventEditorPanel.class.getName()); + if (eventEditorDialog.show() == DialogDescriptor.OK_OPTION) { + mEventsTableModel.add(eventEditorPanel.commit()); + } else { + mRoot.getGedcom().undoUnitOfWork(false); + } + } + }//GEN-LAST:event_eventTypeComboBoxActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton addEventButton; private javax.swing.JButton deleteEventButton; private javax.swing.JButton editEventButton; + private javax.swing.JComboBox<String> eventTypeComboBox; private javax.swing.JScrollPane eventsScrollPane; private javax.swing.JTable eventsTable; private javax.swing.JToolBar eventsToolBar; + private javax.swing.JLabel jLabel1; // End of variables declaration//GEN-END:variables public void setEventsList(Property root, List<PropertyEvent> eventsList) { 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 Mon Dec 9 21:15:53 2013 @@ -5,13 +5,17 @@ import ancestris.modules.editors.genealogyeditor.models.GeonamePlacesListModel; import ancestris.modules.place.geonames.GeonamesPlacesList; import ancestris.util.swing.DialogManager; +import genj.gedcom.Gedcom; +import genj.gedcom.GedcomException; import genj.gedcom.PropertyPlace; +import genj.gedcom.UnitOfWork; import java.util.List; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import org.jdesktop.swingx.JXMapKit; import org.jdesktop.swingx.mapviewer.GeoPosition; import org.openide.DialogDescriptor; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; /** @@ -876,6 +880,20 @@ return placeString; } - public void commit() { + public PropertyPlace commit() { + try { + place.getGedcom().doUnitOfWork(new UnitOfWork() { + + @Override + public void perform(Gedcom gedcom) throws GedcomException { + } + }); // end of doUnitOfWork + + } catch (GedcomException ex) { + Exceptions.printStackTrace(ex); + return null; + } finally { + return place; + } } } --------------------------------------------------------------------- Site Web Ancestris : http://www.ancestris.org <*> Pour vous desinscrire de cette liste, envoyez un mail a : ancestris-commit-unsubscr...@ml.arvernes.com <*> Pour obtenir de l'aide sur les commandes de la liste : ancestris-commit-h...@ml.arvernes.com 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 : ancestris-commit-thread.4...@ml.arvernes.com