Revision 47790 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/ViewPort.java

View differences:

ViewPort.java
52 52
import org.gvsig.fmap.geom.exception.CreateGeometryException;
53 53
import org.gvsig.fmap.geom.primitive.Envelope;
54 54
import org.gvsig.fmap.geom.primitive.Point;
55
import static org.gvsig.fmap.mapcontext.MapContext.DEFAULT_SELECTION_COLOR;
55 56
import org.gvsig.fmap.mapcontext.events.ColorEvent;
56 57
import org.gvsig.fmap.mapcontext.events.ExtentEvent;
57 58
import org.gvsig.fmap.mapcontext.events.ProjectionEvent;
......
312 313

  
313 314
  /**
314 315
   * <p>
316
   * Selection color of this view.
317
   * </p>
318
   *
319
   * @see #getSelectionColor()
320
   * @see #setSelectionColor(Color)
321
   */
322
  private Color selectionColor = MapContext.DEFAULT_SELECTION_COLOR;
323

  
324
  /**
325
   * <p>
315 326
   * Information about the map projection used in this view.
316 327
   * </p>
317 328
   *
......
1268 1279

  
1269 1280
  /**
1270 1281
   * <p>
1282
   * Sets the selection color.
1283
   * </p>
1284
   *
1285
   * @param c the new selection color
1286
   * @see #getSelectionColor()
1287
   */
1288
  public void setSelectionColor(Color c) {
1289
    if (!c.equals(this.selectionColor)) {
1290
      this.updateDrawVersion();
1291
      selectionColor = c;
1292
      callColorChanged(selectionColor);
1293
    }
1294
  }
1295

  
1296
  /**
1297
   * <p>
1271 1298
   * Gets the background color.
1272 1299
   * </p>
1273 1300
   *
......
1280 1307

  
1281 1308
  /**
1282 1309
   * <p>
1310
   * Gets the selection color.
1311
   * </p>
1312
   *
1313
   * @return the selection color of the view
1314
   * @see #setSelectionColor(Color)
1315
   */
1316
  public Color getSelectionColor() {
1317
    return selectionColor;
1318
  }
1319

  
1320
  /**
1321
   * <p>
1283 1322
   * Returns the extent currently covered by the view adjusted (scaled) to the
1284 1323
   * image size aspect.
1285 1324
   * </p>
......
1685 1724
    state.set(FIELD_PROJ, proj);
1686 1725

  
1687 1726
    state.set(FIELD_IMAGE_SIZE, imageSize);
1727
    
1728
    state.set("selectionColor", this.getSelectionColor());
1729

  
1688 1730
  }
1689 1731

  
1690 1732
  public void loadFromState(PersistentState state) throws PersistenceException {
......
1703 1745
    imageSize = (Dimension) state.get(FIELD_IMAGE_SIZE);
1704 1746
    distanceArea = state.getInt(FIELD_DISTANCE_AREA);
1705 1747

  
1748
    this.selectionColor = (Color) state.get("selectionColor");
1749
    if (this.selectionColor == null) {
1750
        this.selectionColor = DEFAULT_SELECTION_COLOR;
1751
    }
1752
    
1706 1753
    refreshExtent();
1707 1754
  }
1708 1755

  
......
1747 1794

  
1748 1795
        definition.addDynFieldObject(FIELD_IMAGE_SIZE)
1749 1796
            .setClassOfValue(Dimension.class).setMandatory(false);
1797

  
1798
        definition.addDynFieldObject("selectionColor")
1799
            .setClassOfValue(Color.class)
1800
            .setMandatory(false);
1801

  
1750 1802
      }
1751 1803
      return Boolean.TRUE;
1752 1804
    }

Also available in: Unified diff