package p2.application.tappshortcutmode;

import baseclass.MultiselectDataBeanCust;
import p2.pao.PaoRemote;
import p2.pao.PaoSetRemote;
import p2.util.P2Exception;
import p2.webclient.system.controller.Utility;

public class ShortCutMlt extends MultiselectDataBeanCust {
	@Override
	protected PaoSetRemote getPaoSetRemote() throws P2Exception {
		PaoRemote pao = this.app.getAppBean().getPao();
		PaoSetRemote paoSet = super.getPaoSetRemote();// 获得对话框绑定物件
		if (pao != null) {
			if (!screenDesignMode) {
				if (this.app.getAppBean().getPao() != null) {
					paoSet.setWhere(getworlds(
							pao.getPaoSet("TAPPSHORTCUTMODE"), "APPNAME", "APP"));
					paoSet.reset();
				}
			}
		}
		return paoSet;
	}

	public int addapps() throws P2Exception {
		PaoSetRemote detailset = app.getAppBean().getPao()
				.getPaoSet("TAPPSHORTCUTMODE");
        for (PaoRemote paoRemote : (Iterable<PaoRemote>) getPaoSet().getSelection()) {
            PaoRemote newpao = detailset.addAtEnd();
            newpao.setValue("APPNAME", paoRemote.getString("APP"));
        }
		Utility.sendEvent(sessionContext, app.getCurrentPageId(),
				"dialogclose", null);// 关闭当前对话框
		app.getAppBean().save();
		app.getAppBean().reloadTable();
		app.getAppBean().refreshTable();
		this.sessionContext.queueRefreshEvent();
		return 1;
	}
}
