javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/PermissionDetailsView.java
changeset 21 2a9601315dfc
child 23 98ccebc37403
equal deleted inserted replaced
18:e8e63152f320 21:2a9601315dfc
       
     1 /*
       
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 package com.nokia.mj.impl.installer.ui.eswt2;
       
    20 
       
    21 import com.nokia.mj.impl.installer.ui.PermissionInfo;
       
    22 
       
    23 import org.eclipse.swt.SWT;
       
    24 import org.eclipse.swt.layout.GridData;
       
    25 import org.eclipse.swt.widgets.Composite;
       
    26 import org.eclipse.swt.widgets.Label;
       
    27 
       
    28 /**
       
    29  * PermissionDetailsView displays permission details to the user.
       
    30  */
       
    31 public class PermissionDetailsView extends ConfirmationViewBase
       
    32 {
       
    33     private PermissionInfo iPermissionInfo = null;
       
    34 
       
    35     /** Constructor */
       
    36     protected PermissionDetailsView()
       
    37     {
       
    38         super();
       
    39     }
       
    40 
       
    41     /** Constructor */
       
    42     protected PermissionDetailsView(InstallerUiEswt aInstaller, Composite aParent,
       
    43                                     String aTitle,
       
    44                                     PermissionInfo aPermissionInfo)
       
    45     {
       
    46         super(aInstaller, aParent, 1, true);
       
    47         iPermissionInfo = aPermissionInfo;
       
    48         setTitle(aTitle);
       
    49         setCommands(null, InstallerUiTexts.get(InstallerUiTexts.OK));
       
    50     }
       
    51 
       
    52     /**
       
    53      * This method is called once before view is opened.
       
    54      * Inheriting class must implement this method.
       
    55      */
       
    56     protected void createView()
       
    57     {
       
    58         GridData gridData = null;
       
    59         int horizontalSpan = getColumns();
       
    60         int labelStyle = SWT.WRAP;
       
    61 
       
    62         // Add title label.
       
    63         Label detailsLabel = createLabel
       
    64                              (InstallerUiTexts.get
       
    65                               (InstallerUiTexts.PERM_VIEW_DETAILS_TITLE),
       
    66                               horizontalSpan, labelStyle);
       
    67         detailsLabel.setFont(iInstallerUi.getBoldFont());
       
    68 
       
    69         // Add permission names.
       
    70         String[] permNames = iPermissionInfo.getPermissionNames();
       
    71         if (permNames != null)
       
    72         {
       
    73             for (int i = 0; i < permNames.length; i++)
       
    74             {
       
    75                 Label permLabel = createLabel(
       
    76                                       permNames[i], horizontalSpan, labelStyle);
       
    77             }
       
    78         }
       
    79 
       
    80         // Add permissions details message.
       
    81         if (iPermissionInfo.getPermissionsDetails() != null)
       
    82         {
       
    83             Label emptyLabel = createLabel("", horizontalSpan, labelStyle);
       
    84             Label permissionDetailsLabel = createLabel(
       
    85                                                iPermissionInfo.getPermissionsDetails(),
       
    86                                                horizontalSpan, labelStyle);
       
    87         }
       
    88     }
       
    89 
       
    90     /**
       
    91      * This method is called after user has answered
       
    92      * to confirmation.
       
    93      * Inheriting class must implement this method.
       
    94      */
       
    95     protected void getDataFromView()
       
    96     {
       
    97         // nop
       
    98     }
       
    99 
       
   100     /**
       
   101      * Returns SWT style for this view.
       
   102      */
       
   103     protected int getStyle()
       
   104     {
       
   105         return SWT.V_SCROLL;
       
   106     }
       
   107 }