001/* 002 * Copyright (c) 1998-2010 The Regents of the University of California. 003 * All rights reserved. 004 * 005 * '$Author: crawl $' 006 * '$Date: 2015-08-24 22:45:41 +0000 (Mon, 24 Aug 2015) $' 007 * '$Revision: 33631 $' 008 * 009 * Permission is hereby granted, without written agreement and without 010 * license or royalty fees, to use, copy, modify, and distribute this 011 * software and its documentation for any purpose, provided that the above 012 * copyright notice and the following two paragraphs appear in all copies 013 * of this software. 014 * 015 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY 016 * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 017 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 018 * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF 019 * SUCH DAMAGE. 020 * 021 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 022 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 024 * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 025 * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 026 * ENHANCEMENTS, OR MODIFICATIONS. 027 * 028 */ 029 030package org.kepler.objectmanager.data; 031 032import diva.graph.GraphController; 033import ptolemy.kernel.util.IllegalActionException; 034import ptolemy.kernel.util.NameDuplicationException; 035import ptolemy.kernel.util.NamedObj; 036import ptolemy.vergil.basic.NamedObjController; 037import ptolemy.vergil.basic.NodeControllerFactory; 038 039////////////////////////////////////////////////////////////////////////// 040//// DataSourceControllerFactory 041/** 042 * This is attribute that produces a custom node controller for Data Sources. 043 * This class produces a node controller that is customized in order to add the 044 * "Get metadata" menu. To use this class, just insert it as an attribute inside 045 * any Ptolemy II object, and then right clicking on the icon for that object 046 * will result in the use of the controller specified here. The instance by 047 * convention will be named "_controllerFactory", but the only reason to enforce 048 * this is that only the first such controller factory found as an attribute 049 * will be used. It is a singleton, so placing it any container will replace any 050 * previous controller factory with the same name. 051 * 052 * @author Matthew Jones 053 * @version $Id: DataSourceControllerFactory.java 15645 2008-11-07 19:39:48Z 054 * berkley $ 055 * @since Ptolemy II 4.0 056 * @Pt.ProposedRating Red (mbj) 057 * @Pt.AcceptedRating Red (mbj) 058 */ 059public class DataSourceControllerFactory extends NodeControllerFactory { 060 061 /** 062 * Construct a new factory with the given container and name. 063 * 064 * @param container 065 * The container. 066 * @param name 067 * The name. 068 * @exception IllegalActionException 069 * If the factory cannot be contained by the proposed 070 * container. 071 * @exception NameDuplicationException 072 * If the container already has an attribute with this name. 073 */ 074 public DataSourceControllerFactory(NamedObj container, String name) 075 throws NameDuplicationException, IllegalActionException { 076 super(container, name); 077 } 078 079 // ///////////////////////////////////////////////////////////////// 080 // // public methods //// 081 082 /** 083 * Return a new node controller. This class returns an instance of 084 * DataSourceInstanceController which customizes the "Get metadata" menu to 085 * support documentation for the data sources. 086 * 087 * @param controller 088 * The associated graph controller. 089 * @return A new node controller. 090 */ 091 public NamedObjController create(GraphController controller) { 092 return new DataSourceInstanceController(controller); 093 } 094}