use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class MergedRecordsTableModel method valueChanged.
@Override
public void valueChanged(final ListSelectionEvent event) {
final RecordRowTable table = getTable();
final ListSelectionModel selectionModel = table.getSelectionModel();
final int rowCount = super.getRowCount();
final boolean mergedSelected = selectionModel.isSelectedIndex(rowCount);
for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
final Record record = getRecord(rowIndex);
if (record != null) {
if (mergedSelected || selectionModel.isSelectedIndex(rowIndex)) {
this.layer.addHighlightedRecords((LayerRecord) record);
} else {
this.layer.unHighlightRecords((LayerRecord) record);
}
}
}
this.layer.zoomToHighlighted();
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class ModeSelected method getRecordsForCache.
@Override
protected List<LayerRecord> getRecordsForCache() {
final AbstractRecordLayer layer = getLayer();
final List<LayerRecord> selectedRecords = layer.getSelectedRecords();
return selectedRecords;
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class RecordLayerHighlightedListSelectionModel method addSelectionInterval.
@Override
public void addSelectionInterval(final int index0, final int index1) {
super.addSelectionInterval(convertRowIndexToModel(index0), convertRowIndexToModel(index1));
final List<LayerRecord> records = getObjects(index0, index1);
final AbstractRecordLayer layer = this.model.getLayer();
layer.addHighlightedRecords(records);
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class RecordLayerTableModel method getMenu.
@Override
public BaseJPopupMenu getMenu(final int rowIndex, final int columnIndex) {
final LayerRecord record = getRecord(rowIndex);
if (record != null) {
final AbstractRecordLayer layer = getLayer();
if (layer != null) {
LayerRecordMenu.setEventRecord(record);
if (isUseRecordMenu()) {
final LayerRecordMenu menu = record.getMenu();
final BaseJPopupMenu popupMenu = menu.newJPopupMenu();
popupMenu.addSeparator();
final RecordLayerTable table = getTable();
final boolean cellEditable = isCellEditable(rowIndex, columnIndex);
final Object value = getValueAt(rowIndex, columnIndex);
final boolean canCopy = Property.hasValue(value);
if (cellEditable) {
final JMenuItem cutMenu = RunnableAction.newMenuItem("Cut Field Value", "cut", table::cutFieldValue);
cutMenu.setEnabled(canCopy);
popupMenu.add(cutMenu);
}
final JMenuItem copyMenu = RunnableAction.newMenuItem("Copy Field Value", "page_copy", table::copyFieldValue);
copyMenu.setEnabled(canCopy);
popupMenu.add(copyMenu);
if (cellEditable) {
popupMenu.add(RunnableAction.newMenuItem("Paste Field Value", "paste_plain", table::pasteFieldValue));
}
return popupMenu;
} else {
return super.getMenu().newJPopupMenu();
}
}
}
return null;
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class RecordLayerTableModel method isCellEditable.
@Override
protected boolean isCellEditable(final int rowIndex, final int columnIndex, final Record record) {
final AbstractRecordLayer layer = getLayer();
final LayerRecord layerRecord = (LayerRecord) record;
if (layer.isDeleted(layerRecord)) {
return false;
} else if (layer.isCanEditRecords() || layer.isNew(layerRecord) && layer.isCanAddRecords()) {
return super.isCellEditable(rowIndex, columnIndex, record);
} else {
return false;
}
}
Aggregations