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);
}
}
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++;
}
}
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);
}
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);
}
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");
}
Aggregations