Examples of DatasetEditorTable


Examples of com.dci.intellij.dbn.editor.data.ui.table.DatasetEditorTable

        }

    }

    public void deleteRecords() {
        DatasetEditorTable editorTable = getEditorTable();
        DatasetEditorModel model = getTableModel();

        if (editorTable != null && model != null) {
            int[] indexes = editorTable.getSelectedRows();
            model.deleteRecords(indexes);
        }
    }
View Full Code Here

Examples of com.dci.intellij.dbn.editor.data.ui.table.DatasetEditorTable

            model.deleteRecords(indexes);
        }
    }

    public void insertRecord() {
        DatasetEditorTable editorTable = getEditorTable();
        DatasetEditorModel model = getTableModel();

        if (editorTable != null && model != null) {
            int[] indexes = editorTable.getSelectedRows();

            int rowIndex = indexes.length > 0 && indexes[0] < model.getSize() ? indexes[0] : 0;
            model.insertRecord(rowIndex);
        }
    }
View Full Code Here

Examples of com.dci.intellij.dbn.editor.data.ui.table.DatasetEditorTable

            model.insertRecord(rowIndex);
        }
    }

    public void duplicateRecord() {
        DatasetEditorTable editorTable = getEditorTable();
        DatasetEditorModel model = getTableModel();
        if (editorTable != null && model != null) {
            int[] indexes = editorTable.getSelectedRows();
            if (indexes.length == 1) {
                model.duplicateRecord(indexes[0]);
            }
        }
    }
View Full Code Here

Examples of com.dci.intellij.dbn.editor.data.ui.table.DatasetEditorTable

            }
        }
    }

    public void openRecordEditor() {
        DatasetEditorTable editorTable = getEditorTable();
        DatasetEditorModel model = getTableModel();

        if (editorTable != null && model != null) {
            int index = editorTable.getSelectedRow();
            if (index == -1) index = 0;
            DatasetEditorModelRow row = model.getRowAtIndex(index);
            editorTable.stopCellEditing();
            editorTable.selectRow(row.getIndex());
            DatasetRecordEditorDialog editorDialog = new DatasetRecordEditorDialog(row);
            editorDialog.show();
        }
    }
View Full Code Here

