Search in sources :

Example 21 with FindCriteriaValues

use of au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FindCriteriaValues in project constellation by constellation-app.

the class AdvancedSearchPlugin method searchAsColor.

/**
 * This function checks to see if a graph elements color attribute matches
 * the criteria specified by the ColourCriteriaValues.
 *
 * @param values the color criteriaValues
 * @param attributeInt the int of the attribute
 * @param currElement the currentElement
 * @param graph the current graph
 * @return
 */
private boolean searchAsColor(final FindCriteriaValues values, final int attributeInt, final int currElement, final GraphWriteMethods graph) {
    final ColourCriteriaValues colorValues = (ColourCriteriaValues) values;
    final ConstellationColor color = graph.getObjectValue(attributeInt, currElement);
    boolean matches = false;
    // if the color of the attribute matches the users color matches = true
    if (colorValues.getFilter().equals(IS) && colorValues.getColorValue().equals(color)) {
        matches = true;
    // if the color of the attribute doesnt match the users color matches = true
    } else if (colorValues.getFilter().equals(IS_NOT) && !colorValues.getColorValue().equals(color)) {
        matches = true;
    }
    return matches;
}
Also used : ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) ColourCriteriaValues(au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.ColourCriteriaValues)

Aggregations

FindCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FindCriteriaValues)15 ArrayList (java.util.ArrayList)11 Test (org.testng.annotations.Test)11 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)9 StringCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.StringCriteriaValues)9 BooleanCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.BooleanCriteriaValues)5 ColourCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.ColourCriteriaValues)5 FloatCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FloatCriteriaValues)5 AdvancedFindTab (au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab)4 AdvancedCriteriaBorderPane (au.gov.asd.tac.constellation.views.find2.components.advanced.AdvancedCriteriaBorderPane)4 StringCriteriaPanel (au.gov.asd.tac.constellation.views.find2.components.advanced.StringCriteriaPanel)4 DateTimeCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.DateTimeCriteriaValues)4 IconCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.IconCriteriaValues)4 AdvancedSearchParameters (au.gov.asd.tac.constellation.views.find2.components.advanced.utilities.AdvancedSearchParameters)4 GridPane (javafx.scene.layout.GridPane)4 FindViewController (au.gov.asd.tac.constellation.views.find2.FindViewController)3 ChoiceBox (javafx.scene.control.ChoiceBox)3 ZonedDateTime (java.time.ZonedDateTime)2 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)1 WritableGraph (au.gov.asd.tac.constellation.graph.WritableGraph)1