Package de.lessvoid.nifty.tools

Examples of de.lessvoid.nifty.tools.SizeValue


  private boolean horizontal = false;

  public void activate(final Nifty nifty, final Element element, final EffectProperties parameter) {
    entries.clear();
    for (Attributes entry : parameter.getEffectValues().getValues()) {
      SizeValue offset = new SizeValue(entry.get("offset"));
      Color color = entry.getAsColor("color");
      entries.add(new Entry(offset, color));
    }
    horizontal = "horizontal".equals(parameter.getProperty("direction", "vertical"));
  }
View Full Code Here


        if (lineWidth > maxWidth) {
          maxWidth = lineWidth;
        }
      }
    }
    element.setConstraintWidth(new SizeValue(getTextWidth() + "px"));
    element.setConstraintHeight(new SizeValue(getTextHeight() + "px"));
    isCalculatedLineWrapping = true;
  }
View Full Code Here

      final Falloff falloff,
      final NiftyRenderEngine r) {
    if (targetElement != null) {
      TextRenderer textRenderer = targetElement.getRenderer(TextRenderer.class);
      textRenderer.setText(hintText);
      targetElement.setConstraintWidth(new SizeValue(textRenderer.getTextWidth() + "px"));
      nifty.getCurrentScreen().layoutLayers();
    }
  }
View Full Code Here

    LayoutPart layerLayout = new LayoutPart();
    layerLayout.getBox().setX(0);
    layerLayout.getBox().setY(0);
    layerLayout.getBox().setWidth(nifty.getRenderEngine().getWidth());
    layerLayout.getBox().setHeight(nifty.getRenderEngine().getHeight());
    layerLayout.getBoxConstraints().setX(new SizeValue("0px"));
    layerLayout.getBoxConstraints().setY(new SizeValue("0px"));
    layerLayout.getBoxConstraints().setWidth(new SizeValue(nifty.getRenderEngine().getWidth() + "px"));
    layerLayout.getBoxConstraints().setHeight(new SizeValue(nifty.getRenderEngine().getHeight() + "px"));
    return layerLayout;
  }
View Full Code Here

      falloffConstraint = HoverFalloffConstraint.valueOf(falloffConstraintString);
    }

    String hoverWidthString = parameter.getProperty(Falloff.HOVER_WIDTH);
    if (hoverWidthString != null) {
      hoverWidth = new SizeValue(hoverWidthString);
    }

    String hoverHeightString = parameter.getProperty(Falloff.HOVER_HEIGHT);
    if (hoverHeightString != null) {
      hoverHeight = new SizeValue(hoverHeightString);
    }
  }
View Full Code Here

      final Falloff falloff,
      final NiftyRenderEngine r) {
    NiftyMouse niftyMouse = nifty.getNiftyMouse();

    int newPosX = borderCheck(niftyMouse.getX() + offsetX, element.getWidth(), r.getWidth());
    element.setConstraintX(new SizeValue(newPosX + "px"));

    int newPosY = borderCheck(niftyMouse.getY() + offsetY, element.getHeight(), r.getHeight());
    element.setConstraintY(new SizeValue(newPosY + "px"));

    element.getParent().layoutElements();
  }
View Full Code Here

    preProcessConstraintWidthThisLevel();
  }

  private void preProcessConstraintWidthThisLevel() {
    // try the original width value first
    SizeValue myWidth = getConstraintWidth();

    // is it empty and we have an layoutManager there's still hope for a width constraint
    if (layoutManager != null && (myWidth == null || isCalcWidthConstraint)) {

      // collect all child layoutPart that have a fixed pixel size in a list
      List < LayoutPart > layoutPartChild = new ArrayList < LayoutPart >();
      for (int i=0; i<elements.size(); i++) {
        Element e = elements.get(i);
        SizeValue childWidth = e.getConstraintWidth();
        if (childWidth != null && childWidth.isPixel()) {
          layoutPartChild.add(e.layoutPart);
        }
      }

      // if all (!) child elements have a pixel fixed width we can calculate a new width constraint for this element!
      if (elements.size() == layoutPartChild.size()) {
        SizeValue newWidth = layoutManager.calculateConstraintWidth(this.layoutPart, layoutPartChild);
        if (newWidth != null) {
          setConstraintWidth(newWidth);
          isCalcWidthConstraint = true;
        }
      }
View Full Code Here

    preProcessConstraintHeightThisLevel();
  }

  private void preProcessConstraintHeightThisLevel() {
    // try the original height value first
    SizeValue myHeight = getConstraintHeight();

    // is it empty and we have an layoutManager there's still hope for a height constraint
    if (layoutManager != null && (myHeight == null || isCalcHeightConstraint)) {
      // collect all child layoutPart that have a fixed px size in a list
      List < LayoutPart > layoutPartChild = new ArrayList < LayoutPart >();
      for (int i=0; i<elements.size(); i++) {
        Element e = elements.get(i);
        SizeValue childHeight = e.getConstraintHeight();
        if (childHeight != null && childHeight.isPixel()) {
          layoutPartChild.add(e.layoutPart);
        }
      }

      // if all (!) child elements have a px fixed height we can calculate a new height constraint for this element!
      if (elements.size() == layoutPartChild.size()) {
        SizeValue newHeight = layoutManager.calculateConstraintHeight(this.layoutPart, layoutPartChild);
        if (newHeight != null) {
          setConstraintHeight(newHeight);
          isCalcHeightConstraint = true;
        }
      }
View Full Code Here

  private boolean activated = false;

  public void activate(final Nifty nifty, final Element element, final EffectProperties parameter) {
    String startSizeString = parameter.getProperty("startSize");
    if (startSizeString != null) {
      startSize = new SizeValue(startSizeString);
    }

    String endSizeString = parameter.getProperty("endSize");
    if (endSizeString != null) {
      endSize = new SizeValue(endSizeString);
    }
    pulsator = new Pulsator(parameter, new TimeProvider());
  }
View Full Code Here

    endSize = Float.parseFloat(parameter.getProperty("endSize", "2.0"));

    // for hover mode only
    String maxSizeString = parameter.getProperty("maxSize");
    if (maxSizeString != null) {
      imageSize = new SizeValue(maxSizeString);
    }
    interpolator = parameter.getInterpolator();
  }
View Full Code Here

TOP

Related Classes of de.lessvoid.nifty.tools.SizeValue

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.