Package de.lessvoid.nifty.elements

Examples of de.lessvoid.nifty.elements.Element


      nifty.subscribe(screen, scrollbar.getId(), ScrollbarChangedEvent.class, horizontalScrollbarSubscriber);
    }
  }

  private void unsubscribeVerticalScrollbar() {
    Element scrollbar = getElement().findElementByName("#vertical-scrollbar");
    if (scrollbar != null) {
      nifty.unsubscribe(scrollbar.getId(), verticalScrollbarSubscriber);
    }
  }
View Full Code Here


      nifty.unsubscribe(scrollbar.getId(), verticalScrollbarSubscriber);
    }
  }

  private void unsubscribeHorizontalScrollbar() {
    Element scrollbar = getElement().findElementByName("#horizontal-scrollbar");
    if (scrollbar != null) {
      nifty.unsubscribe(scrollbar.getId(), horizontalScrollbarSubscriber);
    }
  }
View Full Code Here

  }

  @Override
  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;
          }
          subscribeVerticalScrollbar();
          ensureWidthConstraints();
View Full Code Here

  @Override
  public void updateTotalWidth(final int newWidth) {
    this.lastMaxWidth = newWidth;
    if (horizontalScrollbar == ScrollbarMode.optional) {
      Element horizontal = getElement().findElementByName("#horizontal-scrollbar-parent");
      if (newWidth > listBoxPanelElement.getWidth()) {
        if (horizontal == null) {
          nifty.createElementFromType(screen, getElement(), horizontalScrollbarTemplate.getElementType());

          updateBottomRightElement();
View Full Code Here

    listBoxImpl.changeSelectionMode(listBoxSelectionMode, "true".equalsIgnoreCase(forceSelection));
  }

  private void initializeScrollPanel(final Screen screen) {
    if (horizontalScrollbar == ScrollbarMode.off || horizontalScrollbar == ScrollbarMode.optional) {
      Element horizontal = getElement().findElementByName("#horizontal-scrollbar-parent");
      if (horizontal != null) {
        nifty.removeElement(screen, horizontal);
      }
    }
    if (verticalScrollbar == ScrollbarMode.off || verticalScrollbar == ScrollbarMode.optional) {
      Element vertical = getElement().findElementByName("#vertical-scrollbar");
      if (vertical != null) {
        nifty.removeElement(screen, vertical);
      }
    }
View Full Code Here

    nifty.executeEndOfFrameElementActions();
    screen.layoutLayers();
  }

  private void updateBottomRightElement() {
    Element horizontal = getElement().findElementByName("#horizontal-scrollbar-parent");
    Element vertical = getElement().findElementByName("#vertical-scrollbar");
    Element bottomRight = getElement().findElementByName("#bottom-right");
    if (horizontal != null) {
      if (vertical == null) {
        if (bottomRight != null) {
          nifty.removeElement(screen, bottomRight);
          nifty.executeEndOfFrameElementActions();
View Full Code Here

    screen.layoutLayers();
  }

  private int findHorizontalScrollbarHeight() {
    int horizontalScrollbarElementHeight = 0;
    Element horizontalScrollbarElement = getElement().findElementByName("#horizontal-scrollbar");
    if (horizontalScrollbarElement != null) {
      horizontalScrollbarElementHeight = horizontalScrollbarElement.getHeight();
    }
    return horizontalScrollbarElementHeight;
  }
View Full Code Here

    dropDownControl.refresh();
  }

  @SuppressWarnings({ "deprecation", "rawtypes" })
  private void linkPopupToDropDownPosition(final DropDownControl<T> dropDownControl) {
    Element panel = getElement().findElementByName("#panel");
    panel.setConstraintX(new SizeValue(dropDownControl.getElement().getX() + "px"));
    panel.setConstraintWidth(new SizeValue(dropDownControl.getWidth() + "px"));
    getElement().layoutElements();

    ListBoxControl listBox = getElement().findNiftyControl("#listBox", ListBoxControl.class);
    listBox.ensureWidthConstraints();

    panel.setConstraintHeight(new SizeValue(listBox.getHeight() + "px"));

    if ((dropDownControl.getElement().getY() + listBox.getHeight()) > nifty.getRenderEngine().getHeight()) {
      panel.setConstraintY(new SizeValue(dropDownControl.getElement().getY() - listBox.getHeight() + "px"));
      updateMoveEffect(listBox, 1);
    } else {
      panel.setConstraintY(new SizeValue(dropDownControl.getElement().getY() + dropDownControl.getHeight() + "px"));
      updateMoveEffect(listBox, -1);
    }
    getElement().layoutElements();
  }
View Full Code Here

  // CheckBoxView Implementation

  @Override
  public void update(final boolean checked) {
    final Element selectImage = getElement().findElementByName("#select");
    if (checked) {
      selectImage.stopEffect(EffectEventId.onCustom);
      selectImage.startEffect(EffectEventId.onCustom, null, "show");
    } else {
      selectImage.stopEffect(EffectEventId.onCustom);
      selectImage.startEffect(EffectEventId.onCustom, null, "hide");
    }
  }
View Full Code Here

  public void onFocus(final boolean getFocus) {
    super.onFocus(getFocus);
  }

  public boolean inputEvent(final NiftyInputEvent inputEvent) {
    Element buttonElement = getElement();
    if (inputEvent == NiftyInputEvent.NextInputElement) {
      if (focusHandler != null) {
        focusHandler.getNext(buttonElement).setFocus();
      }
      return true;
    } else if (inputEvent == NiftyInputEvent.PrevInputElement) {
      if (focusHandler != null) {
        focusHandler.getPrev(buttonElement).setFocus();
      }
      return true;
    } else if (inputEvent == NiftyInputEvent.Activate) {
      buttonClick();
      return true;
    } else if (inputEvent == NiftyInputEvent.MoveCursorDown) {
      if (focusHandler != null) {
        Element nextElement = focusHandler.getNext(buttonElement);
        if (nextElement.getParent().equals(buttonElement.getParent())) {
          nextElement.setFocus();
          return true;
        }
      }
    } else if (inputEvent == NiftyInputEvent.MoveCursorUp) {
      if (focusHandler != null) {
        Element prevElement = focusHandler.getPrev(buttonElement);
        if (prevElement.getParent().equals(buttonElement.getParent())) {
          prevElement.setFocus();
          return true;
        }
      }
    }
    return false;
View Full Code Here

TOP

Related Classes of de.lessvoid.nifty.elements.Element

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.