use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class LayerRecordForm method getTitle.
public static String getTitle(final LayerRecord record) {
final AbstractRecordLayer layer = record.getLayer();
final Identifier id = record.getIdentifier();
String title;
final String layerName = layer.getName();
if (record.getState() == RecordState.NEW) {
title = "Add New " + layerName;
} else if (layer.isCanEditRecords()) {
title = "Edit " + layerName;
if (id != null) {
title += " #" + id;
}
} else {
title = "View " + layerName;
if (id != null) {
title += " #" + id;
}
}
return title;
}
use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class RecordLayerTable method addModifiedRecordHighlighter.
@Override
protected void addModifiedRecordHighlighter() {
final RecordLayerTableModel model = getModel();
final HighlightPredicate predicate = (renderer, adapter) -> {
try {
final int rowIndex = adapter.convertRowIndexToModel(adapter.row);
final LayerRecord record = model.getRecord(rowIndex);
final AbstractRecordLayer layer = model.getLayer();
return layer.isModified(record);
} catch (final Throwable e) {
return false;
}
};
addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.EVEN), WebColors.newAlpha(WebColors.LimeGreen, 127), WebColors.Black, WebColors.newAlpha(WebColors.DarkGreen, 191), Color.WHITE));
addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.ODD), WebColors.LimeGreen, WebColors.Black, WebColors.DarkGreen, Color.WHITE));
}
use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class RecordLayerTable method addNewRecordHighlighter.
@Override
protected void addNewRecordHighlighter() {
final RecordLayerTableModel model = getModel();
final HighlightPredicate predicate = (renderer, adapter) -> {
try {
final int rowIndex = adapter.convertRowIndexToModel(adapter.row);
final LayerRecord record = model.getRecord(rowIndex);
final AbstractRecordLayer layer = model.getLayer();
return layer.isNew(record);
} catch (final Throwable e) {
return false;
}
};
addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.EVEN), WebColors.newAlpha(WebColors.LightSkyBlue, 127), WebColors.Black, WebColors.newAlpha(WebColors.RoyalBlue, 191), Color.WHITE));
addHighlighter(new ColorHighlighter(new AndHighlightPredicate(predicate, HighlightPredicate.ODD), WebColors.LightSkyBlue, WebColors.Black, WebColors.RoyalBlue, Color.WHITE));
}
use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class RecordLayerTablePanel method actionShowFieldSetsMenu.
private void actionShowFieldSetsMenu() {
final JPopupMenu menu = new JPopupMenu();
final JMenuItem editMenuItem = RunnableAction.newMenuItem("Edit Field Sets", "fields_filter_edit", () -> {
final String fieldNamesSetName = FieldNamesSetPanel.showDialog(this.layer);
if (Property.hasValue(fieldNamesSetName)) {
this.tableModel.setFieldNamesSetName(fieldNamesSetName);
}
});
menu.add(editMenuItem);
menu.addSeparator();
final AbstractRecordLayer layer = getLayer();
final String selectedFieldSetName = layer.getFieldNamesSetName();
for (final String fieldSetName : layer.getFieldNamesSetNames()) {
final JCheckBoxMenuItem menuItem = RunnableAction.newCheckBoxMenuItem(fieldSetName, () -> this.tableModel.setFieldNamesSetName(fieldSetName));
if (fieldSetName.equalsIgnoreCase(selectedFieldSetName)) {
menuItem.setSelected(true);
}
menu.add(menuItem);
}
MenuFactory.showMenu(menu, this.fieldSetsButton, 10, 10);
}
use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class ModeSelected method deactivate.
@Override
public void deactivate() {
super.deactivate();
final AbstractRecordLayer layer = getLayer();
layer.clearHighlightedRecords();
}
Aggregations