public void clearData() { i_valueSetItemSearchXmlDS.setTestData(new Record[0]); setData(new ListGridRecord[0]); fetchData(); redraw(); }
public void getData(String codeSystem, String codeSystemVersion, String searchText) { i_searchString = searchText; Criteria criteria = new Criteria(); criteria.addCriteria("searchText", searchText); criteria.addCriteria("codeSystem", codeSystem); criteria.addCriteria("codeSystemVersion", codeSystemVersion); i_valueSetItemSearchXmlDS.fetchData( criteria, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if ((response != null) && (response.getAttribute("reason") != null)) { setEmptyMessage("<b><font color=\"red\">" + ERROR_MESSAGE + "</font></b>"); } else { setEmptyMessage(EMPTY_MESSAGE); } setData(new ListGridRecord[0]); fetchData(); redraw(); // let others know that the data has been retrieved. Cts2Editor.EVENT_BUS.fireEvent(new ValueSetItemsReceivedEvent()); } }); }
public SearchValueSetItemsListGrid() { super(); i_valueSetItemSearchXmlDS = ValueSetItemSearchXmlDS.getInstance(); setWidth100(); setHeight100(); setShowAllRecords(true); setWrapCells(false); setDataSource(i_valueSetItemSearchXmlDS); setEmptyMessage(EMPTY_MESSAGE); ListGridField addField = new ListGridField("add", "Add"); addField.setType(ListGridFieldType.BOOLEAN); addField.setShowHover(false); addField.setDefaultValue(false); addField.setCanEdit(true); addField.addChangedHandler( new ChangedHandler() { @Override public void onChanged(ChangedEvent changedEvent) { if ((Boolean) changedEvent.getValue()) { ListGridRecord selected = getSelectedRecord(); String uri = selected.getAttribute("uri"); String code = selected.getAttribute("name"); String description = selected.getAttribute("designation"); String codeSystem = selected.getAttribute("namespace"); String codeSystemVersion = selected.getAttribute("codeSystemVersion"); Cts2Editor.EVENT_BUS.fireEvent( new AddEntitySelectedEvent( uri, code, description, codeSystem, codeSystemVersion)); } else { ListGridRecord selected = getSelectedRecord(); String href = selected.getAttribute("uri"); Cts2Editor.EVENT_BUS.fireEvent(new AddEntityDeselectedEvent(href)); } } }); ListGridField nameField = new ListGridField(ID_NAME, TITLE_NAME); nameField.setWrap(false); nameField.setWidth("25%"); nameField.setShowHover(false); nameField.setCanEdit(false); nameField.setCellFormatter( new CellFormatter() { @Override public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value != null) { return addCellHighlights(value.toString()); } else { return null; } } }); ListGridField designationField = new ListGridField(ID_DESIGNATION, TITLE_DESIGNATION); designationField.setWrap(false); designationField.setWidth("*"); designationField.setCanEdit(false); designationField.setCellFormatter( new CellFormatter() { @Override public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value != null) { return addCellHighlights(value.toString()); } else { return null; } } }); setFields(addField, nameField, designationField); setSelectOnEdit(true); setSelectionAppearance(SelectionAppearance.ROW_STYLE); setSelectionType(SelectionStyle.SINGLE); // Set edit and edit event to get the download checkbox to work // correctly. setCanEdit(true); setAutoFetchData(false); setCanHover(true); setShowHover(true); setShowHoverComponents(true); // set the initial sort SortSpecifier[] sortspec = new SortSpecifier[1]; sortspec[0] = new SortSpecifier(ID_NAME, SortDirection.ASCENDING); setInitialSort(sortspec); // addEventHandlers(); }