Author: lemovice
Date: Sun Nov 24 12:38:11 2013
New Revision: 4680

Log:
Editors improvements, Adding and removing events is now possible. However event 
editing is not functional
Add open from Tree view

Added:
   
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/TreeViewOpenGenealogyEditorAction.java
      - copied, changed from r4679, 
/trunk/AncestrisExtensions/gedcom.sosanumbers/src/ancestris/modules/gedcom/sosanumbers/TreeViewSosaAction.java
   
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/beans/
   
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/beans/Bundle.properties
   
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/beans/SexBeanPanel.form
   
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/beans/SexBeanPanel.java
Modified:
   
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/Bundle.properties
   
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/models/EventsTableModel.java
   
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/Bundle.properties
   
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/EventsListPanel.java
   
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/IndividualEditorPanel.form
   
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/IndividualEditorPanel.java

Modified: 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/Bundle.properties
==============================================================================
--- 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/Bundle.properties
   (original)
+++ 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/Bundle.properties
   Sun Nov 24 12:38:11 2013
@@ -1,2 +1,8 @@
 OpenIDE-Module-Display-Category=\u00c9diteur
+OpenIDE-Module-Long-Description=\
+    This editor is under heavy development, and is provided for debug purpose 
only.\n\
+    WARNING some spurious modifications of the gedcom can occurs. if you want 
to test it please made a copy of your gedcom before any try.\n\n\
+    Cet editeur est en cours de d\u00e9veloppement, il n'est fournit que pour 
les personnes qui d\u00e9sire l'essayer et participer a son 
d\u00e9veloppement.\n\
+    ATTENTION des modifications non control\u00e9s du gedcom peuvent 
malheureusement se produire donc sauvegarder votre gedcom avant tout essai de 
l'\u00e9diteur.
 OpenIDE-Module-Name=Genealogy editor for debug only
+OpenIDE-Module-Short-Description=WARNING : for Debug and test only

Copied: 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/TreeViewOpenGenealogyEditorAction.java
 (from r4679, 
/trunk/AncestrisExtensions/gedcom.sosanumbers/src/ancestris/modules/gedcom/sosanumbers/TreeViewSosaAction.java)
==============================================================================
--- 
/trunk/AncestrisExtensions/gedcom.sosanumbers/src/ancestris/modules/gedcom/sosanumbers/TreeViewSosaAction.java
      (original)
+++ 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/actions/TreeViewOpenGenealogyEditorAction.java
      Sun Nov 24 12:38:11 2013
@@ -1,60 +1,88 @@
-package ancestris.modules.gedcom.sosanumbers;
+package ancestris.modules.editors.genealogyeditor.actions;
 
+import ancestris.core.actions.AbstractAncestrisAction;
 import ancestris.core.actions.CommonActions;
+import ancestris.modules.editors.genealogyeditor.panels.FamilyEditorPanel;
+import ancestris.modules.editors.genealogyeditor.panels.IndividualEditorPanel;
+import ancestris.util.swing.DialogManager;
+import ancestris.view.SelectionDispatcher;
 import genj.gedcom.Entity;
+import genj.gedcom.Fam;
 import genj.gedcom.Gedcom;
 import genj.gedcom.Indi;
 import java.awt.event.ActionEvent;
-import java.util.prefs.Preferences;
 import javax.swing.AbstractAction;
 import javax.swing.Action;
-import javax.swing.ImageIcon;
-import org.openide.DialogDisplayer;
-import org.openide.NotifyDescriptor;
-import org.openide.awt.ActionID;
-import org.openide.awt.ActionReference;
-import org.openide.awt.ActionReferences;
-import org.openide.awt.ActionRegistration;
-import org.openide.awt.DynamicMenuContent;
+import org.openide.DialogDescriptor;
+import org.openide.awt.*;
 import org.openide.util.ContextAwareAction;
 import org.openide.util.NbBundle;
