Search in sources :

Example 1 with RecordTableCellEditor

use of com.revolsys.swing.table.record.editor.RecordTableCellEditor in project com.revolsys.open by revolsys.

the class LayerRecordForm method editingStopped.

@Override
public void editingStopped(final ChangeEvent e) {
    final RecordTableCellEditor editor = (RecordTableCellEditor) e.getSource();
    final String name = editor.getFieldName();
    final Object value = editor.getCellEditorValue();
    setFieldValue(name, value, true);
}
Also used : RecordTableCellEditor(com.revolsys.swing.table.record.editor.RecordTableCellEditor)

Example 2 with RecordTableCellEditor

use of com.revolsys.swing.table.record.editor.RecordTableCellEditor in project com.revolsys.open by revolsys.

the class RecordLayerTable method copyFieldValue.

public void copyFieldValue() {
    if (isEditingCurrentCell()) {
        final RecordTableCellEditor tableCellEditor = getTableCellEditor();
        final JComponent editorComponent = tableCellEditor.getEditorComponent();
        SwingUtil.dndCopy(editorComponent);
    } else {
        final RecordRowTableModel model = getTableModel();
        final int row = TablePanel.getEventRow();
        final int column = TablePanel.getEventColumn();
        final Object value = model.getValueAt(row, column);
        if (value != null) {
            final String copyValue;
            if (value instanceof Geometry) {
                final Geometry geometry = (Geometry) value;
                copyValue = geometry.toEwkt();
            } else {
                copyValue = model.toDisplayValue(row, column, value);
            }
            final StringSelection transferable = new StringSelection(copyValue);
            ClipboardUtil.setContents(transferable);
        }
    }
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) JComponent(javax.swing.JComponent) RecordRowTableModel(com.revolsys.swing.table.record.model.RecordRowTableModel) EventObject(java.util.EventObject) RecordTableCellEditor(com.revolsys.swing.table.record.editor.RecordTableCellEditor) StringSelection(java.awt.datatransfer.StringSelection)

Example 3 with RecordTableCellEditor

use of com.revolsys.swing.table.record.editor.RecordTableCellEditor in project com.revolsys.open by revolsys.

the class RecordLayerTablePanel method close.

@Override
public void close() {
    final RecordLayerTable table = getTable();
    if (table != null) {
        final RecordTableCellEditor tableCellEditor = table.getTableCellEditor();
        tableCellEditor.close();
        table.dispose();
    }
    if (this.layer != null) {
        MapPanel.getMapPanel(this.layer).removePropertyChangeListener("boundingBox", this.viewportListener);
        Property.removeListener(this.layer, this);
        this.layer.setPluginConfig(AbstractLayer.PLUGIN_TABLE_VIEW, toMap());
        this.layer = null;
    }
    this.tableModel = null;
    if (this.fieldFilterPanel != null) {
        this.fieldFilterPanel.close();
        this.fieldFilterPanel = null;
    }
}
Also used : RecordTableCellEditor(com.revolsys.swing.table.record.editor.RecordTableCellEditor)

Example 4 with RecordTableCellEditor

use of com.revolsys.swing.table.record.editor.RecordTableCellEditor in project com.revolsys.open by revolsys.

the class RecordLayerTable method cutFieldValue.

public void cutFieldValue() {
    if (isEditingCurrentCell()) {
        final RecordTableCellEditor tableCellEditor = getTableCellEditor();
        final JComponent editorComponent = tableCellEditor.getEditorComponent();
        SwingUtil.dndCut(editorComponent);
    } else {
        copyFieldValue();
        final RecordRowTableModel model = getTableModel();
        final int row = TablePanel.getEventRow();
        final int column = TablePanel.getEventColumn();
        model.setValueAt(null, row, column);
    }
}
Also used : JComponent(javax.swing.JComponent) RecordRowTableModel(com.revolsys.swing.table.record.model.RecordRowTableModel) RecordTableCellEditor(com.revolsys.swing.table.record.editor.RecordTableCellEditor)

Example 5 with RecordTableCellEditor

use of com.revolsys.swing.table.record.editor.RecordTableCellEditor in project com.revolsys.open by revolsys.

the class RecordLayerTable method pasteFieldValue.

public void pasteFieldValue() {
    if (isEditingCurrentCell()) {
        final RecordTableCellEditor tableCellEditor = getTableCellEditor();
        final JComponent editorComponent = tableCellEditor.getEditorComponent();
        SwingUtil.dndPaste(editorComponent);
    } else {
        try {
            final Transferable clipboard = ClipboardUtil.getContents();
            final Object value = clipboard.getTransferData(DataFlavor.stringFlavor);
            final RecordRowTableModel model = getTableModel();
            final int row = TablePanel.getEventRow();
            final int column = TablePanel.getEventColumn();
            model.setValueAt(value, row, column);
        } catch (final Throwable e) {
        }
    }
}
Also used : JComponent(javax.swing.JComponent) Transferable(java.awt.datatransfer.Transferable) RecordRowTableModel(com.revolsys.swing.table.record.model.RecordRowTableModel) EventObject(java.util.EventObject) RecordTableCellEditor(com.revolsys.swing.table.record.editor.RecordTableCellEditor)

Aggregations

RecordTableCellEditor (com.revolsys.swing.table.record.editor.RecordTableCellEditor)6 RecordRowTableModel (com.revolsys.swing.table.record.model.RecordRowTableModel)3 JComponent (javax.swing.JComponent)3 EventObject (java.util.EventObject)2 NumericComparator (com.revolsys.comparator.NumericComparator)1 Geometry (com.revolsys.geometry.model.Geometry)1 RecordDefinition (com.revolsys.record.schema.RecordDefinition)1 BaseJTable (com.revolsys.swing.table.BaseJTable)1 SingleRecordTableCellRenderer (com.revolsys.swing.table.record.renderer.SingleRecordTableCellRenderer)1 StringSelection (java.awt.datatransfer.StringSelection)1 Transferable (java.awt.datatransfer.Transferable)1 TableColumnExt (org.jdesktop.swingx.table.TableColumnExt)1