Author: lemovice
Date: Thu Sep 12 21:33:24 2013
New Revision: 4544

Log:
Update percentage computation method

Modified:
   
trunk/Tools/trancestris/Explorers/src/org/ancestris/trancestris/explorers/zipexplorer/ZipDirectoryNode.java
   
trunk/Tools/trancestris/Explorers/src/org/ancestris/trancestris/explorers/zipexplorer/ZipExplorerTopComponent.java

Modified: 
trunk/Tools/trancestris/Explorers/src/org/ancestris/trancestris/explorers/zipexplorer/ZipDirectoryNode.java
==============================================================================
--- 
trunk/Tools/trancestris/Explorers/src/org/ancestris/trancestris/explorers/zipexplorer/ZipDirectoryNode.java
 (original)
+++ 
trunk/Tools/trancestris/Explorers/src/org/ancestris/trancestris/explorers/zipexplorer/ZipDirectoryNode.java
 Thu Sep 12 21:33:24 2013
@@ -27,18 +27,10 @@
     @Override
     public String getHtmlDisplayName() {
         if (directory.isTranslated() == false) {
-            if (directory.getResourceFile() != null) {
-                return "<font color='#FF0000'>" + directory.getName() + " (" + 
directory.getResourceFile().getTranslatedPercent() + " %) </font>";
-            } else {
-                return "<font color='#FF0000'>" + directory.getName() + 
"</font>";
+                return "<font color='#FF0000'>" + directory.getName() + " (" + 
(int)(((float) (directory.getTranslatedLineCount()) / (float) 
directory.getLineCount()) * 100) + " %) </font>";
 
-            }
         } else {
-            if (directory.getResourceFile() != null) {
-                return "<font color='#0000FF'>" + directory.getName() + " (" + 
directory.getResourceFile().getTranslatedPercent() + " %) </font>";
-            } else {
-                return "<font color='#0000FF'>" + directory.getName() + 
"</font>";
-            }
+           return "<font color='#0000FF'>" + directory.getName() + " (" + 
(int)(((float) (directory.getTranslatedLineCount()) / (float) 
directory.getLineCount()) * 100) + " %) </font>";
         }
     }
 

Modified: 
trunk/Tools/trancestris/Explorers/src/org/ancestris/trancestris/explorers/zipexplorer/ZipExplorerTopComponent.java
==============================================================================
--- 
trunk/Tools/trancestris/Explorers/src/org/ancestris/trancestris/explorers/zipexplorer/ZipExplorerTopComponent.java
  (original)
+++ 
trunk/Tools/trancestris/Explorers/src/org/ancestris/trancestris/explorers/zipexplorer/ZipExplorerTopComponent.java
  Thu Sep 12 21:33:24 2013
@@ -39,7 +39,9 @@
 
     private static final Logger logger = 
Logger.getLogger(ZipExplorerTopComponent.class.getName());
     private static ZipExplorerTopComponent instance;
-    /** path to the icon used by the component and its open action */
+    /**
+     * path to the icon used by the component and its open action
+     */
     static final String ICON_PATH = 
"org/ancestris/trancestris/explorers/zipexplorer/actions/zip-icon.png";
     private static final String PREFERRED_ID = "ZipExplorerTopComponent";
     private ExplorerManager zipExplorerManager = null;
@@ -86,10 +88,10 @@
         }
     }
 
-    /** 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.
+    /**
+     * 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.
      */
     // <editor-fold defaultstate="collapsed" desc="Generated 
Code">//GEN-BEGIN:initComponents
     private void initComponents() {
@@ -149,9 +151,9 @@
     // End of variables declaration//GEN-END:variables
 
     /**
-     * Gets default instance. Do not use directly: reserved for *.settings 
files only,
-     * i.e. deserialization routines; otherwise you could get a 
non-deserialized instance.
-     * To obtain the singleton instance, use {@link #findInstance}.
+     * Gets default instance. Do not use directly: reserved for *.settings 
files
+     * only, i.e. deserialization routines; otherwise you could get a
+     * non-deserialized instance. To obtain the singleton instance, use {@link 
#findInstance}.
      */
     public static synchronized ZipExplorerTopComponent getDefault() {
         if (instance == null) {
@@ -161,7 +163,8 @@
     }
 
     /**
-     * Obtain the ZipExplorerTopComponent instance. Never call {@link 
#getDefault} directly!
+     * Obtain the ZipExplorerTopComponent instance. Never call {@link 
#getDefault}
+     * directly!
      */
     public static synchronized ZipExplorerTopComponent findInstance() {
         TopComponent win = 
WindowManager.getDefault().findTopComponent(PREFERRED_ID);
@@ -228,7 +231,7 @@
 
         zipArchive = new ZipArchive(zipFile, fromLocale, toLocale);
         Frame mainWindow = WindowManager.getDefault().getMainWindow();
-        mainWindow.setTitle(NbBundle.getMessage(ZipExplorerTopComponent.class, 
"CTL_MainWindow_Title", fromLocale.getDisplayLanguage(), 
toLocale.getDisplayLanguage(), zipArchive.getTranslatePercent()));
+        mainWindow.setTitle(NbBundle.getMessage(ZipExplorerTopComponent.class, 
"CTL_MainWindow_Title", fromLocale.getDisplayLanguage(), 
toLocale.getDisplayLanguage(), (int) (((float) 
(zipArchive.getTranslatedLineCount()) / (float) zipArchive.getLineCount()) * 
100)));
         
editorSearchPanel.setFromLocaleToggleButtonText(fromLocale.getDisplayLanguage());
         
editorSearchPanel.setToLocaleToggleButtonText(toLocale.getDisplayLanguage());
         newZipRootNode = new ZipRootNode(zipArchive);

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