/** * Build an element in a specified position in parent element list * * @return the Element created */ @Nonnull public Element build(@Nonnull final Element parent, final int index) { Screen screen = parent.getScreen(); ElementType type = buildElementType(); Element result = parent.getNifty().createElementFromType(screen, parent, type, index); screen.layoutLayers(); return result; }
/** * Build a element * * @return the element created */ public Element build(@Nonnull final Element parent) { ElementType type = buildElementType(); Element result = parent.getNifty().createElementFromType(parent.getScreen(), parent, type); parent.layoutElements(); return result; }
private void createVerticalScrollbar() { if (verticalScrollbarState || nifty == null || screen == null || verticalScrollbarTemplate == null) { return; } if (scrollElement == null) { return; } ElementType type = verticalScrollbarTemplate.copy(); Element scrollbarElement = nifty.createElementFromType(screen, scrollElement, type); verticalScrollbar = scrollbarElement.getNiftyControl(Scrollbar.class); if (verticalScrollbar == null) { log.severe("Recreating the scrollbar resulted in a object that does not seem to be a scrollbar. Strange thing."); } else { subscribeVerticalScrollbar(scrollbarElement); } verticalScrollbarState = true; ensureWidthConstraints(); updateBottomRightElement(); }
private void createVerticalScrollbar() { if (verticalScrollbarState || nifty == null || screen == null || verticalScrollbarTemplate == null) { return; } if (scrollElement == null) { return; } ElementType type = verticalScrollbarTemplate.copy(); Element scrollbarElement = nifty.createElementFromType(screen, scrollElement, type); verticalScrollbar = scrollbarElement.getNiftyControl(Scrollbar.class); if (verticalScrollbar == null) { log.severe("Recreating the scrollbar resulted in a object that does not seem to be a scrollbar. Strange thing."); } else { subscribeVerticalScrollbar(scrollbarElement); } verticalScrollbarState = true; ensureWidthConstraints(); updateBottomRightElement(); }
private void createHorizontalScrollbar() { if (horizontalScrollbarState || nifty == null || screen == null || horizontalScrollbarTemplate == null) { return; } Element element = getElement(); if (element == null) { return; } final ElementType type = horizontalScrollbarTemplate.copy(); String id = getId(); if (id != null) { applyIdPrefixToElementType(id, type); } Element scrollbarElement = nifty.createElementFromType(screen, element, type); horizontalScrollbar = scrollbarElement.findNiftyControl("#horizontal-scrollbar", Scrollbar.class); if (horizontalScrollbar == null) { log.severe("Recreating the scrollbar resulted in a object that does not seem to be a scrollbar. Strange thing."); } else { subscribeHorizontalScrollbar(scrollbarElement); } horizontalScrollbarState = true; updateBottomRightElement(); }
private void createHorizontalScrollbar() { if (horizontalScrollbarState || nifty == null || screen == null || horizontalScrollbarTemplate == null) { return; } Element element = getElement(); if (element == null) { return; } final ElementType type = horizontalScrollbarTemplate.copy(); String id = getId(); if (id != null) { applyIdPrefixToElementType(id, type); } Element scrollbarElement = nifty.createElementFromType(screen, element, type); horizontalScrollbar = scrollbarElement.findNiftyControl("#horizontal-scrollbar", Scrollbar.class); if (horizontalScrollbar == null) { log.severe("Recreating the scrollbar resulted in a object that does not seem to be a scrollbar. Strange thing."); } else { subscribeHorizontalScrollbar(scrollbarElement); } horizontalScrollbarState = true; updateBottomRightElement(); }
"List box is expected to look crappy."); } else { nifty.createElementFromType(screen, horizontal, bottomRightTemplate); initializeHorizontalScrollbar(); element.getParent().layoutElements();
"List box is expected to look crappy."); } else { nifty.createElementFromType(screen, horizontal, bottomRightTemplate); initializeHorizontalScrollbar(); element.getParent().layoutElements();
labelElements[i] = nifty.createElementFromType(screen, childRootElement, templateType);
labelElements[i] = nifty.createElementFromType(screen, childRootElement, templateType);
private void initTab(@Nonnull final Tab tab) { final int tabIndex = indexOf(tab); Element button = getButton(tabIndex); if (button == null) { if (buttonTemplate == null || nifty == null || screen == null || tabButtonPanel == null) { log.severe("Tab can't be initialized. Binding not done yet or binding failed."); return; } final ElementType newButtonTemplate = buttonTemplate.copy(); newButtonTemplate.getAttributes().set("id", buildTabButtonName(tabIndex)); button = nifty.createElementFromType(screen, tabButtonPanel, newButtonTemplate); } String buttonId = button.getId(); if (buttonId != null) { nifty.subscribe(screen, buttonId, ButtonClickedEvent.class, buttonClickedSubscriber); } if (!button.isVisible()) { button.show(); } final Button btnControl = button.getNiftyControl(Button.class); if (btnControl == null) { log.warning("Can't set label of tab selection element that is not a button."); } else { btnControl.setText(tab.getCaption()); } if (tab instanceof TabGroupMember) { ((TabGroupMember) tab).setParentTabGroup(this); } }
private void initTab(@Nonnull final Tab tab) { final int tabIndex = indexOf(tab); Element button = getButton(tabIndex); if (button == null) { if (buttonTemplate == null || nifty == null || screen == null || tabButtonPanel == null) { log.severe("Tab can't be initialized. Binding not done yet or binding failed."); return; } final ElementType newButtonTemplate = buttonTemplate.copy(); newButtonTemplate.getAttributes().set("id", buildTabButtonName(tabIndex)); button = nifty.createElementFromType(screen, tabButtonPanel, newButtonTemplate); } String buttonId = button.getId(); if (buttonId != null) { nifty.subscribe(screen, buttonId, ButtonClickedEvent.class, buttonClickedSubscriber); } if (!button.isVisible()) { button.show(); } final Button btnControl = button.getNiftyControl(Button.class); if (btnControl == null) { log.warning("Can't set label of tab selection element that is not a button."); } else { btnControl.setText(tab.getCaption()); } if (tab instanceof TabGroupMember) { ((TabGroupMember) tab).setParentTabGroup(this); } }
private void initTab(final Tab tab) { final int tabIndex = indexOf(tab); Element button = getButton(tabIndex); if (button == null) { if (buttonTemplate == null || nifty == null || screen == null || tabButtonPanel == null) { log.severe("Tab can't be initialized. Binding not done yet or binding failed."); return; } final ElementType newButtonTemplate = buttonTemplate.copy(); newButtonTemplate.getAttributes().set("id", buildTabButtonName(tabIndex)); newButtonTemplate.getAttributes().set("image", ((CustomTabControl) tab).getImage()); newButtonTemplate.getAttributes().set("active", ((CustomTabControl) tab).getImageActive()); newButtonTemplate.getAttributes().set("hintText", ((CustomTabControl) tab).getHint()); newButtonTemplate.getAttributes().set("tooltip", ((CustomTabControl) tab).getTooltip()); button = nifty.createElementFromType(screen, tabButtonPanel, newButtonTemplate); } String buttonId = button.getId(); if (buttonId != null) { nifty.subscribe(screen, buttonId, ButtonClickedEvent.class, buttonClickedSubscriber); } if (!button.isVisible()) { button.show(); } if (tab instanceof TabGroupMember) { ((TabGroupMember) tab).setParentTabGroup(this); } }