/** * When a radio button is selected, its associated patient list is activated. */ public void onCheck$rgrpLists() { Radio radio = rgrpLists.getSelectedItem(); if (radio == null) { radio = rgrpLists.getItemAtIndex(0); rgrpLists.setSelectedItem(radio); } IPatientList list = (IPatientList) radio.getAttribute(ATTR_PATIENT_LIST); setActiveList(list); }
private void postOnInitRender(String idx) { //20080724, Henri Chen: optimize to avoid postOnInitRender twice if (getAttribute(ZUL_RADIOGROUP_ON_INITRENDER) == null) { //Bug #2010389 setAttribute(ZUL_RADIOGROUP_ON_INITRENDER, Boolean.TRUE); //flag syncModel Events.postEvent("onInitRender", this, idx); } }
private void doSelectionChanged() { final Selectable<Object> smodel = getSelectableModel(); if (smodel.isSelectionEmpty()) { if (_jsel >= 0) setSelectedItem(null); return; } if (_jsel >= 0 && smodel.isSelected(_model.getElementAt(_jsel))) return; //nothing changed int j = 0; for (final Radio item : getItems()) { if (smodel.isSelected(_model.getElementAt(j++))) { setSelectedItem(item); return; } } setSelectedItem(null); //something wrong but be self-protected }
/** Removes the child radio button in the radio group at the given index. * @return the removed radio button. */ public Radio removeItemAt(int index) { final Radio item = getItemAtIndex(index); if (item != null && !removeExternal(item)) { final Component p = item.getParent(); if (p != null) p.removeChild(item); } return item; }
public void onInitRender(Event data) { removeAttribute(ZUL_RADIOGROUP_ON_INITRENDER); //clear syncModel flag final Renderer renderer = new Renderer(); final ListModel subset = _model; try { if (!getChildren().isEmpty()) getChildren().clear(); int pgsz = subset.getSize(), ofs = 0; for (int j = 0; j < pgsz; ++j) { if (v != null) //a new item is created to replace the existent one item = (Radio) v; if (getSelectableModel().isSelected(value)) setSelectedItem(item);
/** Make sure only one of them is checked. */ private void fixSiblings(boolean checked, boolean byclient) { final Radiogroup group = getRadiogroup(); if (group != null) { if (checked) { final Radio sib = group.getSelectedItem(); if (sib != null && sib != this) { if (byclient) { sib._checked = false; } else { sib.setChecked(false); //and fixSelectedIndex return; } } } group.fixSelectedIndex(); group.syncSelectionToModel(); } }
/** Deselects all of the currently selected radio button and selects * the radio button with the given index. */ public void setSelectedIndex(int jsel) { if (jsel < 0) jsel = -1; if (_jsel != jsel) { if (jsel < 0) { Radio r = getSelectedItem(); if (r != null) r.setSelected(false); } else { getItemAtIndex(jsel).setSelected(true); } } }
public void render(final Radio item, final Object data, final int index) throws Exception { final Radiogroup radiogroup = item.getRadiogroup(); final int size = radiogroup.getModel().getSize(); final Template tm = resolveTemplate(radiogroup, item, data, index, size, "model"); if (tm == null) { Object oldVar = radiogroup.getAttribute(varnm); Object oldIter = radiogroup.getAttribute(itervarnm); radiogroup.setAttribute(varnm, data); radiogroup.setAttribute(itervarnm, iterStatus); radiogroup.removeAttribute(varnm); } else { radiogroup.setAttribute(varnm, oldVar); radiogroup.removeAttribute(itervarnm); } else { radiogroup.setAttribute(itervarnm, oldIter);
private boolean checkInOut(String data) { String inout = piece(data, ";", 2); String opt = (String) rgInOut.getSelectedItem().getValue(); return opt.contains(inout); }
/** * Sets the show all setting. If true, all notifications are displayed, regardless of any * patient association. If false, only notifications associated with the selected patient are * displayed. * * @param value The show all setting. */ public void setShowAll(boolean value) { showAll = value; if (rgFilter != null) { rgFilter.setSelectedItem(showAll ? radAll : radPatient); refresh(); } }
public void onClick$btnSearch() { String text = txtSearch.getValue().trim(); boolean synonym = rgrpLookupMode.getSelectedIndex() == 1; FMDate date = new FMDate(datSearch.getValue()); Long max = (Long) rgrpMaxResults.getSelectedItem().getValue(); String[] filters = getSelectedSubsets(); List<TermMatch> matches = TermUtil.lookupSCT(text, synonym, date, max, filters); TreeNode<Object> rootNode = new DefaultTreeNode<>(null, null, false); buildModel(rootNode, matches); DefaultTreeModel<Object> model = new DefaultTreeModel<>(rootNode); treeSearch.setModel(model); }
@SuppressWarnings("unchecked") public Object coerceToUi(Object val, Component comp, BindContext ctx) { Radiogroup radiogroup = (Radiogroup) comp; final ListModel<?> model = radiogroup.getModel(); } else { for (final Iterator<?> it = radiogroup.getItems().iterator(); it.hasNext();) { final Radio radio = (Radio) it.next(); if (val.equals(radio.getValue())) {
/** * Loads the registered lists into the radio group. */ private void initRegisteredLists() { for (IPatientList list : registry) { if (!list.isDisabled()) { Radio radio = new Radio(list.getName()); radio.setAttribute(ATTR_PATIENT_LIST, list); rgrpLists.appendChild(radio); if (list == favorites) { radio.setId("radFavorites"); } } } rgrpLists.setSelectedIndex(0); pendingListItem.add(new PatientListItem(null, txtWaitMessage)); }
/** Returns the selected radio button. */ public Radio getSelectedItem() { return _jsel >= 0 ? getItemAtIndex(_jsel) : null; }
/** Deselects all of the currently selected radio buttons and selects * the given radio button. */ public void setSelectedItem(Radio item) { if (item == null) { setSelectedIndex(-1); } else { if (item.getRadiogroup() != this) throw new UiException("Not a child: " + item); item.setSelected(true); } }
public void onClick$btnOK() { clearMessages(); Radio radio = rgReason.getSelectedItem(); String reasonCode = radio == null ? null : (String) radio.getValue(); if (reasonCode == null) { Clients.wrongValue(rgReason, "You must select a reason for the deletion."); return; } String reasonText = "3".equals(reasonCode) ? txtOther.getText().trim() : null; if (reasonText != null && reasonText.isEmpty()) { Clients.wrongValue(txtOther, "Please enter text describing the reason for the deletion."); return; } try { service.delete(record, reasonCode, reasonText); } catch (Exception e) { PromptDialog.showError(e.getMessage()); return; } root.setAttribute("ok", true); root.detach(); } }
/** * Set up display. */ @Override public void init() { super.init(); getContainer().registerProperties(this, "showAll", "alertDuration", "alertThreshold"); rgFilter.setSelectedItem(showAll ? radAll : radPatient); processingController = ProcessingController.create(this); lstNotification.setItemRenderer(renderer); RowComparator.autowireColumnComparators(lstNotification.getListhead().getChildren()); model.setMultiple(true); updatePatient(true); subscribe(true); }
rgIndicated.setSelectedItem(record.getIndicated() ? radYes : radNo); selectItem(cboGoal, record.getGoalRange()); selectItem(cboMin, formatDouble(record.getGoalMin()));