Package org.apache.empire.data

Examples of org.apache.empire.data.Column


    private void renderReadOnlyColumns(HtmlWriter w)
    {
        if (record instanceof Record && ((Record)record).isValid())
        {   // Special Timestamp Logic
            Column timestamp = null;
            if (record instanceof DBRecord)
            {   // Only for instances of DBRecord!
                timestamp = ((DBRecord)record).getRowSet().getTimestampColumn();
            }
            // Key Columns
            Record rec = (Record)record;
            Column [] keyCols = rec.getKeyColumns();
            String sysdate = DBDatabase.SYSDATE.toString();
            int count = rec.getFieldCount();
            for (int i=0; i<count; i++)
            {
                Column column = rec.getColumn(i);
                if (column==null)
                    continue;
                if (column!=timestamp)
                {   // Check if column was modified
                    if (rec.wasModified(column)==false || rec.isFieldReadOnly(column)==false)
                        continue;
                    // Check whether column is a key column
                    if (isKeyColumn(column, keyCols))
                        continue;
                }
                // Check for Null-Value
                if (record.isNull(i))
                    continue;
                // Add hidden field
                String value = StringUtils.toString(record.getValue(i));
                if (column.getDataType()==DataType.DATETIME && sysdate.equals(value)==false)
                {   // Special for Timestamps
                    Date date = ObjectUtils.getDate(record.getValue(i));
                    value = formatDate(date, "yyyy-MM-dd HH:mm:ss.S");
                }
                else if (column.getDataType()==DataType.DATE && sysdate.equals(value)==false)
                {   // Special for Timestamps
                    Date date = ObjectUtils.getDate(record.getValue(i));
                    value = formatDate(date, "yyyy-MM-dd");
                }
                // Add hidden field
View Full Code Here


    {
        // add label and input components when the view is loaded for the first time
        super.encodeBegin(context);

        // Create
        Column column = helper.getColumn();
        if (column==null)
            throw new InvalidArgumentException("column", column);
       
        // Tooltip title
        String title = helper.getLabelTooltip(column);
View Full Code Here

            if (rs == null)
            {
                log.error("Table/View '{}' not found in database!", tn);
                return null; // not found
            }
            Column column = rs.getColumn(cn);
            if (column == null)
            {
                log.error("Column '{}' not found in table/view '{}'!", cn, tn);
                return null; // not found
            }
            // done
            return column;
        }
        // When null, try value
        if (col == null)
        { // Try value
            col = tag.getValue();
            // Column supplied?
            if (col instanceof Column)
            {
                return (Column) col;
            }
            // Column expression supplied?
            if (col instanceof ColumnExpr)
            { // Use source column instead
                Column source = ((ColumnExpr) col).getSourceColumn();
                if (source != null)
                    return source;
                // No source column? --> wrap
                return new ColumnExprWrapper((ColumnExpr) col);
            }
View Full Code Here

        return label;
    }
   
    public HtmlOutputLabel createLabelComponent(FacesContext context, String forInput, String styleClass, String style, boolean colon)
    {
        Column column = null;
        boolean readOnly=false;
        boolean required=false;
        // for
        if (StringUtils.isNotEmpty(forInput) && !forInput.equals("*"))
        {   // Set Label input Id
View Full Code Here

        }

        @Override
        public String getInputId()
        {
            Column c = getColumn();
            return c.getName(); // (c instanceof DBColumn) ? ((DBColumn)c).getFullName() : c.getName();
        }
View Full Code Here

                return formatValue(nullValue, vi, false);
            // Empty String
            return "";
        }
        // Format Value
        Column column = vi.getColumn();
        DataType dataType = getValueType(value, (column != null) ? column.getDataType() : DataType.UNKNOWN);
        if (dataType == DataType.TEXT || dataType == DataType.UNKNOWN)
        { // String
            String s = String.valueOf(value);
            if (hasFormatOption(vi, "noencode"))
                return s;
View Full Code Here

        // Is unit supplied as a format option
        String format = getFormatString(vi, FORMAT_UNIT, FORMAT_UNIT_ATTRIBUTE);
        if (format!=null)
            return format;
        // Is it a currency column
        Column column = vi.getColumn();
        if (column!=null && column.getDataType()==DataType.DECIMAL)
        {
            String numberType = StringUtils.toString(column.getAttribute(InputControl.NUMBER_TYPE_ATTRIBUTE));
            if (numberType!=null)
            {
                if (numberType.equalsIgnoreCase("Currency"))
                {
                    String currencyCode = StringUtils.toString(column.getAttribute(InputControl.CURRENCY_CODE_ATTRIBUTE));
                    if (currencyCode!=null)
                    {   // nf = NumberFormat.getCurrencyInstance(locale);
                        Currency currency = Currency.getInstance(currencyCode);
                        return (currency!=null) ? currency.getSymbol() : null;
                    }
View Full Code Here

            return super.formatValue(value, vi, hasError);
        }
        // Check for Abbreviation
        if (hasFormatOption(vi, "short"))
        {
            Column column = vi.getColumn();
            if (column!=null)
            {   // Check for Abbreviation option list
                Object attrValue = column.getAttribute(COLATTR_ABBR_OPTIONS);
                if (attrValue instanceof Options)
                { // Check for Options
                    String text = ((Options)attrValue).get(value);
                    if (text != null)
                        return vi.getText(text);
View Full Code Here

    {
        // Add all Columns
        int count = 0;
        for (int i = 0; i < getFieldCount(); i++)
        { // Check Property
            Column column = getColumn(i);
            if (column.isReadOnly())
                continue;
            if (ignoreList != null && ignoreList.contains(column))
                continue; // ignore this property
            // Get Property Name
            setBeanPropertyValue(bean, column, getValue(i));
View Full Code Here

    {
        // Add all Columns
        int count = 0;
        for (int i = 0; i < getFieldCount(); i++)
        { // Check Property
            Column column = getColumn(i);
            if (column.isReadOnly())
                continue;
            if (ignoreList != null && ignoreList.contains(column))
                continue; // ignore this property
            // Get Property Name
            String property = column.getBeanPropertyName();
            Object value = getBeanPropertyValue(bean, property);
            setValue(column, value);
            count++;
        }
        return count;
View Full Code Here

TOP

Related Classes of org.apache.empire.data.Column

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.