[jsword-svn] r1856 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop bibledesktop/src/main/resources common-swing/src/main/java/org/crosswire/common/swing

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Mon May 12 04:53:54 MST 2008


Author: dmsmith
Date: 2008-05-12 04:53:53 -0700 (Mon, 12 May 2008)
New Revision: 1856

Modified:
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java
   trunk/bibledesktop/src/main/resources/config.properties
   trunk/bibledesktop/src/main/resources/config.xml
   trunk/bibledesktop/src/main/resources/config_de.properties
   trunk/bibledesktop/src/main/resources/config_fa.properties
   trunk/bibledesktop/src/main/resources/config_fa.txt
   trunk/bibledesktop/src/main/resources/config_vi.properties
   trunk/bibledesktop/src/main/resources/config_zh.properties
   trunk/bibledesktop/src/main/resources/config_zh_CN.properties
   trunk/common-swing/src/main/java/org/crosswire/common/swing/CWOptionPane.java
Log:
Fix an option pane bug.
Made view source an advanced hidden option

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java	2008-05-12 03:03:15 UTC (rev 1855)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java	2008-05-12 11:53:53 UTC (rev 1856)
@@ -505,9 +505,14 @@
         sidebarToggle = new JCheckBoxMenuItem(actions.getAction(DesktopActions.SIDEBAR_TOGGLE));
         sidebarToggle.setSelected(isSidebarShowing());
         menuView.add(sidebarToggle).addMouseListener(barStatus);
-        menuView.addSeparator();
-        menuView.add(actions.getAction(DesktopActions.VIEW_SOURCE)).addMouseListener(barStatus);
-        menuView.setToolTipText(null);
+
+        if (viewSourceShowing)
+        {
+            menuView.addSeparator();
+            menuView.add(actions.getAction(DesktopActions.VIEW_SOURCE)).addMouseListener(barStatus);
+            menuView.setToolTipText(null);
+        }
+
         return menuView;
     }
 
@@ -920,6 +925,22 @@
     }
 
     /**
+     * @param show Whether to show the view source in menu at start up.
+     */
+    public static void setViewSourceShowing(boolean show)
+    {
+        viewSourceShowing = show;
+    }
+
+    /**
+     * @return Whether to show the view source in menu at start up.
+     */
+    public static boolean isViewSourceShowing()
+    {
+        return viewSourceShowing;
+    }
+
+    /**
      * @param show Whether to show differences between versions of the Bible
      */
     public void setCompareShowing(boolean show)
@@ -1222,6 +1243,11 @@
     private static boolean sidebarShowing;
 
     /**
+     * Whether to show the view source in the menu at startup
+     */
+    private static boolean viewSourceShowing;
+
+    /**
      * Whether to show differences between versions of the Bible
      */
     private static boolean compareShowing;

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java	2008-05-12 03:03:15 UTC (rev 1855)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java	2008-05-12 11:53:53 UTC (rev 1856)
@@ -42,8 +42,8 @@
 import org.crosswire.common.swing.Actionable;
 import org.crosswire.common.swing.CWOptionPane;
 import org.crosswire.common.swing.desktop.ViewVisitor;
+import org.crosswire.common.util.CWProject;
 import org.crosswire.common.util.ClassUtil;
-import org.crosswire.common.util.CWProject;
 import org.crosswire.common.util.Logger;
 import org.crosswire.common.util.OSType;
 import org.crosswire.common.util.ReflectionUtil;

Modified: trunk/bibledesktop/src/main/resources/config.properties
===================================================================
--- trunk/bibledesktop/src/main/resources/config.properties	2008-05-12 03:03:15 UTC (rev 1855)
+++ trunk/bibledesktop/src/main/resources/config.properties	2008-05-12 11:53:53 UTC (rev 1856)
@@ -94,6 +94,10 @@
 Application.LookAndFeel.name=Look and Feel
 Application.LookAndFeel.help=The look and feel of the application.
 Advanced.name=Advanced
+Advanced.ViewSource
+Advanced.ViewSource.hidden=true
+Advanced.ViewSource.name=View Source
+Advanced.ViewSource.help=Show View Source in the View menu.
 Advanced.DetailShown.hidden=true
 Advanced.DetailShown.name=Show Stack Trace
 Advanced.DetailShown.help=Show the stack trace for reported exceptions.