-import org.openide.util.NbPreferences;
+import static ancestris.modules.editors.genealogyeditor.actions.Bundle.*;
 
 /**
  *
  * @author dominique
  */
-@ActionID(category = "Tree", id = "genj.tree.actions.sosa")
-@ActionRegistration(displayName = "SosaNumbering")
+@ActionID(category = "Edit", id = "ancestris.modules.editors.genealogyeditor")
+@ActionRegistration(displayName = "#OpenInEditor.title")
 @ActionReferences({
-    @ActionReference(path = "Ancestris/Actions/GedcomProperty/Tools", position 
= 1010)})
-public class TreeViewSosaAction
-        extends AbstractAction
-        implements ContextAwareAction {
+    @ActionReference(path = "Ancestris/Actions/GedcomProperty")})
[email protected]("OpenInEditor.title=Edit with genealogyeditor")
+public class TreeViewOpenGenealogyEditorAction extends AbstractAction 
implements ContextAwareAction {
 
-    private final Preferences modulePreferences = 
NbPreferences.forModule(SosaNumbers.class);
     Gedcom myGedcom = null;
-    Indi indiDeCujus = null;
+    Entity entity = null;
 
     @Override
     public void actionPerformed(ActionEvent ae) {
-        new SosaNumbers().generateSosaNbs(myGedcom, indiDeCujus);
-        modulePreferences.put("SelectEntityDialog." + myGedcom.getName(), 
indiDeCujus.getId());
-        DialogDisplayer.getDefault().notify(new 
NotifyDescriptor.Message(NbBundle.getMessage(GenerateSosaAction.class, 
"GenerateSosaAction.done", indiDeCujus.getName()), 
NotifyDescriptor.INFORMATION_MESSAGE));
+        assert false;
     }
 
     @Override
     public Action createContextAwareInstance(org.openide.util.Lookup context) {
-        Entity e = context.lookup(Entity.class);
-        if (e == null || !(e instanceof Indi)) {
-            return CommonActions.NOOP;
-        } else {
-            putValue(DynamicMenuContent.HIDE_WHEN_DISABLED, true);
-            putValue(Action.NAME, NbBundle.getMessage(this.getClass(), 
"CTL_GenerateSosaAction"));
-            putValue(Action.SMALL_ICON, new 
ImageIcon("ancestris/modules/gedcom/sosanumbers/SosaNumbersIcon.png"));
-            indiDeCujus = (Indi) e;
-            myGedcom = e.getGedcom();
-            return this;
+        return new OpenEditor(context.lookup(Entity.class));
+    }
+
+    private static final class OpenEditor extends AbstractAncestrisAction {
+
+        Entity entity;
+
+        public OpenEditor(Entity context) {
+            this.entity = context;
+            setText(OpenInEditor_title());  // NOI18N
+            setImage(new 
javax.swing.ImageIcon(getClass().getResource("/ancestris/modules/editors/genealogyeditor/resources/edit_add.png")));
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
+            SelectionDispatcher.muteSelection(true);
+            DialogManager.ADialog editorDialog;
+
+            if (entity instanceof Indi) {
+                IndividualEditorPanel individualEditorPanel = new 
IndividualEditorPanel();
+                individualEditorPanel.setIndividual((Indi) entity);
+
+                editorDialog = new DialogManager.ADialog(
+                        NbBundle.getMessage(IndividualEditorPanel.class, 
"IndividualEditorPanel.title"),
+                        individualEditorPanel);
+                
editorDialog.setDialogId(IndividualEditorPanel.class.getName());
+                if (editorDialog.show() == DialogDescriptor.OK_OPTION) {
+                    individualEditorPanel.commit();
+                }
+            } else if (entity instanceof Fam) {
+                FamilyEditorPanel familyEditorPanel = new FamilyEditorPanel();
+                familyEditorPanel.setFamily((Fam) entity);
+
+                editorDialog = new DialogManager.ADialog(
+                        NbBundle.getMessage(FamilyEditorPanel.class, 
"FamilyEditorPanel.title"),
+                        familyEditorPanel);
+                editorDialog.setDialogId(FamilyEditorPanel.class.getName());
+                if (editorDialog.show() == DialogDescriptor.OK_OPTION) {
+                    familyEditorPanel.commit();
+                }
+            }
+
+            SelectionDispatcher.muteSelection(false);
         }
     }
 }

Added: 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/beans/Bundle.properties
==============================================================================
--- (empty file)
+++ 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/beans/Bundle.properties
     Sun Nov 24 12:38:11 2013
@@ -0,0 +1,3 @@
+Error reading included file Templates/Other/../Licenses/license-ancestris.txt
+SexBeanPanel.sexLabel.text=Sex
+SexBeanPanel.sexComboBox.toolTipText=Individual sex

Added: 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/beans/SexBeanPanel.form
==============================================================================
--- (empty file)
+++ 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/beans/SexBeanPanel.form
     Sun Nov 24 12:38:11 2013
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.5" 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" alignment="0" attributes="0">
+              <Component id="sexLabel" min="-2" pref="28" max="-2" 
attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+              <Component id="sexComboBox" min="-2" pref="139" max="-2" 
attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+    <DimensionLayout dim="1">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="103" groupAlignment="3" attributes="0">
+              <Component id="sexLabel" alignment="3" min="-2" max="-2" 
attributes="0"/>
+              <Component id="sexComboBox" alignment="3" min="-2" max="-2" 
attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+  </Layout>
+  <SubComponents>
+    <Component class="javax.swing.JLabel" name="sexLabel">
+      <Properties>
+        <Property name="text" type="java.lang.String" 
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString 
bundle="ancestris/modules/editors/genealogyeditor/beans/Bundle.properties" 
key="SexBeanPanel.sexLabel.text" 
replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;),
 {arguments})"/>
