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

com.objogate.wl.swing.probe.ComponentManipulatorProbe Maven / Gradle / Ivy

The newest version!
package com.objogate.wl.swing.probe;

import java.awt.Component;
import org.hamcrest.Description;
import com.objogate.wl.Probe;
import com.objogate.wl.swing.ComponentFinder;
import com.objogate.wl.swing.ComponentManipulation;

public class ComponentManipulatorProbe implements Probe {
    private final ComponentFinder finder;
    private final ComponentManipulation manipulation;

    public ComponentManipulatorProbe(ComponentFinder finder, ComponentManipulation manipulation) {
        this.finder = finder;
        this.manipulation = manipulation;
    }

    public void probe() {
        finder.probe();
        if (finder.isSatisfied()) {
            for (T component : finder.components()) {
                manipulation.manipulate(component);
            }
        }
    }

    public boolean isSatisfied() {
        return finder.isSatisfied();
    }

    public void describeTo(Description description) {
        finder.describeTo(description);
    }

    public void describeFailureTo(Description description) {
        finder.describeFailureTo(description);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy