[kepler-dev] Copies of Ptolemy classes in Tagging

Derik Barseghian barseghian at nceas.ucsb.edu
Tue May 31 14:09:43 PDT 2011


Hi Christopher,
There's a bug for this: http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5405
Also, sensor-view has an override of EntityTreeModel: http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5286

I'll try to look into finding a way to remove these soon...

Derik

On May 31, 2011, at 1:56 PM, Christopher Brooks wrote:

> Hi Derik,
> I noticed that tagging has a copy of vergil/basic/BasicGraphController.
> 
> The diffs between the copy in tagging and the ptII head are substantial.
> 
> I'm concerned that doing the merge will be very difficult.
> 
> It would be good to get this done sooner rather than later, the amount
> of effort to a merge can quickly become exponential.
> 
> Let me know if you want to make changes to BasicGraphController.
> 
> _Christopher
> 
> On 5/27/11 5:47 PM, barseghian at ecoinformatics.org wrote:
>> Author: barseghian
>> Date: 2011-05-27 17:47:49 -0700 (Fri, 27 May 2011)
>> New Revision: 27661
>> 
>> Modified:
>>    trunk/modules/tagging/src/ptolemy/vergil/basic/BasicGraphController.java
>> Log:
>> fix override so workflows can execute again.
>> we need to remove this override so this doesn't happen again. this means finding an alternate soln for how tagging changes context to 'workflow'
>> 
>> Modified: trunk/modules/tagging/src/ptolemy/vergil/basic/BasicGraphController.java
>> ===================================================================
>> --- trunk/modules/tagging/src/ptolemy/vergil/basic/BasicGraphController.java	2011-05-27 23:41:50 UTC (rev 27660)
>> +++ trunk/modules/tagging/src/ptolemy/vergil/basic/BasicGraphController.java	2011-05-28 00:47:49 UTC (rev 27661)
>> @@ -1,30 +1,29 @@
>> -/*
>> - * Copyright (c) 1999-2010 The Regents of the University of California.
>> - * All rights reserved.
>> - *
>> - * '$Author$'
>> - * '$Date$'
>> - * '$Revision$'
>> - *
>> - * Permission is hereby granted, without written agreement and without
>> - * license or royalty fees, to use, copy, modify, and distribute this
>> - * software and its documentation for any purpose, provided that the above
>> - * copyright notice and the following two paragraphs appear in all copies
>> - * of this software.
>> - *
>> - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
>> - * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
>> - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
>> - * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
>> - * SUCH DAMAGE.
>> - *
>> - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
>> - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
>> - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
>> - * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
>> - * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
>> - * ENHANCEMENTS, OR MODIFICATIONS.
>> - *
>> +/* (An override of Ptolemy's:) Base class for graph controllers in Ptolemy.
>> +
>> + Copyright (c) 1999-2010 The Regents of the University of California.
>> + All rights reserved.
>> + Permission is hereby granted, without written agreement and without
>> + license or royalty fees, to use, copy, modify, and distribute this
>> + software and its documentation for any purpose, provided that the above
>> + copyright notice and the following two paragraphs appear in all copies
>> + of this software.
>> +
>> + IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
>> + FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
>> + ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
>> + THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
>> + SUCH DAMAGE.
>> +
>> + THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
>> + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
>> + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
>> + PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
>> + CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
>> + ENHANCEMENTS, OR MODIFICATIONS.
>> +
>> + PT_COPYRIGHT_VERSION_2
>> + COPYRIGHTENDKEY
>> +
>>   */
>> 
>>  package ptolemy.vergil.basic;
>> @@ -35,6 +34,7 @@
>>  import java.awt.geom.Point2D;
>>  import java.net.URL;
>>  import java.util.Iterator;
>> +import java.util.LinkedList;
>>  import java.util.List;
>> 
>>  import javax.swing.AbstractAction;
>> @@ -51,14 +51,20 @@
>>  import org.kepler.tagging.gui.TaggingPanel;
>> 
>>  import ptolemy.actor.CompositeActor;
>> +import ptolemy.actor.gui.ColorAttribute;
>>  import ptolemy.actor.gui.Configuration;
>>  import ptolemy.actor.gui.DialogTableau;
>>  import ptolemy.data.expr.Parameter;
>>  import ptolemy.kernel.Entity;
>>  import ptolemy.kernel.InstantiableNamedObj;
>> +import ptolemy.kernel.util.Attribute;
>> +import ptolemy.kernel.util.ChangeRequest;
>>  import ptolemy.kernel.util.DebugEvent;
>>  import ptolemy.kernel.util.DebugListener;
>> +import ptolemy.kernel.util.IllegalActionException;
>>  import ptolemy.kernel.util.Locatable;
>> +import ptolemy.kernel.util.NameDuplicationException;
>> +import ptolemy.kernel.util.Nameable;
>>  import ptolemy.kernel.util.NamedObj;
>>  import ptolemy.kernel.util.Settable;
>>  import ptolemy.kernel.util.ValueListener;
>> @@ -114,6 +120,31 @@
>>      ///////////////////////////////////////////////////////////////////
>>      ////                         public methods                    ////
>> 
>> +    public void clearAllErrorHighlights() {
>> +        ChangeRequest request = _getClearAllErrorHighlightsChangeRequest();
>> +        _frame.getModel().requestChange(request);
>> +    }
>> +
>> +    /** Highlight the specified object and all its containers to
>> +     *  indicate that it is the source of an error.
>> +     *  @param culprit The culprit.
>> +     */
>> +    public void highlightError(final Nameable culprit) {
>> +        if (culprit instanceof NamedObj) {
>> +            ChangeRequest request = new ChangeRequest(this, "Error Highlighter") {
>> +                protected void _execute() throws Exception {
>> +                    _addErrorHighlightIfNeeded(culprit);
>> +                    NamedObj container = culprit.getContainer();
>> +                    while (container != null) {
>> +                        _addErrorHighlightIfNeeded(container);
>> +                        container = container.getContainer();
>> +                    }
>> +                }
>> +            };
>> +            ((NamedObj) culprit).requestChange(request);
>> +        }
>> +    }
>> +
>>      /** Add commands to the specified menu and toolbar, as appropriate
>>       *  for this controller.  In this base class, nothing is added.
>>       *  @param menu The menu to add to, or null if none.
>> @@ -420,8 +451,34 @@
>>       *  will not have been fully constructed by the time this is called.
>>       */
>>      protected void _createControllers() {
>> +    }
>> +
>> +    protected boolean _areThereActiveErrorHighlights() {
>> +        return !_errorHighlights.isEmpty();
>>      }
>> +
>> +    /**
>> +     *
>> +     * @return
>> +     */
>> +    protected ChangeRequest _getClearAllErrorHighlightsChangeRequest() {
>> +        ChangeRequest request = new ChangeRequest(this,
>> +                "Error Highlight Clearer", true) {
>> +            protected void _execute() throws Exception {
>> +                for (Attribute highlight : _errorHighlights) {
>> +                    highlight.setContainer(null);
>> +                }
>> +            }
>> +        };
>> 
>> +        // Mark the Error Highlight Clearer request as
>> +        // non-persistant so that we don't mark the model as being
>> +        // modified.  ptolemy/actor/lib/jni/test/Scale/Scale.xml
>> +        // required this change.
>> +        request.setPersistent(false);
>> +        return request;
>> +    }
>> +
>>      /** Initialize interactions for the specified controller.  This
>>       *  method is called when a new controller is constructed. This
>>       *  base class does nothing, but derived classes may attach interactors
>> @@ -643,6 +700,30 @@
>>      protected UnitSolverDialogAction _unitSolverDialogAction = new UnitSolverDialogAction();
>> 
>>      ///////////////////////////////////////////////////////////////////
>> +    ////                         private methods                   ////
>> +
>> +    /** Add an error highlight color to the specified culprit if it is
>> +     *  not already present.
>> +     *  @param culprit The culprit to highlight.
>> +     *  @exception IllegalActionException If the highlight cannot be added.
>> +     *  @exception NameDuplicationException Should not be thrown.
>> +     */
>> +    private void _addErrorHighlightIfNeeded(Nameable culprit)
>> +            throws IllegalActionException, NameDuplicationException {
>> +        Attribute highlightColor = ((NamedObj) culprit)
>> +                .getAttribute("_highlightColor");
>> +        if (highlightColor == null) {
>> +            highlightColor = new ColorAttribute((NamedObj) culprit,
>> +                    "_highlightColor");
>> +            ((ColorAttribute) highlightColor)
>> +                    .setExpression("{1.0, 0.0, 0.0, 1.0}");
>> +            highlightColor.setPersistent(false);
>> +            ((ColorAttribute) highlightColor).setVisibility(Settable.EXPERT);
>> +            _errorHighlights.add(highlightColor);
>> +        }
>> +    }
>> +
>> +    ///////////////////////////////////////////////////////////////////
>>      ////                         private variables                 ////
>> 
>>      /** The time to sleep upon animation. */
>> @@ -658,6 +739,9 @@
>>       */
>>      private static ContextMenuFactoryCreator _contextMenuFactoryCreator;
>> 
>> +    /** List of error highlight attributes we have created. */
>> +    private List<Attribute>  _errorHighlights = new LinkedList<Attribute>();
>> +
>>      // The get documentation action.
>>      private GetDocumentationAction _getDocumentationAction = new GetDocumentationAction();
>> 
>> 
>> _______________________________________________
>> Kepler-cvs mailing list
>> Kepler-cvs at kepler-project.org
>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-cvs
> 
> -- 
> Christopher Brooks, PMP                       University of California
> CHESS Executive Director                      US Mail: 337 Cory Hall
> Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
> ph: 510.643.9841      	                      (Office: 545Q Cory)
> home: (F-Tu) 707.665.0131 cell: 707.332.0670



More information about the Kepler-dev mailing list