001    /*
002     * Copyright 2007 - 2007 JEuclid, http://jeuclid.sf.net
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    /* $Id: AbstractRowLike.java 310 2007-05-18 20:26:36Z maxberger $ */
018    
019    package net.sourceforge.jeuclid.elements.presentation.general;
020    
021    import java.awt.Graphics2D;
022    
023    import net.sourceforge.jeuclid.MathBase;
024    
025    /**
026     * Common base class for all elements that present themself as a row of
027     * children, like the mrow element.
028     * 
029     * @author Max Berger
030     * @version $Revision: 310 $
031     */
032    public abstract class AbstractRowLike extends AbstractMathElementWithChildren {
033    
034        /**
035         * Default constructor.
036         * 
037         * @param base
038         *            MathBase to use.
039         */
040        public AbstractRowLike(final MathBase base) {
041            super(base);
042        }
043    
044        /** {@inheritDoc} */
045        @Override
046        public float calculateAscentHeight(final Graphics2D g) {
047            return super.calculateChildrenAscentHeight(g);
048        }
049    
050        /** {@inheritDoc} */
051        @Override
052        public float calculateDescentHeight(final Graphics2D g) {
053            return super.calculateChildrenDescentHeight(g);
054        }
055    
056        /** {@inheritDoc} */
057        @Override
058        public float calculateWidth(final Graphics2D g) {
059            return super.calculateChildrenWidth(g);
060        }
061    
062        /** {@inheritDoc} */
063        @Override
064        public void paint(final Graphics2D g, final float posX, final float posY) {
065            super.paint(g, posX, posY);
066            this.paintChildren(g, posX, posY);
067        }
068    
069    }