Ensures that a value is a SetCell
487249
def coerce(self, value):
        
        if hasattr(value, 'values') and hasattr(value, 'domain'):
            return value
        elif hasattr(value, '__iter__'):
            # if the values are consistent with the comparison's domains, then
            # copy them, otherwise, make a new domain with the values.
            if all(map(lambda x: x in self.domain, value)):
                return self._stem(self.domain, value)
            else:
                raise CellConstructionFailure("Cannot turn %s into a cell" % (value))
        elif value in self.domain:
            return self._stem(self.domain, [value])
        else:
            raise CellConstructionFailure("Cannot turn %s into a cell" % (value))
1258028
def setCurrentValue(self, value):
        
        enum = self.enum()
        if not enum:
            return
        
        if self.isCheckable():
            indexes = []
            for i in range(self.count()):
                try:
                    check_value = enum[nativestring(self.itemText(i))]
                except KeyError:
                    continue
                
                if check_value & value:
                    indexes.append(i)
            self.setCheckedIndexes(indexes)
        else:
            try:
                text = enum[value]
            except (AttributeError, KeyError):
                return
            
            self.setCurrentIndex(self.findText(text))
343514
def setValueSafe(self, row, value):
        ''
        try:
            return self.setValue(row, value)
        except Exception as e:
            exceptionCaught(e)
532205
public static void createCell(SheetTemplate template, Object value, String styleKey) {
        Cell cell = template.currentRow.createCell(template.currentColumnIndex);
        setCellStyle(template, cell, styleKey);
        if (null == value || "".equals(value)) {
            template.currentColumnIndex++;
            return;
        }

        if (String.class == value.getClass()) {
            cell.setCellValue((String) value);
            template.currentColumnIndex++;
            return;
        }

        if (int.class == value.getClass()) {
            cell.setCellValue((int) value);
            template.currentColumnIndex++;
            return;
        }

        if (Integer.class == value.getClass()) {
            cell.setCellValue((Integer) value);
            template.currentColumnIndex++;
            return;
        }

        if (double.class == value.getClass()) {
            cell.setCellValue((double) value);
            template.currentColumnIndex++;
            return;
        }

        if (Double.class == value.getClass()) {
            cell.setCellValue((Double) value);
            template.currentColumnIndex++;
            return;
        }

        if (Date.class == value.getClass()) {
            cell.setCellValue((Date) value);
            template.currentColumnIndex++;
            return;
        }

        if (boolean.class == value.getClass()) {
            cell.setCellValue((boolean) value);
            template.currentColumnIndex++;
            return;
        }

        if (Boolean.class == value.getClass()) {
            cell.setCellValue((Boolean) value);
            template.currentColumnIndex++;
            return;
        }

        if (Calendar.class == value.getClass()) {
            cell.setCellValue((Calendar) value);
            template.currentColumnIndex++;
            return;
        }

        if (RichTextString.class == value.getClass()) {
            cell.setCellValue((RichTextString) value);
            template.currentColumnIndex++;
            return;
        }
        // default value#toString
        cell.setCellValue(value.toString());
        template.currentColumnIndex++;
    }
106309
def set(self, value):
        """"""
        if self.validate(value):
            #print "Parameter " + self.id + " successfully set to " + repr(value)
            self.hasvalue = True
            if isinstance(value, float):
                self.value = round(value)
            else:
                self.value = int(value)
            return True
        else:
            #print "Parameter " + self.id + " COULD NOT BE set to " + repr(value)
            return False
254402
public static void setCellValue(Cell cell, Object value, StyleSet styleSet, boolean isHeader) {
		final CellStyle headCellStyle = styleSet.getHeadCellStyle();
		final CellStyle cellStyle = styleSet.getCellStyle();
		if (isHeader && null != headCellStyle) {
			cell.setCellStyle(headCellStyle);
		} else if (null != cellStyle) {
			cell.setCellStyle(cellStyle);
		}

		if (null == value) {
			cell.setCellValue(StrUtil.EMPTY);
		} else if (value instanceof FormulaCellValue) {
			// 公式
			cell.setCellFormula(((FormulaCellValue) value).getValue());
		} else if (value instanceof Date) {
			if (null != styleSet && null != styleSet.getCellStyleForDate()) {
				cell.setCellStyle(styleSet.getCellStyleForDate());
			}
			cell.setCellValue((Date) value);
		} else if (value instanceof Calendar) {
			cell.setCellValue((Calendar) value);
		} else if (value instanceof Boolean) {
			cell.setCellValue((Boolean) value);
		} else if (value instanceof RichTextString) {
			cell.setCellValue((RichTextString) value);
		} else if (value instanceof Number) {
			if ((value instanceof Double || value instanceof Float) && null != styleSet && null != styleSet.getCellStyleForNumber()) {
				cell.setCellStyle(styleSet.getCellStyleForNumber());
			}
			cell.setCellValue(((Number) value).doubleValue());
		} else {
			cell.setCellValue(value.toString());
		}
	}
