use of org.pepsoft.worldpainter.layers.EditLayerDialog in project WorldPainter by Captain-Chaos.
the class TunnelLayerDialog method editFloorLayer.
private void editFloorLayer() {
int selectedRow = tableFloorLayers.getSelectedRow();
if (selectedRow != -1) {
Layer layer = floorLayersTableModel.getLayer(selectedRow);
if (layer instanceof CustomLayer) {
EditLayerDialog<Layer> dialog = new EditLayerDialog<>(this, layer);
dialog.setVisible(true);
if (!dialog.isCancelled()) {
floorLayersTableModel.layerChanged(selectedRow);
}
}
}
}
use of org.pepsoft.worldpainter.layers.EditLayerDialog in project WorldPainter by Captain-Chaos.
the class TunnelLayerDialog method newFloorLayer.
private void newFloorLayer() {
JPopupMenu popupMenu = new JPopupMenu();
JMenuItem item = new JMenuItem("Custom Objects Layer");
item.addActionListener(e -> {
EditLayerDialog<Bo2Layer> dialog = new EditLayerDialog(TunnelLayerDialog.this, Bo2Layer.class);
dialog.setVisible(true);
if (!dialog.isCancelled()) {
Bo2Layer newLayer = dialog.getLayer();
newLayer.setHide(true);
floorLayersTableModel.addLayer(newLayer);
}
});
popupMenu.add(item);
item = new JMenuItem("Custom Ground Cover Layer");
item.addActionListener(e -> {
EditLayerDialog<GroundCoverLayer> dialog = new EditLayerDialog(TunnelLayerDialog.this, GroundCoverLayer.class);
dialog.setVisible(true);
if (!dialog.isCancelled()) {
GroundCoverLayer newLayer = dialog.getLayer();
newLayer.setHide(true);
floorLayersTableModel.addLayer(newLayer);
}
});
popupMenu.add(item);
item = new JMenuItem("Custom Plants Layer");
item.addActionListener(e -> {
EditLayerDialog<PlantLayer> dialog = new EditLayerDialog(TunnelLayerDialog.this, PlantLayer.class);
dialog.setVisible(true);
if (!dialog.isCancelled()) {
PlantLayer newLayer = dialog.getLayer();
newLayer.setHide(true);
floorLayersTableModel.addLayer(newLayer);
}
});
popupMenu.add(item);
popupMenu.show(buttonNewFloorLayer, buttonNewFloorLayer.getWidth(), 0);
}
Aggregations