Note that there are some explanatory texts on larger screens.

plurals
  1. POcreate new instance of class that is managed by gin
    text
    copied!<p>Im using GWTP, working on their tab panel example. My issue is i need to demonstrate taking a search term and adding a new tab to the tab panel with the search results. So if i search 5 times, i have 5 tabs. easy enough, so i thought.</p> <p>Gin is used extensively in GWTP. So my method to add a new tab, which should be something as simple as </p> <pre><code>tabPanel.addTab(new SearchDataGridView(), NameTokens.searchPage + 1); </code></pre> <p>gets confusing because of the constructor for the SearchDataGridView class</p> <pre><code>@Inject SearchDataGridView(Binder uiBinder) { employeeDataProvider = new ListDataProvider&lt;Employee&gt;(); initSearchGrid(); initWidget(uiBinder.createAndBindUi(this)); } </code></pre> <p>yea, i know im not passing the search term yet, im still trying to get the tab to open. </p> <p>My gin config is this</p> <pre><code>bindPresenter( SearchDataGridPresenter.class, SearchDataGridPresenter.MyView.class, SearchDataGridView.class, SearchDataGridPresenter.MyProxy.class); </code></pre> <p>The gwtp gin config</p> <pre><code>@Override protected void configure() { // RestDispatchAsyncModule.Builder dispatchBuilder = new RestDispatchAsyncModule.Builder(); // install(dispatchBuilder.build()); // install(new RestDispatchAsyncModule.Builder().build()); install(new DefaultModule(DefaultPlaceManager.class)); install(new ApplicationModule()); bind(CurrentUser.class).in(Singleton.class); bind(IsAdminGatekeeper.class).in(Singleton.class); // DefaultPlaceManager Constants bindConstant().annotatedWith(DefaultPlace.class).to(NameTokens.homeNewsPage); bindConstant().annotatedWith(ErrorPlace.class).to(NameTokens.homeNewsPage); bindConstant().annotatedWith(UnauthorizedPlace.class).to(NameTokens.homeNewsPage); bindConstant().annotatedWith(Names.named("rest")).to("http://localhost/services"); // Google Analytics // bindConstant().annotatedWith(GaAccount.class).to("UA-8319339-6"); // Load and inject CSS resources bind(ResourceLoader.class).asEagerSingleton(); } </code></pre> <p>How do i pull this off?</p> <p>thanks</p> <p>Using comments below, sorta got it working. The problem is i can't get the contents of the tab to display. I added debugging code to the setInSlot method of my SearchContainer class and realized that whenever i click the search tab, it fires this setInSlot method, but its fired with my default page presenter listed as content.</p> <pre><code>@Override public void setInSlot(Object slot, IsWidget content) { Window.alert("fired setInSlot: " + slot.toString()); Window.alert("fired setInSlot: " + content.toString()); if (slot == ApplicationPresenter.TYPE_SetTabContent) { tabPanel.setPanelContent(content); } else { super.setInSlot(slot, content); } } </code></pre> <p>Thats the method im using to get my info. Its weird that the tab appears properly, the jsonRPC calls that are built into the view are executed properly, it just doesn't display.</p> <p>My main container presenter has its view and proxy identified by this</p> <pre><code>public class ApplicationPresenter extends TabContainerPresenter&lt;ApplicationPresenter.MyView, ApplicationPresenter.MyProxy&gt; implements CurrentUserChangedHandler, AsyncCallStartHandler, AsyncCallFailHandler, AsyncCallSucceedHandler, ApplicationUiHandler { /** * {@link ApplicationPresenter}'s proxy. */ @ProxyStandard public interface MyProxy extends Proxy&lt;ApplicationPresenter&gt; { } /** * {@link ApplicationPresenter}'s view. */ public interface MyView extends TabView, HasUiHandlers&lt;ApplicationUiHandler&gt; { void refreshTabs(); void setTopMessage(String string); } </code></pre> <p>Could my issue be with my content type? Here is what i have defined for all my types</p> <pre><code>/** * This will be the event sent to our "unknown" child presenters, in order for them to register their tabs. */ @RequestTabs public static final Type&lt;RequestTabsHandler&gt; TYPE_RequestTabs = new Type&lt;RequestTabsHandler&gt;(); /** * Fired by child proxie's when their tab content is changed. */ @ChangeTab public static final Type&lt;ChangeTabHandler&gt; TYPE_ChangeTab = new Type&lt;ChangeTabHandler&gt;(); /** * Use this in leaf presenters, inside their {@link #revealInParent} method. */ @ContentSlot public static final Type&lt;RevealContentHandler&lt;?&gt;&gt; TYPE_SetTabContent = new Type&lt;RevealContentHandler&lt;?&gt;&gt;(); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload