@Override public void onStartScreen() { if (nifty == null || screen == null) { log.severe("Starting screen failed. Seems the binding is not done yet."); } String id = getId(); if (id != null) { nifty.subscribe(screen, id, ElementShowEvent.class, showEventSubscriber); } }
@Override public void onStartScreen() { if (nifty == null || screen == null) { log.severe("Starting screen failed. Seems the binding is not done yet."); } String id = getId(); if (id != null) { nifty.subscribe(screen, id, ElementShowEvent.class, showEventSubscriber); } }
private void subscribeVerticalScrollbar(@Nonnull final Element scrollbar) { if (nifty == null || screen == null) { log.severe("Subscribing scrollbar before binding is done."); return; } String id = scrollbar.getId(); if (id != null) { nifty.subscribe(screen, id, ScrollbarChangedEvent.class, verticalScrollbarSubscriber); } }
private void subscribeVerticalScrollbar(@Nonnull final Element scrollbar) { if (nifty == null || screen == null) { log.severe("Subscribing scrollbar before binding is done."); return; } String id = scrollbar.getId(); if (id != null) { nifty.subscribe(screen, id, ScrollbarChangedEvent.class, verticalScrollbarSubscriber); } }
private void subscribeHorizontalScrollbar(@Nonnull final Element scrollbar) { if (nifty == null || screen == null) { log.severe("Subscribing scrollbar before binding is done."); return; } String id = scrollbar.getId(); if (id != null) { nifty.subscribe(screen, id, ScrollbarChangedEvent.class, horizontalScrollbarSubscriber); } }
@Override public void onStartScreen() { if (nifty == null || screen == null) { log.severe("Starting screen failed. Seems the binding is not done yet."); } String id = getId(); if (id != null) { nifty.subscribe(screen, id, ElementShowEvent.class, showEventSubscriber); } }
private void subscribeHorizontalScrollbar(@Nonnull final Element scrollbar) { if (nifty == null || screen == null) { log.severe("Subscribing scrollbar before binding is done."); return; } String id = scrollbar.getId(); if (id != null) { nifty.subscribe(screen, id, ScrollbarChangedEvent.class, horizontalScrollbarSubscriber); } }
@Override public void init(@Nonnull final Parameters parameter) { super.init(parameter); if (screen == null || nifty == null) { log.severe("Required instances not found, binding did not run or failed."); } String id = getId(); if (id == null) { log.warning("Checkbox has not ID, can't register a event subscriber to monitor update events. Checkbox " + "functionality will be limited."); } else { focusHandler = screen.getFocusHandler(); nifty.subscribe(screen, id, ElementShowEvent.class, this); } }
@Override public void init(@Nonnull final Parameters parameter) { super.init(parameter); if (screen == null || nifty == null) { log.severe("Required instances not found, binding did not run or failed."); } String id = getId(); if (id == null) { log.warning("Checkbox has not ID, can't register a event subscriber to monitor update events. Checkbox " + "functionality will be limited."); } else { focusHandler = screen.getFocusHandler(); nifty.subscribe(screen, id, ElementShowEvent.class, this); } }
@Override public void perform() { // this really feels like a hack but I don't have another idea right now: // // when the popup is closed Nifty will automatically remove all subscribers for all controls in the popup. // this is in general the right behaviour, since the controls are gone (the popup is closed). However in this // case here the listbox is still used by the DropDown. So we need to subscribe our listener again. nifty.subscribe(screen, listBoxId, ListBoxSelectionChangedEvent.class, new DropDownListBoxSelectionChangedEventSubscriber(nifty, screen, listBox, DropDownControl.this, popup)); if (endNotify != null) { endNotify.perform(); } } });
@Override public void perform() { // this really feels like a hack but I don't have another idea right now: // // when the popup is closed Nifty will automatically remove all subscribers for all controls in the popup. // this is in general the right behaviour, since the controls are gone (the popup is closed). However in this // case here the listbox is still used by the DropDown. So we need to subscribe our listener again. nifty.subscribe(screen, listBoxId, ListBoxSelectionChangedEvent.class, new DropDownListBoxSelectionChangedEventSubscriber(nifty, screen, listBox, DropDownControl.this, popup)); if (endNotify != null) { endNotify.perform(); } } });
@Override public void init(@Nonnull final Parameters parameter) { super.init(parameter); if (textfield == null || nifty == null || screen == null) { log.severe("The element is not bound or the binding failed."); } else { String id = textfield.getId(); if (id == null) { log.warning("The text field does not seem to have a proper ID. Event subscribing is not possible. Console " + "functions limited."); } else { nifty.subscribe(screen, id, NiftyInputEvent.class, this); } Element element = getElement(); if (element != null) { element.getParent().layoutElements(); } } }
@Override public void init(@Nonnull final Parameters parameter) { super.init(parameter); if (textfield == null || nifty == null || screen == null) { log.severe("The element is not bound or the binding failed."); } else { String id = textfield.getId(); if (id == null) { log.warning("The text field does not seem to have a proper ID. Event subscribing is not possible. Console " + "functions limited."); } else { nifty.subscribe(screen, id, NiftyInputEvent.class, this); } Element element = getElement(); if (element != null) { element.getParent().layoutElements(); } } }
@Override public void init(@Nonnull final Parameters parameter) { super.init(parameter); if (nifty == null || screen == null) { log.severe("Binding of control is not done. Can't initialize."); return; } initializeScrollPanel(nifty, screen); initializeScrollbars(); Element scrollbarV = getVerticalScrollbar(); if (scrollbarV != null) { String id = scrollbarV.getId(); if (id != null) { nifty.subscribe(screen, id, ScrollbarChangedEvent.class, new VerticalEventTopicSubscriber(this)); } } Element scrollbarH = getHorizontalScrollbar(); if (scrollbarH != null) { String id = scrollbarH.getId(); if (id != null) { nifty.subscribe(screen, id, ScrollbarChangedEvent.class, new HorizontalEventTopicSubscriber(this)); } } }
@Override public void init(@Nonnull final Parameters parameter) { super.init(parameter); if (nifty == null || screen == null) { log.severe("Binding of control is not done. Can't initialize."); return; } initializeScrollPanel(nifty, screen); initializeScrollbars(); Element scrollbarV = getVerticalScrollbar(); if (scrollbarV != null) { String id = scrollbarV.getId(); if (id != null) { nifty.subscribe(screen, id, ScrollbarChangedEvent.class, new VerticalEventTopicSubscriber(this)); } } Element scrollbarH = getHorizontalScrollbar(); if (scrollbarH != null) { String id = scrollbarH.getId(); if (id != null) { nifty.subscribe(screen, id, ScrollbarChangedEvent.class, new HorizontalEventTopicSubscriber(this)); } } }
@Override @SuppressWarnings("deprecation") public void onStartScreen() { if (nifty == null || screen == null) { log.severe("Control is not bound yet. Can't start the screen for this element."); } Element element = getElement(); if (element != null) { ListBox listBox = element.findNiftyControl("#listBox", ListBox.class); if (listBox != null) { String listBoxId = listBox.getId(); if (listBoxId == null) { log.warning("List box has no ID, can't subscribe to events, functionality limited."); } else { nifty.subscribe(screen, listBoxId, ListBoxSelectionChangedEvent.class, new DropDownListBoxSelectionChangedEventSubscriber(nifty, screen, listBox, dropDownControl, popupInstance)); } } } linkPopupToDropDownPosition(dropDownControl); dropDownControl.refresh(); }
@Override @SuppressWarnings("deprecation") public void onStartScreen() { if (nifty == null || screen == null) { log.severe("Control is not bound yet. Can't start the screen for this element."); } Element element = getElement(); if (element != null) { ListBox listBox = element.findNiftyControl("#listBox", ListBox.class); if (listBox != null) { String listBoxId = listBox.getId(); if (listBoxId == null) { log.warning("List box has no ID, can't subscribe to events, functionality limited."); } else { nifty.subscribe(screen, listBoxId, ListBoxSelectionChangedEvent.class, new DropDownListBoxSelectionChangedEventSubscriber(nifty, screen, listBox, dropDownControl, popupInstance)); } } } linkPopupToDropDownPosition(dropDownControl); dropDownControl.refresh(); }
@Override public void init(@Nonnull final Parameters parameter) { super.init(parameter); if (nifty == null || screen == null) { log.severe("Init of controller called before binding was done."); return; } initializeScrollPanel(); initializeScrollElementHeight(); listBoxImpl.updateView(0); initializeHorizontalScrollbar(); initializeVerticalScrollbar(labelTemplateHeight, 0); initSelectionMode(listBoxImpl, parameter.getWithDefault("selectionMode", "Single"), parameter.getWithDefault("forceSelection", "false")); listBoxImpl.updateViewTotalCount(); listBoxImpl.updateViewScroll(); String id = getId(); if (id == null) { log.warning("ListBox has no ID. Functionality will be limited."); } else { nifty.subscribe(screen, getId(), ElementShowEvent.class, listBoxControlShowEventSubscriber); } Element element = getElement(); if (element != null) { element.getParent().layoutElements(); } }
@Override public void onStartScreen() { updateEnabled(); if (listBox instanceof ListBoxControl) { ListBoxControl<T> listBoxControl = (ListBoxControl<T>) listBox; Element element = getElement(); if (element != null) { Element textElement = element.findElementById("#text"); if (textElement != null) { T selectedItem = getSelection(); if (selectedItem != null) { ListBoxViewConverter<T> converter = listBoxControl.getViewConverter(); if (converter != null) { converter.display(textElement, selectedItem); } } } } } if (nifty != null && screen != null && listBox != null && popup != null) { String listBoxId = listBox.getId(); if (listBoxId != null) { nifty.subscribe(screen, listBoxId, ListBoxSelectionChangedEvent.class, new DropDownListBoxSelectionChangedEventSubscriber(nifty, screen, listBox, this, popup)); } } }
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); } }