Wicket breadCrumb后退按钮

时间:2018-05-08 13:33:24

标签: wicket

我有一个面板页面,当我从页面点击一个按钮时,我会显示两个面包屑链接。我希望能够回到后退按钮上的同一页面。例如,我在小组页面" Group"当在“组”页面上单击按钮时,将显示两个面包屑 组>>项>>应用。 我想在单击后退按钮时从应用程序页面返回组页面。

<PrivateRoute path="/edit/:id" component={SomeEditPage} />

}

public class GroupPanel extends Panel
{

private final IBreadCrumModel breadCrumbModel;


public GroupPanel(String id, final IBreadCrumbModel breadCrumbModel)
{
    super(id);
    this.breadCrumbModel = breadCrumbModel;
    addGroup();
}

public void addGroup()
{

    add(new ListView<GroupDetails>("rows", listData)
    {
        public void populateItem(final ListItem<GroupDetails> item)
        {
            item.add(new WebMarkupContainer("view")
            {
                private static final long serialVersionUID = 1L;

                @Override
                public boolean isVisible()
                {
                    return true;
                }
            }.add(new BreadCrumbLink<Void>("action", breadCrumbModel)
            {
                private static final long serialVersionUID = 1L;

                @Override
                public IBreadCrumbParticipant getBreadCrumbParticipant()
                {
                    breadCrumbModel.setActive(new ItemPanel(breadCrumbModel, ItemModel));// adding
                                                                                            // two
                                                                                            // breadcrumbs
                    return new ApplicationPanel(breadCrumbModel, ApplicationModel);

                }
            }));
        }
    });

}

}

public class ApplicationPanel extends BreadCrumbPanel
{

private IBreadCrumbParticipant breadCrumbReturn

public ApplicationPanel(final IBreadCrumbModel breadCrumbModel, IModel<Application> ApplicationModel){
    this(breadCrumbModel.getActive().getComponent().getId(), breadCrumbModel, ApplicationModel)
}

public ApplicationPanel(String id, final IBreadCrumbModel breadCrumbModel, IModel<Application> ApplicationModel){
    super(id, breadCrumbModel)
    setBreadCrumbModel(breadcrumbs.getActive())
}

@Override
protected void onInitialize() {
    super.onInitialize()
    form = new Form<Void>("form"){
    add(form);

    addBackButton();
}

public void setBreadCrumbReturn(IBreadCrumbParticipant breadCrumbReturn)
{
    this.breadCrumbReturn = breadCrumbReturn;
}

protected void addBackButton(){

    form.add(new BreadCrumbLink<Void>("back", getBreadCrumbModel()) {
        private static final long serialVersionUID = 1L;

        @Override
        public IBreadCrumbParticipant getBreadCrumbParticipant() {
            return breadCrumbReturn;    
        }

        @Override
        public boolean isVisible() {
            return true
        }
    }); 
}

/**
 * @see org.apache.wicket.extensions.breadcrumb.IBreadCrumbParticipant#getTitle()
 */
public String getTitle()
{
    return "Application";
}

}

0 个答案:

没有答案