Examples of AnnotationStyle


Examples of org.apache.uima.caseditor.editor.AnnotationStyle

     
      AnnotationTypeNode typeNode = (AnnotationTypeNode) element;
     
      Type type = typeNode.getAnnotationType();
     
      AnnotationStyle style = editor.getAnnotationStyle(type);
     
      return new Color(Display.getCurrent(), style.getColor().getRed(),
              style.getColor().getGreen(), style.getColor().getBlue());
    }
View Full Code Here

Examples of org.apache.uima.caseditor.editor.AnnotationStyle

      typeNameToColorMap.remove(style.getAnnotation());
      newStyles.add(style);
    }
   
    for (Map.Entry<String, Color> entry : typeNameToColorMap.entrySet()) {
      newStyles.add(new AnnotationStyle(entry.getKey(), AnnotationStyle.Style.BACKGROUND,
              entry.getValue(), 0));
    }
   
    return Collections.unmodifiableSet(newStyles);
  }
View Full Code Here

Examples of org.apache.uima.caseditor.editor.AnnotationStyle

   *
   * @param type
   * @return the requested style or null if none
   */
  public AnnotationStyle getAnnotation(Type type) {
    AnnotationStyle style = mStyleMap.get(type.getName());

    if (style == null) {
      style = new AnnotationStyle(type.getName(), AnnotationStyle.DEFAULT_STYLE,
              AnnotationStyle.DEFAULT_COLOR, 0);
    }

    return style;
  }
View Full Code Here

Examples of org.apache.uima.caseditor.editor.AnnotationStyle

    }
  }

  private Image updateIcon(Type type) {
    AnnotationStyle style = editor.getAnnotationStyle(type);
    Color fg = new Color(Display.getCurrent(), 0, 0, 0);
    Color bg = new Color(Display.getCurrent(), style.getColor().getRed(), style.getColor()
            .getGreen(), style.getColor().getBlue());

    PaletteData paletteData = new PaletteData(new RGB[] { bg.getRGB(), fg.getRGB() });
    ImageData imageData = new ImageData(40, 40, 1, paletteData);

    Image image = new Image(Display.getCurrent(), imageData);
    GC gc = new GC(image);

    String styleString = style.getStyle().name().substring(0, 2);
    Point p = gc.stringExtent(styleString);

    gc.dispose();
    image.dispose();
View Full Code Here

Examples of org.apache.uima.caseditor.editor.AnnotationStyle

      typeNameToColorMap.remove(style.getAnnotation());
      newStyles.add(style);
    }
   
    for (Map.Entry<String, Color> entry : typeNameToColorMap.entrySet()) {
      newStyles.add(new AnnotationStyle(entry.getKey(), AnnotationStyle.Style.BACKGROUND,
              entry.getValue(), 0));
    }
   
    return Collections.unmodifiableSet(newStyles);
  }
View Full Code Here

Examples of org.apache.uima.caseditor.editor.AnnotationStyle

  /**
   * Tests the {@link AnnotationStyle#equals(Object)} method.
   */
  @Test
  public void testEquals() {
    AnnotationStyle a = new AnnotationStyle("testType", AnnotationStyle.Style.BRACKET, new Color(
            255, 255, 0), 0);

    AnnotationStyle b = new AnnotationStyle("testType", AnnotationStyle.Style.BRACKET, new Color(
            255, 255, 0), 0);

    assertEquals(a, b);
  }
View Full Code Here

Examples of org.apache.uima.caseditor.editor.AnnotationStyle

  /**
   * Test the {@link AnnotationStyle#hashCode()} method.
   *
   */
  public void testHashCode() {
    AnnotationStyle a = new AnnotationStyle("testType", AnnotationStyle.Style.BRACKET, new Color(
            255, 255, 0), 0);

    AnnotationStyle b = new AnnotationStyle("testType", AnnotationStyle.Style.BRACKET, new Color(
            255, 255, 0), 0);

    assertEquals(a.hashCode(), b.hashCode());
  }
View Full Code Here

Examples of org.apache.uima.caseditor.editor.AnnotationStyle

  @Test
  public void testSerializeAndCreate() throws CoreException {
    DotCorpus original = new DotCorpus();
    original.setTypeSystemFilename("typesystem");
    original.addCasProcessorFolder("uima processor folder");
    original.setStyle(new AnnotationStyle("test", Style.BRACKET, new Color(255, 255, 0), 0));
    original.addCorpusFolder("corpus");

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    DotCorpusSerializer.serialize(original, out);
View Full Code Here

Examples of org.apache.uima.caseditor.editor.AnnotationStyle

    IStructuredSelection selection = (IStructuredSelection) mTypeList.getSelection();

    Type selectedType = (Type) selection.getFirstElement();

    return new AnnotationStyle(selectedType.getName(), AnnotationStyle.DEFAULT_STYLE,
            AnnotationStyle.DEFAULT_COLOR, mCurrentSelectedAnnotation.getLayer());
  }
View Full Code Here

Examples of org.apache.uima.caseditor.editor.AnnotationStyle

  private void itemSelected() {
    IStructuredSelection selection = (IStructuredSelection) mTypeList.getSelection();

    Type selectedType = (Type) selection.getFirstElement();

    AnnotationStyle style = mDotCorpusElement.getAnnotation(selectedType);

    mCurrentSelectedAnnotation = style;

    if (style == null) {
      style = new AnnotationStyle(selectedType.getName(), AnnotationStyle.DEFAULT_STYLE,
              AnnotationStyle.DEFAULT_COLOR, mCurrentSelectedAnnotation.getLayer());
    }

    mStyleCombo.setText(style.getStyle().name());
    mStyleCombo.setEnabled(true);

    Color color = style.getColor();
    mColorSelector.setColorValue(new RGB(color.getRed(), color.getGreen(), color.getBlue()));
    mColorSelector.setEnabled(true);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.