@NiftyEventSubscriber(id="ApplyButton") public void onButton(String id, ButtonClickedEvent event) { LOG.log(Level.INFO, "Change context: platorm={0}, device={1}", new Object[]{selectedPlatform, selectedDevice}); restart(); }
@NiftyEventSubscriber(id="DeviceListBox") public void onDeviceChanged(String id, ListBoxSelectionChangedEvent<String> event) { String d = event.getSelection().isEmpty() ? null : event.getSelection().get(0); LOG.log(Level.INFO, "Selected device changed to {0}", d); selectedDevice = d; }
@NiftyEventSubscriber(id="PlatformListBox") public void onPlatformChanged(String id, ListBoxSelectionChangedEvent<String> event) { String p = event.getSelection().isEmpty() ? null : event.getSelection().get(0); LOG.log(Level.INFO, "Selected platform changed to {0}", p); selectedPlatform = p; changePlatform(p); }
@NiftyEventSubscriber(id = ID_ITEMS) public void onListBoxSelectionChanged(final String id, final ListBoxSelectionChangedEvent<Object> event) { List<Object> selection = event.getSelection(); if (selection.size() == 1) { app.onSelectionChanged(selection.get(0)); } }
@NiftyEventSubscriber(id = "tabs-hud") public void onTabChange(String id, TabSelectedEvent event) { updateSelectedItem(state.getInteractionState()); }
@NiftyEventSubscriber(id = "multiplayerChat") public void onChatTextSend(final String id, final ChatTextSendEvent event) { state.chatTextSend(event.getText()); }
@NiftyEventSubscriber(id = ID_TYPES) public void onTypeChanged(final String id, final DropDownSelectionChangedEvent<ModelViewer.Types> event) { app.fillList(event.getSelection()); }
@NiftyEventSubscriber(id = ID_SOUNDS) public void onSoundSelectionChanged(final String id, final DropDownSelectionChangedEvent<SoundFile> event) { app.onSoundChanged(event.getSelection()); }
@NiftyEventSubscriber(id = "fullscreen") public void onFullscreenChanged(final String id, final CheckBoxStateChangedEvent event) { //Set the refresh dropdown DropDown refresh = screen.findNiftyControl("refreshRate", DropDown.class); if (event.isChecked()) { refresh.enable(); } else { refresh.disable(); } }
@NiftyEventSubscriber(id = "mapsTable") public void onListBoxSelectionChanged(final String id, final ListBoxSelectionChangedEvent<TableRow> event) { if (event.getSelectionIndices().isEmpty()) { return; } KwdFile map = state.mapSelector.getMaps().get(event.getSelectionIndices().get(0)).getMap(); if (state.mapSelector.isMPD()) { // on mpd we show the briefing state.selectedLevel = new CustomMPDLevel(map); goToScreen("briefing"); } else { // The map title populateSelectedMap(map); } }
@NiftyEventSubscriber(id = "resolution") public void onResolutionChanged(final String id, final DropDownSelectionChangedEvent<MyDisplayMode> event) { //Set the refresh dropdown DropDown refresh = screen.findNiftyControl("refreshRate", DropDown.class); refresh.clear(); refresh.addAllItems(event.getSelection().refreshRate); refresh.selectItemByIndex(refresh.itemCount() - 1); }
@NiftyEventSubscriber(id = PLAYER_LIST_ID) public void onPlayerListSelectionChanged(final String id, final ListBoxSelectionChangedEvent<PlayerTableRow> event) { List<PlayerTableRow> selection = event.getSelection(); Element element = screen.findElementById("changeAi"); if (selection.isEmpty() || !selection.get(0).getClientInfo().getKeeper().isAi()) { element.hide(); } else { TextRenderer textRenderer = element.getRenderer(TextRenderer.class); ResourceBundle rb = Utils.getMainTextResourceBundle(); String text = rb.getString("2121") + ": " + rb.getString(selection.get(0).getClientInfo().getKeeper().getAiType().getTranslationKey()); textRenderer.setText(text); element.setConstraintWidth(new SizeValue(textRenderer.getFont().getWidth(text) + "px")); element.show(); // Recalculate element.getParent().layoutElements(); } }