+        </Property>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JComboBox" name="sexComboBox">
+      <Properties>
+        <Property name="model" type="javax.swing.ComboBoxModel" 
editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+          <Connection code="sexComboBoxModel" type="code"/>
+        </Property>
+        <Property name="toolTipText" type="java.lang.String" 
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString 
bundle="ancestris/modules/editors/genealogyeditor/beans/Bundle.properties" 
key="SexBeanPanel.sexComboBox.toolTipText" 
replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;),
 {arguments})"/>
+        </Property>
+      </Properties>
+      <AuxValues>
+        <AuxValue name="JavaCodeGenerator_TypeParameters" 
type="java.lang.String" value="&lt;String&gt;"/>
+      </AuxValues>
+    </Component>
+  </SubComponents>
+</Form>

Added: 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/beans/SexBeanPanel.java
==============================================================================
--- (empty file)
+++ 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/beans/SexBeanPanel.java
     Sun Nov 24 12:38:11 2013
@@ -0,0 +1,71 @@
+package ancestris.modules.editors.genealogyeditor.beans;
+
+import ancestris.modules.editors.genealogyeditor.models.SexComboBoxModel;
+import genj.gedcom.Property;
+import genj.gedcom.PropertySex;
+
+/**
+ *
+ * @author dominique
+ */
+public class SexBeanPanel extends javax.swing.JPanel {
+
+    private SexComboBoxModel sexComboBoxModel = new SexComboBoxModel();
+    private Property root;
+    private PropertySex sex;
+
+    /**
+     * Creates new form SexBeanPanel
+     */
+    public SexBeanPanel() {
+        initComponents();
+    }
+
+    /**
+     * 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() {
+
+        sexLabel = new javax.swing.JLabel();
+        sexComboBox = new javax.swing.JComboBox<String>();
+
+        
sexLabel.setText(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/beans/Bundle").getString("SexBeanPanel.sexLabel.text"),
 new Object[] {})); // NOI18N
+
+        sexComboBox.setModel(sexComboBoxModel);
+        
sexComboBox.setToolTipText(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/beans/Bundle").getString("SexBeanPanel.sexComboBox.toolTipText"),
 new Object[] {})); // NOI18N
+
+        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+        this.setLayout(layout);
+        layout.setHorizontalGroup(
+            
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(layout.createSequentialGroup()
+                .addComponent(sexLabel, 
javax.swing.GroupLayout.PREFERRED_SIZE, 28, 
javax.swing.GroupLayout.PREFERRED_SIZE)
+                
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                .addComponent(sexComboBox, 
javax.swing.GroupLayout.PREFERRED_SIZE, 139, 
javax.swing.GroupLayout.PREFERRED_SIZE))
+        );
+        layout.setVerticalGroup(
+            
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                .addComponent(sexLabel)
+                .addComponent(sexComboBox, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE))
+        );
+    }// </editor-fold>//GEN-END:initComponents
+    // Variables declaration - do not modify//GEN-BEGIN:variables
+    private javax.swing.JComboBox<String> sexComboBox;
+    private javax.swing.JLabel sexLabel;
+    // End of variables declaration//GEN-END:variables
+
+    public void setSex(Property root, PropertySex sex) {
+        sexComboBox.setSelectedIndex(sex.getSex());
+        this.root = root;
+        this.sex = sex;
+    }
+
+    public void commit() {
+        sex.setSex(sexComboBox.getSelectedIndex());
+    }
+}

Modified: 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/models/EventsTableModel.java
==============================================================================
--- 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/models/EventsTableModel.java
        (original)
+++ 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/models/EventsTableModel.java
        Sun Nov 24 12:38:11 2013
@@ -61,6 +61,12 @@
         return eventsList.get(row);
     }
 
+    public PropertyEvent remove(int row) {
+        PropertyEvent event = eventsList.remove(row);
+        fireTableDataChanged();
+        return event;
+    }
+
     public void update(List<PropertyEvent> eventsList) {
         this.eventsList.clear();
         addAll(eventsList);

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
    Sun Nov 24 12:38:11 2013
@@ -48,13 +48,11 @@
 FamilyEditorPanel.ListMothersButton.text=
 
 IndividualEditorPanel.title= Edit Individual
-IndividualEditorPanel.sexLabel.text=Sex
 IndividualEditorPanel.eventsPanel.TabConstraints.tabTitle=Events
 IndividualEditorPanel.namesPanel.TabConstraints.tabTitle=Names
 IndividualEditorPanel.sourcesPanel.TabConstraints.tabTitle=Sources
 IndividualEditorPanel.notesPanel.TabConstraints.tabTitle=Notes
 IndividualEditorPanel.referencesPanel.TabConstraints.tabTitle=References
-IndividualEditorPanel.sexComboBox.toolTipText=Individual sex
 IndividualEditorPanel.individualIDLabel.text=ID
 IndividualEditorPanel.individualIDTextField.toolTipText=Individual Identifier
 IndividualEditorPanel.individualIDTextField.text=

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
 Sun Nov 24 12:38:11 2013
@@ -3,6 +3,7 @@
 import ancestris.modules.editors.genealogyeditor.models.EventsTableModel;
 import ancestris.util.swing.DialogManager.ADialog;
 import genj.gedcom.*;
+import java.util.ArrayList;
 import java.util.List;
 import org.openide.DialogDescriptor;
 import org.openide.util.Exceptions;
@@ -14,8 +15,11 @@
  */
 public class EventsListPanel extends javax.swing.JPanel {
 
-    private EventsTableModel eventsTableModel = new EventsTableModel();
     private Property root;
+    private EventsTableModel eventsTableModel = new EventsTableModel();
+    private ArrayList<PropertyEvent> editedEvents = new 
ArrayList<PropertyEvent>();
+    private ArrayList<PropertyEvent> addedEvents = new 
ArrayList<PropertyEvent>();
+    private ArrayList<PropertyEvent> deletedEvents = new 
ArrayList<PropertyEvent>();
 
     /**
      * Creates new form EventsListPanel
@@ -111,19 +115,9 @@
         eventEditorDialog.setDialogId(EventEditorPanel.class.getName());
 
         if (eventEditorDialog.show() == DialogDescriptor.OK_OPTION) {
-            final PropertyEvent propertyEvent = eventEditorPanel.getEvent();
-            try {
-                root.getGedcom().doUnitOfWork(new UnitOfWork() {
-
-                    @Override
-                    public void perform(Gedcom gedcom) throws GedcomException {
-                        root.copyProperties(propertyEvent, true);
-                    }
-                }); // end of doUnitOfWork
-                eventsTableModel.add(propertyEvent);
-            } catch (GedcomException ex) {
-                Exceptions.printStackTrace(ex);
-            }
+            PropertyEvent propertyEvent = eventEditorPanel.getEvent();
+            addedEvents.add(propertyEvent);
+            eventsTableModel.add(propertyEvent);
         }
     }//GEN-LAST:event_addEventButtonActionPerformed
 
@@ -140,6 +134,7 @@
             eventEditorDialog.setDialogId(EventEditorPanel.class.getName());
 
             if (eventEditorDialog.show() == DialogDescriptor.OK_OPTION) {
+                editedEvents.add(eventEditorPanel.getEvent());
             }
         }
     }//GEN-LAST:event_editEventButtonActionPerformed
@@ -148,20 +143,7 @@
         int selectedRow = eventsTable.getSelectedRow();
         if (selectedRow != -1) {
             int rowIndex = eventsTable.convertRowIndexToModel(selectedRow);
-            final PropertyEvent propertyEvent = 
eventsTableModel.getValueAt(rowIndex);
-            final Property parent = propertyEvent.getParent();
-            try {
-                root.getGedcom().doUnitOfWork(new UnitOfWork() {
-
-                    @Override
-                    public void perform(Gedcom gedcom) throws GedcomException {
-                        parent.delProperty(propertyEvent);
-                    }
-                }); // end of doUnitOfWork
-            } catch (GedcomException ex) {
-                Exceptions.printStackTrace(ex);
-            }
-//            update();
+            deletedEvents.add(eventsTableModel.remove(rowIndex));
         }
     }//GEN-LAST:event_deleteEventButtonActionPerformed
     // Variables declaration - do not modify//GEN-BEGIN:variables
@@ -179,5 +161,21 @@
     }
 
     public void commit() {
+        // Edited Events
+
+        // Added Events
+        for (PropertyEvent event : addedEvents) {
+            try {
+                root.copyProperties(event, true);
+            } catch (GedcomException ex) {
+                Exceptions.printStackTrace(ex);
+            }
+        }
+
+        // Removed Events
+        for (PropertyEvent event : deletedEvents) {
+            Property parent = event.getParent();
+            parent.delProperty(event);
+        }
     }
 }

Modified: 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/IndividualEditorPanel.form
==============================================================================
--- 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/IndividualEditorPanel.form
   (original)
+++ 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/IndividualEditorPanel.form
   Sun Nov 24 12:38:11 2013
@@ -49,9 +49,7 @@
                   <Group type="103" groupAlignment="0" attributes="0">
                       <Component id="simpleNameEditorPanel" alignment="0" 
max="32767" attributes="0"/>
                       <Group type="102" alignment="0" attributes="0">
-                          <Component id="sexLabel" min="-2" pref="28" max="-2" 
attributes="0"/>
-                          <EmptySpace max="-2" attributes="0"/>
-                          <Component id="sexComboBox" min="-2" pref="82" 
max="-2" attributes="0"/>
+                          <Component id="sexBeanPanel" min="-2" max="-2" 
attributes="0"/>
                           <EmptySpace max="32767" attributes="0"/>
                           <Component id="individualIDLabel" min="-2" max="-2" 
attributes="0"/>
                           <EmptySpace max="-2" attributes="0"/>
@@ -66,11 +64,12 @@
           <Group type="103" groupAlignment="0" attributes="0">
               <Group type="102" alignment="0" attributes="0">
                   <EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
-                  <Group type="103" groupAlignment="3" attributes="0">
-                      <Component id="individualIDLabel" alignment="3" min="-2" 
max="-2" attributes="0"/>
-                      <Component id="individualIDTextField" alignment="3" 
min="-2" max="-2" attributes="0"/>
-                      <Component id="sexComboBox" alignment="3" min="-2" 
max="-2" attributes="0"/>
-                      <Component id="sexLabel" alignment="3" min="-2" max="-2" 
attributes="0"/>
+                  <Group type="103" groupAlignment="0" attributes="0">
+                      <Group type="103" groupAlignment="3" attributes="0">
+                          <Component id="individualIDLabel" alignment="3" 
min="-2" max="-2" attributes="0"/>
+                          <Component id="individualIDTextField" alignment="3" 
min="-2" max="-2" attributes="0"/>
+                      </Group>
+                      <Component id="sexBeanPanel" min="-2" max="-2" 
attributes="0"/>
                   </Group>
                   <EmptySpace max="-2" attributes="0"/>
                   <Component id="simpleNameEditorPanel" min="-2" max="-2" 
attributes="0"/>
@@ -80,26 +79,6 @@
         </DimensionLayout>
       </Layout>
       <SubComponents>
-        <Component class="javax.swing.JLabel" name="sexLabel">
-          <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="IndividualEditorPanel.sexLabel.text" 
replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;),
 {arguments})"/>
-            </Property>
-          </Properties>
-        </Component>
-        <Component class="javax.swing.JComboBox" name="sexComboBox">
-          <Properties>
-            <Property name="model" type="javax.swing.ComboBoxModel" 
editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
-              <Connection code="sexComboBoxModel" 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="IndividualEditorPanel.sexComboBox.toolTipText" 
replaceFormat="java.text.MessageFormat.format(java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;),
 {arguments})"/>
-            </Property>
-          </Properties>
-          <AuxValues>
-            <AuxValue name="JavaCodeGenerator_TypeParameters" 
type="java.lang.String" value="&lt;String&gt;"/>
-          </AuxValues>
-        </Component>
         <Component class="javax.swing.JLabel" name="individualIDLabel">
           <Properties>
             <Property name="text" type="java.lang.String" 
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@@ -120,6 +99,8 @@
         </Component>
         <Component 
class="ancestris.modules.editors.genealogyeditor.panels.NameSimpleEditorPanel" 
name="simpleNameEditorPanel">
         </Component>
+        <Component 
class="ancestris.modules.editors.genealogyeditor.beans.SexBeanPanel" 
name="sexBeanPanel">
+        </Component>
       </SubComponents>
     </Container>
     <Container class="javax.swing.JTabbedPane" 
name="individualInformationTabbedPane">
@@ -288,8 +269,8 @@
             <DimensionLayout dim="1">
               <Group type="103" groupAlignment="0" attributes="0">
                   <Group type="102" alignment="1" attributes="0">
-                      <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
-                      <Component id="associationsListPanel" min="-2" max="-2" 
attributes="0"/>
+                      <EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
+                      <Component id="associationsListPanel" max="32767" 
attributes="0"/>
                   </Group>
               </Group>
             </DimensionLayout>

Modified: 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/IndividualEditorPanel.java
==============================================================================
--- 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/IndividualEditorPanel.java
   (original)
+++ 
trunk/AncestrisExtensions/editors.genealogyeditor/src/ancestris/modules/editors/genealogyeditor/panels/IndividualEditorPanel.java
   Sun Nov 24 12:38:11 2013
@@ -1,6 +1,5 @@
 package ancestris.modules.editors.genealogyeditor.panels;
 
-import ancestris.modules.editors.genealogyeditor.models.SexComboBoxModel;
 import genj.gedcom.*;
 import java.util.ArrayList;
 import java.util.List;
@@ -11,9 +10,8 @@
  * @author dominique
  */
 public final class IndividualEditorPanel extends javax.swing.JPanel {
-
+    
     private Indi individual;
-    private SexComboBoxModel sexComboBoxModel = new SexComboBoxModel();
 
     /**
      * Creates new form IndividualEditorPanel
@@ -32,11 +30,10 @@
     private void initComponents() {
 
         generalPanel = new javax.swing.JPanel();
-        sexLabel = new javax.swing.JLabel();
-        sexComboBox = new javax.swing.JComboBox<String>();
         individualIDLabel = new javax.swing.JLabel();
         individualIDTextField = new javax.swing.JTextField();
         simpleNameEditorPanel = new 
ancestris.modules.editors.genealogyeditor.panels.NameSimpleEditorPanel();
+        sexBeanPanel = new 
ancestris.modules.editors.genealogyeditor.beans.SexBeanPanel();
         individualInformationTabbedPane = new javax.swing.JTabbedPane();
         eventsPanel = new javax.swing.JPanel();
         eventsListPanel = new 
ancestris.modules.editors.genealogyeditor.panels.EventsListPanel();
@@ -51,11 +48,6 @@
         galleryPanel = new javax.swing.JPanel();
         multimediaObjectsListPanel = new 
ancestris.modules.editors.genealogyeditor.panels.MultimediaObjectsListPanel();
 
-        
sexLabel.setText(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/panels/Bundle").getString("IndividualEditorPanel.sexLabel.text"),
 new Object[] {})); // NOI18N
-
-        sexComboBox.setModel(sexComboBoxModel);
-        
sexComboBox.setToolTipText(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/panels/Bundle").getString("IndividualEditorPanel.sexComboBox.toolTipText"),
 new Object[] {})); // NOI18N
-
         
individualIDLabel.setText(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/panels/Bundle").getString("IndividualEditorPanel.individualIDLabel.text"),
 new Object[] {})); // NOI18N
 
         individualIDTextField.setColumns(8);
@@ -71,9 +63,7 @@
                 
.addGroup(generalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addComponent(simpleNameEditorPanel, 
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
Short.MAX_VALUE)
                     .addGroup(generalPanelLayout.createSequentialGroup()
-                        .addComponent(sexLabel, 
javax.swing.GroupLayout.PREFERRED_SIZE, 28, 
javax.swing.GroupLayout.PREFERRED_SIZE)
-                        
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addComponent(sexComboBox, 
javax.swing.GroupLayout.PREFERRED_SIZE, 82, 
javax.swing.GroupLayout.PREFERRED_SIZE)
+                        .addComponent(sexBeanPanel, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)
                         
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                         .addComponent(individualIDLabel)
                         
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@@ -84,11 +74,11 @@
             
generalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
             .addGroup(generalPanelLayout.createSequentialGroup()
                 .addGap(12, 12, 12)
-                
.addGroup(generalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                    .addComponent(individualIDLabel)
-                    .addComponent(individualIDTextField, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)
-                    .addComponent(sexComboBox, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)
-                    .addComponent(sexLabel))
+                
.addGroup(generalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                    
.addGroup(generalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                        .addComponent(individualIDLabel)
+                        .addComponent(individualIDTextField, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE))
+                    .addComponent(sexBeanPanel, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE))
                 
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addComponent(simpleNameEditorPanel, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)
                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, 
Short.MAX_VALUE))
@@ -165,8 +155,8 @@
         referencesPanelLayout.setVerticalGroup(
             
referencesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, 
referencesPanelLayout.createSequentialGroup()
-                .addGap(0, 0, Short.MAX_VALUE)
-                .addComponent(associationsListPanel, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE))
+                .addGap(0, 0, 0)
+                .addComponent(associationsListPanel, 
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
Short.MAX_VALUE))
         );
 
         
individualInformationTabbedPane.addTab(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("ancestris/modules/editors/genealogyeditor/panels/Bundle").getString("IndividualEditorPanel.referencesPanel.TabConstraints.tabTitle"),
 new Object[] {}), new 
javax.swing.ImageIcon(getClass().getResource("/ancestris/modules/editors/genealogyeditor/resources/Association.png")),
 referencesPanel); // NOI18N
@@ -222,8 +212,7 @@
     private ancestris.modules.editors.genealogyeditor.panels.NotesListPanel 
notesListPanel;
     private javax.swing.JPanel notesPanel;
     private javax.swing.JPanel referencesPanel;
-    private javax.swing.JComboBox<String> sexComboBox;
-    private javax.swing.JLabel sexLabel;
+    private ancestris.modules.editors.genealogyeditor.beans.SexBeanPanel 
sexBeanPanel;
     private 
ancestris.modules.editors.genealogyeditor.panels.NameSimpleEditorPanel 
simpleNameEditorPanel;
     private ancestris.modules.editors.genealogyeditor.panels.SourcesListPanel 
sourcesListPanel;
     private javax.swing.JPanel sourcesPanel;
@@ -241,60 +230,60 @@
      */
     public void setIndividual(Indi individual) {
         this.individual = individual;
-
-        update();
-    }
-
-    private void update() {
-
+        
         individualIDTextField.setText(individual.getId());
         List<PropertyName> namesList = 
individual.getProperties(PropertyName.class);
-
+        
         PropertyName name = namesList.get(0);
         if (name != null) {
             simpleNameEditorPanel.setName(individual, name);
         }
-
-        sexComboBox.setSelectedIndex(individual.getSex());
-
+        PropertySex sex = (PropertySex) individual.getProperty("SEX", true);
+        if (sex == null) {
+            individual.setSex(PropertySex.UNKNOWN);
+            sex = (PropertySex) individual.getProperty("SEX", true);
+        }
+        sexBeanPanel.setSex(individual, sex);
+        
         namesListPanel.setNamesList(individual, namesList);
-
+        
         List<PropertyEvent> eventsList = 
individual.getProperties(PropertyEvent.class);
         for (Fam family : individual.getFamiliesWhereSpouse()) {
             eventsList.addAll(family.getProperties(PropertyEvent.class));
         }
         eventsListPanel.setEventsList(individual, eventsList);
-
+        
         List<Source> sourcesList = new ArrayList<Source>();
         for (PropertySource sourceRef : 
individual.getProperties(PropertySource.class)) {
             sourcesList.add((Source) sourceRef.getTargetEntity());
         }
         sourcesListPanel.setSourcesList(individual, sourcesList);
-
+        
         List<Note> notesList = new ArrayList<Note>();
         for (PropertyNote noteRef : 
individual.getProperties(PropertyNote.class)) {
             notesList.add((Note) noteRef.getTargetEntity());
         }
         notesListPanel.setNotesList(individual, notesList);
-
+        
         associationsListPanel.setAssociationsList(individual, 
individual.getProperties(PropertyAssociation.class));
-
+        
         List<Media> mediasList = new ArrayList<Media>();
         for (PropertyMedia mediaRef : 
individual.getProperties(PropertyMedia.class)) {
             mediasList.add((Media) mediaRef.getTargetEntity());
         }
         multimediaObjectsListPanel.setMultimediaObjectList(individual, 
mediasList);
     }
-
+    
     public void commit() {
         try {
             individual.getGedcom().doUnitOfWork(new UnitOfWork() {
-
+                
                 @Override
                 public void perform(Gedcom gedcom) throws GedcomException {
+                    sexBeanPanel.commit();
                     simpleNameEditorPanel.commit();
-                    namesListPanel.commit();
                     eventsListPanel.commit();
+                    namesListPanel.commit();
                     sourcesListPanel.commit();
                     notesListPanel.commit();
                     associationsListPanel.commit();

---------------------------------------------------------------------
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]

Reply via email to