upload tizen2.0 alpha installmanager source
[sdk/installer/install-manager.git] / InstallManager_java / src / org / tizen / installmanager / ui / dialog / IndeterminateProgressDialog.java
index f464020..f990a5b 100644 (file)
@@ -48,12 +48,14 @@ public class IndeterminateProgressDialog extends Dialog {
        ProgressBar mProgressBar = null;
 
        boolean bCancel = false;
+       
+       private static IndeterminateProgressDialog progressDialog = null;
 
-       public IndeterminateProgressDialog(Shell parent, int style) {
+       private IndeterminateProgressDialog(Shell parent, int style) {
                super(parent, style);
        }
 
-       public IndeterminateProgressDialog(Shell parent, int style, String title) {
+       private IndeterminateProgressDialog(Shell parent, int style, String title) {
                super(parent, style);
                mDisplay = getParent().getDisplay();
                setText(title);
@@ -65,7 +67,7 @@ public class IndeterminateProgressDialog extends Dialog {
        public void open() {
                createContents();
                setCenterOfMonitor();
-
+               
                mShell.open();
                mShell.layout();
 
@@ -108,14 +110,14 @@ public class IndeterminateProgressDialog extends Dialog {
         */
        private void createContents() {
                mShell = new Shell(getParent(), SWT.None | SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
-               mShell.setSize(250, 130);
+               mShell.setSize(300, 130);
                mShell.setText("InstallManager");
 
-               mProgressBar = new ProgressBar(mShell, SWT.INDETERMINATE);
-               mProgressBar.setBounds(50, 43, 150, 17);
+//             mProgressBar = new ProgressBar(mShell, SWT.INDETERMINATE);
+//             mProgressBar.setBounds(50, 43, 150, 17);
 
                mNameLabel = new Label(mShell, SWT.NONE | SWT.CENTER);
-               mNameLabel.setBounds(45, 17, 160, 17);
+               mNameLabel.setBounds(25, 17, 250, 40);
                mNameLabel.setText("file name");
        }
 
@@ -124,13 +126,16 @@ public class IndeterminateProgressDialog extends Dialog {
         * @param fileName is string that wants to show on dialog
         */
        public void updateName(final String fileName) {
+//             if (!mDisplay.isDisposed()) {
+//                     mNameLabel.setText(fileName);
+//             }
                if (!mDisplay.isDisposed()) {
                        mDisplay.asyncExec(new Runnable() {
                                public void run() {
                                        if (!mNameLabel.isDisposed()) {
                                                if (fileName.length() > 30) {
-                                                       String name = fileName.substring(0, 29);
-                                                       name = name + "...";
+                                                       //String name = fileName.substring(0, 29);
+                                                       String name = fileName + "...";
                                                        mNameLabel.setText(name);
                                                }
                                                else {
@@ -153,8 +158,8 @@ public class IndeterminateProgressDialog extends Dialog {
        /**
         * Finish displaying the indeterminate dialog.
         */
-       public void finish() {
-               if (mShell.isDisposed()) {
+       public void finish() {          
+               if (mShell == null || mShell.isDisposed()) {
                        return;
                }
 
@@ -167,10 +172,12 @@ public class IndeterminateProgressDialog extends Dialog {
                }
        }
 
-       /**
-        * Start to display the indeterminate dialog.
-        */
-       public static void start() {
-
+       public static IndeterminateProgressDialog getInstance() {
+               if (progressDialog == null) {
+                       Shell shell = new Shell(Display.getCurrent());
+                       progressDialog = new IndeterminateProgressDialog(shell, SWT.NONE, "");
+               }
+               
+               return progressDialog;
        }
 }