All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.assertj.swing.fixture.MouseInputSimulationFixture Maven / Gradle / Ivy

The newest version!
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 *
 * Copyright 2012-2018 the original author or authors.
 */
package org.assertj.swing.fixture;

import org.assertj.swing.core.MouseButton;
import org.assertj.swing.core.MouseClickInfo;
import org.jetbrains.annotations.NotNull;

/**
 * Simulates mouse input on an AWT or Swing {@code Component}.
 * 
 * @param  used to simulate "self types." For more information please read "Emulating 'self types' using Java Generics to simplify fluent API implementation."
 * 
 * @author Alex Ruiz
 */
public interface MouseInputSimulationFixture {
  /**
   * Simulates a user clicking this fixture's {@code Component}.
   * 
   * @return this fixture.
   * @throws IllegalStateException if the {@code Component} is disabled.
   * @throws IllegalStateException if the {@code Component} is not showing on the screen.
   */
  @NotNull
  S click();

  /**
   * Simulates a user clicking this fixture's {@code Component}.
   * 
   * @param button the button to click.
   * @return this fixture.
   * @throws IllegalStateException if the {@code Component} is disabled.
   * @throws IllegalStateException if the {@code Component} is not showing on the screen.
   */
  @NotNull
  S click(@NotNull MouseButton button);

  /**
   * Simulates a user clicking this fixture's {@code Component}.
   * 
   * @param mouseClickInfo specifies the button to click and the times the button should be clicked.
   * @return this fixture.
   * @throws NullPointerException if the given {@code MouseClickInfo} is {@code null}.
   * @throws IllegalStateException if the {@code Component} is disabled.
   * @throws IllegalStateException if the {@code Component} is not showing on the screen.
   */
  @NotNull
  S click(@NotNull MouseClickInfo mouseClickInfo);

  /**
   * Simulates a user double-clicking this fixture's {@code Component}.
   * 
   * @return this fixture.
   * @throws IllegalStateException if the {@code Component} is disabled.
   * @throws IllegalStateException if the {@code Component} is not showing on the screen.
   */
  @NotNull
  S doubleClick();

  /**
   * Simulates a user right-clicking this fixture's {@code Component}.
   * 
   * @return this fixture.
   * @throws IllegalStateException if the {@code Component} is disabled.
   * @throws IllegalStateException if the {@code Component} is not showing on the screen.
   */
  @NotNull
  S rightClick();
}