11package jtamaro .graphic ;
22
33import java .util .ArrayList ;
4- import java .util .Collections ;
5- import java .util .IdentityHashMap ;
64import java .util .List ;
7- import java .util .Set ;
85
96/**
107 * Graphic render configuration.
@@ -20,9 +17,7 @@ public final class RenderOptions {
2017
2118 private final int fixedHeight ;
2219
23- private final Set <Graphic > selection ;
24-
25- private Graphic leadSelection ;
20+ private Graphic selection ;
2621
2722 private final List <Listener > listeners ;
2823
@@ -34,7 +29,7 @@ public RenderOptions(int padding, int fixedWidth, int fixedHeight) {
3429 this .padding = padding ;
3530 this .fixedWidth = fixedWidth ;
3631 this .fixedHeight = fixedHeight ;
37- selection = Collections . newSetFromMap ( new IdentityHashMap <>()) ;
32+ selection = null ;
3833 listeners = new ArrayList <>();
3934 }
4035
@@ -60,27 +55,21 @@ public int getFixedHeight() {
6055 }
6156
6257 public void clearSelection () {
63- selection .clear ();
64- leadSelection = null ;
58+ selection = null ;
6559 fireRenderOptionsChanged ();
6660 }
6761
6862 void select (Graphic g ) {
69- selection .add (g );
70- leadSelection = g ;
63+ selection = g ;
7164 fireRenderOptionsChanged ();
7265 }
7366
7467 boolean isSelected (Graphic g ) {
75- return selection .contains (g );
76- }
77-
78- Graphic getLeadSelection () {
79- return leadSelection ;
68+ return selection == g ;
8069 }
8170
82- boolean isLeadSelection ( Graphic g ) {
83- return selection . contains ( g ) ;
71+ Graphic getSelection ( ) {
72+ return selection ;
8473 }
8574
8675 public void addRenderOptionsListener (Listener li ) {
@@ -96,8 +85,7 @@ private void fireRenderOptionsChanged() {
9685 /**
9786 * Graphic render configuration listener.
9887 *
99- * <p>For internal usage only!
100- *
88+ * @apiNote For internal usage only!
10189 * @hidden
10290 */
10391 public interface Listener {
0 commit comments