Package com.dci.intellij.dbn.data.type

Examples of com.dci.intellij.dbn.data.type.DBDataType


        isForeignKey = "Y".equals(resultSet.getString("IS_FOREIGN_KEY"));
        isNullable = "Y".equals(resultSet.getString("IS_NULLABLE"));
        isHidden = "Y".equals(resultSet.getString("IS_HIDDEN"));
        position = resultSet.getInt("POSITION");

        dataType = new DBDataType(this, resultSet);
    }
View Full Code Here


        }
        name = resultSet.getString("ARGUMENT_NAME");
        if (name == null) name = position == 0 ? "return" : "[unnamed]";

        dataType = new DBDataType(this, resultSet);
        if (getParentObject() instanceof DBFunction) {
            position++;
        }
    }
View Full Code Here

    }

    protected void prepareCall(MethodExecutionInput executionInput, CallableStatement callableStatement) throws SQLException {
        for (DBArgument argument : getArguments()) {
            DBDataType dataType = argument.getDataType();
            if (argument.isInput()) {
                String stringValue = executionInput.getInputValue(argument);
                setParameterValue(callableStatement, argument.getPosition(), dataType, stringValue);
            }
            if (argument.isOutput()) {
               callableStatement.registerOutParameter(argument.getPosition(), dataType.getSqlType());
            }
        }
    }
View Full Code Here

            editorComponent.setText("");
        }
    }

    public Object getCellEditorValue() {
        DBDataType dataType = cell.getColumnInfo().getDataType();
        Class clazz = dataType.getTypeClass();
        try {
            String textValue = editorComponent.getText();
           
           
            boolean trim = true;
            if (clazz == String.class) {
                DataEditorGeneralSettings generalSettings = settings.getGeneralSettings();
                boolean isEmpty = StringUtil.isEmptyOrSpaces(textValue);
                trim = (isEmpty && generalSettings.getConvertEmptyStringsToNull().value()) ||
                       (!isEmpty && generalSettings.getTrimWhitespaces().value());
            }
           
            if (trim) textValue = textValue.trim();
           
            if (textValue.length() > 0) {
                Object value = getFormatter().parseObject(clazz, textValue);
                return dataType.getNativeDataType().getDataTypeDefinition().convert(value);
            } else {
                return null;
            }
        } catch (ParseException e) {
            throw new IllegalArgumentException("Can not convert " + editorComponent.getText() + " to " + dataType.getName());
        }
    }
View Full Code Here

        if (possibleValues != null) possibleValues.clear();
    }

    public boolean isSortable() {
        DBColumn column = getColumn();
        DBDataType type = column == null ? null : column.getDataType();
        return type != null && type.isNative() &&
                type.getNativeDataType().getBasicDataType().is(
                        GenericDataType.LITERAL,
                        GenericDataType.NUMERIC,
                        GenericDataType.DATE_TIME);
    }
View Full Code Here

            } else if (!table.isEditing()){
                if (keyChar == 127) {
                    for (int rowIndex : table.getSelectedRows()) {
                        for (int columnIndex : table.getSelectedColumns()) {
                            DatasetEditorModelCell cell = model.getCellAt(rowIndex, columnIndex);
                            DBDataType dataType = cell.getColumnInfo().getDataType();
                            if (dataType.isNative() && !dataType.getNativeDataType().isLOB()) {
                                cell.updateUserValue(null, true);
                            }
                        }
                    }
                    table.updateUI();
View Full Code Here

    }

    public void prepareEditor(DatasetEditorModelCell cell) {
        setCell(cell);
        ColumnInfo columnInfo = cell.getColumnInfo();
        DBDataType dataType = columnInfo.getDataType();
        if (dataType.isNative()) {
            GenericDataType genericDataType = dataType.getNativeDataType().getBasicDataType();
            highlight(cell.hasError() ? HIGHLIGHT_TYPE_ERROR : HIGHLIGHT_TYPE_NONE);
            Object userValue = cell.getUserValue();
            if (genericDataType == GenericDataType.LITERAL) {
                String value = (String) userValue;
                setEditable(value == null || value.indexOf('\n') == -1);
View Full Code Here

    private Map<ColumnInfo, TableCellEditor> cache = new HashMap<ColumnInfo, TableCellEditor>();

    public TableCellEditor getCellEditor(ColumnInfo columnInfo, DatasetEditorTable table) {
        TableCellEditor tableCellEditor = cache.get(columnInfo);
        if (tableCellEditor == null) {
            DBDataType dataType = columnInfo.getDataType();
            tableCellEditor =
                dataType.getNativeDataType() != null ? createEditorForNativeType(columnInfo, table) :
                dataType.getDeclaredType() != null ? createEditorForDeclaredType(columnInfo, table) : null;
            cache.put(columnInfo, tableCellEditor);
        }
        return tableCellEditor;
    }
View Full Code Here

        return tableCellEditor;
    }

    private TableCellEditor createEditorForNativeType(ColumnInfo columnInfo, DatasetEditorTable table) {
        DataEditorSettings dataEditorSettings = DataEditorSettings.getInstance(table.getDatasetEditor().getProject());
        DBDataType dataType = columnInfo.getDataType();
        DBNativeDataType nativeDataType = dataType.getNativeDataType();
        DataTypeDefinition dataTypeDefinition = nativeDataType.getDataTypeDefinition();
        GenericDataType genericDataType = dataTypeDefinition.getGenericDataType();
        if (genericDataType == GenericDataType.NUMERIC) {
            return new DatasetTableCellEditor(table);
        }
        else if (genericDataType == GenericDataType.DATE_TIME) {
            DatasetTableCellEditorWithPopup tableCellEditor = new DatasetTableCellEditorWithPopup(table);
            tableCellEditor.getEditorComponent().createCalendarPopup(false);
            return tableCellEditor;
        }
        else if (genericDataType == GenericDataType.LITERAL) {
            long dataLength = dataType.getLength();


            if (dataLength < dataEditorSettings.getQualifiedEditorSettings().getTextLengthThreshold()) {
                DatasetTableCellEditorWithPopup tableCellEditor = new DatasetTableCellEditorWithPopup(table);
View Full Code Here

TOP

Related Classes of com.dci.intellij.dbn.data.type.DBDataType

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.