javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ProgressView.java
changeset 79 2f468c1958d0
parent 76 4ad59aaee882
equal deleted inserted replaced
76:4ad59aaee882 79:2f468c1958d0
    64     }
    64     }
    65 
    65 
    66     /** Constructor */
    66     /** Constructor */
    67     protected ProgressView(InstallerUiEswt aInstallerUi, Composite aParent, String aMsg)
    67     protected ProgressView(InstallerUiEswt aInstallerUi, Composite aParent, String aMsg)
    68     {
    68     {
    69         this(aInstallerUi, aParent, aMsg, false);
    69         this(aInstallerUi, aParent, aMsg, false, true);
    70     }
    70     }
    71 
    71 
    72     /** Constructor */
    72     /** Constructor */
    73     protected ProgressView(InstallerUiEswt aInstallerUi, Composite aParent, String aMsg,
    73     protected ProgressView(InstallerUiEswt aInstallerUi, Composite aParent, String aMsg,
    74                            boolean aIndeterminate)
    74                            boolean aIndeterminate, boolean aHideCommand)
    75     {
    75     {
    76         super(aInstallerUi, aParent, 8);
    76         super(aInstallerUi, aParent, 8);
    77         iMsg = aMsg;
    77         iMsg = aMsg;
    78 
    78 
    79         // Add header.
    79         // Add header.
   110 
   110 
   111         // After other widgets have been added, add content to
   111         // After other widgets have been added, add content to
   112         // application info Composite.
   112         // application info Composite.
   113         if (iInstallerUi != null)
   113         if (iInstallerUi != null)
   114         {
   114         {
   115             addAppInfo(iInstallerUi.getInstallInfo(), false);
   115             addAppInfo(iInstallerUi.getInstallInfo(), false, false);
   116         }
   116         }
   117 
   117 
   118         // By default add cancel command to all progress bars.
   118         // By default add cancel command to all progress bars.
   119         addCancelCommand();
   119         addCancelCommand(aHideCommand);
   120 
   120 
   121         iInstallerUi.loadCss();
   121         iInstallerUi.loadCss();
   122     }
   122     }
   123 
   123 
   124     /** Update text for this progress bar. */
   124     /** Update text for this progress bar. */
   157             }
   157             }
   158         });
   158         });
   159     }
   159     }
   160 
   160 
   161     /**
   161     /**
   162      * Adds a cancel command for this progress view.
   162      * Adds Cancel command for this progress view.
   163      */
   163      *
   164     protected void addCancelCommand()
   164      * @param aHideCommand if true, also Hide command is added.
       
   165      */
       
   166     protected void addCancelCommand(final boolean aHideCommand)
   165     {
   167     {
   166         if (iCancelCommand != null || isDisposed())
   168         if (iCancelCommand != null || isDisposed())
   167         {
   169         {
   168             // Cancel command has already been added, do not add it anymore.
   170             // Cancel command has already been added, do not add it anymore.
   169             return;
   171             return;
   171         // UI updates must be executed in UI thread.
   173         // UI updates must be executed in UI thread.
   172         getDisplay().syncExec(new Runnable()
   174         getDisplay().syncExec(new Runnable()
   173         {
   175         {
   174             public void run()
   176             public void run()
   175             {
   177             {
       
   178                 GridData gridData = null;
   176                 // Set horizontalSpan to 2 for one button,
   179                 // Set horizontalSpan to 2 for one button,
   177                 // and to 1 for two buttons.
   180                 // and to 1 for two buttons.
   178                 int horizontalSpan = 1;
   181                 int horizontalSpan = 2;
   179                 GridData gridData = null;
   182                 if (aHideCommand)
   180                 iHideCommand = new Button(getCommandComposite(), SWT.PUSH);
   183                 {
   181                 setCssId(iHideCommand, "softKeyButton");
   184                     horizontalSpan = 1;
   182                 gridData = new GridData(GridData.FILL_HORIZONTAL);
   185                     iHideCommand = new Button(getCommandComposite(), SWT.PUSH);
   183                 gridData.horizontalSpan = horizontalSpan;
   186                     setCssId(iHideCommand, "softKeyButton");
   184                 iHideCommand.setLayoutData(gridData);
   187                     gridData = new GridData(GridData.FILL_HORIZONTAL);
   185                 iHideCommand.setText(InstallerUiTexts.get(InstallerUiTexts.HIDE));
   188                     gridData.horizontalSpan = horizontalSpan;
   186                 iHideCommand.addSelectionListener(new SelectionListener()
   189                     iHideCommand.setLayoutData(gridData);
   187                 {
   190                     iHideCommand.setText(
   188                     public void widgetDefaultSelected(SelectionEvent aEvent)
   191                         InstallerUiTexts.get(InstallerUiTexts.HIDE));
   189                     {
   192                     iHideCommand.addSelectionListener(new SelectionListener()
   190                         widgetSelected(aEvent);
   193                     {
   191                     }
   194                         public void widgetDefaultSelected(SelectionEvent aEvent)
   192                     public void widgetSelected(SelectionEvent aEvent)
   195                         {
   193                     {
   196                             widgetSelected(aEvent);
   194                         confirmHide();
   197                         }
   195                     }
   198                         public void widgetSelected(SelectionEvent aEvent)
   196                 });
   199                         {
   197                 addSoftKeyListenerFor(iHideCommand);
   200                             confirmHide();
       
   201                         }
       
   202                     });
       
   203                     addSoftKeyListenerFor(iHideCommand);
       
   204                 }
   198 
   205 
   199                 iCancelCommand = new Button(getCommandComposite(), SWT.PUSH);
   206                 iCancelCommand = new Button(getCommandComposite(), SWT.PUSH);
   200                 setCssId(iCancelCommand, "softKeyButton");
   207                 if (aHideCommand)
   201                 //setCssId(iCancelCommand, "softKeyButtonWide");
   208                 {
       
   209                     setCssId(iCancelCommand, "softKeyButton");
       
   210                 }
       
   211                 else
       
   212                 {
       
   213                     setCssId(iCancelCommand, "softKeyButtonWide");
       
   214                 }
   202                 gridData = new GridData(GridData.FILL_HORIZONTAL);
   215                 gridData = new GridData(GridData.FILL_HORIZONTAL);
   203                 gridData.horizontalSpan = horizontalSpan;
   216                 gridData.horizontalSpan = horizontalSpan;
   204                 iCancelCommand.setLayoutData(gridData);
   217                 iCancelCommand.setLayoutData(gridData);
   205                 iCancelCommand.setText(
   218                 iCancelCommand.setText(
   206                     InstallerUiTexts.get(InstallerUiTexts.CANCEL));
   219                     InstallerUiTexts.get(InstallerUiTexts.CANCEL));