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

mmarquee.automation.controls.AutomationCustom Maven / Gradle / Ivy

There is a newer version: 0.7.0
Show newest version
/*
 * Copyright 2016-17 [email protected]
 *
 * 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.
 */
package mmarquee.automation.controls;

import mmarquee.automation.AutomationElement;
import mmarquee.automation.AutomationException;
import mmarquee.automation.ControlType;
import mmarquee.automation.pattern.ItemContainer;
import mmarquee.automation.pattern.PatternNotFoundException;
import mmarquee.automation.pattern.Value;

/**
 * Created by Mark Humphreys on 08/03/2016.
 *
 * Wrapper for the Custom ControlId, which is usually a container.
 */
public class AutomationCustom extends AutomationContainer implements Valueable {

    private Value valuePattern;

    /**
     * Constructor for the AutomationCustom
     * @param element The element
     * @throws AutomationException Automation library error
     * @throws PatternNotFoundException Pattern not found
     */
    public AutomationCustom (AutomationElement element) throws PatternNotFoundException, AutomationException {
        super(element);
    }

    /**
     * Constructor for the AutomationCustom
     * @param element The element
     * @param container ItemContainer pattern
     * @param value The Value pattern to use
     * @throws AutomationException Automation library error
     * @throws PatternNotFoundException Pattern not found
     */
    public AutomationCustom (AutomationElement element, ItemContainer container, Value value) throws PatternNotFoundException, AutomationException {
        super(element, container);

        this.valuePattern = value;
    }

    /**
     * Gets the value text associated with this element
     * @return The value of the item
     * @throws AutomationException Something has gone wrong
     * @throws PatternNotFoundException Failed to find pattern
     */
    public String getValue() throws AutomationException, PatternNotFoundException {
        if (this.valuePattern == null) {
            this.valuePattern = this.getValuePattern();
        }

        return this.valuePattern.value();
    }

    /**
     * Constructor for the AutomationCustom
     * @param element The element
     * @param container ItemContainer pattern
     * @throws AutomationException Automation library error
     * @throws PatternNotFoundException Pattern not found
     */
    public AutomationCustom (AutomationElement element, ItemContainer container) throws PatternNotFoundException, AutomationException {
        super(element, container);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy