Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.TreePath


  @Test
  public void convertShouldReturnTheDurationInMillisecondsIfTheLastSegmentOfThePathIsADuration()
      throws Exception {
    long expectedMillis = 19L;
    TreePath path = new TreePath(new Object[]{"a", new Duration(expectedMillis)});
    assertThat(converter.convert(path), is(expectedMillis));
  }
View Full Code Here


    assertThat(converter.convert(path), is(expectedMillis));
  }

  @Test
  public void convertShouldReturn0IfTheDurationElementIsNotTheLastSegmentOfThePath() {
    TreePath path = new TreePath(new Object[]{new Duration(10L), "a"});
    assertThat(converter.convert(path), is(0L));
  }
View Full Code Here

    assertThat(converter.convert(path), is(0L));
  }

  @Test
  public void convertShouldReturn0IfThePathDoesNotContainADuration() {
    TreePath path = new TreePath(new Object[]{"a", "1"});
    assertThat(converter.convert(path), is(0L));
  }
View Full Code Here

      @Override
      public String answer(InvocationOnMock invocation) throws Throwable {
        return text[0];
      }
    });
    given(row.getTreePath()).willReturn(new TreePath(new Object[]{element}));

    doAnswer(new Answer<Void>() {
      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        background[0] = (Color) invocation.getArguments()[1];
View Full Code Here

      @Override
      public String answer(InvocationOnMock invocation) throws Throwable {
        return text[0];
      }
    });
    given(row.getTreePath()).willReturn(new TreePath(new Object[]{element}));

    doAnswer(new Answer<Void>() {
      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        background[0] = (Color) invocation.getArguments()[1];
View Full Code Here

    assertThat(create().getValue(null), is(Long.valueOf(0)));
  }

  @Test
  public void getValueShouldReturnTheSumOfTheChildrenValueForAParentPath() {
    TreePath leaf1 = new TreePath(new Object[]{"1", "2", "3"});
    TreePath leaf2 = new TreePath(new Object[]{"1", "2", "4"});
    TreePath leaf3 = new TreePath(new Object[]{"1", "5", "6"});
    TreePath parentOf1n2 = new TreePath(new Object[]{"1", "2"});
    TreePath parentOfAll = new TreePath(new Object[]{"1"});

    @SuppressWarnings("unchecked")
    IConverter<TreePath> converter = mock(IConverter.class);
    given(converter.convert(leaf1)).willReturn(Long.valueOf(1));
    given(converter.convert(leaf2)).willReturn(Long.valueOf(2));
View Full Code Here

    assertThat(values.getValue(parentOfAll), equalTo(value));
  }

  @Test
  public void getValueShouldReturnTheValueOfALeafPathSuppliedByTheConverter() {
    TreePath leaf = new TreePath(new Object[]{""});
    long value = 123;

    @SuppressWarnings("unchecked")
    IConverter<TreePath> c = mock(IConverter.class);
    given(c.convert(leaf)).willReturn(Long.valueOf(value));
View Full Code Here

    //  \        \
    //   \         4  // Value of this path = 10
    //    \
    //     2 - 2 - 2  // Value of this path = 2
    // @formatter:on
    TreePath leaf1 = new TreePath(new Object[]{"1", "2", "3"});
    TreePath leaf2 = new TreePath(new Object[]{"1", "2", "4"});
    TreePath leaf3 = new TreePath(new Object[]{"2", "2", "2"});

    // And elements belong to the same category:
    ICategory category = mock(ICategory.class);
    ICategorizer categorizer = mock(ICategorizer.class);
    given(categorizer.getCategory("2")).willReturn(category);
View Full Code Here

    //  \        \
    //   \         4  // Value of this path = 10
    //    \
    //     2 - 2 - 2  // Value of this path = 2
    // @formatter:on
    TreePath leaf1 = new TreePath(new Object[]{"1", "2", "3"});
    TreePath leaf2 = new TreePath(new Object[]{"1", "2", "4"});
    TreePath leaf3 = new TreePath(new Object[]{"2", "2", "2"});

    // And element "2" belongs to a different category:
    ICategory theCategory = mock(ICategory.class);
    ICategory tmpCategory = mock(ICategory.class);
    ICategorizer categorizer = mock(ICategorizer.class);
View Full Code Here

  }

  @Test
  public void setMaxValueWithCategoryShouldCalculateTheCorrectValue_2() {
    // Given our tree has only one path:
    TreePath leaf1 = new TreePath(new Object[]{"1", "2", "3"});

    // And the value of this path is 100:
    @SuppressWarnings("unchecked")
    IConverter<TreePath> converter = mock(IConverter.class);
    given(converter.convert(leaf1)).willReturn(Long.valueOf(100));
View Full Code Here

TOP

Related Classes of org.eclipse.jface.viewers.TreePath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.