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

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


            buffer.append("    <row index=\"");
            buffer.append(rowIndex);
            buffer.append("\">\n");
            for (int columnIndex=0; columnIndex < model.getColumnCount(); columnIndex++){
                String columnName = model.getColumnName(columnIndex);
                GenericDataType genericDataType = model.getGenericDataType(columnIndex);
                String value = null;
                if (genericDataType == GenericDataType.LITERAL ||
                        genericDataType == GenericDataType.NUMERIC ||
                        genericDataType == GenericDataType.DATE_TIME) {
View Full Code Here


            buffer.append(model.getTableName());
            buffer.append(" (");

            int realColumnIndex = 0;
            for (int columnIndex=0; columnIndex < model.getColumnCount(); columnIndex++){
                GenericDataType genericDataType = model.getGenericDataType(columnIndex);
                if (genericDataType == GenericDataType.LITERAL ||
                        genericDataType == GenericDataType.NUMERIC ||
                        genericDataType == GenericDataType.DATE_TIME) {
                    if (realColumnIndex > 0) buffer.append(", ");
                    buffer.append(model.getColumnName(columnIndex));
                    realColumnIndex++;
                }
            }
            buffer.append(") values (");

            realColumnIndex = 0;
            for (int columnIndex=0; columnIndex < model.getColumnCount(); columnIndex++){
                GenericDataType genericDataType = model.getGenericDataType(columnIndex);
                if (genericDataType == GenericDataType.LITERAL ||
                        genericDataType == GenericDataType.NUMERIC ||
                        genericDataType == GenericDataType.DATE_TIME) {
                    if (columnIndex > 0) buffer.append(", ");
                    Object object = model.getValue(rowIndex, columnIndex);
View Full Code Here

        for (int rowIndex=0; rowIndex < model.getRowCount(); rowIndex++) {
            buffer.append("            <tr>\n");

            for (int columnIndex=0; columnIndex < model.getColumnCount(); columnIndex++){
                GenericDataType genericDataType = model.getGenericDataType(columnIndex);
                String value = null;
                if (genericDataType == GenericDataType.LITERAL ||
                        genericDataType == GenericDataType.NUMERIC ||
                        genericDataType == GenericDataType.DATE_TIME) {
View Full Code Here


        if (argument.isInput() && !dataType.isDeclared() && dataType.getNativeDataType() != null) {
            DBNativeDataType nativeDataType = dataType.getNativeDataType();
            DataTypeDefinition dataTypeDefinition = nativeDataType.getDataTypeDefinition();
            GenericDataType genericDataType = dataTypeDefinition.getGenericDataType();

            if (genericDataType == GenericDataType.DATE_TIME) {
                TextFieldWithPopup inputField = new TextFieldWithPopup(argument.getProject());
                inputField.setPreferredSize(new Dimension(200, -1));
                inputField.createCalendarPopup(false);
View Full Code Here

        else if (StringUtil.isNotEmptyOrSpaces(value)) {
            DBDataType dataType = column == null ? null : column.getDataType();
            if (dataType != null && dataType.isNative()) {
                ConnectionHandler connectionHandler = dataset.getConnectionHandler();
                RegionalSettings regionalSettings = RegionalSettings.getInstance(connectionHandler.getProject());
                GenericDataType genericDataType = dataType.getNativeDataType().getBasicDataType();
                if (genericDataType == GenericDataType.LITERAL) {
                    value = com.intellij.openapi.util.text.StringUtil.replace(value, "'", "''");
                    value = "'" + value + "'";
                } else if (genericDataType == GenericDataType.DATE_TIME) {
                    DatabaseMetadataInterface metadataInterface = connectionHandler.getInterfaceProvider().getMetadataInterface();
View Full Code Here

        errorMap = null;
        List<StatementExecutionVariable> variables = new ArrayList<StatementExecutionVariable>(this.variables);
        Collections.sort(variables);
        for (StatementExecutionVariable variable : variables) {
            String value = temporary ? variable.getTemporaryValueProvider().getValue() : variable.getValue();
            GenericDataType genericDataType = temporary ? variable.getTemporaryValueProvider().getDataType() : variable.getDataType();

            if (!StringUtil.isEmpty(value)) {
                RegionalSettings regionalSettings = RegionalSettings.getInstance(connectionHandler.getProject());

                if (genericDataType == GenericDataType.LITERAL) {
                    value = StringUtil.replace(value, "'", "''");
                    value = "'" + value + "'" ;
                } else if (genericDataType == GenericDataType.DATE_TIME){
                    DatabaseMetadataInterface metadataInterface = connectionHandler.getInterfaceProvider().getMetadataInterface();
                    try {
                        Date date = regionalSettings.getFormatter().parseDateTime(value);
                        value = metadataInterface.createDateString(date);
                    } catch (ParseException e) {
                        try {
                            Date date = regionalSettings.getFormatter().parseDate(value);
                            value = metadataInterface.createDateString(date);
                        } catch (ParseException e1) {
                            addError(variable, "Invalid date");
                        }
                    }
                } else if (genericDataType == GenericDataType.NUMERIC){
                    try {
                        regionalSettings.getFormatter().parseNumber(value);
                    } catch (ParseException e) {
                        addError(variable, "Invalid number");
                    }

                } else {
                    throw new IllegalArgumentException("Data type " + genericDataType.getName() + " not supported with execution variables.");
                }

                statementText = StringUtil.replaceIgnoreCase(statementText, variable.getName(), value);
            }
        }
View Full Code Here

    }

    private class DataTypeCellRenderer extends DefaultListCellRenderer {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            GenericDataType dataType = (GenericDataType) value;
            label.setText(" " + dataType.getName() + " ");
            return label;
        }
View Full Code Here

        dataTypeLabel.setForeground(UIUtil.getInactiveTextColor());

        DBNativeDataType nativeDataType = dataType.getNativeDataType();
        if (nativeDataType != null) {
            DataTypeDefinition dataTypeDefinition = nativeDataType.getDataTypeDefinition();
            GenericDataType genericDataType = dataTypeDefinition.getGenericDataType();

            DataEditorSettings dataEditorSettings = DataEditorSettings.getInstance(project);

            long dataLength = dataType.getLength();

            if (genericDataType.is(GenericDataType.DATE_TIME, GenericDataType.LITERAL)) {
                TextFieldWithPopup textFieldWithPopup = new TextFieldWithPopup(project);

                textFieldWithPopup.setPreferredSize(new Dimension(200, -1));
                JTextField valueTextField = textFieldWithPopup.getTextField();
                valueTextField.getDocument().addDocumentListener(documentListener);
                valueTextField.addKeyListener(keyAdapter);
                valueTextField.addFocusListener(focusListener);

                if (cell.getRow().getModel().isEditable()) {
                    if (genericDataType == GenericDataType.DATE_TIME) {
                        textFieldWithPopup.createCalendarPopup(false);
                    }

                    if (genericDataType == GenericDataType.LITERAL) {
                        if (dataLength > 20 && !column.isPrimaryKey() && !column.isForeignKey())
                            textFieldWithPopup.createTextAreaPopup(false);
                        DataEditorValueListPopupSettings valueListPopupSettings = dataEditorSettings.getValueListPopupSettings();

                        if (column.isForeignKey() || (dataLength <= valueListPopupSettings.getDataLengthThreshold() &&
                                (!column.isSinglePrimaryKey() || valueListPopupSettings.isActiveForPrimaryKeyColumns()))) {
                            ListPopupValuesProvider valuesProvider = new ListPopupValuesProvider() {
                                public List<String> getValues() {
                                    return columnInfo.getPossibleValues();
                                }
                            };
                            textFieldWithPopup.createValuesListPopup(valuesProvider, false);
                        }
                    }
                }
                editorComponent = textFieldWithPopup;
            } else if (genericDataType.is(GenericDataType.BLOB, GenericDataType.CLOB)) {
                editorComponent = new TextFieldWithTextEditor(project);
            } else {
                editorComponent = new BasicDataEditorComponent();
            }
        } else {
View Full Code Here

        attributeTypeLabel.setText(typeAttribute.getDataType().getQualifiedName());

        DBDataType dataType = typeAttribute.getDataType();
        DBNativeDataType nativeDataType = dataType.getNativeDataType();
        DataTypeDefinition dataTypeDefinition = nativeDataType.getDataTypeDefinition();
        GenericDataType genericDataType = dataTypeDefinition.getGenericDataType();


        if (genericDataType == GenericDataType.DATE_TIME) {
            TextFieldWithPopup inputField = new TextFieldWithPopup(argument.getProject());
            inputField.setPreferredSize(new Dimension(200, -1));
View Full Code Here

                    column = col;
                    break;
                }
            }
        }
        GenericDataType dataType = column.getDataType().getNativeDataType().getBasicDataType();


        columnSelector = new ColumnSelector(column);
        columnPanel.add(columnSelector, BorderLayout.CENTER);
View Full Code Here

TOP

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

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.