summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/gui/tabs/execution/RequestButton.java
blob: 0e11a7f2f58b1f746634b5d76617019f8f94b632 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.c2kernel.gui.tabs.execution;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import com.c2kernel.entity.agent.Job;
import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
/**
     * Each job gets a RequestButton
     */

    public class RequestButton extends JButton implements ActionListener {

        Job myJob;
        ActivityViewer parent;

        public RequestButton(Job myJob, ActivityViewer parent) {
            super();
            this.myJob = myJob;
            this.parent = parent;
            String label = Transitions.getTransitionName(myJob.getPossibleTransition());
            label = Character.toUpperCase(label.charAt(0))+label.substring(1);
            if (myJob.isOutcomeUsed()) setBackground(Color.white);
            super.setText(label);
            addActionListener(this);
        }

        public void actionPerformed(ActionEvent event) {
            parent.execute(myJob);
        }
    }