001/* 002 * Copyright (c) 2004-2010 The Regents of the University of California. 003 * All rights reserved. 004 * 005 * '$Author: welker $' 006 * '$Date: 2010-05-06 05:21:26 +0000 (Thu, 06 May 2010) $' 007 * '$Revision: 24234 $' 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.gui; 031 032import java.awt.Component; 033 034import javax.swing.Box; 035import javax.swing.JScrollPane; 036 037import ptolemy.actor.gui.DialogTableau; 038import ptolemy.actor.gui.PortConfigurerDialog; 039import ptolemy.actor.gui.TableauFrame; 040import ptolemy.kernel.Entity; 041import ptolemy.kernel.util.NamedObj; 042 043/** 044 * A JTabbedPane tab to be added to a TabbedDialog object. This particular pane 045 * shows the "Ports" settings for the object being configured 046 * 047 * @author Matthew Brooke 048 * @since 27 February 2006 049 */ 050public class DialogPortsTab extends AbstractDialogTab { 051 052 public DialogPortsTab(NamedObj target, String targetType, TableauFrame frame) { 053 super(target, targetType, frame); 054 } 055 056 /** 057 * Validate the user-editable values associated with this tab 058 * 059 * @return boolean - true if user values validate correctly; false otherwise 060 */ 061 public boolean validateInput() { 062 /** @todo - FIXME - needs to be implemented */ 063 return true; 064 } 065 066 /** 067 * Save the user-editable values associated with this tab 068 */ 069 public void save() { 070 /** @todo - FIXME - needs to be implemented */ 071 } 072 073 /** 074 * get the Component that will be displayed in the NORTH section of the 075 * BorderLayout. Note that if the dialog is resizable, this Component will 076 * need to stretch along the x axis, while retaining its aesthetic qualities 077 * 078 * @return Component 079 */ 080 protected Component getTopPanel() { 081 Box topPanel = Box.createHorizontalBox(); 082 /** @todo - FIXME - needs to be implemented */ 083 return topPanel; 084 } 085 086 /** 087 * get the Component that will be displayed in the CENTER section of the 088 * BorderLayout. Note that if the dialog is resizable, this Component will 089 * need to stretch along both the x <em>and</em> y axes, while retaining its 090 * aesthetic qualities 091 * 092 * @return Component 093 */ 094 protected Component getCenterPanel() { 095 Box centerPanel = Box.createHorizontalBox(); 096 097 /** @todo - FIXME - needs to be implemented */ 098 // 099 // SEE ptolemy.actor.gui.PortConfigurerDialog 100 // and ptolemy.vergil.kernel.PortDialogFactory 101 // 102 DialogTableau dialogTableau = DialogTableau.createDialog(_frame, 103 TabbedDialog.getConfiguration(), _frame.getEffigy(), 104 PortConfigurerDialog.class, (Entity) _target); 105 106 dialogTableau.getFrame().setVisible(false); 107 Component[] panels = dialogTableau.getFrame().getContentPane() 108 .getComponents(); 109 110 for (int i = 0; i < panels.length; i++) { 111 if (panels[i] instanceof JScrollPane) { 112 centerPanel.add(panels[i]); 113 break; 114 } 115 } 116 117 return centerPanel; 118 119 } 120 121 /** 122 * get the Component that will be displayed in the SOUTH section of the 123 * BorderLayout. Note that if the dialog is resizable, this Component will 124 * need to stretch along the x axis, while retaining its aesthetic qualities 125 * 126 * @return Component 127 */ 128 protected Component getBottomPanel() { 129 Box bottomPanel = Box.createHorizontalBox(); 130 /** @todo - FIXME - needs to be implemented */ 131 return bottomPanel; 132 } 133}