public void markForRemoval(@Nullable final EndNotify endNotify) { if (screen == null) { log.warning("Marking the element [" + String.valueOf(getId()) + "] for removal is not possible when there is " + "not screen bound."); } else { nifty.removeElement(screen, this, endNotify); } }
public void removeElement( @Nonnull final Screen screen, @Nonnull final Element element, @Nullable final EndNotify endNotify) { element.startEffect(EffectEventId.onEndScreen, new EndNotify() { @Override public void perform() { scheduleEndOfFrameElementAction(new ElementRemoveAction(screen, element), endNotify); } }); }
private void initializeScrollPanel(@Nonnull final Nifty nifty, @Nonnull final Screen screen) { if (!verticalScrollbar) { Element vertical = getChildById("#nifty-internal-vertical-scrollbar"); if (vertical != null) { nifty.removeElement(screen, vertical); } } if (!horizontalScrollbar) { Element horizontal = getChildById("#nifty-internal-horizontal-panel"); if (horizontal != null) { nifty.removeElement(screen, horizontal); } } }
private void initializeScrollPanel(@Nonnull final Nifty nifty, @Nonnull final Screen screen) { if (!verticalScrollbar) { Element vertical = getChildById("#nifty-internal-vertical-scrollbar"); if (vertical != null) { nifty.removeElement(screen, vertical); } } if (!horizontalScrollbar) { Element horizontal = getChildById("#nifty-internal-horizontal-panel"); if (horizontal != null) { nifty.removeElement(screen, horizontal); } } }
private void removeScreenInternal(@Nonnull final String id) { Screen screen = screens.remove(id); if (screen == null) { log.log(Level.SEVERE, "Internal delete of screen \"" + id + "\" failed: Screen instance not found."); } else { renderEngine.screenRemoved(screen); if (screen.getLayerElements().size() == 0) { return; } for (int i = 0; i < screen.getLayerElements().size(); i++) { removeElement(screen, screen.getLayerElements().get(i)); } } }
private void removeVerticalScrollbar() { if (!verticalScrollbarState || nifty == null || screen == null) { return; } Element scrollbar = getVerticalScrollbarElement(); if (scrollbar != null) { String scrollbarId = scrollbar.getId(); if (scrollbarId != null) { nifty.unsubscribe(scrollbarId, verticalScrollbarSubscriber); } nifty.removeElement(screen, scrollbar, new EndNotify() { @Override public void perform() { ensureWidthConstraints(); updateBottomRightElement(); } }); verticalScrollbar = null; verticalScrollbarState = false; } }
private void removeVerticalScrollbar() { if (!verticalScrollbarState || nifty == null || screen == null) { return; } Element scrollbar = getVerticalScrollbarElement(); if (scrollbar != null) { String scrollbarId = scrollbar.getId(); if (scrollbarId != null) { nifty.unsubscribe(scrollbarId, verticalScrollbarSubscriber); } nifty.removeElement(screen, scrollbar, new EndNotify() { @Override public void perform() { ensureWidthConstraints(); updateBottomRightElement(); } }); verticalScrollbar = null; verticalScrollbarState = false; } }
private void removeHorizontalScrollbar() { if (!horizontalScrollbarState || nifty == null || screen == null) { return; } Element scrollbar = getHorizontalScrollbarElement(); if (scrollbar != null) { String scrollbarId = scrollbar.getId(); if (scrollbarId != null) { nifty.unsubscribe(scrollbarId, horizontalScrollbarSubscriber); } } Element scrollbarParentPanel = getHorizontalScrollbarParentElement(); if (scrollbarParentPanel != null) { nifty.removeElement(screen, scrollbarParentPanel); } horizontalScrollbar = null; horizontalScrollbarState = false; }
private void removeHorizontalScrollbar() { if (!horizontalScrollbarState || nifty == null || screen == null) { return; } Element scrollbar = getHorizontalScrollbarElement(); if (scrollbar != null) { String scrollbarId = scrollbar.getId(); if (scrollbarId != null) { nifty.unsubscribe(scrollbarId, horizontalScrollbarSubscriber); } } Element scrollbarParentPanel = getHorizontalScrollbarParentElement(); if (scrollbarParentPanel != null) { nifty.removeElement(screen, scrollbarParentPanel); } horizontalScrollbar = null; horizontalScrollbarState = false; }
@Override public void execute( @Nonnull final Element element, final float normalizedTime, @Nullable final Falloff falloff, @Nonnull final NiftyRenderEngine r) { if (nifty == null || screen == null || hintLayer == null || hintPanel == null) { log.severe("Can't execute effect. Activation not done or failed."); return; } if (normalizedTime > 0.0) { if (!hintLayer.isVisible()) { // decide if we can already show the hint if (nifty.getNiftyMouse().getNoMouseMovementTime() > hintDelay) { hintPanel.setConstraintX(SizeValue.px(getPosX(element, hintPanel, r.getWidth()))); hintPanel.setConstraintY(SizeValue.px(getPosY(element, hintPanel, r.getHeight()))); // hard remove all old hints, else they only mess with the new ones List<Element> hints = hintLayer.getChildren(); for (int i = 0; i < hints.size() - 1; i++) { nifty.removeElement(screen, hints.get(i)); } hintLayer.layoutElements(); hintLayer.show(); } } } }
if (vertical == null) { if (bottomRight != null) { nifty.removeElement(screen, bottomRight, new EndNotify() { @Override public void perform() {
if (vertical == null) { if (bottomRight != null) { nifty.removeElement(screen, bottomRight, new EndNotify() { @Override public void perform() {
labelTemplateHeight = templateElement.getHeight(); labelTemplateElementType = templateElement.getElementType().copy(); nifty.removeElement(screen, templateElement);
nifty.removeElement(screen, e);
nifty.removeElement(screen, e);
labelTemplateHeight = templateElement.getHeight(); labelTemplateElementType = templateElement.getElementType().copy(); nifty.removeElement(screen, templateElement);
private void generateHiscoreList() { Element hiscoreList = screen.findElementById("hiscoreList"); if (hiscoreList != null) { for (Element oldElement : hiscoreList.getChildren()) { nifty.removeElement(screen, oldElement); } ControlBuilder hiscoreDesc = new ControlBuilder("hiscoreHead", "hiscoreRow"); hiscoreDesc.parameter("rank", "${menu.80}"); hiscoreDesc.parameter("score", "${menu.82}"); hiscoreDesc.parameter("level", "${menu.2042}"); hiscoreDesc.parameter("user", "${menu.83}"); hiscoreDesc.style("nifty-hiscore-head"); hiscoreDesc.build(nifty, screen, hiscoreList); int i = 0; for (HiScores.HiScoresEntry hiscore : HiScores.load().getEntries()) { ControlBuilder hiscoreControl = new ControlBuilder("hiscore" + i++, "hiscoreRow"); hiscoreControl.parameter("rank", i + ""); hiscoreControl.parameter("score", hiscore.getScore() + ""); hiscoreControl.parameter("level", hiscore.getLevel()); hiscoreControl.parameter("user", hiscore.getName()); hiscoreControl.build(nifty, screen, hiscoreList); } } }