public void formTextArea(String fieldName, String value) { if (value == null) { value = ""; } int valueLen = value.length(); int cols = 50; int rows = 1; rows = Math.max(rows, NumberUtility.divideAndCeil(valueLen, cols)); rows = Math.max(rows, StringUtility.getLineCount(value)); m_out.print("<textarea rows=" + rows + " cols=" + cols + " name='" + fieldName + "'>"); print(value); m_out.print("</textarea>"); }
/** * Latitude (φ, y coordinate) * <p> * Example: Berne, Switzerland has latitude <code>7.45</code> */ public BigDecimal getLatitudeAsBigDecimal() { return NumberUtility.getBigDecimalValue(getLatitude()); }
private int compareInternal(NUMBER a, NUMBER b) { return ObjectUtility.compareTo(NumberUtility.numberToBigDecimal(a), NumberUtility.numberToBigDecimal(b)); }
protected SessionInspector[] getSortedSessions() { SessionInspector[] sessionInspectors = ProcessInspector.instance().getSessionInspectors(); TreeMap<CompositeObject, SessionInspector> userAndTimeToSessions = new TreeMap<>(); for (int i = 0; i < sessionInspectors.length; i++) { String user = sessionInspectors[i].getInfo().getUserId(); long lastAccess = NumberUtility.nvl(sessionInspectors[i].getInfo().getLastAccessedTime(), 0L); userAndTimeToSessions.put(new CompositeObject(lastAccess, user, i), sessionInspectors[i]); } return userAndTimeToSessions.values().toArray(new SessionInspector[userAndTimeToSessions.size()]); }
@SuppressWarnings("unchecked") protected VALUE getLookupRowKeyForId(String id) { if (StringUtility.isNullOrEmpty(id)) { return null; } return (VALUE) m_idToKeyMap.get(NumberUtility.parseInt(id)); }
@Override public Long getSequenceNextval(String sequenceName) { String s = getSequenceNextvalStatement(sequenceName); Object[][] ret = createStatementProcessor(s, null, 0).processSelect(getTransaction(), getStatementCache(), null); if (ret.length == 1) { return NumberUtility.toLong(ObjectUtility.nvl((Number) ret[0][0], 0)); } return 0L; }
long delay = NumberUtility.nvl(CONFIG.getPropertyValue(JobCompletionDelayOnSessionShutdown.class), 0L); if (delay > 0L) { try {
/** * @return the default number of columns based on the height of the field and the number of visible buttons (legacy * case). The value is always > 0 */ protected int calcDefaultGridColumnCount() { GridData parentData = m_group.getGridData(); if (parentData == null || parentData.h < 1) { return 1; // by default: vertical align (one column) } int numVisibleFields = m_fields.size(); if (numVisibleFields < 1) { return 1; // no fields } int height = Math.min(numVisibleFields, parentData.h); if (height <= 1) { return numVisibleFields; } return divideAndCeil(numVisibleFields, height); }
private int compareInternal(NUMBER a, NUMBER b) { return ObjectUtility.compareTo(NumberUtility.numberToBigDecimal(a), NumberUtility.numberToBigDecimal(b)); }
/** * Longitude (λ, x coordinate) * <p> * Example: Berne, Switzerland has longitude <code>46.95</code> */ public BigDecimal getLongitudeAsBigDecimal() { return NumberUtility.getBigDecimalValue(getLongitude()); }
/** * Sets GridData on each button (= field) of the group. */ protected void applyGridData() { int numVisibleFields = m_fields.size(); m_gridColumns = Math.min(m_group.getGridColumnCount(), numVisibleFields); if (m_gridColumns <= 0) { m_gridColumns = calcDefaultGridColumnCount(); } m_gridRows = divideAndCeil(numVisibleFields, m_gridColumns); int i = 0; for (int r = 0; r < m_gridRows; r++) { for (int c = 0; c < m_gridColumns; c++) { if (i < numVisibleFields) { GridData data = GridDataBuilder.createFromHints(m_fields.get(i), 1); data.x = c; data.y = r; data.w = 1; data.h = 1; m_fields.get(i).setGridDataInternal(data); i++; } else { break; } } } }
if (getMinPossibleValue() != null && retVal.compareTo(NumberUtility.numberToBigDecimal(getMinPossibleValue())) < 0) { throwNumberTooSmall(); if (getMaxPossibleValue() != null && retVal.compareTo(NumberUtility.numberToBigDecimal(getMaxPossibleValue())) > 0) { throwNumberTooLarge();
reorgBounds.y = minY; VerticalGridMatrix reorgMatrix = new VerticalGridMatrix(reorgBounds.x, reorgBounds.y, reorgBounds.w, divideAndCeil(usedCells, reorgBounds.w)); reorgMatrix.addCells(occupiedCells); while (!reorgMatrix.computeGridData(sortedFieldsToReorganize)) {
@Override protected void layoutAllDynamic(List<IFormField> fields) { // calculate the used cells int cellCount = 0; for (IFormField f : fields) { GridData hints = getGridDataFromHints(f, getGridColumnCount()); cellCount += hints.w * hints.h; } int rowCount = divideAndCeil(cellCount, getGridColumnCount()); VerticalGridMatrix matrix = new VerticalGridMatrix(getGridColumnCount(), rowCount); while (!matrix.computeGridData(fields)) { matrix.resetAll(getGridColumnCount(), ++rowCount); } // setGridData for (IFormField f : fields) { GridData data = matrix.getGridData(f); f.setGridDataInternal(data); } setGridRows(matrix.getRowCount()); }