Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 未设置MVP4G演示者_Java_Gwt_Mvp4g - Fatal编程技术网

Java 未设置MVP4G演示者

Java 未设置MVP4G演示者,java,gwt,mvp4g,Java,Gwt,Mvp4g,我有个问题,我用mvp4g框架开发了一个应用程序。我有一个带选项卡的视图,其中一个选项卡中有第二个带选项卡的视图。当我尝试从第二个视图调用presenter时,我得到NPE presenter为null。 以下是第一视图的代码: public interface ICategoriesView extends IsWidget { public interface ICategoriesPresenter { } } @Presenter(view = CategoriesV

我有个问题,我用mvp4g框架开发了一个应用程序。我有一个带选项卡的视图,其中一个选项卡中有第二个带选项卡的视图。当我尝试从第二个视图调用presenter时,我得到NPE presenter为null。 以下是第一视图的代码:

public interface ICategoriesView extends IsWidget {

    public interface ICategoriesPresenter {
    }
}

@Presenter(view = CategoriesView.class)
public final class CategoriesPresenter extends BasePresenter<ICategoriesView, UserEventBus> implements ICategoriesPresenter {
}

public final class CategoriesView extends ReverseCompositeView<ICategoriesPresenter> implements ICategoriesView {

    interface CategoriesViewUiBinder extends UiBinder<Widget, CategoriesView> {
    }

    private static final CategoriesViewUiBinder UI_BINDER = GWT.create(CategoriesViewUiBinder.class);

    public CategoriesView() {
        initWidget(UI_BINDER.createAndBindUi(this));
    }
}


<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
             xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container"
             xmlns:gxtClient="urn:import:com.sencha.gxt.widget.core.client"
             xmlns:category="urn:import:app.client.ui.settings.categories">

    <ui:with type="app.client.Messages"             field="messages"/>
    <ui:with type="app.client.resource.image.Image" field="imageUser"/>

    <!-- Tab configuration. -->
    <ui:with type="com.sencha.gxt.widget.core.client.TabItemConfig" field="subjectTypes">
        <ui:attributes text="{messages.categories_tab_subjectTypes}" />
    </ui:with>
    <ui:with type="com.sencha.gxt.widget.core.client.TabItemConfig" field="subjectRegions">
        <ui:attributes text="{messages.categories_tab_subjectRegions}" />
    </ui:with>
    <ui:with type="com.sencha.gxt.widget.core.client.TabItemConfig" field="tripTypes">
        <ui:attributes text="{messages.categories_tab_tripTypes}" />
    </ui:with>
    <ui:with type="com.sencha.gxt.widget.core.client.TabItemConfig" field="expenseTypes">
        <ui:attributes text="{messages.categories_tab_expenseTypes}" />
    </ui:with>
    <ui:with type="com.sencha.gxt.widget.core.client.TabItemConfig" field="expensePaymentTypes">
        <ui:attributes text="{messages.categories_tab_expensePaymentTypes}" />
    </ui:with>

    <container:SimpleContainer>
        <gxtClient:TabPanel addStyleNames="margin-10">
            <gxtClient:child config="{subjectTypes}">
                <category:CategoryView category="ONE" />
            </gxtClient:child>

            <gxtClient:child config="{subjectRegions}">
                <category:CategoryView category="TWO" />
            </gxtClient:child>

            <gxtClient:child config="{tripTypes}">
                <category:CategoryView category="THREE" />
            </gxtClient:child>

            <gxtClient:child config="{expenseTypes}">
                <category:CategoryView category="FOUR" />
            </gxtClient:child>

            <gxtClient:child config="{expensePaymentTypes}">
                <category:CategoryView category="FIVE" />
            </gxtClient:child>
        </gxtClient:TabPanel>
    </container:SimpleContainer>

</ui:UiBinder>
下面是第二个视图的代码:

public interface ICategoryView extends IsWidget, Editor<CategoryDTO> {

    public interface ICategoryPresenter {

        public void getCategory(CategoryList category);
    }

    public void setCategory(String category);

    public void setGridContent(List<CategoryDTO> categoryDTOList);

    void showFailedMessage();
}


@Presenter(view = CategoryView.class)
public final class CategoryPresenter extends BasePresenter<ICategoryView, UserEventBus> implements ICategoryPresenter {

    @Inject
    private CategoryServiceAsync categoryServiceAsync;

    public void getCategory(CategoryList category) {
       ...
    }
}

public final class CategoryView extends ReverseCompositeView<ICategoryPresenter> implements ICategoryView {

    interface CategoryViewUiBinder extends UiBinder<Widget, CategoryView> {
    }

    interface CategoryDriver extends SimpleBeanEditorDriver<CategoryDTO, CategoryView> {
    }

    private static final CategoryViewUiBinder UI_BINDER = GWT.create(CategoryViewUiBinder.class);

    public CategoryView() {
        initWidget(UI_BINDER.createAndBindUi(this));
    }

    public void setCategory(String category) {
        List<CategoryDTO> categoryDTOList = Collections.emptyList();
        presenter.getCategory(CategoryList.valueOf(category));  // PRESENTER IS NULL!!!
    }

    public void setGridContent(List<CategoryDTO> categoryDTOList) {
    }

    @Override
    public void showFailedMessage() {
    }
}

您的演示者中没有任何onGoTo方法? 你能展示一下你的活动巴士吗? 并尝试编译代码并将堆栈跟踪复制到此处