Package org.eclipse.jst.pagedesigner.css2.layout

Examples of org.eclipse.jst.pagedesigner.css2.layout.CSSTextFigure


   * @return the associated css style for this text node
   */
  public ICSSStyle getCSSStyle() {
    IFigure figure1 = this.getFigure();
    if (figure1 instanceof ICSSFigure) {
      ICSSStyle style = ((ICSSFigure) figure1).getCSSStyle();
      if (style != null) {
        return style;
      }
    }
    return DefaultStyle.getInstance();
View Full Code Here


   *
   * @return the text data
   * @see org.eclipse.jst.pagedesigner.viewer.DesignPosition
   */
  public String getTextData() {
    ICSSStyle style = getCSSStyle();
    String data = _cachedData;
    if (style.getStyleProperty(ICSSPropertyID.ATTR_WHITESPACE) != ICSSPropertyID.VAL_PRE) {
      return HTMLUtil.compactWhitespaces(_textNode, data);
    }
        return data;
  }
View Full Code Here

   * @see org.eclipse.jst.pagedesigner.figurehandler.IFigureHandler#updateFigure(org.w3c.dom.Element,
   *      org.eclipse.jst.pagedesigner.css2.layout.CSSFigure)
   */
  public void updateFigure(Element node, CSSFigure oldFigure) {
    setCurrentFigure(oldFigure);
    ICSSStyle style = getCSSStyle(node);
    oldFigure.setCSSStyle(style);
  }
View Full Code Here

   * @param propertyName
   * @return the result value
   */
  protected Object getParentResultValue(ICSSPropertyMeta meta,
      String propertyName) {
    ICSSStyle style = getParentStyle();
    return style.getStyleProperty(propertyName);
  }
View Full Code Here

    if (_parentStyle != null) {
      return _parentStyle;
    }
    Node node = _element.getParentNode();
    while (node instanceof Element && node instanceof INodeNotifier) {
      ICSSStyle parentStyle = (ICSSStyle) ((INodeNotifier) node)
          .getAdapterFor(ICSSStyle.class);
      if (parentStyle != null) {
        return parentStyle;
      }
            node = node.getParentNode();
View Full Code Here

  public boolean isInSelection() {
    IRangeSelectionProxy proxy = (IRangeSelectionProxy) getAdapter(IRangeSelectionProxy.class);
    if (proxy != null) {
      return proxy.isRangeSelected();
    }
    ICSSStyle parentStyle = getParentStyle();
    if (parentStyle != null) {
      return parentStyle.isInSelection();
    }
    return false;
  }
View Full Code Here

  /**
   * @return
   */
  private int getDefaultHeight() {
    ICSSStyle style = this.getCSSStyle();
    if (style == null) {
      style = DefaultStyle.getInstance();
    }
    ICSSFont font = style.getCSSFont();
    Font swtfont = font.getSwtFont();
    int fontSize = FigureUtilities.getFontMetrics(swtfont).getHeight();
    return fontSize + VERTICAL_INCREMENT;
  }
View Full Code Here

  /**
   * @return the default width
   */
  public int getDefaultWidth() {
    ICSSStyle style = this.getCSSStyle();
    if (style == null) {
      style = DefaultStyle.getInstance();
    }
    return computeWidth(style.getCSSFont());
  }
View Full Code Here

   *      org.eclipse.draw2d.geometry.Rectangle)
   */
  public void paintFigure(Graphics g, Rectangle rect) {
    String value = getValue();
    if (value != null) {
      ICSSStyle style = this.getCSSStyle();
      if (style == null) {
        style = DefaultStyle.getInstance();
      }
      Object textAlign = style
          .getStyleProperty(ICSSPropertyID.ATTR_TEXTALIGN);

      Font font = style.getCSSFont().getSwtFont();
      g.setFont(font);

      Color newColor = null;
      Object color = style.getColor();
      if (color instanceof Color) {
        g.setForegroundColor((Color) color);
      } else if (color instanceof RGB) {
        newColor = new Color(Display.getCurrent(), (RGB) color);
        g.setForegroundColor(newColor);
View Full Code Here

   * @return the default width
   */
  public int getDefaultWidth() {
    int longestStringWidth = 0;
    if (_options != null) {
      ICSSStyle style = this.getCSSStyle();
      if (style == null) {
        style = DefaultStyle.getInstance();
      }
      ICSSFont font = style.getCSSFont();
      Font swtFont = font.getSwtFont();
      for (int i = 0; i < _options.length; i++) {
        int width = FigureUtilities.getTextWidth(_options[i], swtFont);
        if (width > longestStringWidth) {
          longestStringWidth = width;
View Full Code Here

TOP

Related Classes of org.eclipse.jst.pagedesigner.css2.layout.CSSTextFigure

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.