001: /*
002: * Copyright (c) 2005-2008 Substance Kirill Grouchnikov. All Rights Reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * o Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: *
010: * o Redistributions in binary form must reproduce the above copyright notice,
011: * this list of conditions and the following disclaimer in the documentation
012: * and/or other materials provided with the distribution.
013: *
014: * o Neither the name of Substance Kirill Grouchnikov nor the names of
015: * its contributors may be used to endorse or promote products derived
016: * from this software without specific prior written permission.
017: *
018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
020: * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
021: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
022: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
023: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
024: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
025: * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
026: * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
027: * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
028: * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029: */
030: package org.jvnet.substance.plugin;
031:
032: import java.util.HashSet;
033: import java.util.Set;
034:
035: import org.jvnet.substance.watermark.*;
036:
037: /**
038: * Core plugin for watermarks. See
039: * {@link org.jvnet.substance.plugin.SubstanceWatermarkPlugin} interface. This
040: * class is <b>for internal use only</b>.
041: *
042: * @author Kirill Grouchnikov.
043: */
044: public class BaseWatermarkPlugin implements SubstanceWatermarkPlugin {
045: /**
046: * Creates info object on a single watermark.
047: *
048: * @param displayName
049: * Watermark display name.
050: * @param watermarkClass
051: * Watermark class.
052: * @param isDefault
053: * Indication whether the specified watermark is default.
054: * @return Info object on the specified watermark.
055: */
056: private static WatermarkInfo create(String displayName,
057: Class<?> watermarkClass, boolean isDefault) {
058: WatermarkInfo result = new WatermarkInfo(displayName,
059: watermarkClass.getName());
060: result.setDefault(isDefault);
061: return result;
062: }
063:
064: /*
065: * (non-Javadoc)
066: *
067: * @see org.jvnet.substance.plugin.SubstanceWatermarkPlugin#getWatermarks()
068: */
069: public Set<WatermarkInfo> getWatermarks() {
070: Set<WatermarkInfo> result = new HashSet<WatermarkInfo>();
071: result.add(create(SubstanceStripeWatermark.getName(),
072: SubstanceStripeWatermark.class, false));
073: result.add(create(SubstanceBinaryWatermark.getName(),
074: SubstanceBinaryWatermark.class, false));
075: result.add(create(SubstanceBubblesWatermark.getName(),
076: SubstanceBubblesWatermark.class, false));
077: result.add(create(SubstanceCrosshatchWatermark.getName(),
078: SubstanceCrosshatchWatermark.class, false));
079: result.add(create(SubstanceKatakanaWatermark.getName(),
080: SubstanceKatakanaWatermark.class, false));
081: result.add(create(SubstanceLatchWatermark.getName(),
082: SubstanceLatchWatermark.class, false));
083: result.add(create(SubstanceMetalWallWatermark.getName(),
084: SubstanceMetalWallWatermark.class, false));
085: result.add(create(SubstanceMosaicWatermark.getName(),
086: SubstanceMosaicWatermark.class, false));
087: result.add(create(SubstanceNullWatermark.getName(),
088: SubstanceNullWatermark.class, false));
089: result.add(create(SubstanceNoneWatermark.getName(),
090: SubstanceNoneWatermark.class, false));
091: result.add(create(SubstanceMazeWatermark.getName(),
092: SubstanceMazeWatermark.class, false));
093: result.add(create(SubstanceWoodWatermark.getName(),
094: SubstanceWoodWatermark.class, false));
095: result.add(create(SubstanceMagneticFieldWatermark.getName(),
096: SubstanceMagneticFieldWatermark.class, false));
097: result.add(create(SubstanceFabricWatermark.getName(),
098: SubstanceFabricWatermark.class, false));
099: result.add(create(SubstanceMarbleVeinWatermark.getName(),
100: SubstanceMarbleVeinWatermark.class, false));
101: result.add(create(SubstancePlanktonWatermark.getName(),
102: SubstancePlanktonWatermark.class, false));
103: result.add(create(SubstanceCopperplateEngravingWatermark
104: .getName(),
105: SubstanceCopperplateEngravingWatermark.class, false));
106: // result.add(create(SubstanceGenericNoiseWatermark.getName(),
107: // SubstanceGenericNoiseWatermark.class, false));
108: return result;
109: }
110:
111: /*
112: * (non-Javadoc)
113: *
114: * @see org.jvnet.substance.plugin.SubstanceWatermarkPlugin#getDefaultWatermarkClassName()
115: */
116: public String getDefaultWatermarkClassName() {
117: return null;
118: }
119: }
|