001    /*
002     * JBoss, Home of Professional Open Source.
003     * Copyright 2008, Red Hat Middleware LLC, and individual contributors
004     * as indicated by the @author tags. See the copyright.txt file in the
005     * distribution for a full listing of individual contributors. 
006     *
007     * This is free software; you can redistribute it and/or modify it
008     * under the terms of the GNU Lesser General Public License as
009     * published by the Free Software Foundation; either version 2.1 of
010     * the License, or (at your option) any later version.
011     *
012     * This software is distributed in the hope that it will be useful,
013     * but WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015     * Lesser General Public License for more details.
016     *
017     * You should have received a copy of the GNU Lesser General Public
018     * License along with this software; if not, write to the Free
019     * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020     * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021     */
022    
023    package org.jboss.dna.common.monitor;
024    
025    import java.util.Locale;
026    import org.jboss.dna.common.collection.Problems;
027    import org.jboss.dna.common.i18n.I18n;
028    
029    /**
030     * The thread safety of this class is determined by the delegate.
031     * 
032     * @author Randall Hauch
033     * @author John Verhaeg
034     */
035    public class ProgressMonitorWrapper implements ProgressMonitor {
036    
037        private final ProgressMonitor delegate;
038    
039        public ProgressMonitorWrapper( ProgressMonitor delegate ) {
040            this.delegate = delegate;
041        }
042    
043        public ProgressMonitor getWrappedMonitor() {
044            return this.delegate;
045        }
046    
047        public void beginTask( double totalWork,
048                               I18n name,
049                               Object... params ) {
050            this.delegate.beginTask(totalWork, name, params);
051        }
052    
053        public ProgressMonitor createSubtask( double subtaskWork ) {
054            return this.delegate.createSubtask(subtaskWork);
055        }
056    
057        public void done() {
058            this.delegate.done();
059        }
060    
061        public String getActivityName() {
062            return this.delegate.getActivityName();
063        }
064    
065        public ProgressStatus getStatus( Locale locale ) {
066            return this.delegate.getStatus(locale);
067        }
068    
069        /**
070         * <p>
071         * {@inheritDoc}
072         * </p>
073         * 
074         * @see org.jboss.dna.common.monitor.ProgressMonitor#getProblems()
075         */
076        public Problems getProblems() {
077            return delegate.getProblems();
078        }
079    
080        public boolean isCancelled() {
081            return this.delegate.isCancelled();
082        }
083    
084        /**
085         * {@inheritDoc}
086         * 
087         * @see org.jboss.dna.common.monitor.ProgressMonitor#isDone()
088         */
089        public boolean isDone() {
090            return delegate.isDone();
091        }
092    
093        public void setCancelled( boolean value ) {
094            this.delegate.setCancelled(value);
095        }
096    
097        public void worked( double work ) {
098            this.delegate.worked(work);
099        }
100    }