001    /*
002     * Created on Mar 1, 2008
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
005     * in compliance with the License. You may obtain a copy of the License at
006     *
007     * http://www.apache.org/licenses/LICENSE-2.0
008     *
009     * Unless required by applicable law or agreed to in writing, software distributed under the License
010     * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
011     * or implied. See the License for the specific language governing permissions and limitations under
012     * the License.
013     *
014     * Copyright @2008-2010 the original author or authors.
015     */
016    package org.fest.swing.fixture;
017    
018    import java.awt.Component;
019    import java.awt.Point;
020    
021    import javax.swing.JPopupMenu;
022    
023    import org.fest.swing.exception.ComponentLookupException;
024    
025    /**
026     * Understands input simulation on <code>{@link Component}</code>s capable of invoking
027     * <code>{@link JPopupMenu}</code>s.
028     *
029     * @author Alex Ruiz
030     */
031    public interface JPopupMenuInvokerFixture {
032    
033      /**
034       * Shows a pop-up menu using this fixture's <code>{@link Component}</code> as the invoker of the pop-up menu.
035       * @return a fixture that manages the displayed pop-up menu.
036       * @throws IllegalStateException if this fixture's <code>Component</code> is disabled.
037       * @throws IllegalStateException if this fixture's <code>Component</code> is not showing on the screen.
038       * @throws ComponentLookupException if a pop-up menu cannot be found.
039       */
040      JPopupMenuFixture showPopupMenu();
041    
042      /**
043       * Shows a pop-up menu at the given point using this fixture's <code>{@link Component}</code> as the invoker of the
044       * pop-up menu.
045       * @param p the given point where to show the pop-up menu.
046       * @return a fixture that manages the displayed pop-up menu.
047       * @throws IllegalStateException if this fixture's <code>Component</code> is disabled.
048       * @throws IllegalStateException if this fixture's <code>Component</code> is not showing on the screen.
049       * @throws ComponentLookupException if a pop-up menu cannot be found.
050       */
051      JPopupMenuFixture showPopupMenuAt(Point p);
052    }