Search in sources :

Example 1 with AdvancedCriteriaBorderPane

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

the class FindViewTopComponent method UpdateUI.

/**
 * This calls all the necessary functions for each tab to update the
 * attributes list based on what attributes are available for the user.
 */
public void UpdateUI() {
    // Update the basic find tab
    final GraphElementType basicFindType = GraphElementType.getValue(getFindViewPane().getTabs().getBasicFindTab().getLookForChoiceBox().getSelectionModel().getSelectedItem());
    getFindViewPane().getTabs().getBasicFindTab().saveSelected(basicFindType);
    getFindViewPane().getTabs().getBasicFindTab().populateAttributes(basicFindType);
    getFindViewPane().getTabs().getBasicFindTab().updateSelectedAttributes(getFindViewPane().getTabs().getBasicFindTab().getMatchingAttributeList(basicFindType));
    // Update the replace tab
    final GraphElementType replaceType = GraphElementType.getValue(getFindViewPane().getTabs().getReplaceTab().getLookForChoiceBox().getSelectionModel().getSelectedItem());
    getFindViewPane().getTabs().getReplaceTab().saveSelected(replaceType);
    getFindViewPane().getTabs().getReplaceTab().populateAttributes(replaceType);
    getFindViewPane().getTabs().getReplaceTab().updateSelectedAttributes(getFindViewPane().getTabs().getReplaceTab().getMatchingAttributeList(replaceType));
    // Update each of the advanced find tabs criteria panes
    final GraphElementType advancedType = GraphElementType.getValue(getFindViewPane().getTabs().getAdvancedFindTab().getLookForChoiceBox().getSelectionModel().getSelectedItem());
    for (final AdvancedCriteriaBorderPane criteriaPane : getFindViewPane().getTabs().getAdvancedFindTab().getCorrespondingCriteriaList(advancedType)) {
        /**
         * set the updateUI variable to true. This avoids the change
         * criteria pane function from occurring when re selecting the
         * currently selected element after updating the attribute list
         */
        criteriaPane.setUpdateUI(true);
        criteriaPane.updateAttributesList(advancedType);
        // set the updateUI variable back to false to maintian normal
        // functionality for the change criteriapane function
        criteriaPane.setUpdateUI(false);
    }
}
Also used : GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) AdvancedCriteriaBorderPane(au.gov.asd.tac.constellation.views.find2.components.advanced.AdvancedCriteriaBorderPane)

Example 2 with AdvancedCriteriaBorderPane

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

the class AdvancedFindTab method updateGridCriteriaPanes.

/**
 * Updates the GridCriteriaPane based on the currently selected Graph
 * Element Type
 *
 * @param type
 */
private void updateGridCriteriaPanes(final GraphElementType type) {
    int i = 0;
    final List<AdvancedCriteriaBorderPane> criteriaList = getCorrespondingCriteriaList(type);
    final GridPane gridPane = getCorrespondingGridPane(type);
    // specific list
    for (final AdvancedCriteriaBorderPane criteriaPane : criteriaList) {
        gridPane.add(criteriaPane, 0, i);
        GridPane.setHgrow(criteriaPane, Priority.ALWAYS);
        i++;
    }
}
Also used : GridPane(javafx.scene.layout.GridPane) AdvancedCriteriaBorderPane(au.gov.asd.tac.constellation.views.find2.components.advanced.AdvancedCriteriaBorderPane)

Example 3 with AdvancedCriteriaBorderPane

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

the class AdvancedFindTab method addCriteriaPane.

/**
 * This adds a criteriaPane to the provided graphElement type list. The
 * initial pane will be of type string.
 *
 * @param type
 */
public void addCriteriaPane(final GraphElementType type) {
    // Retrieve the corresponding criteria list and grid pane for the type
    final List<AdvancedCriteriaBorderPane> criteriaList = getCorrespondingCriteriaList(type);
    final GridPane gridPane = getCorrespondingGridPane(type);
    // adds a new StrinCriteriaPanel to the end of the criteriaPaneList
    criteriaList.add(new StringCriteriaPanel(this, "Identifier", getSelectedGraphElementType()));
    gridPane.add(criteriaList.get(criteriaList.size() - 1), 0, gridPane.getRowCount());
    GridPane.setHgrow(criteriaList.get(criteriaList.size() - 1), Priority.ALWAYS);
    // update the grid colours to match the new list order
    updateGridColours(type);
}
Also used : GridPane(javafx.scene.layout.GridPane) StringCriteriaPanel(au.gov.asd.tac.constellation.views.find2.components.advanced.StringCriteriaPanel) AdvancedCriteriaBorderPane(au.gov.asd.tac.constellation.views.find2.components.advanced.AdvancedCriteriaBorderPane)

