001/* A tableau representing a text window in an external text editor. 002 003 Copyright (c) 1998-2014 The Regents of the University of California and 004 Research in Motion Limited. 005 All rights reserved. 006 Permission is hereby granted, without written agreement and without 007 license or royalty fees, to use, copy, modify, and distribute this 008 software and its documentation for any purpose, provided that the above 009 copyright notice and the following two paragraphs appear in all copies 010 of this software. 011 012 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA OR RESEARCH IN MOTION 013 LIMITED BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, 014 INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS 015 SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA 016 OR RESEARCH IN MOTION LIMITED HAVE BEEN ADVISED OF THE POSSIBILITY OF 017 SUCH DAMAGE. 018 019 THE UNIVERSITY OF CALIFORNIA AND RESEARCH IN MOTION LIMITED 020 SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 021 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 022 PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" 023 BASIS, AND THE UNIVERSITY OF CALIFORNIA AND RESEARCH IN MOTION 024 LIMITED HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 025 ENHANCEMENTS, OR MODIFICATIONS. 026 027 PT_COPYRIGHT_VERSION_2 028 COPYRIGHTENDKEY 029 030 */ 031package ptolemy.actor.gui; 032 033import ptolemy.kernel.util.IllegalActionException; 034import ptolemy.kernel.util.NameDuplicationException; 035 036/////////////////////////////////////////////////////////////////// 037//// ExternalTextTableau 038 039/** 040 A tableau representing an external text editor (for now emacs only, with 041 the gnuserv package installed).<p> 042 043 This is just a demo form. TextEditorTableau should really be made 044 abstract and have different implementations depending on user 045 preferences. ExternalTextTableau should not really derive from the java 046 swing Frame based TextEditorTableau. The interface of the abstract 047 TextEditorTableau should support both swing JFrame based editor and 048 external text editor classes. 049 050 Note that one could send signals (events) back to this class for 051 example if the buffer associated with this "tableau" is deleted or 052 updated or "Saved As". This could be achieved by adding special "hooks" 053 to emacs' file operation hook lists... 054 055 @author Zoltan Kemenczy, Research in Motion Limited 056 @version $Id$ 057 @since Ptolemy II 2.1 058 @Pt.ProposedRating Red (cxh) 059 @Pt.AcceptedRating Red (cxh) 060 */ 061public class ExternalTextTableau extends TextEditorTableau { 062 /** Construct a new tableau for the model represented by the given effigy. 063 * @param container The container. 064 * @param name The name. 065 * @exception IllegalActionException If the container does not accept 066 * this entity (this should not occur). 067 * @exception NameDuplicationException If the name coincides with an 068 * attribute already in the container. 069 */ 070 public ExternalTextTableau(TextEffigy container, String name) 071 throws IllegalActionException, NameDuplicationException { 072 super(container, name); 073 } 074 075 /////////////////////////////////////////////////////////////////// 076 //// public methods //// 077 078 /** Make the tableau editable or uneditable. Notice that this does 079 * not change whether the effigy is modifiable, so other tableaux 080 * on the same effigy may still modify the associated file. 081 * @param flag False to make the tableau uneditable. 082 */ 083 @Override 084 public void setEditable(boolean flag) { 085 ((ExternalTextEffigy) getContainer()).setModifiable(flag); 086 } 087 088 /** Make this tableau visible - by calling show() on the container 089 * (ExternalTextEffigy). */ 090 @Override 091 public void show() { 092 ((ExternalTextEffigy) getContainer()).show(); 093 } 094}