Search in sources :

Example 21 with Selection

use of com.dexels.navajo.document.Selection in project navajo by Dexels.

the class TestSelection method testIsSelected.

@Test
public void testIsSelected() {
    Selection selectionRet1 = NavajoFactory.getInstance().createSelection(testDoc, "firstselection", "0", true);
    Selection selectionRet2 = NavajoFactory.getInstance().createSelection(testDoc, "firstselection", "0", false);
    Assert.assertTrue(selectionRet1.isSelected());
    Assert.assertTrue(!selectionRet2.isSelected());
}
Also used : Selection(com.dexels.navajo.document.Selection) Test(org.junit.Test)

Example 22 with Selection

use of com.dexels.navajo.document.Selection in project navajo by Dexels.

the class TestSelection method testSetSelected.

@Test
public void testSetSelected() {
    Selection selection = NavajoFactory.getInstance().createSelection(testDoc, "firstselection", "0", true);
    boolean b1 = true;
    selection.setSelected(b1);
    Assert.assertEquals(selection.isSelected(), true);
}
Also used : Selection(com.dexels.navajo.document.Selection) Test(org.junit.Test)

Example 23 with Selection

use of com.dexels.navajo.document.Selection in project navajo by Dexels.

the class TestSelection method testIsSelectedWithObject1.

@Test
public void testIsSelectedWithObject1() {
    Selection selectionRet = NavajoFactory.getInstance().createSelection(testDoc, "firstselection", "0", Integer.valueOf(0));
    selectionRet.setValue("1");
    Assert.assertTrue(!selectionRet.isSelected());
}
Also used : Selection(com.dexels.navajo.document.Selection) Test(org.junit.Test)

Example 24 with Selection

use of com.dexels.navajo.document.Selection in project navajo by Dexels.

the class TestProperty method tesGetSelectionByValue.

@Test
public void tesGetSelectionByValue() {
    Property testSelectionProp = NavajoFactory.getInstance().createProperty(testDoc, "testselectionproperty", "+", "mydesc", Property.DIR_IN);
    Selection s = NavajoFactory.getInstance().createSelection(testDoc, "myselection", "0", true);
    testSelectionProp.addSelection(s);
    Selection s1 = testSelectionProp.getSelectionByValue("0");
    Assert.assertNotNull(s1);
    Assert.assertEquals(s1.getName(), s.getName());
    Assert.assertEquals(s1.isSelected(), s.isSelected());
    Assert.assertEquals(s1.getValue(), s.getValue());
    s1 = testSelectionProp.getSelectionByValue("1");
    Assert.assertNotNull(s1);
    Assert.assertEquals(Selection.DUMMY_SELECTION, s1.getName());
}
Also used : Selection(com.dexels.navajo.document.Selection) Property(com.dexels.navajo.document.Property) Test(org.junit.Test)

Example 25 with Selection

use of com.dexels.navajo.document.Selection in project navajo by Dexels.

the class TestProperty method tesSetSelected.

@Test
public void tesSetSelected() {
    Property testSelectionProp1 = NavajoFactory.getInstance().createProperty(testDoc, "testselectionproperty", "1", "mydesc", Property.DIR_IN);
    Property testSelectionProp2 = NavajoFactory.getInstance().createProperty(testDoc, "testselectionproperty", "+", "mydesc", Property.DIR_IN);
    Selection s1 = NavajoFactory.getInstance().createSelection(testDoc, "myselection1", "0", false);
    Selection s2 = NavajoFactory.getInstance().createSelection(testDoc, "myselection2", "1", false);
    Selection s3 = NavajoFactory.getInstance().createSelection(testDoc, "myselection3", "2", true);
    Selection s4 = NavajoFactory.getInstance().createSelection(testDoc, "myselection4", "3", false);
    testSelectionProp1.addSelection(s1);
    testSelectionProp1.addSelection(s2);
    testSelectionProp1.addSelection(s3);
    testSelectionProp1.addSelection(s4);
    testSelectionProp1.setSelected("0");
    Assert.assertEquals(true, s1.isSelected());
    Assert.assertTrue(!s3.isSelected());
    s1 = NavajoFactory.getInstance().createSelection(testDoc, "myselection1", "0", false);
    s2 = NavajoFactory.getInstance().createSelection(testDoc, "myselection2", "1", false);
    s3 = NavajoFactory.getInstance().createSelection(testDoc, "myselection3", "2", true);
    s4 = NavajoFactory.getInstance().createSelection(testDoc, "myselection4", "3", false);
    testSelectionProp2.addSelection(s1);
    testSelectionProp2.addSelection(s2);
    testSelectionProp2.addSelection(s3);
    testSelectionProp2.addSelection(s4);
    testSelectionProp2.setSelected("0");
    Assert.assertEquals(true, s1.isSelected());
    Assert.assertTrue(s3.isSelected());
}
Also used : Selection(com.dexels.navajo.document.Selection) Property(com.dexels.navajo.document.Property) Test(org.junit.Test)

Aggregations

Selection (com.dexels.navajo.document.Selection)78 Property (com.dexels.navajo.document.Property)36 Test (org.junit.Test)32 Message (com.dexels.navajo.document.Message)24 Navajo (com.dexels.navajo.document.Navajo)21 Access (com.dexels.navajo.script.api.Access)14 ImmutableMessage (com.dexels.immutable.api.ImmutableMessage)13 ContextExpression (com.dexels.navajo.expression.api.ContextExpression)12 TipiLink (com.dexels.navajo.expression.api.TipiLink)12 MappableTreeNode (com.dexels.navajo.script.api.MappableTreeNode)12 ArrayList (java.util.ArrayList)12 Optional (java.util.Optional)12 Operand (com.dexels.navajo.document.Operand)11 TMLExpressionException (com.dexels.navajo.expression.api.TMLExpressionException)11 List (java.util.List)8 NavajoException (com.dexels.navajo.document.NavajoException)6 UserException (com.dexels.navajo.script.api.UserException)4 Binary (com.dexels.navajo.document.types.Binary)3 FunctionClassification (com.dexels.navajo.expression.api.FunctionClassification)3 StringTokenizer (java.util.StringTokenizer)3