001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Nuxeo - initial API and implementation
011 */
012
013package org.nuxeo.ecm.automation.jsf.operations;
014
015import org.nuxeo.ecm.automation.OperationContext;
016import org.nuxeo.ecm.automation.core.Constants;
017import org.nuxeo.ecm.automation.core.annotations.Context;
018import org.nuxeo.ecm.automation.core.annotations.Operation;
019import org.nuxeo.ecm.automation.core.annotations.OperationMethod;
020import org.nuxeo.ecm.automation.core.annotations.Param;
021import org.nuxeo.ecm.automation.jsf.OperationHelper;
022
023@Operation(id = ChangeTab.ID, category = Constants.CAT_UI, requires = Constants.SEAM_CONTEXT, label = "Change Current Tab", description = "Change the selected tab for the current document. Preserve the current input.", aliases = { "Seam.ChangeTab" })
024public class ChangeTab {
025
026    public static final String ID = "Navigation.ChangeCurrentTab";
027
028    @Context
029    protected OperationContext ctx;
030
031    @Param(name = "tab")
032    protected String tab;
033
034    @OperationMethod
035    public void run() {
036        OperationHelper.getWebActions().setCurrentTabId(tab);
037    }
038
039}