Author: dandre
Date: Mon Sep 30 01:05:29 2013
New Revision: 4587

Log:
* more dialog box refactoring
* add cancel button to blueprint selector in tree view

Modified:
   trunk/AncestrisCore/core.report/src/genj/report/ReportView.java
   
trunk/AncestrisCore/core/src/ancestris/core/actions/AbstractAncestrisAction.java
   trunk/AncestrisCore/core/src/ancestris/gedcom/GedcomMgr.java
   trunk/AncestrisCore/core/src/ancestris/util/swing/DialogManager.java
   trunk/AncestrisCore/core/src/genj/print/PrintAction.java
   trunk/AncestrisCore/core/src/genj/renderer/BlueprintEditor.java
   trunk/AncestrisCore/core/src/genj/renderer/ChooseBlueprintAction.java
   trunk/AncestrisCore/core/src/genj/util/swing/DialogHelper.java
   trunk/AncestrisCore/core/src/genj/view/ScreenshotAction.java
   
trunk/AncestrisCore/document.view/src/ancestris/modules/document/view/HyperLinkTextDocumentView.java
   trunk/AncestrisCore/modules.beans/src/genj/edit/beans/XRefBean.java
   trunk/AncestrisCore/modules.editors.gedcom/src/genj/edit/AdvancedEditor.java
   
trunk/AncestrisCore/modules.editors.gedcom/src/genj/edit/actions/AbstractChange.java
   
trunk/AncestrisCore/modules.editors.gedcom/src/genj/edit/actions/TogglePrivate.java
   trunk/AncestrisCore/modules.views.tree/src/genj/tree/TreeView.java

Modified: trunk/AncestrisCore/core.report/src/genj/report/ReportView.java
==============================================================================
--- trunk/AncestrisCore/core.report/src/genj/report/ReportView.java     
(original)
+++ trunk/AncestrisCore/core.report/src/genj/report/ReportView.java     Mon Sep 
30 01:05:29 2013
@@ -133,7 +133,7 @@
 
         // check if appropriate
         if (context == null || report.accepts(context) == null) {
-            DialogHelper.openDialog(report.getName(), 
DialogHelper.ERROR_MESSAGE, RESOURCES.getString("report.noaccept"), 
AbstractAncestrisAction.okOnly(), ReportView.this);
+            DialogManager.createError(report.getName(), 
RESOURCES.getString("report.noaccept")).show();
             return;
         }
 

Modified: 
trunk/AncestrisCore/core/src/ancestris/core/actions/AbstractAncestrisAction.java
==============================================================================
--- 
trunk/AncestrisCore/core/src/ancestris/core/actions/AbstractAncestrisAction.java
    (original)
+++ 
trunk/AncestrisCore/core/src/ancestris/core/actions/AbstractAncestrisAction.java
    Mon Sep 30 01:05:29 2013
@@ -206,34 +206,6 @@
      * @deprecated
      */
     @Deprecated
