at.spardat.xma.page.WizardPageServer Maven / Gradle / Ivy
The newest version!
/*******************************************************************************
* Copyright (c) 2003, 2009 s IT Solutions AT Spardat GmbH .
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* s IT Solutions AT Spardat GmbH - initial API and implementation
*******************************************************************************/
package at.spardat.xma.page;
import java.util.ArrayList;
import java.util.Iterator;
import at.spardat.xma.component.ComponentServer;
import at.spardat.xma.rpc.RemoteCall;
import at.spardat.xma.rpc.RemoteReply;
/**
* Server half base class for the wizard frame.
* @author laslovd
* @since 2.1.0
*/
public abstract class WizardPageServer extends PageServer {
/**
* Constructs the WizardPageServer.
* This constructor is called by the runtime.
*
* @param component the component this page belongs to
*/
public WizardPageServer ( ComponentServer component, boolean isStateless ) {
super(component,isStateless);
}
/**
* Will be called from client automatically on last wizard when "finished"
* is selected. Calls the saveModels() method with the mnodels of all the
* involved pages.
*
* @param call standard rpc arg (not used)
* @param reply standard rpc arg (not used)
*/
public void finish ( RemoteCall call, RemoteReply reply ) {
ArrayList subPages = new ArrayList();
for ( Iterator it = getComponent().getPageModels(); it.hasNext(); ) {
PageServer pg = (PageServer) it.next();
if ( pg.getParent() == this )
subPages.add(pg);
}
saveModels((PageServer[]) subPages.toArray(new PageServer[0]));
}
/**
* Has to be implemented for the "final save" on the end of the wizard
* flow when the user presses the "finish" button.
* @param subPages
*/
protected abstract void saveModels ( PageServer[] subPages );
}