Package de.lessvoid.nifty.elements.render

Examples of de.lessvoid.nifty.elements.render.TextRenderer


     * {@inheritDoc}
     */
    @Override
    public final int getWidth(final Element listBoxItem, final ChatEntryModelClass item) {
        final Element text = listBoxItem.findElementByName(CHAT_LINE_TEXT);
        final TextRenderer textRenderer = text.getRenderer(TextRenderer.class);
        final Element icon = listBoxItem.findElementByName(CHAT_LINE_ICON);
        final ImageRenderer iconRenderer = icon.getRenderer(ImageRenderer.class);
        return ((textRenderer.getFont() == null) ? 0 : textRenderer.getFont().getWidth(item.getLabel()))
                + ((item.getIcon() == null) ? 0 : item.getIcon().getWidth());
    }
View Full Code Here


  public class ListBoxViewConverterSimple<T> implements ListBoxViewConverter<T> {
    private Logger log = Logger.getLogger(ListBoxViewConverterSimple.class.getName());

    @Override
    public void display(final Element element, final T item) {
      TextRenderer renderer = element.getRenderer(TextRenderer.class);
      if (renderer == null) {
        log.warning(
              "you're using the ListBoxViewConverterSimple but there is no TextRenderer on the listBoxElement."
            + "You've probably changed the item template but did not provided your own "
            + "ListBoxViewConverter to the ListBox.");
        return;
      }
      if (item != null) {
        renderer.setText(item.toString());
      } else {
        renderer.setText("");
      }
    }
View Full Code Here

      }
    }

    @Override
    public int getWidth(final Element element, final T item) {
      TextRenderer renderer = element.getRenderer(TextRenderer.class);
      if (renderer == null) {
        log.warning(
              "you're using the ListBoxViewConverterSimple but there is no TextRenderer on the listBoxElement."
            + "You've probably changed the item template but did not provided your own "
            + "ListBoxViewConverter to the ListBox.");
View Full Code Here

        if (currentElement == null) { //initial element
            if (event.getElement().getRenderer(TextRenderer.class) != null) {
                currentElement = event.getElement();

                // hover
                TextRenderer renderer1 = currentElement.getRenderer(TextRenderer.class);
                renderer1.setColor(Color.BLACK);

                sound.play();
            }
        } else {
            if (event.getElement() != currentElement) {
View Full Code Here

        if (currentElement == null) { //initial element
            if (event.getElement().getRenderer(TextRenderer.class) != null) {
                currentElement = event.getElement();

                // hover
                TextRenderer renderer1 = currentElement.getRenderer(TextRenderer.class);
                renderer1.setColor(Color.BLACK);

                sound.play();
            }
        } else {
            if (event.getElement() != currentElement) {
View Full Code Here

  @Override
  public void display(Element listBoxItem, Character character) {
    final Element characterName = listBoxItem
        .findElementByName("#listbox.character.name");
    final TextRenderer characterNameRenderer = characterName
        .getRenderer(TextRenderer.class);

    final Element characterSpecies = listBoxItem
        .findElementByName("#listbox.character.species");
    final TextRenderer characterSpeciesRenderer = characterSpecies
        .getRenderer(TextRenderer.class);

    final Element icon = listBoxItem
        .findElementByName("#listbox.character.icon");
    final ImageRenderer iconRenderer = icon
        .getRenderer(ImageRenderer.class);

    if (character != null) {
      characterNameRenderer.setText(character.getName());
      characterSpeciesRenderer.setText(character.getSpecies());
      iconRenderer.setImage(character.getIcon());
    } else {
      characterNameRenderer.setText("");
      characterSpeciesRenderer.setText("");
      iconRenderer.setImage(null);
    }
  }
View Full Code Here

  @Override
  public int getWidth(Element element, Character character) {
    final Element text = element
        .findElementByName("#listbox.character.name");
    final TextRenderer textRenderer = text.getRenderer(TextRenderer.class);
    return ((textRenderer.getFont() == null) ? 0 : textRenderer.getFont()
        .getWidth(character.getName()))
        + ((character.getIcon() == null) ? 0 : character.getIcon()
            .getWidth());
  }
View Full Code Here

  }
 
  @Override
  public int getWidth(final Element listBoxItem, final DebugEntry item)
    {
    TextRenderer renderer = listBoxItem.findElementByName("#lbTextElem").getRenderer(TextRenderer.class);
    return renderer.getFont().getWidth(item.data);
    }
View Full Code Here

   * java.lang.Object)
   */
  @Override
  public void display(Element listBoxItem, ListBoxEntryModel item) {
    final Element text = listBoxItem.findElementByName(LISTBOX_LINE_TEXT);
    final TextRenderer textRenderer = text.getRenderer(TextRenderer.class);
    final Element icon = listBoxItem.findElementByName(LISTBOX_LINE_ICON);
    final ImageRenderer iconRenderer = icon.getRenderer(ImageRenderer.class);
    if (item != null) {
      textRenderer.setText(item.getLabel());
      iconRenderer.setImage(item.getIcon());
    } else {
      textRenderer.setText("");
      iconRenderer.setImage(null);
    }
  }
View Full Code Here

   * java.lang.Object)
   */
  @Override
  public int getWidth(Element element, ListBoxEntryModel item) {
    final Element text = element.findElementByName(LISTBOX_LINE_TEXT);
    final TextRenderer textRenderer = text.getRenderer(TextRenderer.class);
    return ((textRenderer.getFont() == null) ? 0 : textRenderer.getFont().getWidth(item.getLabel()))
        + ((item.getIcon() == null) ? 0 : item.getIcon().getWidth());
  }
View Full Code Here

TOP

Related Classes of de.lessvoid.nifty.elements.render.TextRenderer

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.