Modified: trunk/bibledesktop/src/main/resources/config.xml
===================================================================
--- trunk/bibledesktop/src/main/resources/config.xml	2008-05-12 03:03:15 UTC (rev 1855)
+++ trunk/bibledesktop/src/main/resources/config.xml	2008-05-12 11:53:53 UTC (rev 1856)
@@ -122,7 +122,7 @@
     <map name="cswing-styles"/>
   </option>
 
-<!-- This really only useful for developers -->
+<!-- This is really only useful for developers -->
   <option key="BibleDisplay.CSSOverride" type="string">
     <introspect class="org.crosswire.bibledesktop.desktop.Desktop" property="CSSOverride"/>
   </option>
@@ -195,7 +195,7 @@
     <!-- Remove Book for now <alternative number="2"/> -->
   </option>
 
-<!-- This really only useful for developers -->
+<!-- This is really only useful for developers -->
   <option key="Application.LookAndFeel" type="class">
     <introspect class="org.crosswire.common.swing.LookAndFeelUtil" property="LookAndFeel"/>
   </option>
@@ -227,17 +227,22 @@
     <introspect class="org.crosswire.jsword.util.WebWarning" property="WarningShown"/>
   </option>
 
-<!-- This really only useful for developers -->
+<!-- This is really only useful for developers -->
+  <option key="Advanced.ViewSource" type="boolean">
+    <introspect class="org.crosswire.bibledesktop.desktop.Desktop" property="ViewSourceShowing"/>
+  </option>
+
+<!-- This is really only useful for developers -->
   <option key="Advanced.DetailShown" type="boolean">
     <introspect class="org.crosswire.common.swing.ExceptionPane" property="DetailShown"/>
   </option>
 
-<!-- This really only useful for developers -->
+<!-- This is really only useful for developers -->
   <option key="Advanced.SourcePath" type="path">
     <introspect class="org.crosswire.common.swing.ExceptionPane" property="SourcePath"/>
   </option>
 
-<!-- This really only useful for developers -->
+<!-- This is really only useful for developers -->
   <option key="Advanced.DefaultPassageType" type="int-options">
     <introspect class="org.crosswire.jsword.passage.PassageKeyFactory" property="DefaultPassage"/>
     <alternative number="0"/>
@@ -252,19 +257,19 @@
   </option>
 -->
 
-<!-- Limbo: This really only useful for developers
+<!-- Limbo: This is really only useful for developers
   <option key="Advanced.Reports.ShowErrorsInDialogBox" type="boolean">
     <introspect class="org.crosswire.common.swing.ExceptionPane" property="HelpDeskListener"/>
   </option>
 -->
 
-<!-- Limbo: This really only useful for developers
+<!-- Limbo: This is really only useful for developers
   <option key="Advanced.Reports.LogErrorsInLogWindow" type="boolean">
     <introspect class="org.crosswire.common.swing.ExceptionShelf" property="HelpDeskListener"/>
   </option>
 -->
 
-<!-- This really only useful for developers -->
+<!-- This is really only useful for developers -->
   <option key="Advanced.IncludeAdvancedTabs" type="boolean">
     <introspect class="org.crosswire.bibledesktop.desktop.AboutPane" property="Advanced"/>
   </option>

Modified: trunk/bibledesktop/src/main/resources/config_de.properties
===================================================================
--- trunk/bibledesktop/src/main/resources/config_de.properties	2008-05-12 03:03:15 UTC (rev 1855)
+++ trunk/bibledesktop/src/main/resources/config_de.properties	2008-05-12 11:53:53 UTC (rev 1856)
@@ -16,6 +16,9 @@
 Advanced.SourcePath.help=The directories to search for source code in when investigating an exception.
 Advanced.SourcePath.hidden=true
 Advanced.SourcePath.name=Source Path
+Advanced.ViewSource.hidden=true
+Advanced.ViewSource.name=View Source
+Advanced.ViewSource.help=Show View Source in the View menu.
 Advanced.name=Fortgeschritten
 Application.InitialLayout.alternative.0=Tabs
 Application.InitialLayout.alternative.1=Fenster (im Fenster)

Modified: trunk/bibledesktop/src/main/resources/config_fa.properties
===================================================================
--- trunk/bibledesktop/src/main/resources/config_fa.properties	2008-05-12 03:03:15 UTC (rev 1855)
+++ trunk/bibledesktop/src/main/resources/config_fa.properties	2008-05-12 11:53:53 UTC (rev 1856)
@@ -93,6 +93,9 @@
 #Application.LookAndFeel.name=Look and Feel
 #Application.LookAndFeel.help=The look and feel of the application.
 #Advanced.name=Advanced