-    public static AbstractAncestrisAction[] andCancel(AbstractAncestrisAction 
ok) {
-        return new AbstractAncestrisAction[]{ok, cancel()};
-    }
-
-//  /** convenience factory */
-//  public static AbstractAncestrisAction[] okAnd(AbstractAncestrisAction 
action) {
-//    return new AbstractAncestrisAction[]{ ok(), action };
-//  }
-//  
-    /** convenience factory
-     *
-     * @deprecated
-     */
-    @Deprecated
-    public static AbstractAncestrisAction[] okOnly() {
-        return new AbstractAncestrisAction[]{ok()};
-    }
-
-//  /** convenience factory */
-//  public static AbstractAncestrisAction[] cancelOnly() {
-//    return new AbstractAncestrisAction[]{ cancel() };
-//  }
-//
-    /** convenience factory
-     *
-     * @deprecated
-     */
-    @Deprecated
     private static class Constant extends AbstractAncestrisAction {
 
         private Constant(String txt) {

Modified: trunk/AncestrisCore/core/src/ancestris/gedcom/GedcomMgr.java
==============================================================================
--- trunk/AncestrisCore/core/src/ancestris/gedcom/GedcomMgr.java        
(original)
+++ trunk/AncestrisCore/core/src/ancestris/gedcom/GedcomMgr.java        Mon Sep 
30 01:05:29 2013
@@ -251,7 +251,8 @@
                 reader = (GedcomReader) 
Spin.off(GedcomReaderFactory.createReader(origin, (GedcomReaderContext) 
Spin.over(new GedcomReaderContext() {
 
                     public String getPassword() {
-                        return 
DialogManager.getInstance().show(FileUtil.getFileDisplayName(input), 
DialogManager.QUESTION_MESSAGE, RES.getString("cc.provide_password"), "");
+                        return 
DialogManager.create(FileUtil.getFileDisplayName(input), 
RES.getString("cc.provide_password"), "")
+                                .show();
                     }
 
                     public void handleWarning(int line, String warning, 
Context context) {
@@ -261,7 +262,7 @@
 
             } catch (IOException ex) {
                 String txt = RES.getString("cc.open.no_connect_to", input) + 
"\n[" + ex.getMessage() + "]";
-                DialogHelper.openDialog(FileUtil.getFileDisplayName(input), 
DialogHelper.ERROR_MESSAGE, txt, AbstractAncestrisAction.okOnly(), null);
+                DialogManager.createError(FileUtil.getFileDisplayName(input), 
txt).show();
                 return null;
             }
 
@@ -286,7 +287,8 @@
                 }
             } catch (GedcomIOException ex) {
                 // tell the user about it
-                DialogHelper.openDialog(FileUtil.getFileDisplayName(input), 
DialogHelper.ERROR_MESSAGE, RES.getString("cc.open.read_error", "" + 
ex.getLine()) + ":\n" + ex.getMessage(), AbstractAncestrisAction.okOnly(), 
null);
+                DialogManager.createError(FileUtil.getFileDisplayName(input), 
+                        RES.getString("cc.open.read_error", "" + ex.getLine()) 
+ ":\n" + ex.getMessage()).show();
                 // abort
                 return null;
             } finally {
@@ -354,10 +356,10 @@
 
 
                 } catch (GedcomEncodingException gee) {
-                    DialogHelper.openDialog(gedcom.getName(), 
DialogHelper.ERROR_MESSAGE, RES.getString("cc.save.write_encoding_error", 
gee.getMessage()), AbstractAncestrisAction.okOnly(), null);
+                    DialogManager.createError(gedcom.getName(), 
RES.getString("cc.save.write_encoding_error", gee.getMessage())).show();
                     return false;
                 } catch (IOException ex) {
-                    DialogHelper.openDialog(gedcom.getName(), 
DialogHelper.ERROR_MESSAGE, RES.getString("cc.save.open_error", 
gedcom.getOrigin().getFile().getAbsolutePath()), 
AbstractAncestrisAction.okOnly(), null);
+                    DialogManager.createError(gedcom.getName(), 
RES.getString("cc.save.open_error", 
gedcom.getOrigin().getFile().getAbsolutePath())).show();
                     return false;
                 }
 
@@ -383,7 +385,7 @@
                 }
 
             } catch (GedcomIOException gioex) {
-                DialogHelper.openDialog(gedcom.getName(), 
DialogHelper.ERROR_MESSAGE, RES.getString("cc.save.write_error", "" + 
gioex.getLine()) + ":\n" + gioex.getMessage(), 
AbstractAncestrisAction.okOnly(), null);
+                DialogManager.createError(gedcom.getName(),  
RES.getString("cc.save.write_error", "" + gioex.getLine()) + ":\n" + 
gioex.getMessage()).show();
                 return false;
             }
 

Modified: trunk/AncestrisCore/core/src/ancestris/util/swing/DialogManager.java
==============================================================================
--- trunk/AncestrisCore/core/src/ancestris/util/swing/DialogManager.java        
(original)
+++ trunk/AncestrisCore/core/src/ancestris/util/swing/DialogManager.java        
Mon Sep 30 01:05:29 2013
@@ -10,6 +10,8 @@
 import java.awt.Dimension;
 import java.awt.Rectangle;
 import javax.swing.JComponent;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
 import org.openide.DialogDescriptor;
 import org.openide.DialogDisplayer;
 import org.openide.NotifyDescriptor;
@@ -18,27 +20,24 @@
  *
  * @author daniel
  */
-public class DialogManager {
+public abstract class DialogManager {
 
     /** message types */
-    public static final int ERROR_MESSAGE = NotifyDescriptor.ERROR_MESSAGE,
+    public static final int 
+            ERROR_MESSAGE = NotifyDescriptor.ERROR_MESSAGE,
             INFORMATION_MESSAGE = NotifyDescriptor.INFORMATION_MESSAGE,
             WARNING_MESSAGE = NotifyDescriptor.WARNING_MESSAGE,
             QUESTION_MESSAGE = NotifyDescriptor.QUESTION_MESSAGE,
             PLAIN_MESSAGE = NotifyDescriptor.PLAIN_MESSAGE;
-    public static final int OK_CANCEL_OPTION = 
DialogDescriptor.OK_CANCEL_OPTION;
+    public static final int 
+            OK_CANCEL_OPTION = DialogDescriptor.OK_CANCEL_OPTION,
+            YES_NO_OPTION = NotifyDescriptor.YES_NO_OPTION;
     /** Return value if OK is chosen. */
     public static final Object OK_OPTION = DialogDescriptor.OK_OPTION;
     public static final Object CANCEL_OPTION = DialogDescriptor.CANCEL_OPTION;
-    private static DialogManager instance = null;
-    public static DialogManager getInstance() {
-        if (instance == null) {
-            instance = new DialogManager();
-        }
-        return instance;
-    }
+    public static final Object YES_OPTION = DialogDescriptor.YES_OPTION;
 
-    public Object show(String title, int messageType, String txt, Object[] 
options) {
+    public static Object show(String title, int messageType, String txt, 
Object[] options) {
         NotifyDescriptor d = new NotifyDescriptor(txt, title, 
NotifyDescriptor.DEFAULT_OPTION, messageType, options, null);
         return DialogDisplayer.getDefault().notify(d);
     }
@@ -47,74 +46,203 @@
     //TODO: ce qui n'est pas fait: la possibilite de desactiver des boutons 
par le caller
     // p.ex via action[0].setEnable(...)
     //
+    public static ADialog create(String title, JComponent content) {
+        return new ADialog(title, content);
+    }
+
+    public static InputLine create(String title, String text, String value) {
+        return new InputLine(title, text, value);
+    }
+
+    /**
+     * Cretes an error dialog message with only an ok button.
+     *
+     * @param title
+    * @param text
+     *
+     * @return
+     */
+    public static DialogManager createError(String title, String text) {
+        return new Message(title, text).setMessageType(ERROR_MESSAGE);
+    }
+
+    public static DialogManager create(String title, String text) {
+        return new Message(title, 
text).setOptionType(NotifyDescriptor.OK_CANCEL_OPTION);
+    }
+
+    // see http://wiki.netbeans.org/DevFaqDialogControlOKButton
+    /**
+     * custom version of {@link NotifyDescriptor.InputLine} that enable or 
disable
+     * ok button depending on presence of data in input buffer
+     * This behaviour can be disabled using {@link setEnabler}
+     */
+    private static class MyInputLine extends NotifyDescriptor.InputLine {
+
+        private boolean isAutoEnabler = true;
+
+        public MyInputLine(String text, String title) {
+            super(text, title);
+            doEnablement();
+        }
+
+        @Override
+        public void setInputText(String text) {
+            super.setInputText(text);
+            doEnablement();
+        }
 
-    public String show(String title, int messageType, String txt, String 
value) {
-        NotifyDescriptor.InputLine d = new NotifyDescriptor.InputLine(txt, 
title, NotifyDescriptor.OK_CANCEL_OPTION, messageType);
-        d.setInputText(value);
-        // analyze
-        if (NotifyDescriptor.OK_OPTION == 
DialogDisplayer.getDefault().notify(d)) {
-            return d.getInputText();
+        public void setEnabler(boolean set) {
+            isAutoEnabler = set;
+            doEnablement();
+        }
+
+        @Override
+        protected void initialize() {
+            super.initialize();
+            textField.getDocument().addDocumentListener(new DocumentListener() 
{
+
+                public void insertUpdate(DocumentEvent e) {
+                    doEnablement();
+                }
+
+                public void removeUpdate(DocumentEvent e) {
+                    doEnablement();
+                }
+
+                public void changedUpdate(DocumentEvent e) {
+                    doEnablement();
+                }
+            });
+
+        }
+
+        private void doEnablement() {
+            if (isAutoEnabler) {
+                if (textField.getText().isEmpty()) {
+                    setValid(false);
+                } else {
+                    setValid(true);
+                }
+            } else {
+                setValid(true);
+            }
         }
-        return null;
     }
-    
-    public static ADialog create(String title, JComponent content){
-        return new ADialog(title, content);
+
+    protected abstract NotifyDescriptor getDescriptor();
+    protected String dialogId = null;
+
+    public DialogManager setOptions(Object[] newOptions) {
+        getDescriptor().setOptions(newOptions);
+        return this;
     }
-    
-    public static class ADialog{
-        private DialogDescriptor dd;
-        private String dialogId = null;
 
-        public ADialog(String title, JComponent content) {
-            dd = new DialogDescriptor(content, title);
-            dd.setMessageType(DialogDescriptor.QUESTION_MESSAGE);
-            dd.setOptions(new Object[]{ DialogDescriptor.OK_OPTION});
-        }
-
-        public ADialog setOptions(Object[] newOptions) {
-            dd.setOptions(newOptions);
-            return this;
-        }
-
-        public ADialog setOptionType(int newType) {
-            dd.setOptions(null);
-            dd.setOptionType(newType);
-            return this;
-        }
-
-        public ADialog setMessageType(int newType) {
-            dd.setMessageType(newType);
-            return this;
-        }        
-
-        public ADialog setDialogId(String id) {
-            dialogId = id;
-            return this;
-        }
-
-        public final ADialog setValid(boolean newValid) {
-            dd.setValid(newValid);
-            return this;
-        }
-        
-    public Object show() {
-        final Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
-        // restore bounds
-        if (dialogId != null) {
-            final Registry registry = Registry.get(DialogManager.class);
-            Dimension bounds = registry.get(dialogId+".dialog", (Dimension) 
null);
-            if (bounds != null) {
-                Rectangle prev = dialog.getBounds();
-                prev.grow((bounds.width - prev.width) / 2, (bounds.height - 
prev.height) / 2);
-                dialog.setBounds(prev);
+    public DialogManager setOptionType(int newType) {
+        getDescriptor().setOptions(null);
+        getDescriptor().setOptionType(newType);
+        return this;
+    }
+
+    public DialogManager setMessageType(int newType) {
+        getDescriptor().setMessageType(newType);
+        return this;
+    }
+
+    public DialogManager setDialogId(String id) {
+        dialogId = id;
+        return this;
+    }
+
+    public final DialogManager setValid(boolean newValid) {
+        getDescriptor().setValid(newValid);
+        return this;
+    }
+
+    public abstract Object show();
+
+    public static class Message extends DialogManager {
+
+        private NotifyDescriptor descriptor;
+
+        public Message(String title, String message) {
+            super();
+            descriptor = new NotifyDescriptor(
+                    message,
+                    title,
+                    NotifyDescriptor.DEFAULT_OPTION,
+                    NotifyDescriptor.INFORMATION_MESSAGE,
+                    new Object[]{NotifyDescriptor.OK_OPTION},
+                    OK_OPTION);
+        }
+
+        @Override
+        protected NotifyDescriptor getDescriptor() {
+            return descriptor;
+        }
+
+        @Override
+        public Object show() {
+            return DialogDisplayer.getDefault().notify(descriptor);
+        }
+    }
+
+    public static class InputLine extends DialogManager {
+
+        private NotifyDescriptor.InputLine descriptor;
+
+        public InputLine(String title, String text, String value) {
+            super();
+            descriptor = new MyInputLine(text, title);
+            descriptor.setInputText(value);
+            setOptionType(OK_CANCEL_OPTION);
+        }
+
+        @Override
+        protected NotifyDescriptor getDescriptor() {
+            return descriptor;
+        }
+
+        @Override
+        public String show() {
+            // analyze
+            if (NotifyDescriptor.OK_OPTION == 
DialogDisplayer.getDefault().notify(descriptor)) {
+                return descriptor.getInputText();
             }
-            dialog.setVisible(true);
-            registry.put(dialogId+".dialog", dialog.getSize());
-        } else {
-            dialog.setVisible(true);
+            return null;
         }
-        return dd.getValue();
     }
+
+    public static class ADialog extends DialogManager {
+
+        protected DialogDescriptor descriptor;
+
+        public ADialog(String title, JComponent content) {
+            super();
+            descriptor = new DialogDescriptor(content, title);
+        }
+
+        @Override
+        protected NotifyDescriptor getDescriptor() {
+            return descriptor;
+        }
+
+        public Object show() {
+            final Dialog dialog = 
DialogDisplayer.getDefault().createDialog(descriptor);
+            // restore bounds
+            if (dialogId != null) {
+                final Registry registry = Registry.get(DialogManager.class);
+                Dimension bounds = registry.get(dialogId + ".dialog", 
(Dimension) null);
+                if (bounds != null) {
+                    Rectangle prev = dialog.getBounds();
+                    prev.grow((bounds.width - prev.width) / 2, (bounds.height 
- prev.height) / 2);
+                    dialog.setBounds(prev);
+                }
+                dialog.setVisible(true);
+                registry.put(dialogId + ".dialog", dialog.getSize());
+            } else {
+                dialog.setVisible(true);
+            }
+            return descriptor.getValue();
+        }
     }
 }

Modified: trunk/AncestrisCore/core/src/genj/print/PrintAction.java
==============================================================================
--- trunk/AncestrisCore/core/src/genj/print/PrintAction.java    (original)
+++ trunk/AncestrisCore/core/src/genj/print/PrintAction.java    Mon Sep 30 
01:05:29 2013
@@ -67,7 +67,7 @@
       task = new PrintTask(title, getRenderer());
     } catch (PrintException pe) {
       LOG.log(Level.INFO, "can't setup print task", pe);
-      DialogHelper.openDialog(title, DialogHelper.ERROR_MESSAGE, 
pe.getMessage(), AbstractAncestrisAction.okOnly(), e);
+      DialogManager.createError(title, pe.getMessage()).show();
       return;
     }
     

Modified: trunk/AncestrisCore/core/src/genj/renderer/BlueprintEditor.java
==============================================================================
--- trunk/AncestrisCore/core/src/genj/renderer/BlueprintEditor.java     
(original)
+++ trunk/AncestrisCore/core/src/genj/renderer/BlueprintEditor.java     Mon Sep 
30 01:05:29 2013
@@ -192,6 +192,13 @@
   }
   
   /**
+   * Returns true if conatent has been changed.
+   * @return 
+   */
+  public boolean isChanged(){
+      return isChanged;
+  }
+  /**
    * Make sure html is visible
    */
   public void setSourceVisible(boolean v) {

Modified: trunk/AncestrisCore/core/src/genj/renderer/ChooseBlueprintAction.java
==============================================================================
--- trunk/AncestrisCore/core/src/genj/renderer/ChooseBlueprintAction.java       
(original)
+++ trunk/AncestrisCore/core/src/genj/renderer/ChooseBlueprintAction.java       
Mon Sep 30 01:05:29 2013
@@ -79,10 +79,15 @@
     final AbstractAncestrisAction del = new Del();
     blueprints.addListSelectionListener(new ListSelectionListener() {
       public void valueChanged(ListSelectionEvent e) {
-        
-        editor.commit();
-        
-        Blueprint selection = (Blueprint)blueprints.getSelectedValue();
+          if (editor.isChanged() && 
+                  //XXX: Put in bundle
+                  DialogManager.YES_OPTION == DialogManager.create("BluePrint 
Editor", "Do you want to save changes.")
+                      .setMessageType(DialogManager.WARNING_MESSAGE)
+                      .setOptionType(DialogManager.YES_NO_OPTION).show()){
+            editor.commit();
+          }
+
+          Blueprint selection = (Blueprint)blueprints.getSelectedValue();
         
         // no selection?
         if (selection==null) {
@@ -112,15 +117,16 @@
     content.add(bh.create(del));
     content.add(editor);
     
-    DialogManager.create(RESOURCES.getString("blueprint"), content).
+    if (DialogManager.OK_OPTION == 
DialogManager.create(RESOURCES.getString("blueprint"), content).
             setDialogId("genj.renderer.blueprint").
-            show();
-    
-    editor.commit();
+            setOptionType(DialogManager.OK_CANCEL_OPTION).
+            show()){
+        editor.commit();
 
-    current = (Blueprint)blueprints.getSelectedValue();
-    if (current!=null)
-      commit(recipient, current);
+        current = (Blueprint)blueprints.getSelectedValue();
+        if (current!=null)
+        commit(recipient, current);
+    }
   }
 
   private class Add extends AbstractAncestrisAction {
@@ -133,12 +139,11 @@
       // check selection
       Blueprint selection = (Blueprint)blueprints.getSelectedValue();
       // get name
-      String name = DialogManager.getInstance().show(
+      String name = DialogManager.create(
         null,
-        DialogManager.QUESTION_MESSAGE,
         RESOURCES.getString("blueprint.add.confirm"),
         ""
-      );
+      ).show();
       if (name==null||name.length()==0) 
         return;
       // get html

Modified: trunk/AncestrisCore/core/src/genj/util/swing/DialogHelper.java
==============================================================================
--- trunk/AncestrisCore/core/src/genj/util/swing/DialogHelper.java      
(original)
+++ trunk/AncestrisCore/core/src/genj/util/swing/DialogHelper.java      Mon Sep 
30 01:05:29 2013
@@ -156,7 +156,7 @@
     public static int openDialog(String title, int messageType, String txt, 
Action[] actions, Object source) {
 
         Object options[] = actions2options(actions);
-        return getResult(DialogManager.getInstance().show(title, messageType, 
txt, options), options);
+        return getResult(DialogManager.show(title, messageType, txt, options), 
options);
     }
 
     /**
@@ -217,7 +217,7 @@
             this.title = title;
             this.messageType = messageType;
             this.content = content;
-            this.actions = actions != null ? actions : 
AbstractAncestrisAction.okOnly();
+            this.actions = actions;
 
             // find window for source
             parent = null;

Modified: trunk/AncestrisCore/core/src/genj/view/ScreenshotAction.java
==============================================================================
--- trunk/AncestrisCore/core/src/genj/view/ScreenshotAction.java        
(original)
+++ trunk/AncestrisCore/core/src/genj/view/ScreenshotAction.java        Mon Sep 
30 01:05:29 2013
@@ -104,7 +104,7 @@
       long max = Runtime.getRuntime().maxMemory()/1024/1000;
       String msg = RES.getString("screenshot.oom", 
r.width*r.height*4/1024/1000, max, String.valueOf(max));
       Logger.getLogger("genj.view").log(Level.WARNING, msg, oom);
-      DialogHelper.openDialog(getTip(), DialogHelper.ERROR_MESSAGE, msg, 
AbstractAncestrisAction.okOnly(), e);
+      DialogManager.createError(getTip(), msg).show();
     }
     
     

Modified: 
trunk/AncestrisCore/document.view/src/ancestris/modules/document/view/HyperLinkTextDocumentView.java
==============================================================================
--- 
trunk/AncestrisCore/document.view/src/ancestris/modules/document/view/HyperLinkTextDocumentView.java
        (original)
+++ 
trunk/AncestrisCore/document.view/src/ancestris/modules/document/view/HyperLinkTextDocumentView.java
        Mon Sep 30 01:05:29 2013
@@ -14,6 +14,7 @@
 import ancestris.core.actions.AbstractAncestrisAction;
 import ancestris.core.resources.Images;
 import static ancestris.modules.document.view.Bundle.*;
+import ancestris.util.swing.DialogManager;
 import genj.gedcom.Context;
 import genj.util.swing.DialogHelper;
 import java.awt.event.ActionEvent;
@@ -147,7 +148,7 @@
             try {
                 out = new OutputStreamWriter(new FileOutputStream(file), 
Charset.forName("UTF8"));
             } catch (IOException ex) {
-                DialogHelper.openDialog(textOutput.getName(), 
DialogHelper.ERROR_MESSAGE, "Error while saving to\n" + file.getAbsolutePath(), 
AbstractAncestrisAction.okOnly(), HyperLinkTextDocumentView.this);
+                DialogManager.createError(textOutput.getName(), "Error while 
saving to\n" + file.getAbsolutePath()).show();
                 return;
             }
 

Modified: trunk/AncestrisCore/modules.beans/src/genj/edit/beans/XRefBean.java
==============================================================================
--- trunk/AncestrisCore/modules.beans/src/genj/edit/beans/XRefBean.java 
(original)
+++ trunk/AncestrisCore/modules.beans/src/genj/edit/beans/XRefBean.java Mon Sep 
30 01:05:29 2013
@@ -105,12 +105,8 @@
           }
         });
       } catch (GedcomException ge) {
-        DialogHelper.openDialog(
-            getText(), 
-            DialogHelper.WARNING_MESSAGE, 
-            ge.getMessage(), 
-            AbstractAncestrisAction.okOnly(), 
-            event);
+          DialogManager.create(getText(), ge.getMessage())
+                  .setMessageType(DialogManager.WARNING_MESSAGE).show();
         LOG.log(Level.FINER, ge.getMessage(), ge);
       }
       

Modified: 
trunk/AncestrisCore/modules.editors.gedcom/src/genj/edit/AdvancedEditor.java
==============================================================================
--- 
trunk/AncestrisCore/modules.editors.gedcom/src/genj/edit/AdvancedEditor.java    
    (original)
+++ 
trunk/AncestrisCore/modules.editors.gedcom/src/genj/edit/AdvancedEditor.java    
    Mon Sep 30 01:05:29 2013
@@ -453,7 +453,7 @@
                     }
                 });
             } catch (GedcomException e) {
-                DialogHelper.openDialog(null, DialogHelper.ERROR_MESSAGE, 
e.getMessage(), AbstractAncestrisAction.okOnly(), AdvancedEditor.this);
+                DialogManager.createError(null, e.getMessage()).show();
             }
 
             // done
@@ -739,7 +739,7 @@
                 tags = choose.getSelectedTags();
                 addDefaults = check.isSelected();
                 if (tags.length == 0) {
-                    DialogHelper.openDialog(null, DialogHelper.ERROR_MESSAGE, 
resources.getString("add.must_enter"), AbstractAncestrisAction.okOnly(), 
AdvancedEditor.this);
+                    DialogManager.createError(null, 
resources.getString("add.must_enter")).show();
                     return;
                 }
             }

Modified: 
trunk/AncestrisCore/modules.editors.gedcom/src/genj/edit/actions/AbstractChange.java
==============================================================================
--- 
trunk/AncestrisCore/modules.editors.gedcom/src/genj/edit/actions/AbstractChange.java
        (original)
+++ 
trunk/AncestrisCore/modules.editors.gedcom/src/genj/edit/actions/AbstractChange.java
        Mon Sep 30 01:05:29 2013
@@ -128,7 +128,7 @@
                 }
             });
         } catch (Throwable t) {
-            DialogHelper.openDialog(null, DialogHelper.ERROR_MESSAGE, 
t.getMessage(), AbstractAncestrisAction.okOnly(), event);
+            DialogManager.createError(null, t.getMessage()).show();
         }
 
         // propagate selection

Modified: 
trunk/AncestrisCore/modules.editors.gedcom/src/genj/edit/actions/TogglePrivate.java
==============================================================================
--- 
trunk/AncestrisCore/modules.editors.gedcom/src/genj/edit/actions/TogglePrivate.java
 (original)
+++ 
trunk/AncestrisCore/modules.editors.gedcom/src/genj/edit/actions/TogglePrivate.java
 Mon Sep 30 01:05:29 2013
@@ -100,23 +100,18 @@
         // check if that's something we can do
         String pwd = gedcom.getPassword();
         if (Gedcom.PASSWORD_UNKNOWN.equals(pwd)) {
-            DialogHelper.openDialog(
-                    getText(),
-                    DialogHelper.WARNING_MESSAGE,
-                    "This Gedcom file contains encrypted information that has 
to be decrypted before changing private/public status of other information",
-                    AbstractAncestrisAction.okOnly(),
-                    event);
+            DialogManager.create(getText(), "This Gedcom file contains 
encrypted information that has to be decrypted before changing private/public 
status of other information")
+                    .setMessageType(DialogManager.WARNING_MESSAGE).show();
             return null;
         }
 
         // check gedcom
         if (pwd == null) {
 
-            pwd = DialogManager.getInstance().show(
+            pwd = DialogManager.create(
                     getText(),
-                    DialogManager.QUESTION_MESSAGE,
                     AbstractChange.resources.getString("password", 
gedcom.getName()),
-                    "");
+                    "").show();
 
             // canceled?
             if (pwd == null) {

Modified: trunk/AncestrisCore/modules.views.tree/src/genj/tree/TreeView.java
==============================================================================
--- trunk/AncestrisCore/modules.views.tree/src/genj/tree/TreeView.java  
(original)
+++ trunk/AncestrisCore/modules.views.tree/src/genj/tree/TreeView.java  Mon Sep 
30 01:05:29 2013
@@ -1360,8 +1360,9 @@
             }
 
             // Ask for name of bookmark
-            name = DialogManager.getInstance().show(
-                    TITLE, DialogManager.QUESTION_MESSAGE, 
RESOURCES.getString("bookmark.name"), name);
+            name = DialogManager.create(
+                    TITLE, RESOURCES.getString("bookmark.name"), name)
+                    .show();
 
             if (name == null) {
                 return;

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