@Override public void displayView(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context) { IntegerProperty prop = (IntegerProperty) object.safeget(name); if (prop == null) { return; } Integer iValue = (Integer) prop.getValue(); if (iValue != null) { int value = iValue.intValue(); buffer.append(getDisplayValue(context, value)); } }
public String displaySelectSearch(String name, String prefix, XWikiCriteria criteria, XWikiContext context) { select select = new select(prefix + name, 1); select.setMultiple(true); select.setSize(3); String String0 = getDisplayValue(context, 0); String String1 = getDisplayValue(context, 1); String fieldFullName = getFieldFullName(); Number[] selectArray = ((Number[]) criteria.getParameter(fieldFullName)); List<Number> selectlist = (selectArray != null) ? Arrays.asList(selectArray) : new ArrayList<Number>(); option[] options = {new option(String1, "1"), new option(String0, "0")}; options[0].addElement(String1); options[1].addElement(String0); if (selectlist.contains(new Integer(1))) options[0].setSelected(true); if (selectlist.contains(new Integer(0))) options[1].setSelected(true); /* * try { IntegerProperty prop = (IntegerProperty) object.safeget(name); if (prop!=null) { Integer ivalue = * (Integer)prop.getValue(); if (ivalue!=null) { int value = ivalue.intValue(); if (value==1) * options[1].setSelected(true); else if (value==0) options[2].setSelected(true); } else { int value = * getDefaultValue(); if (value==1) options[1].setSelected(true); else if (value==0) * options[2].setSelected(true); } } } catch (Exception e) { // This should not happen e.printStackTrace(); } */ select.addElement(options); return select.toString(); }
select.setDisabled(isDisabled()); String String0 = getDisplayValue(context, 0); String String1 = getDisplayValue(context, 1); int nb1 = 1; int nb2 = 2;
public void displayRadioEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context) String StringNone = getDisplayValue(context, 2); String StringTrue = getDisplayValue(context, 1); String StringFalse = getDisplayValue(context, 0); div[] inputs;