javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionConfirmationView.java
changeset 48 e0d6e9bd3ca7
parent 35 85266cc22c7f
child 72 1f0034e370aa
equal deleted inserted replaced
47:f40128debb5d 48:e0d6e9bd3ca7
    59 
    59 
    60     /** Constructor */
    60     /** Constructor */
    61     protected PermissionConfirmationView(
    61     protected PermissionConfirmationView(
    62         InstallerUiEswt aInstallerUi, Composite aParent)
    62         InstallerUiEswt aInstallerUi, Composite aParent)
    63     {
    63     {
    64         super(aInstallerUi, aParent, 8, true);
    64         super(aInstallerUi, aParent, 8);
    65         setTitle(InstallerUiTexts.get(InstallerUiTexts.INSTALLING));
    65         setTitle(InstallerUiTexts.get(InstallerUiTexts.INSTALLING));
    66         setCommands(null, null);
    66         setCommands(null, null);
    67     }
    67     }
    68 
    68 
    69     /**
    69     /**
    90      * This method is called once before view is opened.
    90      * This method is called once before view is opened.
    91      */
    91      */
    92     protected void createView()
    92     protected void createView()
    93     {
    93     {
    94         // Add header.
    94         // Add header.
    95         String title = "Install?";
    95         addHeader(null, iInstallInfo, null);
    96         String appName = "";
       
    97         if (iInstallInfo != null)
       
    98         {
       
    99             if (iInstallInfo.getOldVersion() != null)
       
   100             {
       
   101                 title = "Update?";
       
   102             }
       
   103             appName = iInstallInfo.getName();
       
   104         }
       
   105         addHeader(title, iInstallInfo, null);
       
   106 
    96 
   107         GridData gridData = null;
    97         GridData gridData = null;
   108         int labelStyle = SWT.WRAP;
    98         int labelStyle = SWT.WRAP;
   109 
    99 
   110         // Add permission query label.
   100         // Add permission query label.
   111         int detailsColumns = 2;
   101         int detailsColumns = 2;
   112         int horizontalSpan = getColumns() - detailsColumns;
   102         int horizontalSpan = getColumns() - detailsColumns;
   113         Label domainLabel = createLabel(
   103         Label permissionQueryLabel = createLabel(
   114             InstallerUiTexts.get(InstallerUiTexts.PERM_QUERY,
   104             InstallerUiTexts.get(InstallerUiTexts.PERM_QUERY),
   115                                  new String[] { appName }),
       
   116             horizontalSpan, labelStyle);
   105             horizontalSpan, labelStyle);
       
   106         setCssId(permissionQueryLabel, "permissionDetails");
   117 
   107 
   118         // Add link for permission details.
   108         // Add link for permission details.
   119         if (iPermissionInfo != null &&
   109         if (iPermissionInfo != null &&
   120                 iPermissionInfo.getPermissionNames() != null &&
   110                 iPermissionInfo.getPermissionNames() != null &&
   121                 iPermissionInfo.getPermissionNames().length > 0)
   111                 iPermissionInfo.getPermissionNames().length > 0)
   122         {
   112         {
   123             horizontalSpan = detailsColumns;
   113             horizontalSpan = detailsColumns;
   124             Button detailsButton = new Button(getComposite(), SWT.NONE);
   114             Button detailsButton = new Button(getComposite(), SWT.NONE);
       
   115             setCssId(detailsButton, "detailsLink");
   125             detailsButton.setText(
   116             detailsButton.setText(
   126                 InstallerUiTexts.get(InstallerUiTexts.PERM_VIEW_DETAILS));
   117                 InstallerUiTexts.get(InstallerUiTexts.PERM_VIEW_DETAILS));
   127             detailsButton.addListener(SWT.Selection, new Listener()
   118             detailsButton.addListener(SWT.Selection, new Listener()
   128             {
   119             {
   129                 public void handleEvent(Event aEvent)
   120                 public void handleEvent(Event aEvent)
   137             addSoftKeyListenerFor(detailsButton);
   128             addSoftKeyListenerFor(detailsButton);
   138         }
   129         }
   139 
   130 
   140         horizontalSpan = getColumns();
   131         horizontalSpan = getColumns();
   141 
   132 
   142         // Number of pixels on top of the buttons.
       
   143         int verticalIndent = 5;
       
   144 
       
   145         // Add allow button.
   133         // Add allow button.
   146         iAllowButton = new Button(getComposite(), SWT.NONE);
   134         iAllowButton = new Button(getComposite(), SWT.NONE);
       
   135         setCssId(iAllowButton, "allowButton");
   147         iAllowButton.setText(InstallerUiTexts.get(
   136         iAllowButton.setText(InstallerUiTexts.get(
   148                                  InstallerUiTexts.PERM_ALLOW_ALWAYS));
   137                                  InstallerUiTexts.PERM_ALLOW_ALWAYS));
   149         iAllowButton.addListener(SWT.Selection, new Listener()
   138         iAllowButton.addListener(SWT.Selection, new Listener()
   150         {
   139         {
   151             public void handleEvent(Event aEvent)
   140             public void handleEvent(Event aEvent)
   168                 // nop
   157                 // nop
   169             }
   158             }
   170         });
   159         });
   171         gridData = new GridData(GridData.FILL_HORIZONTAL);
   160         gridData = new GridData(GridData.FILL_HORIZONTAL);
   172         gridData.horizontalSpan = horizontalSpan;
   161         gridData.horizontalSpan = horizontalSpan;
   173         gridData.verticalIndent = verticalIndent;
       
   174         iAllowButton.setLayoutData(gridData);
   162         iAllowButton.setLayoutData(gridData);
   175         iAllowButton.setFocus();
   163         iAllowButton.setFocus();
   176         addSoftKeyListenerFor(iAllowButton);
   164         addSoftKeyListenerFor(iAllowButton);
   177 
   165 
   178         // Add deny button.
   166         // Add deny button.
   179         iDenyButton = new Button(getComposite(), SWT.NONE);
   167         iDenyButton = new Button(getComposite(), SWT.NONE);
       
   168         setCssId(iDenyButton, "denyButton");
   180         iDenyButton.setText(InstallerUiTexts.get(
   169         iDenyButton.setText(InstallerUiTexts.get(
   181                                 InstallerUiTexts.PERM_ASK_ME_LATER));
   170                                 InstallerUiTexts.PERM_ASK_ME_LATER));
   182         iDenyButton.addListener(SWT.Selection, new Listener()
   171         iDenyButton.addListener(SWT.Selection, new Listener()
   183         {
   172         {
   184             public void handleEvent(Event aEvent)
   173             public void handleEvent(Event aEvent)
   201                 // nop
   190                 // nop
   202             }
   191             }
   203         });
   192         });
   204         gridData = new GridData(GridData.FILL_HORIZONTAL);
   193         gridData = new GridData(GridData.FILL_HORIZONTAL);
   205         gridData.horizontalSpan = horizontalSpan;
   194         gridData.horizontalSpan = horizontalSpan;
   206         gridData.verticalIndent = verticalIndent;
       
   207         iDenyButton.setLayoutData(gridData);
   195         iDenyButton.setLayoutData(gridData);
   208         addSoftKeyListenerFor(iDenyButton);
   196         addSoftKeyListenerFor(iDenyButton);
   209 
   197 
   210         // Add cancel button.
   198         // Add cancel button.
   211         iCancelButton = new Button(getComposite(), SWT.NONE);
   199         iCancelButton = new Button(getComposite(), SWT.NONE);
       
   200         setCssId(iCancelButton, "cancelButton");
   212         iCancelButton.setText(InstallerUiTexts.get(InstallerUiTexts.PERM_CANCEL));
   201         iCancelButton.setText(InstallerUiTexts.get(InstallerUiTexts.PERM_CANCEL));
   213         iCancelButton.addListener(SWT.Selection, new Listener()
   202         iCancelButton.addListener(SWT.Selection, new Listener()
   214         {
   203         {
   215             public void handleEvent(Event aEvent)
   204             public void handleEvent(Event aEvent)
   216             {
   205             {
   231                 // nop
   220                 // nop
   232             }
   221             }
   233         });
   222         });
   234         gridData = new GridData(GridData.FILL_HORIZONTAL);
   223         gridData = new GridData(GridData.FILL_HORIZONTAL);
   235         gridData.horizontalSpan = horizontalSpan;
   224         gridData.horizontalSpan = horizontalSpan;
   236         gridData.verticalIndent = verticalIndent;
       
   237         iCancelButton.setLayoutData(gridData);
   225         iCancelButton.setLayoutData(gridData);
   238         addSoftKeyListenerFor(iCancelButton);
   226         addSoftKeyListenerFor(iCancelButton);
   239 
   227 
   240         // After other widgets have been added, add content to
   228         // After other widgets have been added, add content to
   241         // application info Composite.
   229         // application info Composite.