Example 4 with AdvancedCriteriaBorderPane

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

the class BooleanCriteriaPanelNGTest method testGetCriteriaValues.

/**
 * Test of getCriteriaValues method, of class BooleanCriteriaPanel.
 */
@Test
public void testGetCriteriaValues() {
    System.out.println("getCriteriaValues");
    setupGraph();
    AdvancedFindTab parentComponent = spy(advancedTab);
    final GraphElementType type = GraphElementType.VERTEX;
    BooleanCriteriaPanel booleanCriteriaPanel = new BooleanCriteriaPanel(parentComponent, "dim", type);
    final List<AdvancedCriteriaBorderPane> tempList = new ArrayList<>();
    final GridPane tempGrid = new GridPane();
    tempList.add(booleanCriteriaPanel);
    tempGrid.add(tempList.get(0), 0, 0);
    when(parentComponent.getCorrespondingCriteriaList(Mockito.eq(type))).thenReturn(tempList);
    when(parentComponent.getCorrespondingGridPane(Mockito.eq(type))).thenReturn(tempGrid);
    final List<AdvancedCriteriaBorderPane> criteriaList = parentComponent.getCorrespondingCriteriaList(type);
    final FindCriteriaValues result = criteriaList.get(0).getCriteriaValues();
    final BooleanCriteriaValues boolResult = (BooleanCriteriaValues) result;
    assertEquals(boolResult.getAttribute(), "dim");
    assertEquals(boolResult.getAttributeType(), "boolean");
    assertEquals(boolResult.getFilter(), "Is");
    assertEquals(boolResult.getBoolValue(), true);
}
Also used : FindCriteriaValues(au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FindCriteriaValues) GridPane(javafx.scene.layout.GridPane) AdvancedFindTab(au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab) ArrayList(java.util.ArrayList) BooleanCriteriaValues(au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.BooleanCriteriaValues) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) Test(org.testng.annotations.Test)

Example 5 with AdvancedCriteriaBorderPane

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

the class AdvancedFindTabNGTest method testGetCriteriaValues.

/**
 * Test of getCriteriaValues method, of class AdvancedFindTab.
 */
@Test
public void testGetCriteriaValues() {
    System.out.println("getCriteriaValues");
    setupGraph();
    GraphElementType type = GraphElementType.VERTEX;
    List<AdvancedCriteriaBorderPane> criteriaList = new ArrayList<>();
    AdvancedCriteriaBorderPane pane1 = new StringCriteriaPanel(advancedTab, "Identifier", type);
    AdvancedCriteriaBorderPane pane2 = new StringCriteriaPanel(advancedTab, "Label", type);
    criteriaList.add(pane1);
    criteriaList.add(pane2);
    List<FindCriteriaValues> resultsList = advancedTab.getCriteriaValues(criteriaList);
    assertEquals(resultsList.get(0).getAttribute(), "Identifier");
    assertEquals(resultsList.get(1).getAttribute(), "Label");
}
Also used : FindCriteriaValues(au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FindCriteriaValues) ArrayList(java.util.ArrayList) StringCriteriaPanel(au.gov.asd.tac.constellation.views.find2.components.advanced.StringCriteriaPanel) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType) AdvancedCriteriaBorderPane(au.gov.asd.tac.constellation.views.find2.components.advanced.AdvancedCriteriaBorderPane) Test(org.testng.annotations.Test)

Aggregations

AdvancedCriteriaBorderPane (au.gov.asd.tac.constellation.views.find2.components.advanced.AdvancedCriteriaBorderPane)10 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)9 ArrayList (java.util.ArrayList)9 FindCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FindCriteriaValues)8 GridPane (javafx.scene.layout.GridPane)8 Test (org.testng.annotations.Test)8 StringCriteriaPanel (au.gov.asd.tac.constellation.views.find2.components.advanced.StringCriteriaPanel)5 AdvancedFindTab (au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab)4 StringCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.StringCriteriaValues)4 FindViewController (au.gov.asd.tac.constellation.views.find2.FindViewController)3 ChoiceBox (javafx.scene.control.ChoiceBox)3 Attribute (au.gov.asd.tac.constellation.graph.Attribute)1 BooleanCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.BooleanCriteriaValues)1 ColourCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.ColourCriteriaValues)1 FloatCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FloatCriteriaValues)1