/** show content when select an item in tree */ @Listen("onTopicSelect=#notetreeList") public void showTopicContent(Event fe) { if (!(fe.getTarget() instanceof NoteTreeList)) { return; } NoteTreeList item = (NoteTreeList) fe.getTarget(); currentNodeId = item.getCurrentItem().getId(); NoteNode node = noteService.findTopic(currentNodeId); String text = node.getText(); editor.setValue(text); notePath.setValue(node.getPath()); }
@Listen("onSelect=#filterbox") // Zul page example: onSelect="searchBar.value=self.selectedItem.value.name; searchBar.close();" public void changeNote(Event fe) { if (!(fe.getTarget() instanceof Listbox)) { return; } Listitem item = ((Listbox) fe.getTarget()).getSelectedItem(); NoteNode selectedNode = (NoteNode) item.getValue(); currentNodeId = selectedNode.getId(); notePath.setValue(selectedNode.getPath()); editor.setValue(selectedNode.getText()); EventQueues.lookup("myqueue2", EventQueues.SESSION, true) .publish(new Event("onSelectSearchItem", null, currentNodeId)); }
@Listen("onSave=#editor") public void updateEditorContent() { String text = editor.getValue(); noteService.updateTopicText(currentNodeId, text); QUtils.showClientInfo("Save successfully!", editor); }