Examples of com.dci.intellij.dbn.editor.data.ui.table.DatasetEditorTable

            editorDialog.show();
        }
    }

    public void openRecordEditor(int index) {
        DatasetEditorTable editorTable = getEditorTable();
        DatasetEditorModel model = getTableModel();

        if (editorTable != null && model != null) {
            DatasetEditorModelRow row = model.getRowAtIndex(index);
            DatasetRecordEditorDialog editorDialog = new DatasetRecordEditorDialog(row);
View Full Code Here

Examples of com.dci.intellij.dbn.editor.data.ui.table.DatasetEditorTable

     * ConnectionStatusListener                  *
     * ******************************************************
     */
    @Override
    public void statusChanged(String connectionId) {
        DatasetEditorTable editorTable = getEditorTable();
        ConnectionHandler connectionHandler = getConnectionHandler();
        if (editorTable != null && connectionHandler.getId().equals(connectionId)) {
            editorTable.updateBackground(!connectionHandler.isConnected());
            if (connectionHandler.isConnected()) {
                loadData(STATUS_CHANGE_LOAD_INSTRUCTIONS);
            } else {
                editorTable.repaint();
            }
        }
    }
View Full Code Here

Examples of com.dci.intellij.dbn.editor.data.ui.table.DatasetEditorTable

     * ******************************************************
     */
    public void beforeAction(ConnectionHandler connectionHandler, TransactionAction action) {
        if (connectionHandler == getConnectionHandler()) {
            DatasetEditorModel model = getTableModel();
            DatasetEditorTable editorTable = getEditorTable();
            if (model != null && editorTable != null) {
                if (action == TransactionAction.COMMIT) {

                    if (editorTable.isEditing()) {
                        editorTable.stopCellEditing();
                    }

                    if (isInserting()) {
                        try {
                            model.postInsertRecord(true, false);
                        } catch (SQLException e1) {
                            MessageUtil.showErrorDialog("Could not create row in " + getDataset().getQualifiedNameWithType() + ".", e1);
                        }
                    }
                }

                if (action == TransactionAction.ROLLBACK || action == TransactionAction.ROLLBACK_IDLE) {
                    if (editorTable.isEditing()) {
                        editorTable.stopCellEditing();
                    }
                    if (isInserting()) {
                        model.cancelInsert(true);
                    }
                }
View Full Code Here

Examples of com.dci.intellij.dbn.editor.data.ui.table.DatasetEditorTable

    }

    public void afterAction(ConnectionHandler connectionHandler, TransactionAction action, boolean succeeded) {
        if (connectionHandler == getConnectionHandler()) {
            DatasetEditorModel model = getTableModel();
            DatasetEditorTable editorTable = getEditorTable();
            if (model != null && editorTable != null) {
                if (action == TransactionAction.COMMIT || action == TransactionAction.ROLLBACK) {
                    if (succeeded && isModified()) loadData(STATUS_CHANGE_LOAD_INSTRUCTIONS);
                }

                if (action == TransactionAction.DISCONNECT) {
                    editorTable.stopCellEditing();
                    model.revertChanges();
                    editorTable.repaint();
                }
            }
        }
    }
View Full Code Here

Examples of com.dci.intellij.dbn.editor.data.ui.table.DatasetEditorTable

        return children;
    }

    public void navigate(boolean requestFocus) {
        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;
                table.selectCell(rowIndex, tableColumnIndex);
                if (requestFocus) {
                    table.requestFocus();
                }
            }
        }
    }
View Full Code Here

Examples of com.dci.intellij.dbn.editor.data.ui.table.DatasetEditorTable

    private DatasetEditor datasetEditor;
    public DatasetEditorTableActionGroup(DatasetEditor datasetEditor, @Nullable DatasetEditorModelCell cell, ColumnInfo columnInfo) {
        this.datasetEditor = datasetEditor;
        this.columnInfo = columnInfo;
        this.columnDisplayName = NamingUtil.enhanceUnderscoresForDisplay(columnInfo.getName());
        DatasetEditorTable table = datasetEditor.getEditorTable();

        isHeaderAction = cell == null;
        columnValue = cell == null ? null : cell.getUserValue();

        HideColumnAction hideColumnAction = new HideColumnAction();
        add(hideColumnAction);
        addSeparator();
        if (cell != null && cell.isModified() && !cell.isLobValue()) {
            RevertChangesAction revertChangesAction = new RevertChangesAction(cell);
            add(revertChangesAction);
        }

        DefaultActionGroup filterActionGroup = new DefaultActionGroup("Filter", true);
        filterActionGroup.getTemplatePresentation().setIcon(Icons.DATASET_FILTER_NEW);
        //filterActionGroup.getTemplatePresentation().setIcon(Icons.DATASET_FILTER);
        filterActionGroup.add(new CreateFilterAction(false));
        filterActionGroup.addSeparator();
        if (columnValue != null ) filterActionGroup.add(new CreateFilterAction(true));
        DBDataType dataType = columnInfo.getDataType();
        String text = getClipboardContent((int) dataType.getLength());
        if (text != null) {
            filterActionGroup.add(new CreateClipboardFilterAction(text, false));
            if (dataType.isNative() && dataType.getNativeDataType().getBasicDataType() == GenericDataType.LITERAL) {
                filterActionGroup.add(new CreateClipboardFilterAction(text, true));
            }
        }

        // show the create additional condition action in case the filter is basic,
        // the join is AND, and the column is not already present
        DatasetFilterManager filterManager = DatasetFilterManager.getInstance(table.getDataset().getProject());
        DatasetFilter activeFilter = filterManager.getActiveFilter(table.getDataset());
        if (activeFilter instanceof DatasetBasicFilter) {
            DatasetBasicFilter basicFilter = (DatasetBasicFilter) activeFilter;
            if (basicFilter.getJoinType() == DatasetBasicFilter.JOIN_TYPE_AND &&
                    !basicFilter.containsConditionForColumn(columnInfo.getName())) {
                filterActionGroup.addSeparator();
                filterActionGroup.add(new CreateAdditionalConditionAction());
            }
        }
        add(filterActionGroup);

        if (columnInfo.isSortable()) {
            DefaultActionGroup sortingActionGroup = new DefaultActionGroup("Sort", true);
            //sortingActionGroup.getTemplatePresentation().setIcon(Icons.COMMON_SORTING);
            sortingActionGroup.add(new SortAscendingAction());
            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();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.