001/* 002 003Copyright (c) 2015-2018 The Regents of the University of California. 004All rights reserved. 005 006Permission is hereby granted, without written agreement and without 007license or royalty fees, to use, copy, modify, and distribute this 008software and its documentation for any purpose, provided that the above 009copyright notice and the following two paragraphs appear in all copies 010of this software. 011 012IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA LIABLE TO ANY PARTY 013FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 014ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 015THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF 016SUCH DAMAGE. 017 018THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 019INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 020MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 021PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 022CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 023ENHANCEMENTS, OR MODIFICATIONS. 024 025PT_COPYRIGHT_VERSION_2 026COPYRIGHTENDKEY 027 */ 028package ptolemy.vergil.basic.layout; 029 030import de.cau.cs.kieler.kiml.options.Direction; 031import ptolemy.data.expr.ChoiceParameter; 032import ptolemy.data.expr.Parameter; 033import ptolemy.data.type.BaseType; 034import ptolemy.kernel.util.IllegalActionException; 035import ptolemy.kernel.util.NameDuplicationException; 036import ptolemy.kernel.util.NamedObj; 037 038/** 039 * Specialized layout configuration dialog for 040 * {@link ptolemy.vergil.modal.FSMGraphModel FSMGraphModel}s. 041 * 042 * @version $Id$ 043 * @author Ulf Rueegg 044 * @since Ptolemy II 11.0 045 */ 046public class ModalLayoutConfiguration extends AbstractLayoutConfiguration { 047 048 /////////////////////////////////////////////////////////////////// 049 //// public parameters //// 050 051 /** Whether the edges of FSMs should be routed and drawn as splines. */ 052 public Parameter drawSplines; 053 054 /** Default value for useSplines. */ 055 public static final boolean DEF_USE_SPLINES = true; 056 057 /** Specifies the direction into which the "flow" of the layout points. */ 058 public ChoiceParameter direction; 059 060 /** Default direction. */ 061 public static final Direction DEF_DIRECTION = Direction.DOWN; 062 063 /** 064 * Creates an initializes a layout configuration specifically tailored 065 * for {@link ptolemy.vergil.modal.FSMGraphModel FSMGraphModel}s. 066 * 067 * @param container The container. 068 * @param name The name of this attribute. 069 * @exception IllegalActionException If the attribute is not of an 070 * acceptable class for the container, or if the name contains a period. 071 * @exception NameDuplicationException If the name coincides with 072 * an attribute already in the container. 073 */ 074 public ModalLayoutConfiguration(NamedObj container, String name) 075 throws IllegalActionException, NameDuplicationException { 076 super(container, name); 077 078 drawSplines = new Parameter(this, "useSplines"); 079 drawSplines.setDisplayName("Use splines for arcs"); 080 drawSplines.setTypeEquals(BaseType.BOOLEAN); 081 drawSplines.setExpression(Boolean.toString(DEF_USE_SPLINES)); 082 083 direction = new ChoiceParameter(this, "direction", Direction.class); 084 direction.setDisplayName("Layout direction"); 085 direction.setExpression(DEF_DIRECTION.toString()); 086 087 } 088}