Added a class attribute to the restart workflow link to make the link distinguishable for CSS formatting.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2813 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-08-15 08:07:04 +00:00
parent 992c96ca6f
commit 3836b0bb83
2 changed files with 22 additions and 14 deletions

View File

@ -78,6 +78,7 @@ public final class AssignedTaskSection extends Section {
RestartLink() { RestartLink() {
super(new Label(gz("cms.ui.workflow.restart_stopped_workflow"))); super(new Label(gz("cms.ui.workflow.restart_stopped_workflow")));
setClassAttr("restartWorkflowLink");
addActionListener(new Listener()); addActionListener(new Listener());
} }

View File

@ -49,8 +49,7 @@ final class ItemWorkflowItemPane extends BaseWorkflowItemPane {
m_assigned = new AssignedTaskTable(workflow); m_assigned = new AssignedTaskTable(workflow);
m_detailPane.add(new AssignedTaskSection(workflow, m_assigned)); m_detailPane.add(new AssignedTaskSection(workflow, m_assigned));
final TaskFinishForm taskFinishForm = new TaskFinishForm final TaskFinishForm taskFinishForm = new TaskFinishForm(new TaskSelectionRequestLocal());
(new TaskSelectionRequestLocal());
add(taskFinishForm); add(taskFinishForm);
connect(m_assigned, 2, taskFinishForm); connect(m_assigned, 2, taskFinishForm);
@ -58,13 +57,14 @@ final class ItemWorkflowItemPane extends BaseWorkflowItemPane {
} }
private final class TaskSelectionRequestLocal extends TaskRequestLocal { private final class TaskSelectionRequestLocal extends TaskRequestLocal {
@Override
@Override
protected final Object initialValue(final PageState state) { protected final Object initialValue(final PageState state) {
final String id = m_assigned.getRowSelectionModel().getSelectedKey final String id = m_assigned.getRowSelectionModel().getSelectedKey(state).toString();
(state).toString();
return new CMSTask(new BigDecimal(id)); return new CMSTask(new BigDecimal(id));
} }
} }
private boolean hasAdmin(final PageState state) { private boolean hasAdmin(final PageState state) {
@ -74,61 +74,68 @@ final class ItemWorkflowItemPane extends BaseWorkflowItemPane {
} }
private class StopLink extends ActionLink { private class StopLink extends ActionLink {
StopLink() { StopLink() {
super(new Label(gz("cms.ui.item.workflow.stop"))); super(new Label(gz("cms.ui.item.workflow.stop")));
addActionListener(new Listener()); addActionListener(new Listener());
} }
@Override @Override
public final boolean isVisible(final PageState state) { public final boolean isVisible(final PageState state) {
final Workflow workflow = m_workflow.getWorkflow(state); final Workflow workflow = m_workflow.getWorkflow(state);
return workflow.getProcessState() == Workflow.STARTED; return workflow.getProcessState() == Workflow.STARTED;
} }
private class Listener implements ActionListener { private class Listener implements ActionListener {
@Override
@Override
public final void actionPerformed(final ActionEvent e) { public final void actionPerformed(final ActionEvent e) {
final PageState state = e.getPageState(); final PageState state = e.getPageState();
if (hasAdmin(state)) { if (hasAdmin(state)) {
final Workflow workflow = m_workflow.getWorkflow final Workflow workflow = m_workflow.getWorkflow(state);
(state);
workflow.stop(Web.getWebContext().getUser()); workflow.stop(Web.getWebContext().getUser());
} }
} }
} }
} }
private class StartLink extends ActionLink { private class StartLink extends ActionLink {
StartLink() { StartLink() {
super(new Label(gz("cms.ui.item.workflow.start"))); super(new Label(gz("cms.ui.item.workflow.start")));
addActionListener(new Listener()); addActionListener(new Listener());
} }
@Override @Override
public final boolean isVisible(final PageState state) { public final boolean isVisible(final PageState state) {
final Workflow workflow = m_workflow.getWorkflow(state); final Workflow workflow = m_workflow.getWorkflow(state);
// Start link should be visible if the workflow state is stopped or init // Start link should be visible if the workflow state is stopped or init
return (workflow.getProcessState() == Workflow.STOPPED || workflow.getProcessState() == Workflow.INIT); return (workflow.getProcessState() == Workflow.STOPPED || workflow.getProcessState()
== Workflow.INIT);
} }
private class Listener implements ActionListener { private class Listener implements ActionListener {
@Override
@Override
public final void actionPerformed(final ActionEvent e) { public final void actionPerformed(final ActionEvent e) {
final PageState state = e.getPageState(); final PageState state = e.getPageState();
if (hasAdmin(state)) { if (hasAdmin(state)) {
final Workflow workflow = m_workflow.getWorkflow final Workflow workflow = m_workflow.getWorkflow(state);
(state);
workflow.start(Web.getWebContext().getUser()); workflow.start(Web.getWebContext().getUser());
} }
} }
} }
} }
} }