Skip to content

Commit

Permalink
Drive the layer selection dialog from tools
Browse files Browse the repository at this point in the history
Instead of the dialog having to discover the current renderer, we now have the tools directly set the layer it should
present as selected. This removes an unnecessary assumption in `LayerSelectionDialog` while also making it clear in
`DefaultTool` that the dialog is being updated to use the same layer expected by the tool.
  • Loading branch information
kwvanderlinde committed Aug 25, 2023
1 parent 4e49ba7 commit c61a93b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected void attachTo(ZoneRenderer renderer) {
super.attachTo(renderer);
this.renderer = renderer;
selectedLayer = renderer.getActiveLayer();
layerSelectionDialog.updateViewList();
layerSelectionDialog.setSelectedLayer(selectedLayer);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListSelectionModel;
import net.rptools.maptool.client.MapTool;
import net.rptools.maptool.client.swing.AbeillePanel;
import net.rptools.maptool.model.Zone;

Expand Down Expand Up @@ -51,11 +50,6 @@ public void fireViewSelectionChange() {
}
}

public void updateViewList() {
getLayerList()
.setSelectedValue(MapTool.getFrame().getCurrentZoneRenderer().getActiveLayer(), true);
}

private JList<Zone.Layer> getLayerList() {

if (list == null) {
Expand Down Expand Up @@ -83,7 +77,7 @@ private JList<Zone.Layer> getLayerList() {
}

public void setSelectedLayer(Zone.Layer layer) {
list.setSelectedValue(layer, true);
getLayerList().setSelectedValue(layer, true);
}

public interface LayerSelectionListener {
Expand Down

0 comments on commit c61a93b

Please sign in to comment.