Examples of TextProperties


Examples of org.gephi.graph.api.TextProperties

        }

        @Override
        public void drawTextNode(NodeModel objectModel) {
            Node node = objectModel.getNode();
            TextProperties textData = (TextProperties) node.getTextProperties();
            if (textData != null) {
                String txt = textData.getText();
                if (nodeRefresh) {
                    txt = buildText(node, objectModel, model.getNodeTextColumns());
                    if (txt == null || txt.isEmpty()) {
                        return;
                    }
                    Rectangle2D r = renderer.getBounds(txt);
                    objectModel.setTextBounds(r);
                }
                model.colorMode.textNodeColor(this, objectModel);
                float sizeFactor = textData.getSize() * model.sizeMode.getSizeFactor3d(model.nodeSizeFactor, objectModel);

                float width = sizeFactor * objectModel.getTextWidth();
                float height = sizeFactor * objectModel.getTextHeight();
                float posX = node.x() + (float) width / -2 * sizeFactor;
                float posY = node.y() + (float) height / -2 * sizeFactor;
 
View Full Code Here

Examples of org.gephi.graph.api.TextProperties

        }

        @Override
        public void drawTextEdge(EdgeModel objectModel) {
            Edge edge = objectModel.getEdge();
            TextProperties textData = (TextProperties) edge.getTextProperties();
            if (textData != null) {
                String txt = textData.getText();
                if (edgeRefresh) {
                    txt = buildText(edge, objectModel, model.getEdgeTextColumns());
                    if (txt == null || txt.isEmpty()) {
                        return;
                    }
View Full Code Here

Examples of org.gephi.graph.api.TextProperties

        }

        @Override
        public void drawTextNode(NodeModel objectModel) {
            Node node = objectModel.getNode();
            TextProperties textData = (TextProperties) node.getTextProperties();
            if (textData != null) {
                String txt = textData.getText();
                if (nodeRefresh) {
                    txt = buildText(node, objectModel, model.getNodeTextColumns());
                    if (txt == null || txt.isEmpty()) {
                        return;
                    }
                    Rectangle2D r = renderer.getBounds(txt);
                    objectModel.setTextBounds(r);
                }
                model.colorMode.textNodeColor(this, objectModel);
                float sizeFactor = textData.getSize() * model.sizeMode.getSizeFactor2d(model.nodeSizeFactor, objectModel);
                if (sizeFactor * renderer.getCharWidth('a') < PIXEL_LIMIT) {
                    return;
                }
                Rectangle2D r = renderer.getBounds(txt);
                float posX = objectModel.getViewportX() + (float) r.getWidth() / -2 * sizeFactor;
 
View Full Code Here

Examples of org.gephi.graph.api.TextProperties

        }

        @Override
        public void drawTextEdge(EdgeModel objectModel) {
            Edge edge = objectModel.getEdge();
            TextProperties textData = (TextProperties) edge.getTextProperties();
            if (textData != null) {
                String txt = textData.getText();
                if (edgeRefresh) {
                    txt = buildText(edge, objectModel, model.getEdgeTextColumns());
                    if (txt == null || txt.isEmpty()) {
                        return;
                    }
View Full Code Here

Examples of org.gephi.graph.api.TextProperties

    @Override
    public Item[] getItems(Graph graph, AttributeModel attributeModel) {

        boolean useTextData = false;
        for (Node n : graph.getNodes()) {
            TextProperties textData = n.getTextProperties();
            if (textData != null && textData.getText() != null && !textData.getText().isEmpty()) {
                useTextData = true;
            }
        }

        //Build text
        VisualizationController vizController = Lookup.getDefault().lookup(VisualizationController.class);
        Column[] nodeColumns = vizController != null ? vizController.getNodeTextColumns() : null;

        List<Item> items = new ArrayList<Item>();
        for (Node n : graph.getNodes()) {
            NodeLabelItem labelItem = new NodeLabelItem(n);
            String label = getLabel(n, nodeColumns, graph.getView());
            labelItem.setData(NodeLabelItem.LABEL, label);
            TextProperties textData = n.getTextProperties();
            if (textData != null && useTextData) {
                if (textData.getR() != -1) {
                    labelItem.setData(NodeLabelItem.COLOR, new Color((int) (textData.getR() * 255),
                            (int) (textData.getG() * 255),
                            (int) (textData.getB() * 255),
                            (int) (textData.getAlpha() * 255)));
                }
//                labelItem.setData(NodeLabelItem.WIDTH, textData.getWidth());
//                labelItem.setData(NodeLabelItem.HEIGHT, textData.getHeight());
                labelItem.setData(NodeLabelItem.SIZE, textData.getSize());
                labelItem.setData(NodeLabelItem.VISIBLE, textData.isVisible());
                labelItem.setData(NodeLabelItem.LABEL, textData.getText());
                if (textData.isVisible() && label != null && !label.isEmpty()) {
                    items.add(labelItem);
                }
            } else if (label != null && !label.isEmpty()) {
                items.add(labelItem);
            }
View Full Code Here

Examples of org.odftoolkit.simple.style.TextProperties

   *            - script type
   * @return the country information for a specific script type
   */
  public String getCountry(ScriptType type) {
    String country = null;
    TextProperties textProperties = getTextPropertiesForRead();
    if (textProperties != null) {
      country = textProperties.getCountry(type);
    }
    if (country != null && country.length() > 0) {
      return country;
    }

    boolean isDefault = isUseDefaultStyle;
    OdfStyleBase parentStyle = null;
    if (!isDefault) {
      parentStyle = getParentStyle((OdfStyle) getCurrentUsedStyle());
    }
    while ((!isDefault) && (parentStyle != null)) {
      TextProperties parentStyleSetting = TextProperties.getTextProperties(parentStyle);
      country = parentStyleSetting.getCountry(type);
      if (country != null && country.length() > 0) {
        return country;
      }
      if (parentStyle instanceof OdfDefaultStyle) {
        isDefault = true;
      } else {
        parentStyle = getParentStyle((OdfStyle) parentStyle);
      }
    }
    if (!isDefault) {
      OdfDefaultStyle defaultStyle = getParagraphDefaultStyle();
      TextProperties defaultStyleSetting = TextProperties.getTextProperties(defaultStyle);
      country = defaultStyleSetting.getCountry(type);
    }
    return country;
  }
View Full Code Here

Examples of org.odftoolkit.simple.style.TextProperties

   * @return the font definition for a specific script type
   */
  public Font getFont(ScriptType type) {
    // A font includes font family name, font style, font color, font size
    Font font = null;
    TextProperties textProperties = getTextPropertiesForRead();
    if (textProperties != null) {
      font = textProperties.getFont(type);
    } else {
      font = new Font(null, null, 0, (StyleTypeDefinitions.TextLinePosition) null);
    }

    if (font != null && font.getFamilyName() != null && font.getColor() != null && font.getSize() != 0
        && font.getFontStyle() != null && font.getTextLinePosition() != null) {
      return font;
    }

    boolean isDefault = isUseDefaultStyle;
    OdfStyleBase parentStyle = null;
    if (!isDefault) {
      parentStyle = getParentStyle((OdfStyle) getCurrentUsedStyle());
    }
    while ((!isDefault) && (parentStyle != null)) {
      TextProperties parentStyleSetting = TextProperties.getTextProperties(parentStyle);
      Font tempFont = parentStyleSetting.getFont(type);
      mergeFont(font, tempFont);
      if (font.getFamilyName() != null && font.getColor() != null && font.getSize() > 0
          && font.getFontStyle() != null && font.getTextLinePosition() != null) {
        return font;
      }
      // continue to get parent properties
      if (parentStyle instanceof OdfDefaultStyle) {
        isDefault = true;
      } else {
        parentStyle = getParentStyle((OdfStyle) parentStyle);
      }
    }
    if (!isDefault) {
      OdfDefaultStyle defaultStyle = getParagraphDefaultStyle();
      if (defaultStyle == null) {
        defaultStyle = getParagraphDefaultStyle();
      }
      if (defaultStyle != null) {
        TextProperties defaultStyleSetting = TextProperties.getTextProperties(defaultStyle);
        Font tempFont = defaultStyleSetting.getFont(type);
        mergeFont(font, tempFont);
      }
    }
    if (font.getColor() == null) {
      font.setColor(Color.BLACK);
View Full Code Here

Examples of org.odftoolkit.simple.style.TextProperties

   *            - script type
   * @return the language information for a specific script type
   */
  public String getLanguage(ScriptType type) {
    String language = null;
    TextProperties textProperties = getTextPropertiesForRead();
    if (textProperties != null) {
      language = textProperties.getLanguage(type);
    }
    if (language != null && language.length() > 0) {
      return language;
    }
    boolean isDefault = isUseDefaultStyle;
    OdfStyleBase parentStyle = null;
    if (!isDefault) {
      parentStyle = getParentStyle((OdfStyle) getCurrentUsedStyle());
    }
    while ((!isDefault) && (parentStyle != null)) {
      TextProperties parentStyleSetting = TextProperties.getTextProperties(parentStyle);
      language = parentStyleSetting.getLanguage(type);
      if (language != null && language.length() > 0) {
        return language;
      }
      if (parentStyle instanceof OdfDefaultStyle) {
        isDefault = true;
      } else {
        parentStyle = getParentStyle((OdfStyle) parentStyle);
      }
    }
    if (!isDefault) {
      OdfDefaultStyle defaultStyle = getParagraphDefaultStyle();
      TextProperties defaultStyleSetting = TextProperties.getTextProperties(defaultStyle);
      language = defaultStyleSetting.getLanguage(type);
    }
    return language;
  }
View Full Code Here

Examples of org.odftoolkit.simple.style.TextProperties

   *            - script type
   * @return the country information for a specific script type
   */
  public String getCountry(ScriptType type) {
    String country = null;
    TextProperties textProperties = getTextPropertiesForRead();
    if (textProperties != null)
      country = textProperties.getCountry(type);
    if (country != null && country.length() > 0)
      return country;

    boolean isDefault = isUseDefaultStyle;
    OdfStyleBase parentStyle = null;
    if (!isDefault)
      parentStyle = getParentStyle((OdfStyle) getCurrentUsedStyle());
    while ((!isDefault) && (parentStyle != null)) {
      TextProperties parentStyleSetting = TextProperties.getTextProperties(parentStyle);
      country = parentStyleSetting.getCountry(type);
      if (country != null && country.length() > 0)
        return country;

      if (parentStyle instanceof OdfDefaultStyle)
        isDefault = true;
      else
        parentStyle = getParentStyle((OdfStyle) parentStyle);
    }
    if (!isDefault) {
      OdfDefaultStyle defaultStyle = getCellDefaultStyle();
      TextProperties defaultStyleSetting = TextProperties.getTextProperties(defaultStyle);
      country = defaultStyleSetting.getCountry(type);
    }
    return country;
  }
View Full Code Here

Examples of org.odftoolkit.simple.style.TextProperties

   * @return the font definition for a specific script type
   */
  public Font getFont(ScriptType type) {
    // A font includes font family name, font style, font color, font size
    Font font = null;
    TextProperties textProperties = getTextPropertiesForRead();
    if (textProperties != null)
      font = textProperties.getFont(type);
    else
      font = new Font(null, null, 0, (StyleTypeDefinitions.TextLinePosition) null);

    if (font != null && font.getFamilyName() != null && font.getColor() != null && font.getSize() != 0
        && font.getFontStyle() != null && font.getTextLinePosition() != null)
      return font;

    boolean isDefault = isUseDefaultStyle;
    OdfStyleBase parentStyle = null;
    if (!isDefault)
      parentStyle = getParentStyle((OdfStyle) getCurrentUsedStyle());
    while ((!isDefault) && (parentStyle != null)) {
      TextProperties parentStyleSetting = TextProperties.getTextProperties(parentStyle);
      Font tempFont = parentStyleSetting.getFont(type);
      mergeFont(font, tempFont);
      if (font.getFamilyName() != null && font.getColor() != null && font.getSize() > 0
          && font.getFontStyle() != null && font.getTextLinePosition() != null) {
        return font;
      }
      // continue to get parent properties
      if (parentStyle instanceof OdfDefaultStyle)
        isDefault = true;
      else
        parentStyle = getParentStyle((OdfStyle) parentStyle);
    }
    if (!isDefault) {
      OdfDefaultStyle defaultStyle = getCellDefaultStyle();
      // For text document, there is no default table cell style.
      // So use default font style in default paragraph style.
      if (defaultStyle == null) {
        defaultStyle = getParagraphDefaultStyle();
      }
      if (defaultStyle != null) {
        TextProperties defaultStyleSetting = TextProperties.getTextProperties(defaultStyle);
        Font tempFont = defaultStyleSetting.getFont(type);
        mergeFont(font, tempFont);
      }
    }

    if (font.getColor() == null)
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.