Package org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.templates

Source Code of org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.templates.VerticalDecoratedTemplateDataGridWidget

/*
* Copyright 2011 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.asseteditor.drools.modeldriven.ui.templates;

import org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.templates.events.SetTemplateDataEvent;
import org.drools.guvnor.client.widgets.drools.decoratedgrid.ResourcesProvider;

import com.google.gwt.event.dom.client.ScrollEvent;
import com.google.gwt.event.dom.client.ScrollHandler;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
* Vertical implementation of DecoratedGridWidget for Template data
*/
public class VerticalDecoratedTemplateDataGridWidget extends AbstractDecoratedTemplateDataGridWidget {

    public VerticalDecoratedTemplateDataGridWidget(ResourcesProvider<TemplateDataColumn> resources,
                                                   TemplateDataCellFactory cellFactory,
                                                   TemplateDataCellValueFactory cellValueFactory,
                                                   TemplateDropDownManager dropDownManager,
                                                   boolean isReadOnly,
                                                   EventBus eventBus) {
        super( resources,
               cellFactory,
               cellValueFactory,
               eventBus,
               new HorizontalPanel(),
               new VerticalPanel(),
               new VerticalMergableTemplateDataGridWidget( resources,
                                                           cellFactory,
                                                           cellValueFactory,
                                                           dropDownManager,
                                                           isReadOnly,
                                                           eventBus ),
               new TemplateDataHeaderWidget( resources,
                                             isReadOnly,
                                             eventBus ),
               new VerticalTemplateDataSidebarWidget( resources,
                                                      isReadOnly,
                                                      eventBus ) );

        //Wire-up event handlers
        eventBus.addHandler( SetTemplateDataEvent.TYPE,
                             this );
    }

    /**
     * Return a ScrollHandler to ensure the Header and Sidebar are repositioned
     * according to the position of the scroll bars surrounding the GridWidget
     */
    @Override
    protected ScrollHandler getScrollHandler() {
        return new ScrollHandler() {

            public void onScroll(ScrollEvent event) {
                headerWidget.setScrollPosition( scrollPanel.getHorizontalScrollPosition() );
                sidebarWidget.setScrollPosition( scrollPanel.getVerticalScrollPosition() );
            }

        };
    }

}
TOP

Related Classes of org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.templates.VerticalDecoratedTemplateDataGridWidget

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.