[kepler-code] r28835 - in releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui: . configurationwizard
tao at ecoinformatics.org
tao at ecoinformatics.org
Mon Oct 24 16:35:44 PDT 2011
Author: tao
Date: 2011-10-24 16:35:44 -0700 (Mon, 24 Oct 2011)
New Revision: 28835
Added:
releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/configurationwizard/
releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/configurationwizard/OpenWorkflowSchedulerURLConfigDialogAction.java
releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/configurationwizard/WorkflowSchedulerURLConfigurationDialog.java
Modified:
releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/WorkflowSchedulerPanel.java
releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/WorkflowSchedulerServerInstallationInfoPanel.java
Log:
merge the change add a gui to configure the workflow scheduler url to the branch.
Modified: releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/WorkflowSchedulerPanel.java
===================================================================
--- releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/WorkflowSchedulerPanel.java 2011-10-24 23:23:24 UTC (rev 28834)
+++ releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/WorkflowSchedulerPanel.java 2011-10-24 23:35:44 UTC (rev 28835)
@@ -419,7 +419,7 @@
/*
* Add a component with specified layout to the given panel
*/
- private void addComponent(JPanel panel, JComponent component, GridBagLayout layout, GridBagConstraints constraint)
+ public static void addComponent(JPanel panel, JComponent component, GridBagLayout layout, GridBagConstraints constraint)
{
if(component != null && panel != null && layout != null)
{
@@ -432,7 +432,7 @@
/*
* Add a component with specified layout to the given panel
*/
- private void addFixWidthComponent(JPanel panel, JComponent component, GridBagLayout layout, GridBagConstraints constraint)
+ public static void addFixWidthComponent(JPanel panel, JComponent component, GridBagLayout layout, GridBagConstraints constraint)
{
if(component != null && panel != null && layout != null)
{
Modified: releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/WorkflowSchedulerServerInstallationInfoPanel.java
===================================================================
--- releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/WorkflowSchedulerServerInstallationInfoPanel.java 2011-10-24 23:23:24 UTC (rev 28834)
+++ releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/WorkflowSchedulerServerInstallationInfoPanel.java 2011-10-24 23:35:44 UTC (rev 28835)
@@ -1,6 +1,35 @@
+/**
+ * Copyright (c) 2010 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * '$Author: tao $'
+ * '$Date: 2010-06-03 16:45:10 -0700 (Thu, 03 Jun 2010) $'
+ * '$Revision: 24730 $'
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the above
+ * copyright notice and the following two paragraphs appear in all copies
+ * of this software.
+ *
+ * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
+ * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+ * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+ * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+ * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
+ * ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ */
package org.kepler.workflowscheduler.gui;
import java.awt.Desktop;
+import java.awt.event.ActionEvent;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URISyntaxException;
@@ -18,6 +47,7 @@
import org.kepler.gui.TabManager;
import org.kepler.gui.TabPane;
import org.kepler.module.workflowschedulergui.Initialize;
+import org.kepler.workflowscheduler.gui.configurationwizard.OpenWorkflowSchedulerURLConfigDialogAction;
import com.sun.jndi.toolkit.url.UrlUtil;
@@ -33,12 +63,16 @@
*/
public class WorkflowSchedulerServerInstallationInfoPanel extends JTextPane implements TabPane
{
-
+ private static final String WORKFLOWSCHEDULERURL= "http://workflow.scheduler.url";
+ private static final String WORKFLOWRUENGINE = "http://workflow.run.engine";
private static final String NOTE1= "<br><br>Kepler detects that ";
private static final String NOTE2NOSCHEDULER = "the workflow scheduler part hasn't been configured.";
private static final String NOTE2NOENGINE = "the workflow run engine part hasn't been configured.";
private static final String NOTE2NOSCHEDULERENGINE = "both the workflow scheduler and the workflow run engine parts haven't been configured.";
- private static final String NOTE3 = "<br>Please quit the Kepler and modify the file at ";
+ private static final String NOTE3NOSCHEDULER = "<br>Please click "+"<a href=\""+WORKFLOWSCHEDULERURL+"\">"+
+ "here"+"</a> to configure the workflow scheduler url.";
+ private static final String NOTE3NOENGINE = "<br>Please click "+"<a href=\""+WORKFLOWRUENGINE+"\">"+
+ "here"+"</a> to configure the workflow run engine.";
private static final String NOTE4 ="<br>If either Workflow Schedulr server or Workflow Run Engine is not available, please click "+
"<a href=\"https://kepler-project.org/developers/interest-groups/distributed/technical-documentation\">"+
"here"+"</a> for the installation instructions.";
@@ -115,17 +149,21 @@
if(!Initialize.isSchedulerURLConfigured() && !Initialize.isWorkflowRunEngineConfigured())
{
answer.append(NOTE2NOSCHEDULERENGINE);
+ answer.append(NOTE3NOSCHEDULER);
+ answer.append(NOTE3NOENGINE);
}
else if(!Initialize.isSchedulerURLConfigured())
{
answer.append(NOTE2NOSCHEDULER);
+ answer.append(NOTE3NOSCHEDULER);
}
else if(!Initialize.isWorkflowRunEngineConfigured())
{
answer.append(NOTE2NOENGINE);
+ answer.append(NOTE3NOENGINE);
}
- answer.append(NOTE3);
- answer.append(StringEscapeUtils.escapeHtml(Initialize.getConfigFilePath())+".");
+
+ //answer.append(StringEscapeUtils.escapeHtml(Initialize.getConfigFilePath())+".");
answer.append(NOTE4);
return addHTMLTag(answer.toString());
}
@@ -140,7 +178,32 @@
{
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
{
- openURL(event.getURL().toString());
+ if(event.getURL() != null)
+ {
+ //System.out.println("the url is === "+event.getURL().toString());
+ if(event.getURL().toString().equals(WORKFLOWSCHEDULERURL))
+ {
+ OpenWorkflowSchedulerURLConfigDialogAction action =
+ new OpenWorkflowSchedulerURLConfigDialogAction(parent);
+ ActionEvent e = new ActionEvent(this, 100, "Fire workflow scheduler configuration");
+ action.actionPerformed(e);
+ //System.out.println("==== the action to configure workflow scheduler url being performed");
+ }
+ else if (event.getURL().toString().equals(WORKFLOWRUENGINE))
+ {
+
+ }
+ else
+ {
+ openURL(event.getURL().toString());
+ }
+
+ }
+ else
+ {
+ //System.out.println("============event.getURL() is null");
+ }
+
}
}
}
Added: releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/configurationwizard/OpenWorkflowSchedulerURLConfigDialogAction.java
===================================================================
--- releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/configurationwizard/OpenWorkflowSchedulerURLConfigDialogAction.java (rev 0)
+++ releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/configurationwizard/OpenWorkflowSchedulerURLConfigDialogAction.java 2011-10-24 23:35:44 UTC (rev 28835)
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2010 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * '$Author: tao $'
+ * '$Date: 2010-06-03 16:45:10 -0700 (Thu, 03 Jun 2010) $'
+ * '$Revision: 24730 $'
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the above
+ * copyright notice and the following two paragraphs appear in all copies
+ * of this software.
+ *
+ * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
+ * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+ * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+ * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+ * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
+ * ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ */
+package org.kepler.workflowscheduler.gui.configurationwizard;
+
+import java.awt.Component;
+import java.awt.Window;
+import java.awt.event.ActionEvent;
+
+import org.kepler.gui.GUIUtil;
+
+public class OpenWorkflowSchedulerURLConfigDialogAction
+{
+ private Window parent = null;
+
+ /**
+ * Constructor
+ * @param parent
+ */
+ public OpenWorkflowSchedulerURLConfigDialogAction(Window parent)
+ {
+ this.parent = parent;
+ }
+
+ /**
+ * Open a workflow scheduler dialog box
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ if (parent == null) {
+ parent = GUIUtil.getParentWindow((Component) e.getSource());
+ }
+ WorkflowSchedulerURLConfigurationDialog dialog = new WorkflowSchedulerURLConfigurationDialog(parent);
+
+ }
+
+}
Added: releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/configurationwizard/WorkflowSchedulerURLConfigurationDialog.java
===================================================================
--- releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/configurationwizard/WorkflowSchedulerURLConfigurationDialog.java (rev 0)
+++ releases/release-branches/workflow-scheduler-gui-1.0/src/org/kepler/workflowscheduler/gui/configurationwizard/WorkflowSchedulerURLConfigurationDialog.java 2011-10-24 23:35:44 UTC (rev 28835)
@@ -0,0 +1,199 @@
+/**
+ * Copyright (c) 2010 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * '$Author: tao $'
+ * '$Date: 2010-06-03 16:45:10 -0700 (Thu, 03 Jun 2010) $'
+ * '$Revision: 24730 $'
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the above
+ * copyright notice and the following two paragraphs appear in all copies
+ * of this software.
+ *
+ * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
+ * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+ * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+ * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+ * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
+ * ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ */
+package org.kepler.workflowscheduler.gui.configurationwizard;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.Window;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import org.kepler.workflowscheduler.gui.WorkflowSchedulerPanel;
+
+/**
+ * This dialog provide a interface for user to add a workflow scheduler url
+ * @author tao
+ *
+ */
+public class WorkflowSchedulerURLConfigurationDialog extends JDialog
+{
+ private static final String TITLE = "Workflow URL Configuration";
+ private static final String DEFAULTURL = "http://yourhostname/workflowscheduler/scheduler";
+ private static final int WIDTH = 800;
+ private static final int HEIGHT = 200;
+ static final int LEADSPACESIZE = 50; // leading space of each row
+ static final int TEXTFIELDSIZE = 600;
+ private Window parent = null;
+ private GridBagConstraints textFieldConstraint = null;
+ private GridBagConstraints labelConstraint = null;
+ private GridBagConstraints lastConstraint = null;
+ private JTextField urlTextField = null;
+
+ /**
+ * Constructor
+ */
+ public WorkflowSchedulerURLConfigurationDialog(Window parent)
+ {
+ super(parent);
+ this.parent = parent;
+ init();
+ this.pack();
+ this.setVisible(true);
+ }
+
+ /*
+ * Initialize the dialog
+ */
+ private void init()
+ {
+ setPreferredSize(new Dimension(WIDTH, HEIGHT));
+ if(parent != null)
+ {
+ setLocation(parent.getLocation());
+ }
+ setTitle(TITLE);
+ setModal(true);
+ setLayout(new BorderLayout());
+ initializeGridBagLayout();
+ initMainPanel();
+ initButtonPanel();
+ }
+
+ /*
+ * Initialize the grid bag layout manager
+ */
+ private void initializeGridBagLayout()
+ {
+ textFieldConstraint = new GridBagConstraints();
+ textFieldConstraint.fill = GridBagConstraints.HORIZONTAL;
+ //lastConstraint.anchor = GridBagConstraints.NORTHWEST;
+ // Give the "last" component as much space as possible
+ textFieldConstraint.weightx = 1.0;
+ //textFieldConstraint.gridwidth = GridBagConstraints.RELATIVE;
+ textFieldConstraint.insets = new Insets(4, 4, 4, 4);
+
+ lastConstraint = (GridBagConstraints) textFieldConstraint.clone();
+ //These still get as much space as possible, but do
+ //not close out a row
+ lastConstraint.gridwidth = GridBagConstraints.REMAINDER;
+
+ // first component (usually it is a label) on each row
+ labelConstraint = (GridBagConstraints) textFieldConstraint.clone();
+ // Give these as little space as necessary
+ labelConstraint.weightx = 0.0;
+ labelConstraint.gridwidth = 1;
+
+ }
+
+ /*
+ * Initialize the main panel containing the text field and description
+ */
+ private void initMainPanel()
+ {
+ JPanel mainPanel = new JPanel();
+ GridBagLayout gridbag = new GridBagLayout();
+ mainPanel.setLayout(gridbag);
+ addLeadingSpace(mainPanel, gridbag, labelConstraint);
+ JLabel nameLabel = new JLabel("Workflow Scheduler Server URL ");
+ WorkflowSchedulerPanel.addComponent(mainPanel, nameLabel, gridbag, labelConstraint);
+ urlTextField = new JTextField();
+ urlTextField.setText(DEFAULTURL);
+ WorkflowSchedulerPanel.addFixWidthComponent(mainPanel, urlTextField , gridbag, textFieldConstraint);
+ addEndingSpace(mainPanel, gridbag,lastConstraint);
+ add(mainPanel, BorderLayout.CENTER);
+ }
+
+ /*
+ * Initialize the panel containing Add and cancel button
+ */
+ private void initButtonPanel()
+ {
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
+ buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+ buttonPanel.add(Box.createHorizontalGlue());
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.setPreferredSize(new Dimension(100, 50));
+ cancelButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ dispose();
+ }
+ });
+ buttonPanel.add(cancelButton);
+ buttonPanel.add(Box.createHorizontalStrut(10));
+ JButton addButton = new JButton("Add");
+ addButton.setPreferredSize(new Dimension(100, 50));
+ addButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ dispose();
+ }
+ });
+ buttonPanel.add(addButton);
+ add(buttonPanel, BorderLayout.SOUTH);
+ }
+
+ /*
+ *Add leading space in each row of a panel
+ */
+ static void addLeadingSpace(JPanel panel, GridBagLayout layout, GridBagConstraints labelConstraint)
+ {
+ String space = " ";
+ JLabel leadingLabel = new JLabel(space);
+ Dimension size = leadingLabel.getPreferredSize();
+ size.width = LEADSPACESIZE;
+ leadingLabel.setPreferredSize(size);
+ WorkflowSchedulerPanel.addComponent(panel, leadingLabel, layout, labelConstraint);
+ }
+
+ /*
+ *Add ending space in each row of a panel
+ */
+ static void addEndingSpace(JPanel panel, GridBagLayout layout, GridBagConstraints lastConstraint )
+ {
+ String space = " ";
+ JLabel leadingLabel = new JLabel(space);
+ WorkflowSchedulerPanel.addComponent(panel, leadingLabel, layout, lastConstraint);
+ }
+}
More information about the Kepler-cvs
mailing list