121890
private <C> void fireEventToCell(Event event, String eventType, Element parentElem,
                                     final T rowValue, Context context, HasCell<T, C> column) {
        // Check if the cell consumes the event.
        Cell<C> cell = column.getCell();
        if (!cellConsumesEventType(cell, eventType)) {
            return;
        }

        C cellValue = column.getValue(rowValue);
        boolean cellWasEditing = cell.isEditing(context, parentElem, cellValue);
        if (column instanceof Column) {
          /*
           * If the HasCell is a Column, let it handle the event itself. This is
           * here for legacy support.
           */
            Column<T, C> col = (Column<T, C>) column;
            col.onBrowserEvent(context, parentElem, rowValue, event);
        } else {
            // Create a FieldUpdater.
            final FieldUpdater<T, C> fieldUpdater = column.getFieldUpdater();
            final int index = context.getIndex();
            ValueUpdater<C> valueUpdater = (fieldUpdater == null) ? null : (value) -> {
                fieldUpdater.update(index, rowValue, value);
            };

            // Fire the event to the cell.
            cell.onBrowserEvent(context, parentElem, cellValue, event, valueUpdater);
        }
180060
function() {
    // Get new value
    var inputValue = this.getInputValue();
    var validValue = inputValue;
    
    // Validate new value
    if(this.validator) {
        validValue = this.validator.call(this.getDataTable(), inputValue, this.value, this);
        if(validValue === undefined ) {
            if(this.resetInvalidData) {
                this.resetForm();
            }
            this.fireEvent("invalidDataEvent",
                    {editor:this, oldData:this.value, newData:inputValue});
            return;
        }
    }
        
    var oSelf = this;
    var finishSave = function(bSuccess, oNewValue) {
        var oOrigValue = oSelf.value;
        if(bSuccess) {
            // Update new value
            oSelf.value = oNewValue;
            oSelf.getDataTable().updateCell(oSelf.getRecord(), oSelf.getColumn(), oNewValue);
            
            // Hide CellEditor
            oSelf.getContainerEl().style.display = "none";
            oSelf.isActive = false;
            oSelf.getDataTable()._oCellEditor =  null;
            
            oSelf.fireEvent("saveEvent",
                    {editor:oSelf, oldData:oOrigValue, newData:oSelf.value});
        }
        else {
            oSelf.resetForm();
            oSelf.fireEvent("revertEvent",
                    {editor:oSelf, oldData:oOrigValue, newData:oNewValue});
        }
        oSelf.unblock();
    };
    
    this.block();
    if(lang.isFunction(this.asyncSubmitter)) {
        this.asyncSubmitter.call(this, finishSave, validValue);
    } 
    else {   
        finishSave(true, validValue);
    }
}
343742
void set(int row, int column, V value) {
        this.row = row;
        this.column = column;
        this.value = value;
    }
1140435
function setValue(promise, value) {
  utils.defineProperty(promise, 'value', {
    enumerable: false,
    configurable: false,
    writable: false,
    value: value
  });
}
974950
def _ensure_value_is_in_objects(self,val):
        
        if not (val in self.objects):
           self.objects.append(val)
630649
def _set(self, instance, value, **kw):
        
        logger.debug("ATFieldManager::set: value=%r" % value)

        # check field permission
        if not self.field.checkPermission("write", instance):
            raise Unauthorized("You are not allowed to write the field {}"
                               .format(self.name))

        # check if field is writable
        if not self.field.writeable(instance):
            raise Unauthorized("Field {} is read only."
                               .format(self.name))

        # id fields take only strings
        if self.name == "id":
            value = str(value)

        # get the field mutator
        mutator = self.field.getMutator(instance)

        # Inspect function and apply *args and **kwargs if possible.
        mapply(mutator, value, **kw)

        return True
1278458
def ensure_cell_exists(row_index, column_index = 0)
    validate_nonnegative(row_index)
    validate_nonnegative(column_index)

    sheet_data.rows[row_index] || add_row(row_index)
  end
389040
@Override
    public void setValue(Object value) throws WidgetException {
        boolean set = false;
        try {
            if (value instanceof String) {
                if (((String) value).equalsIgnoreCase(UNCHECK)) {
                    doAction(true);
                } else if (((String) value).equalsIgnoreCase(CHECK)) {
                    doAction(false);
                }

                set = true;
            } else {
                throw new WidgetRuntimeException(
                        "value must be a String of either 'check' or 'uncheck'", getByLocator());
            }
        } catch (Exception e) {
            throw new WidgetException("Error while checking/unchecking", getByLocator(), e);
        }

        if (!set)
            throw new WidgetException(
                    "Invalid set value for checkbox. It must be either 'check' or 'uncheck'",
                    getByLocator());
    }
264096
private void writeCellValue(Object value, Map<String, Integer> schema, String column, Row row) {
        if (column == null || value == null) {
            return;
        }
        Cell cell = row.getCell(schema.get(column), Row.CREATE_NULL_AS_BLANK);
        if (NumberUtils.isNumber(value.toString())) {
            cell.setCellValue(Double.parseDouble(value.toString()));
        } else {
            if (value.toString().contains("\n")) {
                cell.getCellStyle().setWrapText(true);
            }
            cell.setCellValue(value.toString());
        }
    }
101908
public static ICellValue resolveCellValue(org.apache.poi.ss.usermodel.CellValue cellval) {
        if (cellval == null) { return CellValue.BLANK; }

        switch (cellval.getCellType()) {
            case CELL_TYPE_NUMERIC: { return CellValue.from(cellval.getNumberValue()); }
            case CELL_TYPE_STRING: { return CellValue.from(cellval.getStringValue()); }
            case CELL_TYPE_BOOLEAN: { return CellValue.from(cellval.getBooleanValue()); }
            case CELL_TYPE_ERROR: { return CellValue.from(ErrorEval.valueOf(cellval.getErrorValue()).getErrorString()); }
            case CELL_TYPE_BLANK: { return CellValue.BLANK; }
            case CELL_TYPE_FORMULA: { throw new CalculationEngineException("Result of evaluation cannot be a formula."); }
            default: { throw new CalculationEngineException(String.format("CellValue's tType %s is not supported.", cellval.getCellType())); }
        }
    }
1070610
def set(self, value):
        """"""
        value = min(self.max, max(self.min, value))
        self._value = value
        start_new_thread(self.func, (self.get(),))