+#Advanced.ViewSource.hidden=true
+#Advanced.ViewSource.name=View Source
+#Advanced.ViewSource.help=Show View Source in the View menu.
 #Advanced.DetailShown.hidden=true
 #Advanced.DetailShown.name=Show Stack Trace
 #Advanced.DetailShown.help=Show the stack trace for reported exceptions.

Modified: trunk/bibledesktop/src/main/resources/config_fa.txt
===================================================================
--- trunk/bibledesktop/src/main/resources/config_fa.txt	2008-05-12 03:03:15 UTC (rev 1855)
+++ trunk/bibledesktop/src/main/resources/config_fa.txt	2008-05-12 11:53:53 UTC (rev 1856)
@@ -93,6 +93,9 @@
 #Application.LookAndFeel.name=Look and Feel
 #Application.LookAndFeel.help=The look and feel of the application.
 #Advanced.name=Advanced
+#Advanced.ViewSource.hidden=true
+#Advanced.ViewSource.name=View Source
+#Advanced.ViewSource.help=Show View Source in the View menu.
 #Advanced.SourcePath.name=Source Path
 #Advanced.SourcePath.help=The directories to search for source code in when investigating an exception.
 #Advanced.DefaultPassageType.name=Default Passage Type

Modified: trunk/bibledesktop/src/main/resources/config_vi.properties
===================================================================
--- trunk/bibledesktop/src/main/resources/config_vi.properties	2008-05-12 03:03:15 UTC (rev 1855)
+++ trunk/bibledesktop/src/main/resources/config_vi.properties	2008-05-12 11:53:53 UTC (rev 1856)
@@ -167,6 +167,9 @@
 Application.LookAndFeel.name=Look and Feel
 Application.LookAndFeel.help=The look and feel of the application.
 Advanced.name=Advanced
+Advanced.ViewSource.hidden=true
+Advanced.ViewSource.name=View Source
+Advanced.ViewSource.help=Show View Source in the View menu.
 Advanced.DetailShown.hidden=true
 Advanced.DetailShown.name=Show Stack Trace
 Advanced.DetailShown.help=Show the stack trace for reported exceptions.

Modified: trunk/bibledesktop/src/main/resources/config_zh.properties
===================================================================
--- trunk/bibledesktop/src/main/resources/config_zh.properties	2008-05-12 03:03:15 UTC (rev 1855)
+++ trunk/bibledesktop/src/main/resources/config_zh.properties	2008-05-12 11:53:53 UTC (rev 1856)
@@ -16,6 +16,9 @@
 Advanced.SourcePath.help=The directories to search for source code in when investigating an exception.
 Advanced.SourcePath.hidden=true
 Advanced.SourcePath.name=Source Path
+Advanced.ViewSource.hidden=true
+Advanced.ViewSource.name=View Source
+Advanced.ViewSource.help=Show View Source in the View menu.
 Advanced.name=Advanced
 Application.InitialLayout.alternative.0=\u55AE\u4ECB\u9762\u6587\u4EF6
 Application.InitialLayout.alternative.1=\u591A\u4ECB\u9762\u6587\u4EF6

Modified: trunk/bibledesktop/src/main/resources/config_zh_CN.properties
===================================================================
--- trunk/bibledesktop/src/main/resources/config_zh_CN.properties	2008-05-12 03:03:15 UTC (rev 1855)
+++ trunk/bibledesktop/src/main/resources/config_zh_CN.properties	2008-05-12 11:53:53 UTC (rev 1856)
@@ -16,6 +16,9 @@
 Advanced.SourcePath.help=The directories to search for source code in when investigating an exception.
 Advanced.SourcePath.hidden=true
 Advanced.SourcePath.name=Source Path
