Package com.dci.intellij.dbn.object

Examples of com.dci.intellij.dbn.object.DBColumn


    public int indexOfColumn(DBColumn column) {
        for (int i=0; i<getColumnCount(); i++) {
            ColumnInfo info = getColumnInfo(i);
            DatasetEditorColumnInfo columnInfo = (DatasetEditorColumnInfo) info;
            DBColumn col = columnInfo.getColumn();
            if (col != null && col.equals(column)) return i;
        }
        return -1;
    }
View Full Code Here


            }

            @Nullable
            public String getLocationString() {
                if (treeNode instanceof DBColumn) {
                    DBColumn column  = (DBColumn) treeNode;
                    return column.getPresentableTextDetails();

                }
                return null;
            }
View Full Code Here

        if (!datasetEditor.isDisposed()) {
            DatasetEditorTable table = datasetEditor.getEditorTable();
            table.cancelEditing();
            DatasetEditorModel model = table.getModel();
            if (treeNode instanceof DBColumn &&  model.getSize() > 0) {
                DBColumn column = (DBColumn) treeNode;
                int modelColumnIndex = model.getHeader().indexOfColumn(column);
                int tableColumnIndex = table.convertColumnIndexToView(modelColumnIndex);
                int rowIndex = table.getSelectedRow();
                if (rowIndex == -1rowIndex = 0;
                if (tableColumnIndex == -1) tableColumnIndex = 0;
View Full Code Here

    }

    public int compareTo(@NotNull Object o) {
        DatasetEditorStructureViewElement desve = (DatasetEditorStructureViewElement) o;
        if (treeNode instanceof DBColumn && desve.treeNode instanceof DBColumn) {
            DBColumn thisColumn = (DBColumn) treeNode;
            DBColumn remoteColumn = (DBColumn) desve.treeNode;
            return thisColumn.compareTo(remoteColumn);
        }
        return 0;
    }
View Full Code Here

            sortingActionGroup.add(new SortDescendingAction());
            add(sortingActionGroup);
        }

        DBDataset dataset = table.getDataset();
        DBColumn column = dataset.getColumn(columnInfo.getName());
        if (columnValue != null) {
            if (column.isForeignKey()) {
                DatasetFilterInput filterInput = table.getModel().resolveForeignKeyRecord(cell);
                add(new ShowReferencedRecordAction(filterInput));
            }
            if (column.isPrimaryKey()) {
                ShowReferencingRecordsAction action = new ShowReferencingRecordsAction(column, columnValue);
                action.setPopupLocation(table.getColumnHeaderLocation(column));
                add(action);
            }
        }

        addSeparator();

        DefaultActionGroup columnPropertiesActionGroup = new DefaultActionGroup("Column info", true);
        columnPropertiesActionGroup.add(new NavigateToObjectAction(column));
        for (DBObjectNavigationList navigationList : column.getNavigationLists()) {
            if (!navigationList.isLazy()) {
                add(new ObjectNavigationListActionGroup(column, navigationList, true));
            }
        }
        add(columnPropertiesActionGroup);
View Full Code Here

    private RegionalSettings regionalSettings;

    public DatasetRecordEditorColumnForm(DatasetRecordEditorForm parentForm, DatasetEditorModelCell cell) {
        this.parentForm = parentForm;
        final DatasetEditorColumnInfo columnInfo = cell.getColumnInfo();
        DBColumn column = columnInfo.getColumn();
        DBDataType dataType = column.getDataType();
        Project project = column.getProject();
        regionalSettings = RegionalSettings.getInstance(project);

        columnLabel.setIcon(column.getIcon());
        columnLabel.setText(column.getName());
        dataTypeLabel.setText(dataType.getQualifiedName());
        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();
                                }
                            };
View Full Code Here

        }

        DBTable sourceTable = (DBTable) sourceColumn.getDataset();
        for (DBColumn column : sourceTable.getForeignKeyColumns()) {
            if (column != sourceColumn) {
                DBColumn fkColumn = column.getForeignKeyColumn();
                buildDependencyPath(path, fkColumn, targetColumn, shortestPath);
            }

        }
View Full Code Here

    public DatasetSortingColumnForm(final DatasetEditorSortingForm parentForm, SortingInstruction sortingInstruction) {
        this.parentForm = parentForm;
        this.sortingInstruction = sortingInstruction;

        DBColumn column = parentForm.getDataset().getColumn(sortingInstruction.getColumnName());
        ColumnSelector columnSelector = new ColumnSelector(column);
        columnPanel.add(columnSelector, BorderLayout.CENTER);
        dataTypeLabel.setText(column.getDataType().getQualifiedName());
        dataTypeLabel.setForeground(UIUtil.getInactiveTextColor());

        ActionToolbar actionToolbar = ActionUtil.createActionToolbar(
                "DBNavigator.DataEditor.Sorting.Instruction", true,
                new ChangeSortingDirectionAction(this),
View Full Code Here

        return clone;
    }

    public String toString() {
        StringBuilder buffer = new StringBuilder();
        DBColumn lastElement = pathElements.get(pathElements.size() - 1);
        for (DBColumn pathElement : pathElements) {
            buffer.append(pathElement.getDataset().getName());
            buffer.append(".");
            buffer.append(pathElement.getName());
            if (lastElement != pathElement) {
View Full Code Here

    public boolean isModified() {
        return isInserting || isModified;
    }

    public DatasetFilterInput resolveForeignKeyRecord(DatasetEditorModelCell cell) {
        DBColumn column = cell.getColumnInfo().getColumn();
        if (column != null && column.isForeignKey()) {
            for (DBConstraint constraint : column.getConstraints()) {
                constraint = (DBConstraint) constraint.getUndisposedElement();
                if (constraint != null && constraint.isForeignKey()) {
                    DBConstraint foreignKeyConstraint = constraint.getForeignKeyConstraint();
                    if (foreignKeyConstraint != null) {
                        DBDataset foreignKeyDataset = foreignKeyConstraint.getDataset();
                        DatasetFilterInput filterInput = new DatasetFilterInput(foreignKeyDataset);

                        for (DBColumn constraintColumn : constraint.getColumns()) {
                            DBColumn foreignKeyColumn = ((DBColumn) constraintColumn.getUndisposedElement()).getForeignKeyColumn();
                            Object value = cell.getRow().getCellForColumn(constraintColumn).getUserValue();
                            filterInput.setColumnValue(foreignKeyColumn, value);
                        }
                        return filterInput;
View Full Code Here

TOP

Related Classes of com.dci.intellij.dbn.object.DBColumn

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.