001/** 002 * Copyright (c) 2010 The Regents of the University of California. 003 * All rights reserved. 004 * 005 * '$Author: tao $' 006 * '$Date: 2010-06-03 16:45:10 -0700 (Thu, 03 Jun 2010) $' 007 * '$Revision: 24730 $' 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 */ 029package org.kepler.workflowscheduler.gui.configurationwizard; 030 031import javax.swing.JTextPane; 032 033import org.kepler.gui.PreferencesTab; 034import org.kepler.gui.PreferencesTabFactory; 035import org.kepler.gui.TabManager; 036import org.kepler.workflowscheduler.gui.URLHyperLinkListener; 037import org.kepler.workflowscheduler.gui.WorkflowSchedulerServerInstallationInfoPanel; 038 039import ptolemy.actor.gui.TableauFrame; 040import ptolemy.kernel.util.IllegalActionException; 041import ptolemy.kernel.util.NameDuplicationException; 042import ptolemy.kernel.util.NamedObj; 043 044/** 045 * A Tab shows in the Preference Frame to configure workflow scheduler 046 * @author tao 047 * 048 */ 049public class WorkflowSchedulerPreferenceTab extends JTextPane implements PreferencesTab 050{ 051 public static final String TABNAME = "Workflow Scheduler URL"; 052 private String tabName = null; 053 private TableauFrame parent = null; 054 /** 055 * PreferencesTab usually will need access to the configuration of the 056 * Tableau that is opened in the BasicGraphFrame. This method will be called 057 * before calling initializeTab. 058 * 059 * @param config 060 */ 061 public void setParent(TableauFrame frame) 062 { 063 parent = frame; 064 tabName = TABNAME; 065 } 066 067 /** 068 * Initialization of the tab should be done at some point after the 069 * constructor is called. The setConfiguration method is called before 070 * calling initializeTab() and this allows for easily adding new functions 071 * to this interface later on. 072 * 073 * @throws Exception 074 */ 075 public void initializeTab() throws Exception 076 { 077 this.setEditable(false); 078 this.addHyperlinkListener(new URLHyperLinkListener(parent)); 079 this.setContentType("text/html"); 080 this.setBackground(TabManager.BGCOLOR); 081 //System.out.println("the content =====is \n"+notes); 082 this.setText(WorkflowSchedulerServerInstallationInfoPanel.addHTMLTag( 083 WorkflowSchedulerServerInstallationInfoPanel.NOTE3NOSCHEDULER)); 084 } 085 086 /** 087 * This method should return the name of the tab which is used to label the 088 * tab in the PreferencesFrame. 089 */ 090 public String getTabName() 091 { 092 return tabName; 093 } 094 095 096 /* 097 * Set the table name 098 */ 099 /*public void setTabName(String tabName) { 100 this.tabName = tabName; 101 }*/ 102 103 /** 104 * This method is called as the preferences frame is closed legitimately 105 * meaning that all changes to the preferences should be saved. 106 */ 107 public void onClose() 108 { 109 //do nothing 110 } 111 112 /** 113 * This method is called if the user presses the cancel button on the preferences frame. 114 * In this case all changes to the preferences should be ignored. 115 */ 116 public void onCancel() 117 { 118 //do nothing 119 } 120 121 /** 122 * A factory that creates the ServicesListModification panel for the 123 * PreferencesFrame. 124 */ 125 public static class Factory extends PreferencesTabFactory 126 { 127 /** 128 * Create a factory with the given name and container. 129 * 130 *@param container 131 * The container. 132 *@param name 133 * The name of the entity. 134 *@exception IllegalActionException 135 * If the container is incompatible with this attribute. 136 *@exception NameDuplicationException 137 * If the name coincides with an attribute already in the 138 * container. 139 */ 140 public Factory(NamedObj container, String name) 141 throws IllegalActionException, NameDuplicationException 142 { 143 super(container, name); 144 } 145 146 147 /* 148 * (non-Javadoc) 149 * @see org.kepler.gui.PreferencesTabFactory#createPreferencesTab() 150 */ 151 public WorkflowSchedulerPreferenceTab createPreferencesTab() 152 { 153 154 WorkflowSchedulerPreferenceTab kpt = new WorkflowSchedulerPreferenceTab(); 155 //kpt.setTabName(TABNAME); 156 return kpt; 157 } 158 } 159}