summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java
diff options
context:
space:
mode:
authorabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
committerabranson <andrew.branson@cern.ch>2011-08-04 00:42:34 +0200
commit0ec8481c10cd8277d84c7c1a785483a0a739e5a0 (patch)
tree5f6e5d9ae75193e67e6f3b3dfa488960c5cde1d5 /source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java
parent036cbdba66f804743c4c838ed598d6972c4b3e17 (diff)
More code cleanup:
Refactored Entity Proxy Subscription to handle generics better Rewrote RemoteMap to use TreeMap instead of the internal array for order. It now sorts its keys by number if they parse, else as strings. Removed a no-longer-in-progress outcome form class
Diffstat (limited to 'source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java')
-rw-r--r--source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java47
1 files changed, 25 insertions, 22 deletions
diff --git a/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java b/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java
index d33b717..32b234e 100644
--- a/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java
+++ b/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java
@@ -39,12 +39,12 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen
protected GridBagLayout gridbag;
protected GridBagConstraints c;
protected Box transBox;
- protected JComboBox executors;
+ protected JComboBox<?> executors;
protected JComboBox<String> states = new JComboBox<String>(States.states);
protected JCheckBox active = new JCheckBox();
protected JLabel status = new JLabel();
protected ItemProxy mItem;
-
+
public TransitionPanel() {
super();
gridbag = new GridBagLayout();
@@ -53,37 +53,37 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen
c.gridx=0; c.gridy=0;
c.weightx=1; c.weighty=0;
c.fill=GridBagConstraints.HORIZONTAL;
-
+
JLabel title = new JLabel("Available Transitions");
title.setFont(EntityTabPane.titleFont);
gridbag.setConstraints(title, c);
add(title);
-
- c.gridy++;
+
+ c.gridy++;
gridbag.setConstraints(status, c);
add(status);
c.gridy++;
-
+
transBox = Box.createHorizontalBox();
gridbag.setConstraints(transBox, c);
add(transBox);
-
+
c.weightx=0; c.gridx++;
executors = MainFrame.getExecutionPlugins();
if (executors.getItemCount() > 1) {
gridbag.setConstraints(executors, c);
add(executors);
}
-
-
+
+
if (MainFrame.isAdmin) {
c.gridx=0; c.gridy++;
title = new JLabel("State Hacking");
title.setFont(EntityTabPane.titleFont);
gridbag.setConstraints(title, c);
add(title);
- Box hackBox = Box.createHorizontalBox();
+ Box hackBox = Box.createHorizontalBox();
hackBox.add(states);
hackBox.add(Box.createHorizontalGlue());
hackBox.add(new JLabel("Active:"));
@@ -94,14 +94,15 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen
states.addActionListener(this);
active.addActionListener(this);
}
-
+
clear();
-
+
}
/**
*
*/
- public void select(Vertex vert) {
+ @Override
+ public void select(Vertex vert) {
clear();
if (!(vert instanceof Activity)) return;
mCurrentAct = (Activity)vert;
@@ -129,8 +130,9 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen
}
revalidate();
}
-
- public void actionPerformed(ActionEvent e) {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
if (e.getSource() == active && mCurrentAct != null) {
mCurrentAct.active = active.isSelected();
return;
@@ -142,14 +144,14 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen
if (!e.getActionCommand().startsWith("Trans:")) return;
int transition = Integer.parseInt(e.getActionCommand().substring(6));
Logger.msg("Requesting transition "+transition);
- Job thisJob = new Job(mItem.getSystemKey(),
- mCurrentAct.getPath(),
+ Job thisJob = new Job(mItem.getSystemKey(),
+ mCurrentAct.getPath(),
transition,
new StateMachine(mCurrentAct).simulate(transition),
mCurrentAct.getCurrentState(),
mCurrentAct.getName(),
mCurrentAct.getProperties(),
- mCurrentAct.getType(),
+ mCurrentAct.getType(),
MainFrame.userAgent.getName());
try {
Executor selectedExecutor = (Executor)executors.getSelectedItem();
@@ -160,10 +162,11 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen
Logger.error(ex);
JOptionPane.showMessageDialog(null, ex.getMessage(), className, JOptionPane.ERROR_MESSAGE);
}
-
+
}
- public void clear() {
+ @Override
+ public void clear() {
mCurrentAct = null;
transBox.removeAll();
status.setText("No activity selected");
@@ -173,8 +176,8 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen
active.setEnabled(false);
revalidate();
}
-
-
+
+
/**
* @param item The mItem to set.
*/