Package jsynoptic.plugins.async

Source Code of jsynoptic.plugins.async.AsyncPlugin

/* ========================
* JSynoptic : a free Synoptic editor
* ========================
*
* Project Info:  http://jsynoptic.sourceforge.net/index.html
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* (C) Copyright 2001-2004, by :
*     Corporate:
*         EADS Astrium SAS
*         EADS CRC
*     Individual:
*         Claude Cazenave
*
* $Id: AsyncPlugin.java,v 1.10 2009/01/19 17:27:14 ogor Exp $
*
* Changes
* -------
* 11 jan. 2005 : Initial public release (CC);
*
*/
package jsynoptic.plugins.async;

import java.util.ArrayList;
import java.util.List;
import java.util.TimeZone;

import jsynoptic.base.Plugin;
import jsynoptic.base.Template;
import jsynoptic.ui.Run;
import jsynoptic.ui.ShapeCreator;
import simtools.data.async.StreamingMSDataSource;
import simtools.data.async.TimeStampedDataSourceCollection;
import simtools.shapes.AbstractShape;
import simtools.ui.MenuResourceBundle;
import simtools.ui.ResourceFinder;

/**
* A plugin to enable TimePlot shape dedidated to asynchonous data sources
*
* @author Claude Cazenave
*/
public class AsyncPlugin extends Plugin {

    public static MenuResourceBundle resources = ResourceFinder.getMenu(AsyncPlugin.class);

    public final static String TIME_PLOT = resources.getString("TimePlot");
    static {
        String readTimeZone = "GMT";
        if (Run.getProperties()!=null){
            readTimeZone = Run.getProperties().getString("simtools.data.readTimeZone",readTimeZone);
        }
        TimeStampedDataSourceCollection.timeStampedDateFormat.setTimeZone(TimeZone.getTimeZone(readTimeZone));
    }

    protected List shapeCreators;

    /**
     *
     */
    public AsyncPlugin(){
        shapeCreators = new ArrayList();
        shapeCreators.add(new ShapeCreator(this, TIME_PLOT));
    }

   
    /* (non-Javadoc)
     * @see jsynoptic.base.Plugin#getShapeCreators()
     */
    public List getShapeCreators(){
       return shapeCreators;
    }

    public Object[][] getDataSourceIcons() {
        Object[][] ret = new Object[1][2];
        ret[0][0] = StreamingMSDataSource.class;
        ret[0][1] = jsynoptic.ui.SourceTree.resources.getIcon("dynamicSourceIcon");

        return ret;
    }

    public Template[] getTemplates() {
        Template[] res = new Template[1];
        res = new Template[1];
        res[0] new AsyncTemplate();
        return res;
    }


    /* (non-Javadoc)
     * @see jsynoptic.base.Plugin#createShape(java.lang.String)
     */
    public AbstractShape createShape(String name) {
        AbstractShape res = null;

        if (name.equals(TIME_PLOT)){
            res =  createTimePlot();
        }
        return res;
    }
   
    public static AbstractShape createTimePlot() {
        return new TimePlot(
                0, 0,
                400,
                250
        );
    }
   
    /**
     * Enter your plugin information here. This will appear in the about box.
     * Warning : uses HTML... @see jsynoptic.base.Plugin#about()
     */
    public String about() {
        return resources.getString("about");
    }
}
TOP

Related Classes of jsynoptic.plugins.async.AsyncPlugin

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.