view flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MinMaxState.java @ 2197:5781847433d8

"Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0). flys-artifacts/trunk@3813 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 27 Jan 2012 17:59:24 +0000
parents 2792d2617be9
children d1660809daab
line wrap: on
line source
package de.intevation.flys.artifacts.states;

import org.w3c.dom.Element;

import de.intevation.artifacts.Artifact;
import de.intevation.artifacts.CallContext;

import de.intevation.artifacts.common.ArtifactNamespaceContext;
import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;

import de.intevation.artifactdatabase.ProtocolUtils;

import de.intevation.flys.artifacts.FLYSArtifact;


/**
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public abstract class MinMaxState extends DefaultState {

    @Override
    protected void appendItems(
        Artifact       artifact,
        ElementCreator creator,
        String         name,
        CallContext    context,
        Element        select
    ) {
        FLYSArtifact flys = (FLYSArtifact) artifact;

        select.setAttributeNS(
            ArtifactNamespaceContext.NAMESPACE_URI,
            "art:type",
            getType());

        Element min = ProtocolUtils.createArtNode(
            creator,
            "min",
            new String[] { "value" },
            new String[] { String.valueOf(getLower(flys)) });

        Element max = ProtocolUtils.createArtNode(
            creator,
            "max",
            new String[] { "value" },
            new String[] { String.valueOf(getUpper(flys)) });

        select.appendChild(min);
        select.appendChild(max);
    }


    protected abstract Object getLower(FLYSArtifact flys);

    protected abstract Object getUpper(FLYSArtifact flys);

    protected abstract String getType();
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org