private void initializeScrollElementHeight() { if (scrollElement != null) { scrollElement.setConstraintHeight(SizeValue.px(displayItems * labelTemplateHeight)); } }
private void initializeScrollElementHeight() { if (scrollElement != null) { scrollElement.setConstraintHeight(SizeValue.px(displayItems * labelTemplateHeight)); } }
@Override public void update(final int position) { elementPosition.setConstraintX(SizeValue.px(position)); elementBackground.layoutElements(); }
@Override public void update(final int position) { elementPosition.setConstraintY(SizeValue.px(position)); elementBackground.layoutElements(); }
@Override public void update(final int position) { elementPosition.setConstraintY(SizeValue.px(position)); elementBackground.layoutElements(); }
@Override public void update(final int position) { elementPosition.setConstraintX(SizeValue.px(position)); elementBackground.layoutElements(); }
private void updateLayoutPart(@Nonnull final LayoutPart layoutPart, final int width, final int height) { Box box = layoutPart.getBox(); box.setWidth(width); box.setHeight(height); BoxConstraints boxConstraints = layoutPart.getBoxConstraints(); boxConstraints.setWidth(SizeValue.px(width)); boxConstraints.setHeight(SizeValue.px(height)); }
@Override public void onEvent(final String id, @Nonnull final ScrollbarChangedEvent event) { if (childRootElement != null) { childRootElement.setConstraintX(SizeValue.px(-(int) event.getValue())); childRootElement.getParent().layoutElements(); } } };
@Override public void setText(@Nonnull final String text) { if (buttonTextRenderer != null && buttonTextElement != null) { buttonTextRenderer.setText(text); if (!buttonTextRenderer.isLineWrapping()) { buttonTextElement.setConstraintWidth(SizeValue.px(getTextWidth())); } } else { if (!isBound()) { throw new IllegalStateException("Setting the text is not possible before the binding is done."); } log.warning("Failed to apply the text because the required references are not set. Maybe the element is not " + "bound yet?"); } }
@Override public void onEvent(final String id, @Nonnull final ScrollbarChangedEvent event) { if (childRootElement != null) { childRootElement.setConstraintX(SizeValue.px(-(int) event.getValue())); childRootElement.getParent().layoutElements(); } } };
private void dragCancel() { final Element draggable = getElement(); if (draggable == null) { return; } if (revert) { draggable.setConstraintX(originalConstraintX); draggable.setConstraintY(originalConstraintY); } else { draggable.setConstraintX(SizeValue.px(draggable.getX())); draggable.setConstraintY(SizeValue.px(draggable.getY())); } moveDraggableBackToOriginalParent(); notifyObserversDragCanceled(); }
public void forward() { int cX = content.getConstraintX().getValueAsInt(1.f); if (cX < 0) { content.setConstraintX(SizeValue.px(cX + stepSize)); content.getParent().layoutElements(); } }
@Nonnull public LayoutPart createRootLayerLayoutPart(@Nonnull final Nifty nifty) { 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(SizeValue.px(0)); layerLayout.getBoxConstraints().setY(SizeValue.px(0)); layerLayout.getBoxConstraints().setWidth(SizeValue.px(nifty.getRenderEngine().getWidth())); layerLayout.getBoxConstraints().setHeight(SizeValue.px(nifty.getRenderEngine().getHeight())); return layerLayout; } }
public void back() { int cX = content.getConstraintX().getValueAsInt(1.f); if (cX + content.getWidth() > content.getParent().getWidth()) { content.setConstraintX(SizeValue.px(cX - stepSize)); content.getParent().layoutElements(); } }