use of au.gov.asd.tac.constellation.views.find2.utilities.BasicFindReplaceParameters in project constellation by constellation-app.
the class ResetStatePluginNGTest method setupGraph.
private void setupGraph() {
graph = new DualGraph(SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema());
try {
WritableGraph wg = graph.getWritableGraph("", true);
final int stateId = FindViewConcept.MetaAttribute.FINDVIEW_STATE.ensure(wg);
ArrayList<Attribute> attributeList = new ArrayList<>();
BasicFindReplaceParameters parameters = new BasicFindReplaceParameters("label name", "", GraphElementType.GRAPH.VERTEX, attributeList, true, false, false, false, false, false, false, false, false);
FindResultsList foundResult = new FindResultsList(2, parameters, graph.getId());
wg.setObjectValue(stateId, 0, foundResult);
wg.commit();
} catch (final InterruptedException ex) {
Exceptions.printStackTrace(ex);
Thread.currentThread().interrupt();
}
}
use of au.gov.asd.tac.constellation.views.find2.utilities.BasicFindReplaceParameters in project constellation by constellation-app.
the class FindViewControllerNGTest method testUpdateBasicReplaceParameters.
/**
* Test of updateBasicReplaceParameters method, of class FindViewController.
*/
@Test
public void testUpdateBasicReplaceParameters() {
System.out.println("updateBasicReplaceParameters");
FindViewController instance = FindViewController.getDefault();
List<Attribute> attributeList = new ArrayList<>();
instance.updateBasicReplaceParameters(parameters);
BasicFindReplaceParameters result = instance.getCurrentBasicReplaceParameters();
// The object is copied in the updateBasicFindParameters function
// This will cause a direct comparison of the object to be false
assertEquals(result, parameters);
assertNotEquals(result, parameters2);
}
use of au.gov.asd.tac.constellation.views.find2.utilities.BasicFindReplaceParameters in project constellation by constellation-app.
the class FindViewControllerNGTest method testGetCurrentBasicFindParameters.
/**
* Test of getCurrentBasicFindParameters method, of class
* FindViewController.
*/
@Test
public void testGetCurrentBasicFindParameters() {
System.out.println("getCurrentBasicFindParameters");
final FindViewTopComponent findViewTopComponent = mock(FindViewTopComponent.class);
FindViewController instance = FindViewController.getDefault().init(findViewTopComponent);
/**
* Check getting getCurrentBasicReplaceParamters returns the default
* parameters
*/
BasicFindReplaceParameters defaultParameters = new BasicFindReplaceParameters();
instance.updateBasicFindParameters(defaultParameters);
assertEquals(instance.getCurrentBasicFindParameters(), defaultParameters);
/**
* Check getting getCurrentBasicReplaceParamters returns the matching
* parameters of what it was set to
*/
instance.updateBasicFindParameters(parameters);
assertEquals(instance.getCurrentBasicFindParameters(), parameters);
}
use of au.gov.asd.tac.constellation.views.find2.utilities.BasicFindReplaceParameters in project constellation by constellation-app.
the class ReplaceTab method updateBasicReplaceParamters.
/**
* Reads the find text, element type, attributes selected, standard text
* selection, regEx selection, ignore case selection, exact match selected
* and search all graphs selection and passes them to the controller to
* create a BasicFindReplaceParameter
*/
public void updateBasicReplaceParamters() {
// get the currently selected graphElementType
final GraphElementType elementType = GraphElementType.getValue(lookForChoiceBox.getSelectionModel().getSelectedItem());
// get the matching attributeList
final List<Attribute> attributeList = new ArrayList<>(getMatchingAttributeList(elementType));
boolean replaceIn = false;
// determine what currentSelectionChoiceBox option is selected
if (currentSelectionChoiceBox.getSelectionModel().getSelectedIndex() == 1) {
replaceIn = true;
}
// Create the paramters with the current UI selections
final BasicFindReplaceParameters parameters = new BasicFindReplaceParameters(findTextField.getText(), replaceTextField.getText(), elementType, attributeList, standardRadioBtn.isSelected(), regExBtn.isSelected(), ignoreCaseCB.isSelected(), exactMatchCB.isSelected(), false, false, false, replaceIn, searchAllGraphs.isSelected());
// Update the basic replace paramters with the newly created parameter
FindViewController.getDefault().updateBasicReplaceParameters(parameters);
}
use of au.gov.asd.tac.constellation.views.find2.utilities.BasicFindReplaceParameters in project constellation by constellation-app.
the class BasicFindTab method updateBasicFindParamters.
/**
* Reads the find text, element type, attributes selected, standard text
* selection, regEx selection, ignore case selection, exact match selected
* and search all graphs selection and passes them to the controller to
* create a BasicFindReplaceParameter
*/
public void updateBasicFindParamters() {
final GraphElementType elementType = GraphElementType.getValue(lookForChoiceBox.getSelectionModel().getSelectedItem());
final List<Attribute> attributeList = new ArrayList<>(getMatchingAttributeList(elementType));
boolean addTo = false;
boolean removeFrom = false;
boolean findIn = false;
// to true
switch(currentSelectionChoiceBox.getSelectionModel().getSelectedIndex()) {
case 0:
break;
case 1:
addTo = true;
break;
case 2:
findIn = true;
break;
case 3:
removeFrom = true;
break;
default:
break;
}
// creates a new basicFindReplaceParameter with the currently selected
// UI parameters
final BasicFindReplaceParameters parameters = new BasicFindReplaceParameters(findTextField.getText(), "", elementType, attributeList, standardRadioBtn.isSelected(), regExBtn.isSelected(), ignoreCaseCB.isSelected(), exactMatchCB.isSelected(), findIn, addTo, removeFrom, false, searchAllGraphs.isSelected());
FindViewController.getDefault().updateBasicFindParameters(parameters);
}
Aggregations