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; 030 031import javax.swing.JTextPane; 032 033import org.kepler.gui.TabManager; 034import org.kepler.gui.TabPane; 035import org.kepler.module.workflowschedulergui.Initialize; 036 037import ptolemy.actor.gui.TableauFrame; 038//import com.sun.jndi.toolkit.url.UrlUtil; 039 040 041/** 042 * This panel will show the information for user to how to configure the configuration file 043 * and install workflow scheduler server and workflow run engine. 044 * @author tao 045 * 046 */ 047public class WorkflowSchedulerServerInstallationInfoPanel extends JTextPane implements TabPane 048{ 049 050 private static final String NOTE1= "<br><br>Kepler detects that "; 051 private static final String NOTE2NOSCHEDULER = "the Workflow Scheduler URL hasn't been set."; 052 private static final String NOTE2NOENGINE = "the Workflow Run Engine URL hasn't been set."; 053 private static final String NOTE2NOSCHEDULERENGINE = "the Workflow Scheduler and Workflow Run Engine URLs haven't been set."; 054 public static final String NOTE3NOSCHEDULER = "<br>Set the "+"<a href=\""+URLHyperLinkListener.WORKFLOWSCHEDULERURL+"\">"+ 055 "Workflow Scheduler URL"+"</a>."; 056 public static final String NOTE3NOENGINE = "<br>Set the "+"<a href=\""+URLHyperLinkListener.WORKFLOWRUENGINE+"\">"+ 057 "Workflow Run Engine URL"+"</a>."; 058 private static final String NOTE4 ="<br><br><br>If you would like to setup your own Workflow Scheduler or Workflow Run Engine, please read the instructions: "+ 059 "<br><a href=\"https://code.ecoinformatics.org/code/wfscheduler/trunk/docs/dev/index.html#Building\">"+ 060 "Workflow Scheduler installation"+"</a>"+ 061 "<br><a href=\"https://kepler-project.org/developers/interest-groups/distributed/technical-documentation/the-overview-of-the-workflow-run-engine-component#Deployment\">"+ 062 "Workflow Run Engine installation"+"</a>"; 063 064 private TableauFrame parent = null; 065 private WorkflowSchedulerDialog dialog = null; 066 067 068 069 070 /** 071 * Constructor 072 * @param parent the parent TableauFrame object 073 */ 074 public WorkflowSchedulerServerInstallationInfoPanel(TableauFrame parent, WorkflowSchedulerDialog dialog) 075 { 076 this.parent = parent; 077 this.dialog = dialog; 078 init(); 079 } 080 081 /* 082 * Initialize the panel 083 */ 084 private void init() 085 { 086 087 this.setEditable(false); 088 this.addHyperlinkListener(new URLHyperLinkListener(parent)); 089 this.setContentType("text/html"); 090 this.setBackground(TabManager.BGCOLOR); 091 String notes = createNotes(); 092 //System.out.println("the content =====is \n"+notes); 093 this.setText(notes); 094 } 095 /** 096 * Return the parent frame 097 */ 098 public TableauFrame getParentFrame() 099 { 100 return parent; 101 } 102 103 /** 104 * This method should return the name of the tab which is used to label the 105 * tab in the TabbedPane 106 */ 107 public String getTabName() 108 { 109 return WorkflowSchedulerParentPanel.SCHEDULER; 110 } 111 112 /** 113 * Initialize the tab 114 */ 115 public void initializeTab() throws Exception 116 { 117 118 } 119 120 /** 121 * Set the parent frame of this panel 122 */ 123 public void setParentFrame(TableauFrame parent) 124 { 125 this.parent = parent; 126 } 127 128 129 /* 130 * Create the notes. 131 */ 132 private String createNotes() 133 { 134 StringBuilder answer = new StringBuilder(); 135 answer.append(NOTE1); 136 if(!Initialize.isSchedulerURLConfigured() && !Initialize.isWorkflowRunEngineConfigured()) 137 { 138 answer.append(NOTE2NOSCHEDULERENGINE); 139 answer.append(NOTE3NOSCHEDULER); 140 answer.append(NOTE3NOENGINE); 141 } 142 else if(!Initialize.isSchedulerURLConfigured()) 143 { 144 answer.append(NOTE2NOSCHEDULER); 145 answer.append(NOTE3NOSCHEDULER); 146 } 147 else if(!Initialize.isWorkflowRunEngineConfigured()) 148 { 149 answer.append(NOTE2NOENGINE); 150 answer.append(NOTE3NOENGINE); 151 } 152 153 //answer.append(StringEscapeUtils.escapeHtml(Initialize.getConfigFilePath())+"."); 154 answer.append(NOTE4); 155 return addHTMLTag(answer.toString()); 156 } 157 158 159 /* 160 * Add html tag for the input 161 */ 162 public static String addHTMLTag(String input) 163 { 164 StringBuilder answer = new StringBuilder(); 165 answer.append("<html><body bgcolor=\"rgb("+TabManager.BGCOLOR.getRed()+ 166 ","+TabManager.BGCOLOR.getGreen()+","+TabManager.BGCOLOR.getBlue()+")\"/>"); 167 answer.append(input); 168 answer.append("</body></html>"); 169 return answer.toString(); 170 171 } 172 173 174}