[Title] bar graph fix, DA folder change
authorjy.exe.lee <jy.exe.lee@samsung.com>
Fri, 13 Jul 2012 04:37:08 +0000 (13:37 +0900)
committerjy.exe.lee <jy.exe.lee@samsung.com>
Fri, 13 Jul 2012 04:37:08 +0000 (13:37 +0900)
[Type] bug fix
[Module] Dynamic Analyzer
[Priority] major
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

37 files changed:
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/graph/bar/FourBarGraph.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/graph/bar/SingleBar.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/Formatter.java
org.tizen.dynamicanalyzer.widgets/src/test/TestClass.java
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/config/config [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/config/config with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/config/license [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/config/license with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/config/system_panel_battery_table_U1 [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/config/system_panel_battery_table_U1 with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/config/system_panel_battery_table_default [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/config/system_panel_battery_table_default with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/target/arm/da_event [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/target/arm/da_event with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/target/arm/da_manager [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/target/arm/da_manager with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/target/arm/da_probe_osp.so [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/target/arm/da_probe_osp.so with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/target/arm/da_probe_tizen.so [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/target/arm/da_probe_tizen.so with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/target/arm/readelf [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/target/arm/readelf with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/target/x86/da_event [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/target/x86/da_event with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/target/x86/da_manager [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/target/x86/da_manager with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/target/x86/da_probe_osp.so [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/target/x86/da_probe_osp.so with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/target/x86/da_probe_tizen.so [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/target/x86/da_probe_tizen.so with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/target/x86/readelf [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/target/x86/readelf with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/tool/WindowActivator [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/tool/WindowActivator with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/tool/WindowActivator.exe [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/tool/WindowActivator.exe with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/tool/windowactivator.bat [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/tool/windowactivator.bat with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/tool/windowactivator.sh [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/tool/windowactivator.sh with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/tool/windowactivator.vbs [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/tool/windowactivator.vbs with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/version [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/version with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/xml/CheckList.leak [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/xml/CheckList.leak with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/xml/image.logc [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/xml/image.logc with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/xml/lifecycle.logc [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/xml/lifecycle.logc with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/xml/memory.logc [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/xml/memory.logc with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/xml/resource.logc [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/xml/resource.logc with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/xml/system.logc [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/xml/system.logc with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/xml/ui_event.logc [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/xml/ui_event.logc with 100% similarity]
org.tizen.dynamicanalyzer.workbench/dynamic_analyzer/xml/user_function.logc [moved from org.tizen.dynamicanalyzer.workbench/DynamicAnalyzer/xml/user_function.logc with 100% similarity]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/constants/AnalyzerConstants.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/theme/DAThemeBlack.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/theme/DAThemeWhite.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/views/SnapshotView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/Formatter.java

index f4c9cd7..ac6fadc 100644 (file)
@@ -16,12 +16,19 @@ import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
+import org.tizen.dynamicanalyzer.widgets.helper.Formatter;
 
 public class FourBarGraph extends Composite {
+       public static int TYPE_BYTE = 1;
+       public static int TYPE_PERCENT = 0;
+
+       private String measure = Formatter.toByteFormatMeasure(0);
+       private String labelText = "";
 
        private final int INNER_MARGIN = 3;
        private final int LABEL_MARGIN = 15;
        private int graphCount = 4;
+       private int graphType = TYPE_PERCENT;
        private List<SingleBar> graphs;
        private Label label;
        private Font labelFont;
@@ -29,18 +36,19 @@ public class FourBarGraph extends Composite {
        private FourBarGraph me;
        private Color bgColor = ColorResources.BLACK;
 
-       public FourBarGraph(Composite parent, int style) {
+       public FourBarGraph(Composite parent, int style, int type) {
                super(parent, style);
+               graphType = type;
                me = this;
                graphs = new ArrayList<SingleBar>();
                labelFont = new Font(getDisplay(), new FontData[] { new FontData(
-                               "Arial", 10, SWT.NORMAL) });
+                               "Arial", 8, SWT.NORMAL) });
                this.setLayout(new FormLayout());
                this.setBackground(bgColor);
                this.addControlListener(controlListener);
 
                for (int i = 0; i < graphCount; i++) {
-                       SingleBar bar = new SingleBar(me, SWT.NONE);
+                       SingleBar bar = new SingleBar(me, SWT.NONE, graphType);
                        FormData data = new FormData();
                        data.top = new FormAttachment(0, 0);
                        if (i == 0) {
@@ -92,13 +100,26 @@ public class FourBarGraph extends Composite {
 
        public void setCurrentValue(List<Long> currentValues) {
                for (int i = 0; i < currentValues.size() && i < graphCount; i++) {
+                       if (graphType == TYPE_BYTE) {
+                               long value = currentValues.get(i);
+                               measure = Formatter.toByteFormatMeasure(value);
+                               System.out.println(value + "  " + measure);
+                               setText(labelText);
+                       }
                        graphs.get(i).setCurrentSize(currentValues.get(i));
                        graphs.get(i).redraw();
                }
        }
 
        public void setText(String text) {
+               labelText = text;
                label.setForeground(fontColor);
+               if (graphType == TYPE_BYTE) {
+                       text += " (" + measure + ")";
+               } else {
+                       text += " (%)";
+               }
+
                label.setText(text);
        }
 
@@ -142,7 +163,6 @@ public class FourBarGraph extends Composite {
                                graphs.add(bar);
                        }
 
-                       // label = new Label(me, SWT.TRANSPARENT);
                        FormData data = new FormData();
                        data.top = new FormAttachment(graphs.get(0), 0);
                        data.height = 15;
index 01d0bd2..a848ce4 100644 (file)
@@ -10,13 +10,19 @@ import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.widgets.Canvas;
 import org.eclipse.swt.widgets.Composite;
 import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
+import org.tizen.dynamicanalyzer.widgets.helper.Formatter;
 
 public class SingleBar extends Canvas {
 
+       public static int TYPE_PERCENT = 0;
+       public static int TYPE_BYTE = 1;
+
        private final int TOP_MARGIN = 5;
        private final int BOTTOM_MARGIN = 4;
        private final int BOTTOM_FULL_MARGIN = 15;
 
+       private int graphType = TYPE_PERCENT;
+
        private long maxSize;
        private long currentSize;
        private Color graphColor;
@@ -38,6 +44,11 @@ public class SingleBar extends Canvas {
                                SWT.NORMAL) });
        }
 
+       public SingleBar(Composite parent, int style, int type) {
+               this(parent, style);
+               graphType = type;
+       }
+
        private PaintListener barPaintListener = new PaintListener() {
 
                @Override
@@ -77,7 +88,14 @@ public class SingleBar extends Canvas {
                        int textY = endY + BOTTOM_MARGIN;
                        e.gc.setForeground(fontColor);
                        e.gc.setFont(font);
-                       e.gc.drawText(Long.toString(currentSize), rect.x + 1, textY);
+                       String value = null;
+                       if (graphType == TYPE_BYTE) {
+                               value = Formatter.toByteFormatValue(currentSize);
+                               System.out.println(value);
+                       } else {
+                               value = Long.toString(currentSize);
+                       }
+                       e.gc.drawText(value, rect.x + 1, textY);
                }
        };
 
index a83781a..90e4f23 100644 (file)
@@ -250,4 +250,53 @@ public class Formatter {
                        return "Byte"; //$NON-NLS-1$
                }
        }
+
+       // only return value
+       public static String toByteFormatValue(long input) {
+               int reminder = 0;
+               long quotient = input;
+               int count = 0;
+               String value = ""; //$NON-NLS-1$
+
+               while (true) {
+                       if (quotient >= 1024) {
+                               reminder = (int) (quotient % 1024);
+                               quotient = quotient / 1024;
+                               count++;
+                               continue;
+                       } else {
+                               value = Long.toString(quotient);
+                               String remStr = Integer.toString(reminder);
+                               if (count > 0) {
+                                       if (remStr.length() < 3) {
+                                               value += ".0"; //$NON-NLS-1$
+                                       } else {
+                                               value += "." + remStr.substring(0, 1); //$NON-NLS-1$
+                                       }
+                               }
+                               //                              value += " " + getMeasure(count); //$NON-NLS-1$
+                               break;
+                       }
+               }
+               return value;
+       }
+
+       // only return measure
+       public static String toByteFormatMeasure(long input) {
+               long quotient = input;
+               int count = 0;
+               String value = null;
+
+               while (true) {
+                       if (quotient >= 1024) {
+                               quotient = quotient / 1024;
+                               count++;
+                               continue;
+                       } else {
+                               value = getMeasure(count); //$NON-NLS-1$
+                               break;
+                       }
+               }
+               return value;
+       }
 }
index 918dcab..ebe9725 100644 (file)
@@ -115,7 +115,7 @@ public class TestClass {
                bar.setMaxSize(100);
                bar.setCurrentSize(45);
 
-               FourBarGraph fbar = new FourBarGraph(shell, SWT.NONE);
+               FourBarGraph fbar = new FourBarGraph(shell, SWT.NONE, FourBarGraph.TYPE_PERCENT);
                data = new FormData();
                data.top = new FormAttachment(bar, 10);
                data.left = new FormAttachment(10, 0);
index 41ff455..3936bc0 100644 (file)
@@ -40,7 +40,7 @@ public class AnalyzerConstants {
        public static final String PERCENT = "%"; //$NON-NLS-1$\r
 \r
        /* paths */\r
-       public static final String DYNAMICANALYZER_FOLDER_NAME = "DynamicAnalyzer"; //$NON-NLS-1$\r
+       public static final String DYNAMICANALYZER_FOLDER_NAME = "dynamic_analyzer"; //$NON-NLS-1$\r
        public static final String DYNAMICANALYZER_DIR_PATH = AnalyzerManager\r
                        .getDefaultDynamicAnalyzerRoot();\r
        public static final String SAVE_FOLDER_NAME = "save"; //$NON-NLS-1$\r
index 6f25564..fcd0389 100644 (file)
@@ -28,23 +28,14 @@ public class DAThemeBlack extends DATheme {
 
                /** device and application combo specific colors start **/
                setColor("device_application_enable_font", new RGB(255, 255, 255)); //$NON-NLS-1$
-
                setColor("device_application_disable_font", new RGB(128, 128, 128)); //$NON-NLS-1$
-
                setColor("device_application_popup_outer_1", new RGB(31, 31, 31)); //$NON-NLS-1$
-
                setColor("device_application_popup_outer_2", new RGB(31, 137, 163)); //$NON-NLS-1$
-
                setColor("device_application_item_normal_top", new RGB(76, 76, 77)); //$NON-NLS-1$
-
                setColor("device_application_item_normal_inner", new RGB(66, 66, 67)); //$NON-NLS-1$
-
                setColor("device_application_item_normal_bottom", new RGB(56, 56, 60)); //$NON-NLS-1$
-
                setColor("device_application_item_select_top", new RGB(76, 76, 77)); //$NON-NLS-1$
-
                setColor("device_application_item_select_inner", new RGB(0, 151, 201)); //$NON-NLS-1$
-
                setColor("device_application_item_select_bottom", new RGB(56, 56, 60)); //$NON-NLS-1$
 
                /** device and application combo specific colors end **/
@@ -58,16 +49,12 @@ public class DAThemeBlack extends DATheme {
                setColor("device_application_button_hover_end", new RGB(0, 151, 201)); //$NON-NLS-1$
                setColor("device_application_button_disable_start", new RGB(51, 52, 53)); //$NON-NLS-1$
                setColor("device_application_button_disable_end", new RGB(0, 0, 0)); //$NON-NLS-1$
-
                setColor("device_application_button_outline", new RGB(0, 0, 0));
+               
                /** normal view layout colors start **/
-
                setColor("normal_view_layout_outer", new RGB(160, 160, 160)); //$NON-NLS-1$
-
                setColor("normal_view_layout_middle", new RGB(74, 74, 74)); //$NON-NLS-1$
-
                setColor("normal_view_layout_inner", new RGB(66, 66, 68)); //$NON-NLS-1$
-
                /** normal view layout colors end **/
 
                /** current view colors start **/
@@ -82,9 +69,7 @@ public class DAThemeBlack extends DATheme {
                setColor("current_view_cpu_text", new RGB(2, 171, 208)); //$NON-NLS-1$
                setColor("current_view_process_text", new RGB(114, 203, 8)); //$NON-NLS-1$
                setColor("current_view_graph_bg", new RGB(79, 79, 81)); //$NON-NLS-1$
-
                setColor("current_view_graph_outline", new RGB(43, 44, 45)); //$NON-NLS-1$
-
                setColor("current_view_snapshot_outline", new RGB(49, 104, 127)); //$NON-NLS-1$
                /** current view colors end **/
 
@@ -120,7 +105,7 @@ public class DAThemeBlack extends DATheme {
                setColor("tab_hover_color", new RGB(63, 72, 78));
                setColor("tab_push_color", new RGB(36, 41, 45));
                setColor("tab_outline_color", new RGB(104, 104, 104));
-               
+
                setColor("tab_normal_font_color", new RGB(140, 140, 140));
                setColor("tab_other_font_color", new RGB(255, 255, 255));
 
@@ -185,11 +170,11 @@ public class DAThemeBlack extends DATheme {
                setColor("defaultBackground", new RGB(255, 255, 255)); //$NON-NLS-1$
                setColor("defaultRed", new RGB(173, 13, 1)); //$NON-NLS-1$
 
-               // circular graph
+               // bar graph
                setColor("cpu_bar_graph_color", new RGB(2, 171, 208)); //$NON-NLS-1$
                setColor("cpu_bar_graph_gray_color", new RGB(79, 79, 81));
                setColor("cpu_bar_graph_bg_color", new RGB(43, 44, 45));
-               
+
                setColor("process_bar_graph_color", new RGB(114, 203, 8)); //$NON-NLS-1$
                setColor("process_bar_graph_gray_color", new RGB(79, 79, 81)); //$NON-NLS-1$
                setColor("process_bar_graph_bg_color", new RGB(43, 44, 45)); //$NON-NLS-1$
index 1723ecb..e13deb4 100644 (file)
@@ -20,6 +20,7 @@ public class DAThemeWhite extends DATheme {
                // shell window background color
                setColor("window_bg_color", new RGB(255, 255, 255)); //$NON-NLS-1$
                setColor("coolbar_bg_color", new RGB(255, 255, 255)); //$NON-NLS-1$
+
                /** title bar colors **/
                setColor("titlebar_text_color", new RGB(64, 208, 255)); //$NON-NLS-1$
 
@@ -27,32 +28,20 @@ public class DAThemeWhite extends DATheme {
 
                /** device and application combo specific colors start **/
                setColor("device_application_enable_font", new RGB(0, 0, 0)); //$NON-NLS-1$
-
                setColor("device_application_disable_font", new RGB(160, 160, 160)); //$NON-NLS-1$
-
                setColor("device_application_popup_outer_1", new RGB(120, 120, 120)); //$NON-NLS-1$
-
                setColor("device_application_popup_outer_2", new RGB(50, 185, 231)); //$NON-NLS-1$
-
                setColor("device_application_item_normal_top", new RGB(255, 255, 255)); //$NON-NLS-1$
-
                setColor("device_application_item_normal_inner", new RGB(230, 230, 230)); //$NON-NLS-1$
-
-               setColor(
-                               "device_application_item_normal_bottom", new RGB(189, 189, 189)); //$NON-NLS-1$
-
+               setColor("device_application_item_normal_bottom", new RGB(189, 189, 189)); //$NON-NLS-1$
                setColor("device_application_item_select_top", new RGB(255, 255, 255)); //$NON-NLS-1$
-
                setColor("device_application_item_select_inner", new RGB(50, 185, 231)); //$NON-NLS-1$
-
-               setColor(
-                               "device_application_item_select_bottom", new RGB(189, 189, 189)); //$NON-NLS-1$
+               setColor("device_application_item_select_bottom", new RGB(189, 189, 189)); //$NON-NLS-1$
 
                /** device and application combo specific colors end **/
 
                /*** combo button gradation ***/
-               setColor(
-                               "device_application_button_normal_start", new RGB(221, 221, 221)); //$NON-NLS-1$
+               setColor("device_application_button_normal_start", new RGB(221, 221, 221)); //$NON-NLS-1$
                setColor("device_application_button_normal_end", new RGB(157, 157, 157)); //$NON-NLS-1$
                setColor("device_application_button_push_start", new RGB(24, 147, 189)); //$NON-NLS-1$
                setColor("device_application_button_push_end", new RGB(24, 147, 189)); //$NON-NLS-1$
@@ -60,17 +49,12 @@ public class DAThemeWhite extends DATheme {
                setColor("device_application_button_hover_end", new RGB(50, 185, 231)); //$NON-NLS-1$
                setColor("device_application_button_disable_start", new RGB(78, 79, 81)); //$NON-NLS-1$
                setColor("device_application_button_disable_end", new RGB(78, 79, 81)); //$NON-NLS-1$
-
                setColor("device_application_button_outline", new RGB(31, 31, 31));
 
                /** normal view layout colors start **/
-
                setColor("normal_view_layout_outer", new RGB(160, 160, 160)); //$NON-NLS-1$
-
                setColor("normal_view_layout_middle", new RGB(74, 74, 74)); //$NON-NLS-1$
-
                setColor("normal_view_layout_inner", new RGB(66, 66, 68)); //$NON-NLS-1$
-
                /** normal view layout colors end **/
 
                /** current view colors start **/
@@ -85,9 +69,7 @@ public class DAThemeWhite extends DATheme {
                setColor("current_view_cpu_text", new RGB(2, 171, 208)); //$NON-NLS-1$
                setColor("current_view_process_text", new RGB(114, 203, 8)); //$NON-NLS-1$
                setColor("current_view_graph_bg", new RGB(79, 79, 81)); //$NON-NLS-1$
-
                setColor("current_view_graph_outline", new RGB(43, 44, 45)); //$NON-NLS-1$
-
                setColor("current_view_snapshot_outline", new RGB(49, 104, 127)); //$NON-NLS-1$
                /** current view colors end **/
 
@@ -188,9 +170,14 @@ public class DAThemeWhite extends DATheme {
                setColor("defaultBackground", new RGB(255, 255, 255)); //$NON-NLS-1$
                setColor("defaultRed", new RGB(173, 13, 1)); //$NON-NLS-1$
 
-               // circular graph
-               setColor("cpu_circular_graph_color", new RGB(2, 171, 208)); //$NON-NLS-1$
-               setColor("process_circular_graph_color", new RGB(114, 203, 8)); //$NON-NLS-1$
+               // bar graph
+               setColor("cpu_bar_graph_color", new RGB(2, 171, 208)); //$NON-NLS-1$
+               setColor("cpu_bar_graph_gray_color", new RGB(79, 79, 81));
+               setColor("cpu_bar_graph_bg_color", new RGB(43, 44, 45));
+
+               setColor("process_bar_graph_color", new RGB(114, 203, 8)); //$NON-NLS-1$
+               setColor("process_bar_graph_gray_color", new RGB(79, 79, 81)); //$NON-NLS-1$
+               setColor("process_bar_graph_bg_color", new RGB(43, 44, 45)); //$NON-NLS-1$
 
                setColor("profiling_graph_color_start", new RGB(145, 190, 3)); //$NON-NLS-1$
                setColor("profiling_graph_color_end", new RGB(114, 149, 1)); //$NON-NLS-1$
@@ -215,23 +202,4 @@ public class DAThemeWhite extends DATheme {
                return colorRegistry.get(colorName);
        }
 
-       // @Override
-       // public String getThemePath() {
-       // // TODO Auto-generated method stub
-       // // return THEME_PATH;
-       // return "theme" + File.separator + name + File.separator;
-       // }
-       //
-       // @Override
-       // public String getImagePath() {
-       // // TODO Auto-generated method stub
-       // return IMAGE_PATH;
-       // }
-       //
-       // @Override
-       // public String getIconPath() {
-       // // TODO Auto-generated method stub
-       // return ICON_PATH;
-       // }
-
 }
index 46bdd68..13d5c8c 100644 (file)
@@ -211,7 +211,7 @@ public class SnapshotView extends DAView {
                // cpu graph
                // cpuGrp = new CircularGraph(graphComp, SWT.NONE,
                // CircularGraph.TYPE_PERCENT);
-               cpuGrp = new FourBarGraph(graphComp, SWT.NONE);
+               cpuGrp = new FourBarGraph(graphComp, SWT.NONE, FourBarGraph.TYPE_PERCENT);
                data = new FormData();
                data.top = new FormAttachment(0, 0);
                data.left = new FormAttachment(0, 0);
@@ -232,9 +232,9 @@ public class SnapshotView extends DAView {
                // process graph
                // processGraph = new CircularGraph(graphComp, SWT.NONE,
                // CircularGraph.TYPE_CUSTOM);
-               processGraph = new FourBarGraph(graphComp, SWT.NONE);
+               processGraph = new FourBarGraph(graphComp, SWT.NONE, FourBarGraph.TYPE_BYTE);
                data = new FormData();
-               data.top = new FormAttachment(cpuGrp, 15);
+               data.top = new FormAttachment(cpuGrp, 5);
                data.left = new FormAttachment(0, 0);
                data.right = new FormAttachment(100, 0);
                // data.bottom = new FormAttachment(100, 0);
@@ -288,9 +288,11 @@ public class SnapshotView extends DAView {
        private void computeData() {
 
                if (startTime % 1000000 != 0)
-                       startTime += 1000000;
-               String query = "select * from system where time = (select max(time) from system where time < " //$NON-NLS-1$
+                       startTime += 500000;
+               String query = "select * from system where time = (select max(time) from system where time <= " //$NON-NLS-1$
                                + startTime + ");"; //$NON-NLS-1$
+               // FIXME : debug log
+               System.out.println(startTime);
                List<String> input = SqlManager
                                .executeSelectQuery(query, AnalyzerManager
                                                .getLogCenterById(LogCenterConstants.LOG_DEVICE));
index 15b0f01..b1cfe3f 100644 (file)
@@ -39,39 +39,6 @@ public class Formatter {
                }
        }
 
-       public static String toByteNumberFormat(String value) {
-               if (null == value || value.isEmpty()) {
-                       return null;
-               }
-
-               try {
-                       long num = Long.parseLong(value);
-                       String str = ""; //$NON-NLS-1$
-                       while (num > 0) {
-                               long n = num % 1000;
-                               if (str.isEmpty()) {
-                                       str += Long.toString(n);
-                               } else {
-                                       String zero = ""; //$NON-NLS-1$
-                                       if (str.length() == 1) {
-                                               zero += "00"; //$NON-NLS-1$
-                                       } else if (str.length() == 2) {
-                                               zero += "0"; //$NON-NLS-1$
-                                       }
-                                       str = zero + Long.toString(n) + "," + str; //$NON-NLS-1$
-                               }
-                               num /= 1000;
-                       }
-                       if (str.isEmpty()) {
-                               str += "0"; //$NON-NLS-1$
-                       }
-                       return str;
-               } catch (Exception e) {
-                       e.printStackTrace();
-                       return "0"; //$NON-NLS-1$
-               }
-       }
-
        public static String toByteToMbNumberFormat2(String value) {
                if (null == value || value.isEmpty()) {
                        return null;
@@ -166,6 +133,7 @@ public class Formatter {
                return ret;
        }
 
+       // 1000 to 1,000
        public static String toNumberFormat(long input) {
                int reminder = 0;
                long quotient = input;
@@ -190,9 +158,9 @@ public class Formatter {
                }
                return output;
        }
-       
-       public static String toNumberFormat(double input){
-               return toNumberFormat((long)input);
+
+       public static String toNumberFormat(double input) {
+               return toNumberFormat((long) input);
        }
 
        public static String toByteFormat(long input) {
@@ -223,10 +191,11 @@ public class Formatter {
                }
                return value;
        }
+
        public static String toByteFormat(double input) {
-               return toByteFormat((long)input);
+               return toByteFormat((long) input);
        }
-       
+
        public static String toHzFormat(long input) {
                int reminder = 0;
                long quotient = input;
@@ -255,25 +224,26 @@ public class Formatter {
                }
                return value;
        }
+
        public static String toHzFormat(double input) {
-               return toHzFormat((long)input);
+               return toHzFormat((long) input);
        }
-       
-       public static String toBpsFormat(long nByte, long startTime, long endTime){
+
+       public static String toBpsFormat(long nByte, long startTime, long endTime) {
                String value = ""; //$NON-NLS-1$
                DecimalFormat df1 = new DecimalFormat("#,##0.00"); //$NON-NLS-1$
                double Bps = nByte;
 
-               if(endTime - startTime >= 1000000){
-                       Bps = ((double)nByte * ((double)1000000 / (double)(endTime - startTime)));
+               if (endTime - startTime >= 1000000) {
+                       Bps = ((double) nByte * ((double) 1000000 / (double) (endTime - startTime)));
                }
-               
+
                value += df1.format(Bps) + " Bps"; //$NON-NLS-1$
                return value;
        }
-       
-       public static String toBpsFormat(double nByte, long startTime, long endTime){
-               return toBpsFormat((long)nByte, startTime, endTime);
+
+       public static String toBpsFormat(double nByte, long startTime, long endTime) {
+               return toBpsFormat((long) nByte, startTime, endTime);
        }
 
        private static String getMeasure(int count) {
@@ -289,7 +259,7 @@ public class Formatter {
                        return "Byte"; //$NON-NLS-1$
                }
        }
-       
+
        private static String getHzMeasure(int count) {
                if (count == 4) {
                        return "THz"; //$NON-NLS-1$
@@ -303,4 +273,53 @@ public class Formatter {
                        return "Hz"; //$NON-NLS-1$
                }
        }
+
+       // only return value
+       public static String toByteFormatValue(long input) {
+               int reminder = 0;
+               long quotient = input;
+               int count = 0;
+               String value = ""; //$NON-NLS-1$
+
+               while (true) {
+                       if (quotient >= 1024) {
+                               reminder = (int) (quotient % 1024);
+                               quotient = quotient / 1024;
+                               count++;
+                               continue;
+                       } else {
+                               value = Long.toString(quotient);
+                               String remStr = Integer.toString(reminder);
+                               if (count > 0) {
+                                       if (remStr.length() < 3) {
+                                               value += ".0"; //$NON-NLS-1$
+                                       } else {
+                                               value += "." + remStr.substring(0, 1); //$NON-NLS-1$
+                                       }
+                               }
+                               //                              value += " " + getMeasure(count); //$NON-NLS-1$
+                               break;
+                       }
+               }
+               return value;
+       }
+
+       // only return measure
+       public static String toByteFormatMeasure(long input) {
+               long quotient = input;
+               int count = 0;
+               String value = null;
+
+               while (true) {
+                       if (quotient >= 1024) {
+                               quotient = quotient / 1024;
+                               count++;
+                               continue;
+                       } else {
+                               value = getMeasure(count); //$NON-NLS-1$
+                               break;
+                       }
+               }
+               return value;
+       }
 }