+Advanced.ViewSource.hidden=true
+Advanced.ViewSource.name=View Source
+Advanced.ViewSource.help=Show View Source in the View menu.
 Advanced.name=Advanced
 Application.InitialLayout.alternative.0=\u5355\u4ECB\u9762\u6587\u4EF6
 Application.InitialLayout.alternative.1=\u591A\u4ECB\u9762\u6587\u4EF6

Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/CWOptionPane.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/CWOptionPane.java	2008-05-12 03:03:15 UTC (rev 1855)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/CWOptionPane.java	2008-05-12 11:53:53 UTC (rev 1856)
@@ -193,7 +193,7 @@
      */
     public CWOptionPane(Object message, int messageType, int optionType, Icon icon, Object[] options, Object initialValue)
     {
-        super(message, messageType, optionType, icon, CWOptionPane.fixOptions(options, optionType), initialValue);
+        super(message, messageType, optionType, icon, CWOptionPane.fixOptions(options, optionType, messageType), initialValue);
     }
 
     /**
@@ -366,8 +366,8 @@
      */
     public static void showMessageDialog(Component parentComponent, Object message) throws HeadlessException
     {
-        showMessageDialog(parentComponent, message, "?", INFORMATION_MESSAGE); //$NON-NLS-1$
-    }
+        showOptionDialog(parentComponent, message, "?", DEFAULT_OPTION, INFORMATION_MESSAGE, null, null, null); //$NON-NLS-1$
+   }
 
     /**
      * Brings up a dialog that displays a message using a default
@@ -392,7 +392,7 @@
      */
     public static void showMessageDialog(Component parentComponent, Object message, String title, int messageType) throws HeadlessException
     {
-        showMessageDialog(parentComponent, message, title, messageType, null);
+        showOptionDialog(parentComponent, message, title, DEFAULT_OPTION, messageType, null, null, null);
     }
 
     /**
@@ -442,7 +442,7 @@
      */
     public static int showConfirmDialog(Component parentComponent, Object message) throws HeadlessException
     {
-        return showConfirmDialog(parentComponent, message, "?", YES_NO_CANCEL_OPTION); //$NON-NLS-1$
+        return showOptionDialog(parentComponent, message, "?", YES_NO_CANCEL_OPTION, QUESTION_MESSAGE, null, null, null); //$NON-NLS-1$
     }
 
     /**
@@ -467,7 +467,7 @@
      */
     public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType) throws HeadlessException
     {
-        return showConfirmDialog(parentComponent, message, title, optionType, QUESTION_MESSAGE);
+        return showOptionDialog(parentComponent, message, title, optionType, QUESTION_MESSAGE, null, null, null);
     }
 
     /**
@@ -503,7 +503,7 @@
      */
     public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType) throws HeadlessException
     {
-        return showConfirmDialog(parentComponent, message, title, optionType, messageType, null);
+        return showOptionDialog(parentComponent, message, title, optionType, messageType, null, null, null);
     }
 
     /**
@@ -760,33 +760,43 @@
         return actions.getAction(key).getValue(Action.NAME).toString();
     }
 
-    private static Object[] fixOptions(Object[] options, int optionType)
+    private static Object[] fixOptions(Object[] options, int optionType, int messageType)
     {
         Object[] opts = options;
         if (options == null)
         {
-            switch (optionType)
+            if (optionType == YES_NO_OPTION)
             {
-                case YES_NO_OPTION:
-                    opts = new Object[]
-                    {
-                                    getActionName("Yes"), //$NON-NLS-1$
-                                    getActionName("No")}; //$NON-NLS-1$
-                    break;
-                case OK_CANCEL_OPTION:
-                    opts = new Object[]
-                    {
-                                    getActionName("OK"), //$NON-NLS-1$
-                                    getActionName("Cancel")}; //$NON-NLS-1$
-                    break;
-                default:
-                    opts = new Object[]
-                    {
-                                    getActionName("Yes"), //$NON-NLS-1$
-                                    getActionName("No"), //$NON-NLS-1$
-                                    getActionName("Cancel")}; //$NON-NLS-1$
-                    break;
+                opts = new Object[]
+                {
+                                getActionName("Yes"), //$NON-NLS-1$
+                                getActionName("No") //$NON-NLS-1$
+                };
             }
+            else if (optionType == OK_CANCEL_OPTION)
+            {
+                opts = new Object[]
+                {
+                                getActionName("OK"), //$NON-NLS-1$
+                                getActionName("Cancel") //$NON-NLS-1$
+                };
+            }
+            else if (optionType == YES_NO_CANCEL_OPTION && messageType != INFORMATION_MESSAGE)
+            {
+                opts = new Object[]
+                {
+                                getActionName("Yes"), //$NON-NLS-1$
+                                getActionName("No"), //$NON-NLS-1$
+                                getActionName("Cancel") //$NON-NLS-1$
+                };
+            }
+            else
+            {
+                opts = new Object[]
+                {
+                                getActionName("OK"), //$NON-NLS-1$
+                };
+            }
         }
         return opts;
     }




More information about the jsword-svn mailing list