001: /*
002: * This code is licensed under the GPL 2.0 license, available at the root
003: * application directory.
004: */
005: package org.vfny.geoserver.global;
006:
007: import org.vfny.geoserver.global.dto.LegendURLDTO;
008:
009: /**
010: * This class represents legend icon parameters.
011: *
012: * @author Charles Kolbowicz
013: * @version $Id: LegendURL.java 6177 2007-02-19 10:11:27Z aaime $
014: */
015: public class LegendURL extends GlobalLayerSupertype {
016: /** Holds value of legend icon width. */
017: private int width;
018:
019: /** Holds value of legend icon height. */
020: private int height;
021:
022: /** Holds value of legend icon format. */
023: private String format;
024:
025: /** Holds value of legend icon onlineResource. */
026: private String onlineResource;
027:
028: /**
029: * Legend constructor.
030: *
031: * <p>
032: * Stores the new LegendURLDTO data for this LegendURL.
033: * </p>
034: *
035: * @param dto
036: *
037: * @throws NullPointerException when the param is null
038: */
039: public LegendURL(LegendURLDTO dto) {
040: if (dto == null) {
041: throw new NullPointerException();
042: }
043:
044: onlineResource = dto.getOnlineResource();
045: format = dto.getFormat();
046: width = dto.getWidth();
047: height = dto.getHeight();
048: }
049:
050: /**
051: * load purpose.
052: *
053: * <p>
054: * loads a new copy of data into this object.
055: * </p>
056: *
057: * @param dto
058: *
059: * @throws NullPointerException DOCUMENT ME!
060: */
061: public void load(LegendURLDTO dto) {
062: if (dto == null) {
063: throw new NullPointerException();
064: }
065:
066: onlineResource = dto.getOnlineResource();
067: format = dto.getFormat();
068: width = dto.getWidth();
069: height = dto.getHeight();
070: }
071:
072: Object toDTO() {
073: LegendURLDTO dto = new LegendURLDTO();
074: dto.setOnlineResource(onlineResource);
075: dto.setFormat(format);
076: dto.setWidth(width);
077: dto.setHeight(height);
078:
079: return dto;
080: }
081:
082: /**
083: * Getter for legend icon width.
084: *
085: * @return Value of property width.
086: */
087: public int getWidth() {
088: return this .width;
089: }
090:
091: /**
092: * Getter for legend icon height.
093: *
094: * @return Value of legend icon height.
095: */
096: public int getHeight() {
097: return this .height;
098: }
099:
100: /**
101: * Getter for legend icon format.
102: *
103: * @return Value of legend icon format.
104: */
105: public String getFormat() {
106: return this .format;
107: }
108:
109: /**
110: * Getter for legend icon onlineResource.
111: *
112: * @return Value of legend icon onlineResource.
113: */
114: public String getOnlineResource() {
115: return this.onlineResource;
116: }
117: }
|