All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gwtplatform.mvp.client.proxy.TabContentProxyImpl Maven / Gradle / Ivy

There is a newer version: 1.6
Show newest version
/**
 * Copyright 2010 ArcBees 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 com.gwtplatform.mvp.client.proxy;

import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.GwtEvent.Type;
import com.google.inject.Inject;

import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.RequestTabsEvent;
import com.gwtplatform.mvp.client.RequestTabsHandler;
import com.gwtplatform.mvp.client.Tab;
import com.gwtplatform.mvp.client.TabData;

/**
 * @param  The Presenter's type.
 * 
 * @author Philippe Beaudoin
 */
public class TabContentProxyImpl> extends ProxyImpl
    implements TabContentProxy {

  protected String targetHistoryToken;
  protected TabData tabData;
  protected Type requestTabsEventType;

  private Tab tab;

  /**
   * Creates a {@link Proxy} for a {@link Presenter} that is meant to be
   * contained within at {@link com.gwtplatform.mvp.client.TabContainerPresenter}. As such, these proxy
   * hold a string that can be displayed on the tab.
   */
  public TabContentProxyImpl() {
  }

  @Override
  public String getTargetHistoryToken() {
    return targetHistoryToken;
  }

  @Override
  public TabData getTabData() {
    return tabData;
  }

  @Override
  public Tab getTab() {
    return tab;
  }
  
  @Inject
  @Override
  protected void bind(ProxyFailureHandler failureHandler, EventBus eventBus) {
    super.bind(failureHandler, eventBus);
    eventBus.addHandler(requestTabsEventType, new RequestTabsHandler() {
      @Override
      public void onRequestTabs(RequestTabsEvent event) {
        tab = event.getTabContainer().addTab(TabContentProxyImpl.this);
      }
    });
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy