Search in sources :

Example 1 with WizardPage

use of com.willshex.blogwt.client.wizard.WizardPage in project blogwt by billy1380.

the class EditPagePage method onfinished.

/* (non-Javadoc)
	 * 
	 * @see com.willshex.blogwt.client.wizard.PagePlanFinishedHandler#onfinished
	 * (java.util.List) */
@Override
public void onfinished(List<WizardPage<?>> pages) {
    Page page = null;
    Post post = null;
    for (WizardPage<?> wizardPage : pages) {
        if (wizardPage instanceof EditPageWizardPage) {
            page = ((EditPageWizardPage) wizardPage).getData();
            if (page.posts != null) {
                page.posts.clear();
            }
        } else if (wizardPage instanceof SelectPostWizardPage) {
            if (page.posts == null) {
                page.posts = new ArrayList<Post>();
            }
            post = ((SelectPostWizardPage) wizardPage).getData();
            page.posts.add(post);
        }
    }
    if (page.id == null) {
        PageController.get().createPage(page);
    } else {
        PageController.get().updatePage(page);
    }
}
Also used : SelectPostWizardPage(com.willshex.blogwt.client.wizard.page.SelectPostWizardPage) EditPageWizardPage(com.willshex.blogwt.client.wizard.page.EditPageWizardPage) Post(com.willshex.blogwt.shared.api.datatype.Post) ArrayList(java.util.ArrayList) Page(com.willshex.blogwt.shared.api.datatype.Page) EditPageWizardPage(com.willshex.blogwt.client.wizard.page.EditPageWizardPage) WizardPage(com.willshex.blogwt.client.wizard.WizardPage) WizardDialogPage(com.willshex.blogwt.client.page.wizard.WizardDialogPage) SelectPostWizardPage(com.willshex.blogwt.client.wizard.page.SelectPostWizardPage)

Aggregations

WizardDialogPage (com.willshex.blogwt.client.page.wizard.WizardDialogPage)1 WizardPage (com.willshex.blogwt.client.wizard.WizardPage)1 EditPageWizardPage (com.willshex.blogwt.client.wizard.page.EditPageWizardPage)1 SelectPostWizardPage (com.willshex.blogwt.client.wizard.page.SelectPostWizardPage)1 Page (com.willshex.blogwt.shared.api.datatype.Page)1 Post (com.willshex.blogwt.shared.api.datatype.Post)1 ArrayList (java.util.ArrayList)1