Search in sources :

Example 1 with ProvidesBusy

use of org.rstudio.core.client.widget.model.ProvidesBusy in project rstudio by rstudio.

the class WorkbenchTabPanel method add.

private void add(final WorkbenchTab tab) {
    if (tab.isSuppressed())
        return;
    tabs_.add(tab);
    final Widget widget = tab.asWidget();
    tabPanel_.add(widget, tab.getTitle(), false, !tab.closeable() ? null : new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            tab.confirmClose(new Command() {

                @Override
                public void execute() {
                    tab.ensureHidden();
                }
            });
        }
    }, tab instanceof ProvidesBusy ? (ProvidesBusy) tab : null);
    tab.addEnsureVisibleHandler(new EnsureVisibleHandler() {

        public void onEnsureVisible(EnsureVisibleEvent event) {
            // First ensure that we ourselves are visible
            fireEvent(new EnsureVisibleEvent(event.getActivate()));
            if (event.getActivate())
                tabPanel_.selectTab(widget);
        }
    });
    tab.addEnsureHeightHandler(new EnsureHeightHandler() {

        @Override
        public void onEnsureHeight(EnsureHeightEvent event) {
            fireEvent(event);
        }
    });
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Command(com.google.gwt.user.client.Command) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Widget(com.google.gwt.user.client.ui.Widget) ProvidesBusy(org.rstudio.core.client.widget.model.ProvidesBusy)

Aggregations

ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 Command (com.google.gwt.user.client.Command)1 Widget (com.google.gwt.user.client.ui.Widget)1 ProvidesBusy (org.rstudio.core.client.widget.model.ProvidesBusy)1