Package org.drools.guvnor.client.admin

Source Code of org.drools.guvnor.client.admin.PermissionViewer

/*
* Copyright 2010 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

package org.drools.guvnor.client.admin;

import org.drools.guvnor.client.common.InfoPopup;
import org.drools.guvnor.client.common.PrettyFormLayout;
import org.drools.guvnor.client.messages.Constants;
import org.drools.guvnor.client.resources.Images;
import org.drools.guvnor.client.widgets.tables.PermissionsPagedTablePresenter;
import org.drools.guvnor.client.widgets.tables.PermissionsPagedTableView;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.FontWeight;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class PermissionViewer extends Composite {
    private static Images         images    = (Images) GWT.create( Images.class );
    private Constants             constants = ((Constants) GWT.create( Constants.class ));

    private VerticalPanel         layout;
    private PermissionsPagedTableView table;

    public PermissionViewer() {
        PrettyFormLayout pf = new PrettyFormLayout();

        VerticalPanel header = new VerticalPanel();
        Label caption = new Label( constants.PermissionDetails() );
        caption.getElement().getStyle().setFontWeight( FontWeight.BOLD );
        header.add( caption );
        header.add( howToTurnOn() );

        pf.addHeader( images.userPermissionsLarge(),
                      header );

        layout = new VerticalPanel();
        layout.setHeight( "100%" );
        layout.setWidth( "100%" );

        pf.startSection();
        pf.addRow( layout );
        pf.endSection();

        setupWidget();
        initWidget( pf );
    }

    private Widget howToTurnOn() {
        HorizontalPanel hp = new HorizontalPanel();
        hp.add( new HTML( "<small><i>"
                          + constants.TipAuthEnable()
                          + "</i></small>" ) );
        InfoPopup pop = new InfoPopup( constants.EnablingAuthorization(),
                                       constants.EnablingAuthPopupTip() );
        hp.add( pop );
        return hp;
    }

    private void setupWidget() {
        table = new PermissionsPagedTableView();
        PermissionsPagedTablePresenter presenter = new PermissionsPagedTablePresenter(table);
        layout.add( table );
    }
}
TOP

Related Classes of org.drools.guvnor.client.admin.PermissionViewer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.