/** @generated */
 private RotatableDecoration createTargetDecoration() {
   PolylineDecoration df = new PolylineDecoration();
   df.setFill(true);
   df.setFillXOR(false);
   df.setOutline(true);
   df.setOutlineXOR(false);
   df.setLineWidth(1);
   df.setLineStyle(Graphics.LINE_SOLID);
   return df;
 }
示例#2
0
 /**
  * Create a decoration for the navigeable association
  *
  * @return the new decoration
  */
 private PolylineDecoration createNavigableDecoration() {
   PolylineDecoration decoration = new PolylineDecoration();
   decoration.setScale(10, 5);
   return decoration;
 }
  /**
   * @param connection the PolylineConnection
   * @generated
   */
  private void createTargetDecoration(PolylineConnection connection) {

    PolylineDecoration decoration = new PolylineDecoration();
    decoration.setScale(10, 5);
    connection.setTargetDecoration(decoration);
  }
  /**
   *
   *
   * <pre>
   * {@inheritDoc}
   *
   * This method override parent implementation to add a new set of
   * predefined decoration type.
   *
   * The arrowType available constants are given in {@link EdgeDecorationType}.
   * </pre>
   */
  @Override
  protected RotatableDecoration getArrowDecoration(int arrowType) {
    RotatableDecoration decoration = null;
    int width = getLineWidth();
    if (width < 0) {
      width = 1;
    }
    if (arrowType == EdgeDecorationType.OPEN_ARROW) {
      IMapMode mm = getMapMode();
      decoration = new PolylineDecoration();
      ((PolylineDecoration) decoration).setScale(mm.DPtoLP(15 + width), mm.DPtoLP(5 + width));
      ((PolylineDecoration) decoration).setTemplate(PolylineDecoration.TRIANGLE_TIP);
      ((PolylineDecoration) decoration).setLineWidth(mm.DPtoLP(width));

    } else if (arrowType == EdgeDecorationType.SOLID_ARROW_FILLED) {
      IMapMode mm = getMapMode();
      decoration = new PolygonDecoration();
      ((PolygonDecoration) decoration).setScale(mm.DPtoLP(15 + width), mm.DPtoLP(5 + width));
      ((PolygonDecoration) decoration).setTemplate(PolygonDecoration.TRIANGLE_TIP);
      ((PolygonDecoration) decoration).setLineWidth(mm.DPtoLP(width));
      ((PolygonDecoration) decoration).setFill(true);

    } else if (arrowType == EdgeDecorationType.SOLID_ARROW_EMPTY) {
      IMapMode mm = getMapMode();
      decoration = new PolygonDecoration();
      ((PolygonDecoration) decoration).setScale(mm.DPtoLP(15 + width), mm.DPtoLP(5 + width));
      ((PolygonDecoration) decoration).setTemplate(PolygonDecoration.TRIANGLE_TIP);
      ((PolygonDecoration) decoration).setLineWidth(mm.DPtoLP(width));

      // Not really empty... filled with white color.
      ((PolygonDecoration) decoration).setFill(true);
      ((PolygonDecoration) decoration).setBackgroundColor(ColorConstants.white);

    } else if (arrowType == EdgeDecorationType.SOLID_DIAMOND_FILLED) {
      IMapMode mm = getMapMode();
      decoration = new PolygonDecoration();
      ((PolygonDecoration) decoration).setScale(mm.DPtoLP(12 + width), mm.DPtoLP(6 + width));

      PointList diamondPointList = new PointList();
      diamondPointList.addPoint(0, 0);
      diamondPointList.addPoint(-1, 1);
      diamondPointList.addPoint(-2, 0);
      diamondPointList.addPoint(-1, -1);

      ((PolygonDecoration) decoration).setTemplate(diamondPointList);
      ((PolygonDecoration) decoration).setLineWidth(mm.DPtoLP(width));
      ((PolygonDecoration) decoration).setFill(true);

    } else if (arrowType == EdgeDecorationType.SOLID_DIAMOND_EMPTY) {
      IMapMode mm = getMapMode();
      decoration = new PolygonDecoration();
      ((PolygonDecoration) decoration).setScale(mm.DPtoLP(12 + width), mm.DPtoLP(6 + width));

      PointList diamondPointList = new PointList();
      diamondPointList.addPoint(0, 0);
      diamondPointList.addPoint(-1, 1);
      diamondPointList.addPoint(-2, 0);
      diamondPointList.addPoint(-1, -1);

      ((PolygonDecoration) decoration).setTemplate(diamondPointList);
      ((PolygonDecoration) decoration).setLineWidth(mm.DPtoLP(width));

      // Not really empty... filled with white color.
      ((PolygonDecoration) decoration).setFill(true);
      ((PolygonDecoration) decoration).setBackgroundColor(ColorConstants.white);
    }

    return decoration;
  }