Package de.lessvoid.nifty.loaderv2.types

Examples of de.lessvoid.nifty.loaderv2.types.ElementType


  public String pixels(final int px) {
    return Integer.toString(px) + "px";
  }

  public Element build(final Nifty nifty, final Screen screen, final Element parent) {
    ElementType type = buildElementType();
    Element result = nifty.createElementFromType(screen, parent, type);
    screen.layoutLayers();
    return result;
  }
View Full Code Here


   *
   * @return the ElementType representation for this ElementBuilder
   */
  public ElementType buildElementType() {
    connectAttributes();
    ElementType thisType = attributes.createType();

    // this is quite complicated: when we use the builder stuff then all of the
    // builders will create automatically an id for the element it builds. this
    // is a required feature when the builders are used to create actual elements.
    //
    // in this case here we're creating a type and not an actual element instance.
    // this is used for instance in controldefinitions. therefore we need to make
    // sure that the automatically generated id is being removed again. otherwise
    // we would end up with controldefinitions with ids. when we later use these
    // control definitions in multiple controls these ids will be reused which
    // could cause trouble when we have the same id multiple times.
    //
    // so here we make sure that when we have an automatically generated id
    // that we remove it again.
    if (attributes.isAutoId()) {
      thisType.getAttributes().remove("id");
    }

    attributes.connect(thisType);
    for (int i=0; i<elementBuilders.size(); i++) {
      thisType.addElementType(elementBuilders.get(i).buildElementType());
    }

    return thisType;
  }
View Full Code Here

  public void updateTotalCount(final int newCount) {
    if (verticalScrollbar == ScrollbarMode.optional) {
      Element vertical = getElement().findElementByName("#vertical-scrollbar");
      if (newCount > displayItems) {
        if (vertical == null) {
          ElementType templateType = verticalScrollbarTemplate.getElementType().copy();
          CustomControlCreator create = new CustomControlCreator((ControlType) templateType);
          Element e = create.create(nifty, screen, scrollElement);
          if (e.getHeight() < 23*2) { // ugly
            nifty.removeElement(screen, e);
            return;
View Full Code Here

    }
    for (Element e : childRootElement.getElements()) {
      nifty.removeElement(screen, e);
    }   
    for (int i = 0; i < displayItems; i++) {
      ElementType templateType = labelTemplateElement.getElementType().copy();
      templateType.getAttributes().set("id", NiftyIdCreator.generate());
      labelElements[i] = nifty.createElementFromType(screen, childRootElement, templateType);

      // connect it to this listbox
      ListBoxItemController<T> listBoxItemController = labelElements[i].getControl(ListBoxItemController.class);
      if (listBoxItemController != null) {
View Full Code Here

  public void setHoverHeight(final String hoverHeight) {
    attributes.set("hoverHeight", hoverHeight);
  }

  public HoverType create() {
    HoverType effectType = new HoverType();
    effectType.initFromAttributes(attributes);
    return effectType;
  }
View Full Code Here

  protected Element createImage(
      final Nifty nifty,
      final Screen screen,
      final Element parent) {
    ImageType imageType = new ImageType(attributes);
    return buildControl(nifty, screen, parent, imageType, new LayoutPart());
  }
View Full Code Here

    nifty.addControlsWithoutStartScreen();
    return parent.findElementByName(attributes.get("id"));
  }

  public ElementType createType() {
    return new ImageType(attributes);
  }
View Full Code Here

  public void setOnClickAlternateKey(final String onClickAlternateKey) {
    attributes.set("onClickAlternateKey", onClickAlternateKey);
  }

  public InteractType create() {
    InteractType interact = new InteractType();
    interact.initFromAttributes(attributes);
    return interact;
  }
View Full Code Here

  protected Element createLayer(
      final Nifty nifty,
      final Screen screen,
      final Element parent) {
    LayerType layerType = new LayerType(attributes);
    return buildControl(nifty, screen, parent, layerType, nifty.getRootLayerFactory().createRootLayerLayoutPart(nifty));
  }
View Full Code Here

    return layerElement;
  }

  @Override
  public ElementType createType() {
    return new LayerType(attributes);
  }
View Full Code Here

TOP

Related Classes of de.lessvoid.nifty.loaderv2.types.ElementType

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.